From 2383a77a0034480b2a83068bb29d8db71ba03af5 Mon Sep 17 00:00:00 2001 From: OLSSON Hans Date: Tue, 16 Nov 2021 11:29:40 +0100 Subject: [PATCH] Ensure that Modelica code in HTML is actually in fixed-width "teletype" style. --- mlsshared.sty | 7 ++++++- preamble.tex | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/mlsshared.sty b/mlsshared.sty index 523fcbd61..27fdc44b9 100644 --- a/mlsshared.sty +++ b/mlsshared.sty @@ -13,7 +13,10 @@ % white background due to anti-aliasing and similar effects. % Warning: Note that changing to a font with different width -- especially a wider one -- means % that existing manual line breaks are potentially becoming out of place. +\ifpdf \usepackage{newtxtt} +\fi +% There seems to be some major issue with using that font in LaTeXML in listings \usepackage{listings} \usepackage{color} @@ -185,7 +188,7 @@ breaklines=true, % automatic line breaking only at white-space keepspaces, % don't remove space such as those after closing parenthesis captionpos=b, % sets the caption-position to bottom - commentstyle=\color{commentcolor}\sffamily, % comment style + commentstyle=\color{commentcolor}, % comment style keywordstyle=\color{red}, % Unused keyword style in bright red to make it easy to detect and fix. keywordstyle=[1]\color{keywordcolor1}, keywordstyle=[2]\color{keywordcolor1}\bfseries, @@ -197,6 +200,8 @@ belowskip=0pt, defaultdialect=[MLS]C, } +% Note: Not using \sffamily for comments since that causes comments to be of a different size, which looks plain weird +% % Misc math \newcommand{\ud}{\mathrm{d}} diff --git a/preamble.tex b/preamble.tex index 9afcd3512..ef0c933cd 100644 --- a/preamble.tex +++ b/preamble.tex @@ -150,7 +150,12 @@ \usepackage[nameinlink,noabbrev]{cleveref} \fi +% There seems to be some major issue with using this as a package in LaTeXML messing up font in listing +\ifpdf \usepackage{mlsshared} +\else +\include{mlsshared.sty} +\fi \ifpdf % This is the preferred load order for listings and cleveref, so that cleveref is aware of listings, see above.