5
votes

I use pandoc to convert Markdown to Latex. My problem is that pandoc adds extra paragraph breaks around begin/end environments.

Source:

**First** phrase in a paragraph.
\begin{multline*}
some long formulae
\end{multline*}
Second phrase in a paragraph.

Doing pandoc my.md -o my.tex yields:

\textbf{First} phrase in a paragraph.

\begin{multline*}
some long formulae
\end{multline*}

Second phrase in a paragraph.

Clearly this is inappropriate behavior due to extra vertical space put by latex in resulting PDF when it sees extra blank lines around multline.

Is there a way to suppress extra blank lines in .tex output of pandoc?

2
Pandoc converts this to a Raw Tex Block which is always a block level element. But you might use a template and set the vertical space before/after multlines in LaTeX.mb21
@mb21 I think it would be incosistent to try fix pandoc translation problems with latex. But would you please be more specific on what do you mean by “this” in “Pandoc converts this to a Raw Tex Block”. Do you mean each begin/end pair?Artem Pelenitsyn
\begin{}...\end{} is a block element.mb21
You can convince yourself with: pandoc -t native my.md or pandoc -t json my.md Notice the RawBlock? If I'm not mistaken, LaTeX's \begin{}...\end{}is always a paragraph-making environment as well?mb21
@mb21 yes, thank's. Still it's very confusing decision. Seems like it's worth introducing an issue on their GitHub.Artem Pelenitsyn

2 Answers

4
votes

Proper vertical multline


Modification:

**First** phrase in a paragraph.
\empty{
\begin{multline*}
some long formulae
\end{multline*}
}
Second phrase in a paragraph.

parses to

\textbf{First} phrase in a paragraph. \empty{
\begin{multline*}
some long formulae
\end{multline*}
} Second phrase in a paragraph.
1
votes

What about:

**First** phrase in a paragraph. \begin{multline*}
some long formulae
\end{multline*} Second phrase in a paragraph.

pandoc -t latex with the above input and pandoc 2.2.1 gives:

\textbf{First} phrase in a paragraph. \begin{multline*}
some long formulae
\end{multline*} Second phrase in a paragraph.