markup.rocks icon indicating copy to clipboard operation
markup.rocks copied to clipboard

Please don't use LaTeX package/document commands without including them (\tightlist)

Open oscarcarlsson opened this issue 10 years ago • 5 comments

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.

oscarcarlsson avatar May 09 '15 07:05 oscarcarlsson

similar issue in this other pandoc wrapper, rmarkdown: https://github.com/rstudio/rmarkdown/issues/439

maxheld83 avatar May 30 '15 12:05 maxheld83

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?

ozanmakes avatar May 30 '15 12:05 ozanmakes

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.

jtpereyda avatar Jul 31 '18 03:07 jtpereyda

Pandoc also adds images using \includegraphics{} without import \usepackage{graphicx}, so the generated .tex is unusable out-the-box.

nodingneu avatar Nov 08 '20 16:11 nodingneu

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}

JohnLukeBentley avatar May 04 '21 18:05 JohnLukeBentley