Consider this simplest TeX source:
\documentclass{article}
\begin{document}
This is a test.
\end{document}
When converting it to PDF, the following output is shown:
$ pandoc -o test.pdf test.tex
Error producing PDF.
This is all output I get.
Pandoc version:
$ pandoc -v
pandoc.exe 2.1
Compiled with pandoc-types 1.17.3, texmath 0.10.1, skylighting 0.5.1
Default user data directory: C:\Users\moigagoo\AppData\Roaming\pandoc
Copyright (C) 2006-2018 John MacFarlane
Web: http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.
Windows 10 version 1709 build 17063.
MikTeX version:
$ mpm --version
MiKTeX Package Manager 2.9.6538 (MiKTeX 2.9.6530)
Copyright (C) 2005-2017 Christian Schenk
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I discovered this issue on a different and much larger document, but the error is exactly the same.
Not a valid LaTeX document – try prepending \documentclass{article}.
Not a valid LaTeX document – try prepending \documentclass{article}.
The result is the same. I'll add this line to the original issue description, thanks!
You don't need pandoc to go from latex to pdf, use pdflatex (or similar) directly.
Also see http://pandoc.org/MANUAL.html#creating-a-pdf
You don't need pandoc to go from latex to pdf, use pdflatex (or similar) directly.
Pandoc offers an extremely convenient way to customize PDF output with TeX templates. I have a huge document with a custom corporate template, so I'd rather stick to Pandoc.
In fact, I'm very much surprised that you suggest I don't use Pandoc for a task Pandoc was designed to solve.
Sure you _can_, however pandoc only supports a subset of TeX. Also, from the manual:
To debug the PDF creation, it can be useful to look at the intermediate representation: instead of
-o test.pdf, use for example-s -o test.texto output the generated LaTeX. You can then test it withpdflatex test.tex.
My bad, sorry for an asshole-ish comment... The issue seems to be caused by incorrectly installed MiKTeX, because pdflatex crashes with an error. When launched form pwsh, however, it doesn't throw any errors, that's why I couldn't spot the issue earlier.
Thanks!
Most helpful comment
Sure you _can_, however pandoc only supports a subset of TeX. Also, from the manual: