PDF output fails with missing \begin{document} error
See original GitHub issueI have tried running the example from here and converting to PDF with stitch basic.md -o basic.pdf
and I get the following error:
Traceback (most recent call last):
File "/Users/robin/anaconda3/envs/reporting-comparison/bin/stitch", line 11, in <module>
sys.exit(cli())
File "/Users/robin/anaconda3/envs/reporting-comparison/lib/python3.6/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/Users/robin/anaconda3/envs/reporting-comparison/lib/python3.6/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/Users/robin/anaconda3/envs/reporting-comparison/lib/python3.6/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/robin/anaconda3/envs/reporting-comparison/lib/python3.6/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/Users/robin/anaconda3/envs/reporting-comparison/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/Users/robin/anaconda3/envs/reporting-comparison/lib/python3.6/site-packages/stitch/cli.py", line 60, in cli
convert(input_text, to, output_file=output_file, extra_args=extra_args)
File "/Users/robin/anaconda3/envs/reporting-comparison/lib/python3.6/site-packages/stitch/stitch.py", line 480, in convert
outputfile=output_file)
File "/Users/robin/anaconda3/envs/reporting-comparison/lib/python3.6/site-packages/pypandoc/__init__.py", line 103, in convert_text
outputfile=outputfile, filters=filters)
File "/Users/robin/anaconda3/envs/reporting-comparison/lib/python3.6/site-packages/pypandoc/__init__.py", line 325, in _convert_input
'Pandoc died with exitcode "%s" during conversion: %s' % (p.returncode, stderr)
RuntimeError: Pandoc died with exitcode "43" during conversion: b'Error producing PDF.\n! LaTeX Error: Missing \\begin{document}.\n\nSee the LaTeX manual or LaTeX Companion for explanation.\nType H <return> for immediate help.\n ... \n \nl.63 \\textbackslash\n\n'
Any idea what’s going on?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
LaTeX Error: Missing \begin document - Overleaf
This error appears when you have forgotten to include \begin{document} in your document. It can also appear if you have not written \documentclass[...]{....
Read more >LaTeX Error-Missing Begin Document - TeX
In my case, the problem was solved by avoiding any empty space in the main file title. It is not a real solution,...
Read more >Missing \begin{document} | The TeX FAQ
If the error recurs, it could well be due to a buggy class or package. However, it may be that none of the...
Read more >Error: missing \begin{document} in LaTeX - Stack Overflow
When I copy the code you have shown here into Notepad++ with UTF-8 input encoding, I get the following result for the first...
Read more >Incomprehensible Error about missing Begin of Document
Go to "Document" > "Document Settings" > "Format"; Un-check the box saying "Include Unicode BOM". That fixed it and I no longer get...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s caused by the way the backslash escape sequence gets handled by passing it to pandoc after explicitly being added in
stitch/cli.py,
here is the relevant block fromcli.py
:From the pandoc’s man pages:
Note the last sentence --> when compiling to latex by using stitch, some characters are indeed escaped and the header-includes metadata thus compiles to
\textbackslash usepackage\{booktabs\}
.The fix for me was removing the above if condition and including the booktabs package by specifying it as a YAML header in my stitch markdown file (see pandoc’s man pages):
Please elaborate on knitty issues with py3.8