Skip to content

Commit

Permalink
use lualatex, use arial (#42)
Browse files Browse the repository at this point in the history
* use lualatex, use arial

* use helvet

* remove default from helvet

* use fontspec

* use Helvetica not HelveticaNeue

* switch back to arial, install ms core fonts

* use Arial Unicode MS and unicode-math

* use Arial

* use arial unicode ms

* don't use math-unicode

* remove some irrelevant font commands

* use setsansfont

* try formatting titles manually

* use textbf in RedeclareSectionCommand

* bfseries

* no bfseries

* fix stray comma, add default font features back

* use regular arial except when we need unicode glyphs

* use newunicodechar

* add more fallback characters
  • Loading branch information
chrisfenner authored Dec 4, 2023
1 parent e5b2708 commit 8d92030
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 105 deletions.
15 changes: 14 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ RUN tlmgr update --self && \
catchfile \
ragged2e \
enumitem \
mathtools
mathtools \
fontspec \
unicode-math \
titlesec \
newunicodechar

RUN apk upgrade && apk add --no-cache \
bash \
Expand All @@ -49,6 +53,15 @@ RUN apk upgrade && apk add --no-cache \
py3-pip \
yarn

# Install MS core fonts, including Arial
RUN apk --no-cache add msttcorefonts-installer fontconfig && \
update-ms-fonts && \
fc-cache -f

# Install the Arial Unicode MS font as well
RUN wget https://github.com/kaienfr/Font/raw/master/font/ARIALUNI.TTF -P /usr/share/fonts/TTF/ && \
fc-cache -f

RUN pip install pandocfilters

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
Expand Down
4 changes: 3 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ export MERMAID_FILTER_FORMAT="pdf"
if [ -n "${pdf_output}" ]; then
echo "Generating PDF Output"
pandoc \
--trace \
--pdf-engine=lualatex \
--embed-resources \
--standalone \
--template=eisvogel.latex \
Expand Down Expand Up @@ -292,6 +292,7 @@ fi
if [ -n "${latex_output}" ]; then
echo "Generating LaTeX Output"
pandoc \
--pdf-engine=lualatex \
--embed-resources \
--standalone \
--template=eisvogel.latex \
Expand Down Expand Up @@ -324,6 +325,7 @@ fi
if [ -n "${docx_output}" ]; then
echo "Generating DOCX Output"
pandoc \
--pdf-engine=lualatex \
--embed-resources \
--standalone \
--filter=/resources/filters/info.py \
Expand Down
6 changes: 3 additions & 3 deletions sample3.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,15 @@ This section contains an HTML Table.
</thead>
<tbody>
<tr>
<td>CEIL(x)</td>
<td>⌈x⌉</td>
<td>the smallest integer not less than x</td>
</tr>
<tr>
<td><strong>FLOOR(</strong>x<strong>)</strong></td>
<td>⌊x⌋</td>
<td>the largest integer not greater than x</td>
</tr>
<tr>
<td>A $\coloneqq$ B</td>
<td>A B</td>
<td>assignment of the results of the expression on the right (B) to the
parameter on the left</td>
</tr>
Expand Down
127 changes: 27 additions & 100 deletions template/eisvogel.latex
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,6 @@ $if(beamerarticle)$
$endif$
\usepackage{amsmath,amssymb}
\usepackage{mathtools}
$if(fontfamily)$
\usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$}
$else$
\usepackage{lmodern}
$endif$
$if(linestretch)$
\usepackage{setspace}
$else$
Expand All @@ -162,69 +157,17 @@ $if(mathspec)$
$else$
\usepackage{unicode-math}
$endif$
\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
$if(mainfont)$
\setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}
$endif$
$if(sansfont)$
\setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$}
$endif$
$if(monofont)$
\setmonofont[$for(monofontoptions)$$monofontoptions$$sep$,$endfor$]{$monofont$}
$endif$
$for(fontfamilies)$
\newfontfamily{$fontfamilies.name$}[$for(fontfamilies.options)$$fontfamilies.options$$sep$,$endfor$]{$fontfamilies.font$}
$endfor$
$if(mathfont)$
$if(mathspec)$
\ifxetex
\setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
\else
\setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
\fi
$else$
\setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
$endif$
$endif$
$if(CJKmainfont)$
\ifxetex
\usepackage{xeCJK}
\setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
\fi
$endif$

\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}

$if(luatexjapresetoptions)$
\ifluatex
\usepackage[$for(luatexjapresetoptions)$$luatexjapresetoptions$$sep$,$endfor$]{luatexja-preset}
\fi
$endif$
$if(CJKmainfont)$
\ifluatex
\usepackage[$for(luatexjafontspecoptions)$$luatexjafontspecoptions$$sep$,$endfor$]{luatexja-fontspec}
\setmainjfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
\fi
$endif$
\fi
$if(beamer)$
$if(theme)$
\usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$}
$endif$
$if(colortheme)$
\usecolortheme{$colortheme$}
$endif$
$if(fonttheme)$
\usefonttheme{$fonttheme$}
$endif$
$if(mainfont)$
\usefonttheme{serif} % use mainfont rather than sansfont for slide text
$endif$
$if(innertheme)$
\useinnertheme{$innertheme$}
$endif$
$if(outertheme)$
\useoutertheme{$outertheme$}
$endif$
$endif$

% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
Expand Down Expand Up @@ -639,45 +582,29 @@ $endif$
\unskip\unskip\endlist\end{customblockquote}
}

%
% Source Sans Pro as the de­fault font fam­ily
% Source Code Pro for monospace text
%
% 'default' option sets the default
% font family to Source Sans Pro, not \sfdefault.
%
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
$if(fontfamily)$
$else$
\usepackage[default]{sourcesanspro}
\usepackage{sourcecodepro}
$endif$
\else % if not pdftex
$if(mainfont)$
$else$
\usepackage[default]{sourcesanspro}
\usepackage{sourcecodepro}
\usepackage{fontspec}
\setmainfont{Arial}
\setsansfont{Arial}
\setmonofont{Source Code Pro}

% XeLaTeX specific adjustments for straight quotes: https://tex.stackexchange.com/a/354887
% This issue is already fixed (see https://github.com/silkeh/latex-sourcecodepro/pull/5) but the
% fix is still unreleased.
% TODO: Remove this workaround when the new version of sourcecodepro is released on CTAN.
\ifxetex
\makeatletter
\defaultfontfeatures[\ttfamily]
{ Numbers = \sourcecodepro@figurestyle,
Scale = \SourceCodePro@scale,
Extension = .otf }
\setmonofont
[ UprightFont = *-\sourcecodepro@regstyle,
ItalicFont = *-\sourcecodepro@regstyle It,
BoldFont = *-\sourcecodepro@boldstyle,
BoldItalicFont = *-\sourcecodepro@boldstyle It ]
{SourceCodePro}
\makeatother
\fi
$endif$
\fi
\usepackage{newunicodechar}
% Use Arial Unicode to display various unicode symbols that might be present
\newfontfamily{\fallbackfont}{Arial Unicode MS}[Scale=MatchLowercase]
\DeclareTextFontCommand{\textfallback}{\fallbackfont}
% TODO: Cover more characters with a nice loop or macro.
\newunicodechar{≔}{\textfallback{≔}}
\newunicodechar{⌊}{\textfallback{⌊}}
\newunicodechar{⌋}{\textfallback{⌋}}
\newunicodechar{⌈}{\textfallback{⌈}}
\newunicodechar{⌉}{\textfallback{⌉}}
\newunicodechar{⊕}{\textfallback{⊕}}
\newunicodechar{·}{\textfallback{·}}
\newunicodechar{≥}{\textfallback{≥}}
\newunicodechar{≤}{\textfallback{≤}}
\newunicodechar{≠}{\textfallback{≠}}
\newunicodechar{©}{\textfallback{©}}
\newunicodechar{™}{\textfallback{™}}
\newunicodechar{→}{\textfallback{→}}

%
% heading color
Expand Down

0 comments on commit 8d92030

Please sign in to comment.