I know that placing latex code in the main text body solve my issue: the latex code is taken into account both when exporting to latex and to html. However, I like to use Latex blocks because of the syntax highlighting (usefull for long equations etc.).

Does anyone knows a way to make this block also treated by MathJax when exported throught org-export:

#+begin_export latex
        \dfrac{\partial C(x, t)}{\partial t} = \vec{\nabla} \cdot \left( D(x)\vec{\nabla} C(x,t) \right) 
        \quad \forall x\in\Omega \\
        \dfrac{\partial C(x)}{\partial \vec{n}} = 0  
        \quad \forall x\in\partial\Omega \\
        C(x, t=0) = C_{init}(x)
  • I don't know of a simple way. You may be able to write a function that deletes the #+begin/end_export lines and add it to either org-export-before-processing-hook or org-export-before-parsing-hook but I have not tried it, so no guarantees.
    – NickD
    Jan 17 at 1:23
  • 2
    Can't you just get rid of the #+begin/end_export blocks so it works for both? If syntax highlighting is all you want, I think you just (setq org-highlight-latex-and-related t). Jan 18 at 1:33
  • Good catch about the variable, but I think something like this is needed: (setq org-highlight-latex-and-related '(native)) per the doc (and I had to revert the buffer to get it to show).
    – NickD
    Jan 18 at 21:29
  • Well, it does not work for me... thanks for your help anyway :) Jan 21 at 19:36
  • This sounds like something you might want: alhassy.github.io/org-special-block-extras
    – grettke
    Apr 18 at 18:23

Your Answer

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

Browse other questions tagged or ask your own question.