English 中文(简体)
Can I convert a Tex file into an equivalent Org file? If so, how?
原标题:

I m in the process of writing a whitepaper, and am about half-way through. I ve just realized that it would be far simpler to write this in org-mode and export to latex/pdf than writing it directly in latex-mode. Is there any way I can convert the existing work into an org mode file? It would save a lot of work I d have to do manually.

最佳回答

I doubt as well that you will find a direct tool. You ll need to do some search n replace with one tool or the other.

What might help is to use pandoc to convert your LaTeX to something closer to org-mode syntax like "markdown", "reStructuredText" or "MediaWiki" and then do your query-replace-regexp magic or write a small sed script.

Good luck on your journey!

UPDATE: Searching Google for "convert latex to wiki" I found this page with a python script to convert LaTeX source code to Qwiki markup, maybe it gives you some inspiration.

UPDATE: As of 2018, Pandoc supports org-mode as input and output format directly, as pointed out by pkazmierczak.

问题回答

It looks like the latest version of Pandoc mode has a built-in support for Org-mode export.

enter image description here

Would it be a little easier to convert the latex file to markdown using pandoc and then manually convert markdown to org-mode with a few query-replaces and emacs macros ?

https://github.com/uliw/l2org enables round-trip editing between latex and org-mode, i.e., when you collaborate with someone who uses latex

I doubt that there is a tool for your task, but you should be able to save many keystrokes with Emacs.

For many LaTeXisms such as quoted characters, try using query-replace and query-replace-regexp and see how far that gets you. For things that aren t easily solved with regular expressions, you may find keyboard macros useful.





相关问题
suppress additional braces in emacs electric mode

I started using ruby-electric-mode. I like it except that I am used to closing open brackets myself (the other pairing are still useful to me). How can I make emacs suppress additional brackets when ...

Setting up an emacs environment in windows?

I am currently constrained to a windows dev box and I want to migrate my projects from eclipse to emacs. What are some good references on setting up an emacs dev environment for windows? Anything ...

Emacs Setting which-function-mode

I would like to have which-function-mode on by default when I open up Emacs. I ve added the following lines to my .emacs file. (setq which-func-mode t) (setq which-function-mode t) When I open ...

Enabling go mode for emacs

I don t seem to be able to enable a go mode for emacs. C mode doesn t work without semicolons. The best I have found is the JavaScript mode by Karl Landstrom, since JavaScript also doesn t require ...

Custom Emacs key bindings are not working

The key bindings I ve defined in my .emacs file aren t working. Here s the file: ;init modes (menu-bar-mode 0) (tool-bar-mode 0) (cua-mode) (column-number-mode) (fset perl-mode cperl-mode) (cperl-...

eval during emacs lisp macro expansion

How can I fix the simple macro foo in (elisp)Eval During Expansion? None of the followings work: (defmacro foo1 (a) `(setq (eval ,a) t)) (defmacro foo2 (a) `(setq ,(eval a) t)) (defmacro foo3 (...

Get local cvs comment history when committing file/s in emacs

I often commit files with similar cvs comment but not in a single operation. I would like to able to bring up previous comments I ve used in a previous commit when I am in the process of writing a ...

热门标签