Skip to content

Commit d3d6f9a

Browse files
committed
Changed LaTeX preamble for LuaLaTeX + Unicode + OTF support.
1 parent 04f9c1f commit d3d6f9a

3 files changed

Lines changed: 68 additions & 28 deletions

File tree

.github/workflows/Pipeline.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ jobs:
5252
needs:
5353
- ConfigParams
5454
- UnitTestingParams
55+
- PublishCoverageResults # artificial dependency to delay start when pipeline has free job resources
5556
with:
5657
python_version: ${{ needs.UnitTestingParams.outputs.python_version }}
5758
html_report: ${{ needs.ConfigParams.outputs.typing_report_html }}
@@ -61,6 +62,7 @@ jobs:
6162
uses: pyTooling/Actions/.github/workflows/CheckCodeQuality.yml@r7
6263
needs:
6364
- UnitTestingParams
65+
- PublishCoverageResults # artificial dependency to delay start when pipeline has free job resources
6466
with:
6567
python_version: ${{ needs.UnitTestingParams.outputs.python_version }}
6668
package_directory: ${{ needs.UnitTestingParams.outputs.package_directory }}
@@ -292,7 +294,7 @@ jobs:
292294
- UnitTesting
293295
- StaticTypeCheck
294296
- Documentation
295-
# - PDFDocumentation
297+
- PDFDocumentation
296298
- PublishTestResults
297299
- PublishCoverageResults
298300
- PublishToGitHubPages

doc/conf.py

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -120,35 +120,24 @@
120120
# ==============================================================================
121121
# Options for LaTeX / PDF output
122122
# ==============================================================================
123-
from textwrap import dedent
123+
preamblePath = Path("preamble.tex")
124+
try:
125+
with preamblePath.open("r", encoding="utf-8") as fileHandle:
126+
latexPreamble = fileHandle.read()
127+
except Exception as ex:
128+
print(f"[ERROR:] While reading '{preamblePath}'.")
129+
print(ex)
130+
latexPreamble = ""
124131

125132
latex_elements = {
126-
# The paper size ('letterpaper' or 'a4paper').
127-
"papersize": "a4paper",
128-
129-
# The font size ('10pt', '11pt' or '12pt').
130-
#'pointsize': '10pt',
131-
132-
# Additional stuff for the LaTeX preamble.
133-
"preamble": dedent(r"""
134-
% ================================================================================
135-
% User defined additional preamble code
136-
% ================================================================================
137-
% Add more Unicode characters for pdfLaTeX.
138-
% - Alternatively, compile with XeLaTeX or LuaLaTeX.
139-
% - https://GitHub.com/sphinx-doc/sphinx/issues/3511
140-
%
141-
\ifdefined\DeclareUnicodeCharacter
142-
\DeclareUnicodeCharacter{2265}{$\geq$}
143-
\DeclareUnicodeCharacter{21D2}{$\Rightarrow$}
144-
\fi
145-
146-
147-
% ================================================================================
148-
"""),
149-
150-
# Latex figure (float) alignment
151-
#'figure_align': 'htbp',
133+
"inputenc": "", # Let LuaLaTeX handle input encoding
134+
"utf8extra": "",
135+
"fontenc": "", # Disable the default T1 font encoding (Essential for LuaLaTeX)
136+
"fontpkg": "", # Disable the default TeX font package (Times/Palatino)
137+
"papersize": "a4paper", # The paper size ('letterpaper' or 'a4paper').
138+
#'pointsize': '10pt', # The font size ('10pt', '11pt' or '12pt').
139+
"preamble": latexPreamble, # Additional stuff for the LaTeX preamble.
140+
#'figure_align': 'htbp', # Latex figure (float) alignment
152141
}
153142

154143
# Grouping the document tree into LaTeX files. List of tuples

doc/preamble.tex

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
% ================================================================================
2+
% User defined additional preamble code
3+
% ================================================================================
4+
% Add more Unicode characters for pdfLaTeX.
5+
% - Alternatively, compile with XeLaTeX or LuaLaTeX.
6+
% - https://GitHub.com/sphinx-doc/sphinx/issues/3511
7+
%
8+
\usepackage{fontspec}
9+
10+
% Set Main fonts
11+
\usepackage{libertinus-otf}
12+
%\usepackage{noto-emoji}
13+
14+
% Set Math font
15+
\usepackage{unicode-math}
16+
\setmathfont{LibertinusMath}
17+
18+
% Set Symbol font
19+
\usepackage{newunicodechar}
20+
\newfontfamily{\emojifont}[Renderer=OpenType]{NotoColorEmoji.ttf}
21+
\newunicodechar{≤}{\ensuremath{\le}}
22+
\newunicodechar{—}{---}
23+
\newunicodechar{…}{\dots}
24+
\newunicodechar{␣}{\ttfamily\char32} % open box = visible space U+2423
25+
26+
\newunicodechar{🍎}{{\emojifont 🍎}} % red apple
27+
\newunicodechar{🍏}{{\emojifont 🍏}} % green apple
28+
\newunicodechar{🐧}{{\emojifont 🐧}} % penguin
29+
\newunicodechar{⛄}{{\emojifont ⛄}} % snowman
30+
\newunicodechar{🪟}{{\emojifont 🪟}} % window
31+
\newunicodechar{🏢}{{\emojifont 🏢}} % glas building
32+
\newunicodechar{🐍}{{\emojifont 🐍}} % green snake
33+
\newunicodechar{🔴}{{\emojifont 🔴}} % red circle
34+
\newunicodechar{🟠}{{\emojifont 🟠}} % orange circle
35+
\newunicodechar{🟡}{{\emojifont 🟡}} % yellow circle
36+
\newunicodechar{🟢}{{\emojifont 🟢}} % green circle
37+
\newunicodechar{🟣}{{\emojifont 🟣}} % purple circle
38+
\newunicodechar{⚫}{{\emojifont ⚫}} % black circle U+26AB
39+
\newunicodechar{🟧}{{\emojifont 🟧}} % red square U+1F7E7
40+
\newunicodechar{🟨}{{\emojifont 🟨}} % yellow square U+1F7E8
41+
\newunicodechar{🟫}{{\emojifont 🟫}} % braun square U+1F7EB
42+
\newunicodechar{🟦}{{\emojifont 🟦}} % blue square U+1F7E6
43+
\newunicodechar{🟪}{{\emojifont 🟪}} % purple square U+1F7EA
44+
\newunicodechar{⟲}{{\emojifont ⟲}} % circular arrow counterclockwise U+27F2
45+
\newunicodechar{📦}{{\emojifont 📦}}
46+
\newunicodechar{📂}{{\emojifont 📂}}
47+
\newunicodechar{🗑}{{\emojifont 🗑}} % Wastebasket 🗑️ U+1F5D1
48+
49+
% ================================================================================

0 commit comments

Comments
 (0)