1

I edit lots of Markdown files where LaTeX snippets are embedded between a pair of $ or $$. Is there a way to load and use AucTeX package to preview these snippets in Emacs? The motivation is to quickly validate my LaTeX syntax. The file when properly "deployed" will have the LaTeX portion processed into images, but doing that to see the output is just not that editing friendly.

  • I hope you aren't using $$ ... $$ in the raw, but that converts to approved LaTeX syntax.... I believe that AUCTeX would want to parse the whole buffer, not a snippet which may well rely on the loading of certain packages, however, so I'm not sure if this is a viable method. (But see kramdown for another possibility with MathJax.) – jon Oct 7 '15 at 2:49
  • I am hoping it's possible to come up with some custom program to teach AucTeX to only process snippets sandwiched by $s. – Computist Oct 7 '15 at 3:34
  • But what happens when the math relies on an external package? (I said 'neat' at first, but I thought you wrote that you were going to do it. Now I'm back to my initial view that this is actually far trickier than you may be thinking.) – jon Oct 7 '15 at 3:40
  • Between your pair of $ did you have only mathematics? – Romain Picot Oct 7 '15 at 6:52
  • Practically, yes. – Computist Oct 7 '15 at 7:19
1

The solution that I propose to you is to open two buffer in your emacs. You can do it with C-x 2 RET or C-x 3 RET.

In one of them you can have the files you edited containing the markdown. On the other one you have a minimal LaTeX code:

\documentclass{article}

% package you need have to be put here
\begin{document}

\end{document}

You juste have to copy paste the snippets you want to test and use AUCTeX as usual.

With this you don't have to use another programs and could easily validate the LaTeX syntax.

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.