I am trying to convert LaTeX (arXiv files) to markdown (where math equations can be set off with $). I am trying to use pandoc for this, yet run into issues where in a single document may have multiple .tex files used to build it. How would I find the base .tex file with which to call pandoc?

I am also ok with using some other method to convert arXiv to gfm, although I still want some markdown-type method to offset math equations. Would it be better to use LaTeXML (based on ar5iv's usage of it) to convert from latex to XML and then pandoc to convert from XML to markdown?

  • 1
    This question is really too open ended and "opinion based" for the format of this site so it's likely to get closed I would guess. LaTeX is much richer than markdown so any conversion has to compromise somewhere, eg markdown has no native support for fonts or colour or tikz or ... so any conversion will lose something, different systems will make different choices in general and may work better or worse on any specific document. Commented Oct 10, 2023 at 8:08
  • a common heuristic for finding the base tex file in a collection is to use the one that contains \documentclass (eg that's what overleaf does if you do a multi-file zip upload) although you can change that in the settings afterwards.) Commented Oct 10, 2023 at 8:10
  • @DavidCarlisle - I don't imagine that things that are unsupported in markdown will get converted (ie. fonts, font color, etc.). Ideally, tikz would be converted to images and attached via markdown links, but I suspect this is too much for any converter to handle. I mean to ask which flow can handle the regular text (math equations being set off via $, etc.) the best?
    – olivarb
    Commented Oct 10, 2023 at 19:37
  • but that's my point: anything (a few lines of perl) can handle converting basic latex text to markdown and copy over math unchanged to be handled by mathjax in markdown generated html (markdown itself has no math support). So the choice of system depends on the details and on the choices the develpers make on what to discard and what to keep and what to fail to convert and give errors on. Your question, in the form asked has no real answer. Commented Oct 10, 2023 at 20:20
  • @DavidCarlisle - I see. That makes sense. Are there any details online that I can look up that may help me understand the tradeoffs to both approaches? The closest I could find was this, also unanswered, se.tex question or this uncited YC question, both of which don't particularly help.
    – olivarb
    Commented Oct 10, 2023 at 21:37


You must log in to answer this question.

Browse other questions tagged .