markup.rocks
markup.rocks copied to clipboard
Please don't use LaTeX package/document commands without including them (\tightlist)
When converting from markdown to LaTeX I noticed that an unsupported command was used in the itemize environment.
Given the following input (in Markdown):
Test:
- One
- Two
- Three
The following LaTeX was produced:
Test:
\begin{itemize}
\tightlist
\item
One
\item
Two
\item
Three
\end{itemize}
The \tightlist command is most likely from the memoir class which is not included or indicated in any way.
If possible, remove this command or indicate which document class or package is required to compile the output succesfully.
similar issue in this other pandoc wrapper, rmarkdown: https://github.com/rstudio/rmarkdown/issues/439
This is related to a recent change in pandoc. I don't know much about latex but I think pandoc assumes inclusion of it's latex template. Any suggestions on how to approach this?
You can use the pandoc --standalone option to make a LaTeX file that includes everything necessary.
If you want to build snippets with pandoc, the only way I know of is to use --standalone and then copy everything out before the content and put it into my main LaTeX file.
There's also a LaTeX template provided by pandoc I'm not clear on how to use.
Pandoc also adds images using \includegraphics{} without import \usepackage{graphicx}, so the generated .tex is unusable out-the-box.
This is still an issue when using pandoc custom templates, as of pandoc 2.13.
A workaround is to copy the \tightlist command as defined in pandoc's default.latex template file. E.g. to produce a (minimal) custom pandoc template like
\documentclass{article}
$if(title)$
\title{$title$}
$endif$
% Must use to prevent a pandoc bug, where all headers are unconditionally
% inserted with a \hypertarget command See:
% https://github.com/jgm/pandoc/issues/7264
\usepackage{hyperref}
% Avoid pandoc bug when there are lists in the body.
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\begin{document}
\maketitle
$body$
\end{document}