Skip to content

Commit 8d92030

Browse files
authored
use lualatex, use arial (#42)
* 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
1 parent e5b2708 commit 8d92030

File tree

4 files changed

+47
-105
lines changed

4 files changed

+47
-105
lines changed

Dockerfile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ RUN tlmgr update --self && \
3535
catchfile \
3636
ragged2e \
3737
enumitem \
38-
mathtools
38+
mathtools \
39+
fontspec \
40+
unicode-math \
41+
titlesec \
42+
newunicodechar
3943

4044
RUN apk upgrade && apk add --no-cache \
4145
bash \
@@ -49,6 +53,15 @@ RUN apk upgrade && apk add --no-cache \
4953
py3-pip \
5054
yarn
5155

56+
# Install MS core fonts, including Arial
57+
RUN apk --no-cache add msttcorefonts-installer fontconfig && \
58+
update-ms-fonts && \
59+
fc-cache -f
60+
61+
# Install the Arial Unicode MS font as well
62+
RUN wget https://github.com/kaienfr/Font/raw/master/font/ARIALUNI.TTF -P /usr/share/fonts/TTF/ && \
63+
fc-cache -f
64+
5265
RUN pip install pandocfilters
5366

5467
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \

build.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ export MERMAID_FILTER_FORMAT="pdf"
259259
if [ -n "${pdf_output}" ]; then
260260
echo "Generating PDF Output"
261261
pandoc \
262-
--trace \
262+
--pdf-engine=lualatex \
263263
--embed-resources \
264264
--standalone \
265265
--template=eisvogel.latex \
@@ -292,6 +292,7 @@ fi
292292
if [ -n "${latex_output}" ]; then
293293
echo "Generating LaTeX Output"
294294
pandoc \
295+
--pdf-engine=lualatex \
295296
--embed-resources \
296297
--standalone \
297298
--template=eisvogel.latex \
@@ -324,6 +325,7 @@ fi
324325
if [ -n "${docx_output}" ]; then
325326
echo "Generating DOCX Output"
326327
pandoc \
328+
--pdf-engine=lualatex \
327329
--embed-resources \
328330
--standalone \
329331
--filter=/resources/filters/info.py \

sample3.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,15 @@ This section contains an HTML Table.
165165
</thead>
166166
<tbody>
167167
<tr>
168-
<td>CEIL(x)</td>
168+
<td>⌈x⌉</td>
169169
<td>the smallest integer not less than x</td>
170170
</tr>
171171
<tr>
172-
<td><strong>FLOOR(</strong>x<strong>)</strong></td>
172+
<td>⌊x⌋</td>
173173
<td>the largest integer not greater than x</td>
174174
</tr>
175175
<tr>
176-
<td>A $\coloneqq$ B</td>
176+
<td>A B</td>
177177
<td>assignment of the results of the expression on the right (B) to the
178178
parameter on the left</td>
179179
</tr>

template/eisvogel.latex

Lines changed: 27 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,6 @@ $if(beamerarticle)$
135135
$endif$
136136
\usepackage{amsmath,amssymb}
137137
\usepackage{mathtools}
138-
$if(fontfamily)$
139-
\usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$}
140-
$else$
141-
\usepackage{lmodern}
142-
$endif$
143138
$if(linestretch)$
144139
\usepackage{setspace}
145140
$else$
@@ -162,69 +157,17 @@ $if(mathspec)$
162157
$else$
163158
\usepackage{unicode-math}
164159
$endif$
165-
\defaultfontfeatures{Scale=MatchLowercase}
166-
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
167-
$if(mainfont)$
168-
\setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}
169-
$endif$
170-
$if(sansfont)$
171-
\setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$}
172-
$endif$
173-
$if(monofont)$
174-
\setmonofont[$for(monofontoptions)$$monofontoptions$$sep$,$endfor$]{$monofont$}
175-
$endif$
176-
$for(fontfamilies)$
177-
\newfontfamily{$fontfamilies.name$}[$for(fontfamilies.options)$$fontfamilies.options$$sep$,$endfor$]{$fontfamilies.font$}
178-
$endfor$
179-
$if(mathfont)$
180-
$if(mathspec)$
181-
\ifxetex
182-
\setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
183-
\else
184-
\setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
185-
\fi
186-
$else$
187-
\setmathfont[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
188-
$endif$
189-
$endif$
190-
$if(CJKmainfont)$
191-
\ifxetex
192-
\usepackage{xeCJK}
193-
\setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
194-
\fi
195-
$endif$
160+
161+
\defaultfontfeatures{Scale=MatchLowercase}
162+
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
163+
196164
$if(luatexjapresetoptions)$
197165
\ifluatex
198166
\usepackage[$for(luatexjapresetoptions)$$luatexjapresetoptions$$sep$,$endfor$]{luatexja-preset}
199167
\fi
200168
$endif$
201-
$if(CJKmainfont)$
202-
\ifluatex
203-
\usepackage[$for(luatexjafontspecoptions)$$luatexjafontspecoptions$$sep$,$endfor$]{luatexja-fontspec}
204-
\setmainjfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
205-
\fi
206-
$endif$
207169
\fi
208-
$if(beamer)$
209-
$if(theme)$
210-
\usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$}
211-
$endif$
212-
$if(colortheme)$
213-
\usecolortheme{$colortheme$}
214-
$endif$
215-
$if(fonttheme)$
216-
\usefonttheme{$fonttheme$}
217-
$endif$
218-
$if(mainfont)$
219-
\usefonttheme{serif} % use mainfont rather than sansfont for slide text
220-
$endif$
221-
$if(innertheme)$
222-
\useinnertheme{$innertheme$}
223-
$endif$
224-
$if(outertheme)$
225-
\useoutertheme{$outertheme$}
226-
$endif$
227-
$endif$
170+
228171
% Use upquote if available, for straight quotes in verbatim environments
229172
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
230173
\IfFileExists{microtype.sty}{% use microtype if available
@@ -639,45 +582,29 @@ $endif$
639582
\unskip\unskip\endlist\end{customblockquote}
640583
}
641584

642-
%
643-
% Source Sans Pro as the de­fault font fam­ily
644-
% Source Code Pro for monospace text
645-
%
646-
% 'default' option sets the default
647-
% font family to Source Sans Pro, not \sfdefault.
648-
%
649-
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
650-
$if(fontfamily)$
651-
$else$
652-
\usepackage[default]{sourcesanspro}
653-
\usepackage{sourcecodepro}
654-
$endif$
655-
\else % if not pdftex
656-
$if(mainfont)$
657-
$else$
658-
\usepackage[default]{sourcesanspro}
659-
\usepackage{sourcecodepro}
585+
\usepackage{fontspec}
586+
\setmainfont{Arial}
587+
\setsansfont{Arial}
588+
\setmonofont{Source Code Pro}
660589

661-
% XeLaTeX specific adjustments for straight quotes: https://tex.stackexchange.com/a/354887
662-
% This issue is already fixed (see https://github.com/silkeh/latex-sourcecodepro/pull/5) but the
663-
% fix is still unreleased.
664-
% TODO: Remove this workaround when the new version of sourcecodepro is released on CTAN.
665-
\ifxetex
666-
\makeatletter
667-
\defaultfontfeatures[\ttfamily]
668-
{ Numbers = \sourcecodepro@figurestyle,
669-
Scale = \SourceCodePro@scale,
670-
Extension = .otf }
671-
\setmonofont
672-
[ UprightFont = *-\sourcecodepro@regstyle,
673-
ItalicFont = *-\sourcecodepro@regstyle It,
674-
BoldFont = *-\sourcecodepro@boldstyle,
675-
BoldItalicFont = *-\sourcecodepro@boldstyle It ]
676-
{SourceCodePro}
677-
\makeatother
678-
\fi
679-
$endif$
680-
\fi
590+
\usepackage{newunicodechar}
591+
% Use Arial Unicode to display various unicode symbols that might be present
592+
\newfontfamily{\fallbackfont}{Arial Unicode MS}[Scale=MatchLowercase]
593+
\DeclareTextFontCommand{\textfallback}{\fallbackfont}
594+
% TODO: Cover more characters with a nice loop or macro.
595+
\newunicodechar{≔}{\textfallback{≔}}
596+
\newunicodechar{⌊}{\textfallback{⌊}}
597+
\newunicodechar{⌋}{\textfallback{⌋}}
598+
\newunicodechar{⌈}{\textfallback{⌈}}
599+
\newunicodechar{⌉}{\textfallback{⌉}}
600+
\newunicodechar{⊕}{\textfallback{⊕}}
601+
\newunicodechar{·}{\textfallback{·}}
602+
\newunicodechar{≥}{\textfallback{≥}}
603+
\newunicodechar{≤}{\textfallback{≤}}
604+
\newunicodechar{≠}{\textfallback{≠}}
605+
\newunicodechar{©}{\textfallback{©}}
606+
\newunicodechar{™}{\textfallback{™}}
607+
\newunicodechar{→}{\textfallback{→}}
681608

682609
%
683610
% heading color

0 commit comments

Comments
 (0)