1

The example I have in mind is the trivial case of rendering the LaTeX logo using the \LaTeX command for PDF or similar output, and otherwise presenting just a "LaTeX" literal.

I've tried a few overly-clever quoting and commenting methods without luck.

For example:

Just print the
\LaTeX % LaTeX
logo.

... doesn't work.

Putting the \LaTeX command inside HTML comments <!-- ... -->, even across multiple lines, doesn't work:

Just print the
<!-- \LaTeX % --> LaTeX
logo.

Or:

Just print the <!--
\LaTeX % --> LaTeX
logo.

Just to make this more challenging, I'd actually prefer this to be in an unordered list:

* \LaTeX.

Other than specifically manipulating the source Markdown (say, a regex replacement of "\" with "\LaTeX"), before generating latex-based outputs, is there a way to do this within Markdown and Pandoc?

1 Answers1

3

The solution which works for me is to use the raw attribute extension as described here, for Pandoc 2.0 and later.

My bullet-item example renders as desired with:

 * `\LaTeX`{=latex} `LaTeX`{=html}.

In HTML I get "LaTeX". In PDF, I get the styled LaTeX logo.