Mystery verbatim in Latex output

I use the mmd → LaTex compile option. An unexpected behavior I have noticed is paragraphs appearing wrapped in \begin{verbatim}…\end{verbatim} and the .tex output (and thus not rendering correctly in the final pdf). The only solution I have found is to cut the final paragraph, delete all the surrounding blank space, new lines, etc, and then re-paste the offending paragraph with ‘paste and match style.’

I suspect this has something to do with styles not behaving as expected. I have defined styles for inline and full-paragraph raw latex to pass this through as-is during the compile process (e.g. for figures defined in raw Latex), as discussed here with @AmberV. And the offending paragraphs do contain some raw Latex, but the verbatim wraps a longer chunk of text than this style applies to. The raw latex styles work fine in other paragaphs in the same document, so there is something going on at specific locations in the text. I searched for some text or even a single blank space with some style attached to it in the locations where verbatim begins and ends, but can’t anything.

Any ideas on what could cause this behavior or how to fix it without the annoying copy-paste trick?

1 Like

Most likely you have accidental tabs in your text, maybe at some point to “indent” the paragraphs? Tab lines will translate to verbatim text, or “code blocks” in Markdown. If you do not have any intentional code blocks in your text, the Edit ▸ Text Tidying ▸ Strip Leading Tabs command can help.

2 Likes

thanks, will check that if/when this occurs again.

1 Like