Skip to content

Commit a81cb48

Browse files
authored
use XITS for math typesetting (#70)
This change fixes up a conflict between fontspec and unicode-math, and chooses a better math font.
1 parent f6dd083 commit a81cb48

File tree

4 files changed

+47
-17
lines changed

4 files changed

+47
-17
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ RUN tlmgr update --self && \
4444
changepage \
4545
draftwatermark \
4646
appendix \
47-
multirow
47+
multirow \
48+
xits
4849

4950
RUN apk upgrade && apk add --no-cache \
5051
bash \

build.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,11 @@ if [ -n "${pdf_output}" ]; then
315315
${extra_pandoc_options} \
316316
--to=pdf \
317317
--output="${pdf_output}"
318-
echo "PDF Output Generated to file: ${pdf_output}"
319318
if [ $? -ne 0 ]; then
320319
RESULT=$?
320+
echo "PDF output failed"
321+
else
322+
echo "PDF output generated to file: ${pdf_output}"
321323
fi
322324
fi
323325

@@ -358,9 +360,11 @@ if [ -n "${latex_output}" ]; then
358360
${extra_pandoc_options} \
359361
--to=latex \
360362
--output="${latex_output}"
361-
echo "LaTeX Output Generated to file: ${latex_output}"
362363
if [ $? -ne 0 ]; then
363364
RESULT=$?
365+
echo "LaTeX output failed"
366+
else
367+
echo "LaTeX output generated to file: ${latex_output}"
364368
fi
365369
fi
366370

@@ -391,9 +395,11 @@ if [ -n "${docx_output}" ]; then
391395
${extra_pandoc_options} \
392396
--to=docx \
393397
--output="${docx_output}"
394-
echo "DOCX Output Generated to file: ${docx_output}"
395398
if [ $? -ne 0 ]; then
396399
RESULT=$?
400+
echo "DOCX output failed"
401+
else
402+
echo "DOCX output generated to file: ${docx_output}"
397403
fi
398404
fi
399405

@@ -439,9 +445,11 @@ if [ -n "${html_output}" ]; then
439445
${extra_pandoc_options} \
440446
--to=html \
441447
--output="${html_output}"
442-
echo "HTML Output Generated to file: ${html_output}"
443448
if [ $? -ne 0 ]; then
444449
RESULT=$?
450+
echo "HTML output failed"
451+
else
452+
echo "HTML output generated to file: ${html_output}"
445453
fi
446454
fi
447455

guide.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,8 @@ To get an HTML table to word-wrap its contents, use `<colgroup>` to style the wi
716716

717717
# Math {#sec:math}
718718

719+
## Equations
720+
719721
Markdown supports inline math notation. For example, @eq:fermat can be typeset as:
720722

721723
```md
@@ -726,8 +728,28 @@ Note the `{#eq:fermat}` at the end of the equation. This allows referencing @eq:
726728

727729
$$ \nexists {n \ge 3; a, b, c \in \mathbb{Z}} \mid a^n + b^n = c^n $$ {#eq:fermat}
728730

731+
## Inline math
732+
729733
Sometimes, you just need a little inline math in the middle of a sentence, like with `$a^2 + b^2 = c^2$` to get $a^2 + b^2 = c^2$.
730734

735+
## Words in equations
736+
737+
To typeset complex equations with multi-character identifiers (such as the function "HMAC" or the word "OPAD") in @eq:hmac-iso,
738+
we recommend using the functions `\symbf` (for functions) and `\symup` (for identifiers).
739+
This avoids strange kerning issues where a string is treated as a product of single-character symbols, like in @eq:hmac-iso-bad-kerning:
740+
741+
```md
742+
$$ \symbf{HMAC}(K, \symup{"text"}) \coloneq H((\bar{K} \oplus \symup{OPAD}) \Vert H((\bar{K} \oplus \symup{IPAD}) \Vert \symup{"text"})) $$ {#eq:hmac-iso}
743+
```
744+
745+
$$ \symbf{HMAC}(K, \symup{"text"}) \coloneq H((\bar{K} \oplus \symup{OPAD}) \Vert H((\bar{K} \oplus \symup{IPAD}) \Vert \symup{"text"})) $$ {#eq:hmac-iso}
746+
747+
```md
748+
$$ HMAC(K, "text") \coloneq H((\bar{K} \oplus OPAD) \Vert H((\bar{K} \oplus IPAD) \Vert "text")) $$ {#eq:hmac-iso-bad-kerning}
749+
```
750+
751+
$$ HMAC(K, "text") \coloneq H((\bar{K} \oplus OPAD) \Vert H((\bar{K} \oplus IPAD) \Vert "text")) $$ {#eq:hmac-iso-bad-kerning}
752+
731753
\beginappendices
732754

733755
# Reporting Issues with the Tools

template/eisvogel.latex

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,6 @@ $endif$
7070
\setstretch{1.0}
7171
\usepackage[absolute,overlay]{textpos}
7272
\usepackage{ifxetex,ifluatex}
73-
$if(mathspec)$
74-
\ifxetex{}
75-
\usepackage{mathspec}
76-
\else
77-
\usepackage{unicode-math}
78-
\fi
79-
$else$
80-
\usepackage{unicode-math}
81-
$endif$
82-
83-
\defaultfontfeatures{Scale=MatchLowercase}
84-
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
8573

8674
$if(luatexjapresetoptions)$
8775
\ifluatex{}
@@ -410,6 +398,17 @@ $endif$
410398
\newunicodechar{™}{\textfallback{™}}
411399
\newunicodechar{→}{\textfallback{→}}
412400

401+
\usepackage[mathit=sym]{unicode-math}
402+
\setmathfont{XITS Math}
403+
404+
% Customize the spacing for math to relax it a bit.
405+
\thinmuskip=6mu
406+
\medmuskip=8mu plus 4mu minus 2mu
407+
\thickmuskip=10mu plus 10mu
408+
409+
\defaultfontfeatures{Scale=MatchLowercase}
410+
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
411+
413412
%
414413
% Set the heading color and ensure that every section begins on its own page.
415414
%

0 commit comments

Comments
 (0)