|
120 | 120 | # ============================================================================== |
121 | 121 | # Options for LaTeX / PDF output |
122 | 122 | # ============================================================================== |
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 = "" |
124 | 131 |
|
125 | 132 | 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 |
152 | 141 | } |
153 | 142 |
|
154 | 143 | # Grouping the document tree into LaTeX files. List of tuples |
|
0 commit comments