Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Separate font size for lstinline and lstlisting #229

Merged
merged 1 commit into from
Oct 22, 2021

Conversation

LudvigHz
Copy link
Contributor

@LudvigHz LudvigHz commented Feb 15, 2021

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
Copy link
Owner

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.

When using listings, the variable `code-block-font-size`
also affected `lstinline` environments.
This will make inline listings follow the surronding font size, as expected.
@LudvigHz
Copy link
Contributor Author

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

@Wandmalfarbe
Copy link
Owner

Thank you!

@Wandmalfarbe Wandmalfarbe merged commit 6baf692 into Wandmalfarbe:master Oct 22, 2021
@LudvigHz LudvigHz deleted the inline-listing branch October 25, 2021 12:32
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants