# Export org file to html and latex

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.

• 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
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}$