Merge pull request #6835 from jfbu/latex_unicode_reduce_tex_escape

LaTeX: escape fewer Unicode chars if engine is lualatex or xelatex
This commit is contained in:
Jean-François B 2019-11-16 11:42:21 +01:00 committed by GitHub
commit 53cd2a064e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 14 deletions

View File

@ -43,7 +43,8 @@ Bugs fixed
.. _latex3/latex2e#173: https://github.com/latex3/latex2e/issues/173
* #6618: LaTeX: Avoid section names at the end of a page
* #6738: LaTeX: Do not replace unicode characters by LaTeX macros on unicode
supported LaTeX engines
supported LaTeX engines: ¶, §, €, ∞, ±, →, ‣, , superscript and subscript
digits go through "as is" (as default OpenType font supports them)
* #6704: linkcheck: Be defensive and handle newly defined HTTP error code
* #6655: image URLs containing ``data:`` causes gettext builder crashed
* #6584: i18n: Error when compiling message catalogs on Hindi

View File

@ -20,29 +20,28 @@ tex_replacements = [
('_', r'\_'),
('{', r'\{'),
('}', r'\}'),
('[', r'{[}'),
(']', r'{]}'),
('`', r'{}`'),
('\\', r'\textbackslash{}'),
('~', r'\textasciitilde{}'),
('^', r'\textasciicircum{}'),
# map chars to avoid mis-interpretation in LaTeX
('[', r'{[}'),
(']', r'{]}'),
# map chars to avoid TeX ligatures
# 1. ' - and , not here for some legacy reason
# 2. no effect with lualatex (done otherwise: #5790)
('`', r'{}`'),
('<', r'\textless{}'),
('>', r'\textgreater{}'),
('^', r'\textasciicircum{}'),
# map char for some unknown reason. TODO: remove this?
('|', r'\textbar{}'),
# map special Unicode characters to TeX commands
('', r'\P{}'),
('§', r'\S{}'),
('', r'\texteuro{}'),
('±', r'\(\pm\)'),
('', r'\(\rightarrow\)'),
('', r'\(\rightarrow\)'),
('', r'\(\checkmark\)'),
('', r'\(\pmb{\checkmark}\)'),
# used to separate -- in options
('', r'{}'),
# map some special Unicode characters to similar ASCII ones
# (even for Unicode LaTeX as may not be supported by OpenType font)
('', r'\_'),
('', r'\textendash{}'),
('|', r'\textbar{}'),
('', r'e'),
('', r'i'),
# Greek alphabet not escaped: pdflatex handles it via textalpha and inputenc
@ -52,8 +51,15 @@ tex_replacements = [
# A map Unicode characters to LaTeX representation
# (for LaTeX engines which don't support unicode)
unicode_tex_replacements = [
# map special Unicode characters to TeX commands
# map some more common Unicode characters to TeX commands
('', r'\P{}'),
('§', r'\S{}'),
('', r'\texteuro{}'),
('', r'\(\infty\)'),
('±', r'\(\pm\)'),
('', r'\(\rightarrow\)'),
('', r'\(\rightarrow\)'),
('', r'\textendash{}'),
# superscript
('', r'\(\sp{\text{0}}\)'),
('¹', r'\(\sp{\text{1}}\)'),