Skip to content

LaTeX Macro expansion with optional argument eats newline #2446

Closed
bordaigorl opened this Issue · 1 comment

1 participant

@bordaigorl

When a macro with an optional argument is replaced, if it is followed by a \n the whitespace is discarded.

To see the issue feed

\newcommand{\macro}[1]{bla #1 bla}
\newcommand{\macroopt}[1][]{bla #1 bla}
A \macro{B}
C

A \macroopt[B]
C

A \macroopt[B] C

to

pandoc -f latex -t plain

to obtain

A bla B bla C

A bla B blaC

A bla B bla C

Note that, following the macro expansion rules of LaTeX,
there should be a space between bla and C in the second line as well.

Tested with

pandoc 1.12.3.3
Compiled with texmath 0.6.6, highlighting-kate 0.5.6.1.

@jgm jgm closed this in 1af8bc6
@jgm jgm added a commit that referenced this issue
@jgm LaTeX reader: don't eat excess whitespace after macros.
Really close #2446.
114103d
@bordaigorl

Great thanks a lot! :+1:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.