Mercurial > octave
comparison scripts/miscellaneous/private/__publish_latex_output__.m @ 30242:33d895260fa4
publish.m: Support some non-ASCII characters in comments for pdf output.
* scripts/miscellaneous/publish.m: Clarify documentation. Publishing Markup is
only interpreted in section comments. Remove sentence that suggests that
commands in the output format might be interpreted in that format.
* scripts/miscellaneous/private/__publish_latex_output__.m: Add substitution
rules for some multi-byte UTF-8 characters (mostly Latin-based) to LaTeX
publish template. This fixes a bug where using these characters in comments
would cause `pdflatex` to fail.
See: https://github.com/gnu-octave/octave/pull/5
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sun, 17 Oct 2021 12:28:51 +0200 |
parents | 0a5b15007766 |
children | 363fb10055df |
comparison
equal
deleted
inserted
replaced
30241:ba4aebad10d1 | 30242:33d895260fa4 |
---|---|
135 '\usepackage{titlesec}', | 135 '\usepackage{titlesec}', |
136 '\usepackage[utf8]{inputenc}', | 136 '\usepackage[utf8]{inputenc}', |
137 '\usepackage[T1]{fontenc}', | 137 '\usepackage[T1]{fontenc}', |
138 '\usepackage{lmodern}'); | 138 '\usepackage{lmodern}'); |
139 | 139 |
140 # "lstlisting" doesn't support multi-byte UTF-8 characters. | |
141 # Add substitution rules for some characters (commonly used in languages with | |
142 # Latin-based script). | |
143 # Set of substitions taken from: | |
144 # https://en.wikibooks.org/w/index.php?title=LaTeX/Source_Code_Listings&oldid=3815132#Encoding_issue | |
145 # FIXME: Any multi-byte UTF-8 character in a non-section comment without a | |
146 # substitution rule will still cause an error. This should be fixed | |
147 # more generally, or a way how to work around this limitation should | |
148 # be documented. | |
140 listings_option = sprintf ("%s\n", | 149 listings_option = sprintf ("%s\n", |
141 "", | 150 "", |
142 "", | 151 "", |
143 '\lstset{', | 152 '\lstset{', |
144 'language=Octave,', | 153 'language=Octave,', |
145 'numbers=none,', | 154 'numbers=none,', |
146 'frame=single,', | 155 'frame=single,', |
147 'tabsize=2,', | 156 'tabsize=2,', |
148 'showstringspaces=false,', | 157 'showstringspaces=false,', |
149 'breaklines=true}'); | 158 'breaklines=true,', |
159 'inputencoding=utf8,', | |
160 'extendedchars=true,', | |
161 'literate=', | |
162 ' {á}{{\''a}}1 {é}{{\''e}}1 {í}{{\''i}}1 {ó}{{\''o}}1 {ú}{{\''u}}1', | |
163 ' {Á}{{\''A}}1 {É}{{\''E}}1 {Í}{{\''I}}1 {Ó}{{\''O}}1 {Ú}{{\''U}}1', | |
164 ' {à}{{\`a}}1 {è}{{\`e}}1 {ì}{{\`i}}1 {ò}{{\`o}}1 {ù}{{\`u}}1', | |
165 ' {À}{{\`A}}1 {È}{{\''E}}1 {Ì}{{\`I}}1 {Ò}{{\`O}}1 {Ù}{{\`U}}1', | |
166 ' {ä}{{\"a}}1 {ë}{{\"e}}1 {ï}{{\"i}}1 {ö}{{\"o}}1 {ü}{{\"u}}1', | |
167 ' {Ä}{{\"A}}1 {Ë}{{\"E}}1 {Ï}{{\"I}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1', | |
168 ' {â}{{\^a}}1 {ê}{{\^e}}1 {î}{{\^i}}1 {ô}{{\^o}}1 {û}{{\^u}}1', | |
169 ' {Â}{{\^A}}1 {Ê}{{\^E}}1 {Î}{{\^I}}1 {Ô}{{\^O}}1 {Û}{{\^U}}1', | |
170 ' {ã}{{\~a}}1 {ẽ}{{\~e}}1 {ĩ}{{\~i}}1 {õ}{{\~o}}1 {ũ}{{\~u}}1', | |
171 ' {Ã}{{\~A}}1 {Ẽ}{{\~E}}1 {Ĩ}{{\~I}}1 {Õ}{{\~O}}1 {Ũ}{{\~U}}1', | |
172 ' {œ}{{\oe}}1 {Œ}{{\OE}}1 {æ}{{\ae}}1 {Æ}{{\AE}}1 {ß}{{\ss}}1', | |
173 ' {ű}{{\H{u}}}1 {Ű}{{\H{U}}}1 {ő}{{\H{o}}}1 {Ő}{{\H{O}}}1', | |
174 ' {ç}{{\c c}}1 {Ç}{{\c C}}1 {ø}{{\o}}1 {å}{{\r a}}1 {Å}{{\r A}}1', | |
175 ' {€}{{\euro}}1 {£}{{\pounds}}1 {«}{{\guillemotleft}}1', | |
176 ' {»}{{\guillemotright}}1 {ñ}{{\~n}}1 {Ñ}{{\~N}}1 {¿}{{?`}}1 {¡}{{!`}}1', | |
177 '}'); | |
150 | 178 |
151 latex_head = sprintf ("%s\n", | 179 latex_head = sprintf ("%s\n", |
152 "", | 180 "", |
153 "", | 181 "", |
154 '\titleformat*{\section}{\Huge\bfseries}', | 182 '\titleformat*{\section}{\Huge\bfseries}', |