Wandmalfarbe / pandoc-latex-template

A pandoc LaTeX template to convert markdown files to PDF or LaTeX.
BSD 3-Clause "New" or "Revised" License
6.21k stars 968 forks source link

Separate font size for `lstinline` and `lstlisting` #229

Closed LudvigHz closed 3 years ago

LudvigHz commented 3 years ago

Thanks for this great template!

I often find myself needing to change the code-block-font-size to a smaller font in order to avoid line wraps in listings. However this also affects inline code. So I've been having to avoid using this variable and instead opt to something like this to avoid the issue:

\lstset{basicstyle=\scriptsize}

~~~sh
$ this code wont wrap
# here is a comment
~~~

\lstset{basicstyle=\normalsize}

This PR is an example of how to avoid this by separating the font size used in lstlisting environments and other listing environments (i.e. inline).

Let me know if I should instead fall back to code-block-font-size for inline listings instead if you want it to be backwards compatible. (although I prefer defaulting to the surrounding text, as the current implementation does).

I will update the documentation if this implementation is approved

Wandmalfarbe commented 3 years ago

It was not intended that the code-block-font-size also modifies the inline listings. I haven't tested that feature thoroughly. Can you change your PR so that the code-block-font-size is only applied to code blocks and there is no option code-inline-font-size? I believe the font size for inline listings should always match the surrounding text and there should be no customization option for that.

LudvigHz commented 3 years ago

I see. I have updated this to only fix the issue with code-block-font-size affecting inline listings.

Wandmalfarbe commented 3 years ago

Thank you!