From 6255f8a277bbcd044be8b47d76eb356d44496f18 Mon Sep 17 00:00:00 2001 From: Kilian Evang Date: Thu, 26 Aug 2021 09:20:20 +0200 Subject: [PATCH] Fixed broken LaTeX escaping in all_papers.tex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit E.g., Haußer was being escaped to Hau\sser, which does not parse. Solution: switched from unicode_tex.unicode_to_tex to pylatex.utils.escape_latex. This only escapes special characters, not non-ASCII characters, but there is no need to, we are using \usepackage[utf8]{inputenc} anyway. --- easy2acl.py | 8 ++++---- requirements.txt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/easy2acl.py b/easy2acl.py index 0120a22..799cf9d 100755 --- a/easy2acl.py +++ b/easy2acl.py @@ -17,17 +17,17 @@ from csv import DictReader from glob import glob from shutil import copy, rmtree -from unicode_tex import unicode_to_tex from pybtex.database import BibliographyData, Entry +from pylatex.utils import escape_latex from PyPDF2 import PdfFileReader def texify(string): - """Return a modified version of the argument string where non-ASCII symbols have - been converted into LaTeX escape codes. + """Return a modified version of the argument string where characters that + are special in LaTeX have been converted into LaTeX escape codes. """ - return ' '.join(map(unicode_to_tex, string.split())).replace(r'\textquotesingle', "'") + return str(escape_latex(string)) #,---- diff --git a/requirements.txt b/requirements.txt index 14c04ef..f7bf08e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -unicode_tex +pylatex pybtex PyPDF2