Skip to content

Change font for comments #3665

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

HansOlsson
Copy link
Collaborator

comments seemed to be fixed-width where letters weren't designed for that.

@HansOlsson HansOlsson added the LaTeX Issue with the LaTeX code label Mar 27, 2025
@HansOlsson
Copy link
Collaborator Author

Before:
image
After:
image

Especially the text illegal (as well as literal in other places) just looks weird with the previous font.

@henrikt-ma
Copy link
Collaborator

Put the following after the definition of \smallifpdf in preamble.tex:

% Comments in listings looks better and more distinct from the actual code if set in a variable-width sans-serif font.
% Unfortunately, the LaTeXML implementation of listings.sty is aligning the variable-width characters on a fixed-width
% grid, which doesn't look nice at all.  Hence, we make a different choice of font depending on the target format.
\ifpdf
\let\sffamilyifpdf\sffamily
\else
\let\sffamilyifpdf\relax
\fi

Then use instead removing the \sffamily in mlsshared.sty.

@HansOlsson
Copy link
Collaborator Author

Put the following after the definition of \smallifpdf in preamble.tex:

% Comments in listings looks better and more distinct from the actual code if set in a variable-width sans-serif font.
% Unfortunately, the LaTeXML implementation of listings.sty is aligning the variable-width characters on a fixed-width
% grid, which doesn't look nice at all.  Hence, we make a different choice of font depending on the target format.
\ifpdf
\let\sffamilyifpdf\sffamily
\else
\let\sffamilyifpdf\relax
\fi

Then use instead removing the \sffamily in mlsshared.sty.

Will do, except it's the other way round.

@HansOlsson
Copy link
Collaborator Author

Changes:

  • Pdf-generation no longer changes font to sans-serif for comments, since the sans-serif font is designed to be variable-width but would be type-set as fixed-width which looks odd.
  • HTML-generation is not changed, the sans-serif for comments are kept and are variable-width.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LaTeX Issue with the LaTeX code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants