Skip to content

Commit e841fc9

Browse files
committed
Latexmk - Improve hyphen package detection
Fixes #8684
1 parent 46b020a commit e841fc9

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

news/changelog-1.5.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ All changes included in 1.5:
88
## PDF Format:
99

1010
- ([#8299](https://github.com/quarto-dev/quarto-cli/issues/8299)): Don't use `rsvg-convert` to convert an SVG to PDF when the PDF is already available; add `use-rsvg-convert` option to control this behavior.
11+
- ([#8684](https://github.com/quarto-dev/quarto-cli/issues/8684)): Improve detection and automatic installation of locale specific hyphenation files.
1112

1213
## Website
1314

src/command/render/latexmk/parse-error.ts

+24
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,30 @@ export function findMissingHyphenationFiles(logText: string) {
119119
return `hyphen-${language.toLowerCase()}`;
120120
}
121121
}
122+
123+
// Try an alternative way of parsing
124+
const hyphenRulesRegex =
125+
/Package babel Info: Hyphen rules for '(.*?)' set to \\l@nil/m;
126+
const match = logText.match(hyphenRulesRegex);
127+
if (match) {
128+
const language = match[1];
129+
if (language) {
130+
//ngerman gets special cased
131+
const filterLang = (lang: string) => {
132+
// NOTE Although the names of the corresponding lfd files match those in this list,
133+
// there are some exceptions, particularly in German and Serbian. So, ngerman is
134+
// called here german, which is the name in the CLDR and, actually, the most logical.
135+
//
136+
// See https://ctan.math.utah.edu/ctan/tex-archive/macros/latex/required/babel/base/babel.pdf
137+
if (lang === "ngerman") {
138+
return "german";
139+
}
140+
return lang;
141+
};
142+
143+
return `hyphen-${filterLang(language.toLowerCase())}`;
144+
}
145+
}
122146
}
123147

124148
// Parse a log file to find latex errors

0 commit comments

Comments
 (0)