Skip to content

Commit 1135d6d

Browse files
authored
Change font for comments (#3665)
* For PDF change font, comments seemed to be fixed-width where letters weren't designed for that.
1 parent fbce0b7 commit 1135d6d

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

mlsshared.sty

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
keepspaces, % don't remove space such as those after closing parenthesis
203203
upquote=true, % Don't turn apostrophe/backtick into single quotation marks.
204204
captionpos=b, % sets the caption-position to bottom
205-
commentstyle=\color{commentcolor}\sffamily,
205+
commentstyle=\color{commentcolor}\sffamilyifhtml,
206206
keywordstyle=\color{red}, % Unused keyword style in bright red to make it easy to detect and fix.
207207
keywordstyle=[1]\color{keywordcolor1},
208208
keywordstyle=[2]\color{keywordcolor1}\bfseries,

preamble.tex

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,15 @@
143143
\let\smallifpdf\normalsize
144144
\fi
145145

146+
% Comments in listings looks better and more distinct from the actual code if set in a variable-width sans-serif font.
147+
% However, just changing font family doesn't work for pdf.
148+
% Hence, we make a different choice of font depending on the target format.
149+
\ifpdf
150+
\let\sffamilyifhtml\relax
151+
\else
152+
\let\sffamilyifhtml\sffamily
153+
\fi
154+
146155
\ifpdf
147156
% Don't load cleveref yet.
148157
\else

0 commit comments

Comments
 (0)