1

I want to use only one org file to export both .tex and .html.

I use begin_latex in my org files to embed maths and I can use C-c ' to use the org-edit-src-code feature which help fast typing latex(Thus I can use Auctex and more). But it seems that the contents in begin_latex will not be formatted into equations when exporting to html.

After I read the org manual, I know that latex code can be embedded without begin_latex, and can be export to both html and tex. In this situation, I have to use cdlatex to type latex in a org file and can not use the org-edit-src-code feature, which means that I lost the latex code highlighting when typing. That really annoys me.

Any suggestions about this?

  • 1
    What I do in this case: #+begin_src latex ... #+end_src and then use the by-backend macro to export the LaTeX code depending on what back-end is currently active. For example see my question here: emacs.stackexchange.com/questions/19419/… (also note the related problems). – wvxvw Jan 23 '16 at 14:33
0

You can write the code in a begin_src latex block with :results drawer :export results in the header. Here is an example:

#+begin_src latex :results drawer :exports results
  \[  \frac{1}{2} \]
#+end_src

This way you can edit the latex with full editor support and end up with raw latex. Best of both worlds!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.