1

After various tentatives to write drafts of article directly in org-mode for Emacs, hoping to take advantage of various of its features (e.g. exporting to html, easier scope exporting than with \includeonly, automatically generating example based on inline code, etc...), I decided that I was more at ease writing my articles directly in latex (under auctex mode in Emacs).

Yet I find myself still converting large fragments of latex code to orgmode (e.g. \textemf{blabla} to /blabla/) for inclusion in org-mode documents (e.g. to export to a webpage). I do so via search and replace with regular expression, and I am thinking about writing a general script to automatize the task, but I thought that someone else might have done so already. A quick search on Google and Stacks Exchange did not yield any useful answer.

1
  • 2
    Pandoc is the best way I'm aware of.
    – jon
    Aug 11, 2014 at 19:21

3 Answers 3

2

I arrived at this page a couple of months ago, hoping for such a script. I have written a simple search-and-replace script in Python. It isn't very fancy, and I've only tested in on two LaTeX documents so far, but it saves me a lot of manual labour when converting from LaTeX to Orgmode. latex2orgmode can be found here:

https://github.com/MarcvdSluys/Orgmode-convert

3
  • Thank you! So orgmode export no longer is a one-way-street. I'll test and give feedback.
    – Keks Dose
    Feb 27, 2022 at 11:06
  • 1
    Could you add footnotes and what about a simple translation of tabulars?
    – Keks Dose
    Feb 27, 2022 at 11:15
  • @KeksDose I was going to ask you to open an issue, but you already did. Let's move the discussion there.
    – AstroFloyd
    Feb 28, 2022 at 13:24
1

You are right: Writing in orgmode and exporting to LaTeX may work for text, but as soon as you get into realms of more sophisticated layout, you think half of the time about how to export it properly from orgmode to LaTeX.

Meanwhile I write my drafts with orgmode. After finishing the draft, I export it to LaTeX and stick to LaTeX.

You probably won't export your whole text to a website, will you? So take the time to copy and paste a short version for the website. That saves much time in the end, compared to head scratching about export from orgmode to LaTeX for the whole document.

4
  • 1
    That's the plan, but when copy pasting short versions to the website, I find myself repeatitively translating \emph{blah} in /blah/ and \texttt{blah} in =blah= and so on. I will program a script to automatize it (and but it on github) if I don't find that someone already made one :)
    – J..y B..y
    Aug 15, 2014 at 12:53
  • @Jeremy Did you ever make such a script?
    – AstroFloyd
    Dec 18, 2021 at 7:34
  • 1
    @AstroFloyd No :(
    – J..y B..y
    Dec 23, 2021 at 14:49
  • I've now written a simple Python script that does the basics. Nothing fancy, but it saves some manual labour when converting: github.com/MarcvdSluys/Orgmode-convert
    – AstroFloyd
    Feb 27, 2022 at 9:49
0

https://github.com/uliw/l2org enables round trip editing between latex and org mode

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .