I am using polymode to edit rmarkdown files. Exporting to e.g. pdf is super simple and works very well. R code chunks are also properly highlighted.
But:
I do quite often use latex code inside (r)markdown. Would it be possible to highlight the latex code as well?
I guessed I need something like latex as a second major mode or a markdown-latex-r-polymode but didn't get very far.
Example
this is bold in markdown
\center{this centers text} in latex
The latex part should also be highlighted.
(setq markdown-enable-math t)for highlighting LaTeX equations in markdown code. But this will not highlight LaTeX command sequences like\center{...}.\begin{align*}...\end{align*}? Those are far more difficult to handle than other LaTeX command sequences. I think I have a solution for LaTeX command sequences but not for environments.(font-lock-add-keywords 'markdown-mode '(("\\(\\\\rightarrow\\)" . font-lock-keyword-face)Another way would be to use org-mode as there is an org-specific setting to highlight latex.