mirror of
https://github.com/MadsLorentzen/ai-job-search.git
synced 2026-09-17 00:26:26 +00:00
fix(verify_pdf): fold LaTeX's typographic substitutions before --contains; guard T1 fontenc for pdflatex (#385, #384) (#458)
`normalize_text()` folded whitespace only, so `--contains` compared what a
user types against what LaTeX renders. The stock CV compiled with the
documented lualatex command turns `'` into U+2019 and `--` into U+2013, so
`--contains "Master's degree"` and `--contains "2016-2024"` both reported
the keyword missing from a document that plainly contains it, through both
extractors. The documented remedy for a missing keyword is to add it, which
is the one thing the ATS section forbids.
Fold both sides at comparison time: NFC, then curly apostrophes and quotes
to ASCII, en/em dashes to `-`, no-break space to space. `--dump-text` still
writes the raw layer - that is what an ATS parses, and the date-range rule
in 05-cv-templates.md needs the raw en-dash visible there.
Separately, pdflatex without T1 font encoding stores accents decomposed
(`e` + U+0300). NFC repairs the pdftotext side of that, but pypdf reads the
same layer as `Z¨ urich` with a spacing accent, which no fold recovers.
moderncv 2.5 loads T1 itself under pdflatex; the apt-packaged 2.3.1 does
not - reproduced by compiling the template against moderncv v2.3.1 with
pdflatex (before: U+0308/U+0300 in pdftotext, `Z¨ urich` in pypdf; after:
U+00FC/U+00E8 in both). The template and the guide's preamble gain
`\ifpdftex\usepackage[T1]{fontenc}\fi`; the lualatex text layer is
byte-identical before and after.
Tests: ten new cases in test_verify_pdf.py (the fold-through and
normalize_text ones fail on the whitespace-only code) and a
test_latex_guidance.py guard that the fontenc line exists and stays inside
the pdflatex branch. framework_version 1.4.3 -> 1.4.4 on 05-cv-templates.md.
Reported and diagnosed by 9scorp4 in Discussions #385 and #384.
This commit is contained in:
@@ -23,6 +23,13 @@
|
||||
\renewcommand*{\sectionstyle}[1]{{\sectionfont\color{color1}#1}}
|
||||
|
||||
\usepackage[utf8]{inputenc}
|
||||
% pdflatex fallback only (the documented engine is lualatex, which skips this
|
||||
% branch). Without T1 font encoding pdflatex builds accented letters with
|
||||
% \accent, and the PDF text layer stores them decomposed - `e` + U+0300 rather
|
||||
% than U+00E8 - so an ATS keyword match on "Genève" fails while the page looks
|
||||
% right. moderncv 2.5 loads T1 itself under pdflatex; 2.3.1 (Debian/Ubuntu apt)
|
||||
% does not. \ifpdftex comes from iftex, which every moderncv version loads.
|
||||
\ifpdftex\usepackage[T1]{fontenc}\fi
|
||||
% moderncv loads hyperref itself in an \AtEndPreamble hook, so \hypersetup
|
||||
% must go in an \AtEndPreamble of our own: on moderncv < 2.4 a top-level
|
||||
% \usepackage{hyperref} clashes with the class's own
|
||||
|
||||
Reference in New Issue
Block a user