Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert multi-file LaTeX documents using the pandoc API?

Tags:

haskell

pandoc

I'm curious how I can convert a multi-file document in LaTeX to some other format using the Haskell pandoc API. I see there is readLaTeX function, but this accepts a single Text value as a parameter instead of e.g. [Text]. What is the correct way to handle this more general situation?

like image 972
bbarker Avatar asked Dec 14 '25 04:12

bbarker


1 Answers

As far as I can tell from the code, inclusion of other LaTeX documents with \input{...}, etc. is handled by searching for the documents using the TEXINPUTS environment variable as a colon-separated search path (or just checking the current directory, if TEXINPUTS isn't defined).

Truth be told, that's not a great way of doing it. (To remain compatible with normal TeX stuff, it should be using the TeX kpathsea library to parse TEXINPUTS.)

But, if you make sure TEXINPUTS is either blank or includes . as one of its colon-separated components, and ensure you switch to the directory where all the files are, if you pass the text of the main file in to readLaTeX, it should "just work".

like image 53
K. A. Buhr Avatar answered Dec 16 '25 19:12

K. A. Buhr