Skip to content

Commit

Permalink
Adjust monospace font size in LaTeXML build
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed Oct 8, 2020
1 parent f0a3e50 commit d53102c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
5 changes: 5 additions & 0 deletions css/MLS.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@
/* Undo bold here to remove the browser's native th styling,
*/
.ltx_th { font-weight:normal; }

/* Compensate for default font size ratio 13:16 for monospace to normal.
* 16/13 = 1.2307..., and due to the way we mix inline code with MathJax math, even this is on the small side.
*/
.ltx_font_typewriter { font-size:123%; }
17 changes: 13 additions & 4 deletions preamble.tex
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@
\definecolor{keywordcolor1}{rgb}{0,0,.4}
\definecolor{keywordcolor2}{rgb}{.90,0,0}

% When producing PDF, the ttfamily looks better in size \small, but with LaTeXML this becomes too small,
% and the size is applied deep down on the HTML elements, making it hard to adjust using CSS.
% Thus, the problem has to be addressed already when a listings language's 'basicstyle' is defined.
\ifpdf
\let\smallifpdf\small
\else
\let\smallifpdf\normalsize
\fi

% See https://github.com/modelica-tools/listings-modelica/blob/master/listings-modelica.cfg
% Note: Changed comment color from green to [rgb]{0,0.4,0} - since the other variant was too distracting
% And added pure,impure,stream as keywords
Expand All @@ -183,7 +192,7 @@
% Note that Integer is both a predefined type and a function; we cannot treat them differently.
% Another solution would be to remove this completely.
\lstdefinelanguage{modelica}{% Language for use with the lstlisting environment.
basicstyle=\upshape\small\ttfamily, % Font size for displayed code listings.
basicstyle=\upshape\smallifpdf\ttfamily, % Font size for displayed code listings.
alsoletter={},
% otherkeywords={-, =, +, [, ], (, ), \{, \}, :, *, !},%
morekeywords=[1]{}, % blue Keywords
Expand Down Expand Up @@ -213,7 +222,7 @@

% Note: within only a keyword in grammar
\lstdefinelanguage{grammar}{%
basicstyle=\upshape\small\ttfamily, % size of fonts used for the code
basicstyle=\upshape\smallifpdf\ttfamily, % size of fonts used for the code
alsoletter={},
alsodigit={-},
breaklines=true,
Expand Down Expand Up @@ -251,7 +260,7 @@

% Duplicate this definition here to avoid issue - and name it "fortran77" to avoid problem in LatexML
\lstdefinelanguage{fortran77}{%
basicstyle=\upshape\small\ttfamily, % size of fonts used for the code
basicstyle=\upshape\smallifpdf\ttfamily, % size of fonts used for the code
morekeywords={%
ASSIGN,BACKSPACE,CALL,CHARACTER,%
CLOSE,COMMON,COMPLEX,CONTINUE,DATA,DIMENSION,DO,DOUBLE,%
Expand Down Expand Up @@ -280,7 +289,7 @@
}[keywords,comments,strings]

\lstdefinelanguage{C}{%
basicstyle=\upshape\small\ttfamily, % size of fonts used for the code
basicstyle=\upshape\smallifpdf\ttfamily, % size of fonts used for the code
morekeywords={%
auto,break,case,char,const,continue,default,do,double,%
else,enum,extern,float,for,goto,if,int,long,register,return,%
Expand Down

0 comments on commit d53102c

Please sign in to comment.