Skip to content

Commit 035f645

Browse files
committed
Fix babel error issue
when lang: en is passed, babel-english needs to be installed. This follows up fix on tinytex R package too about new error handling cause is new pandoc way to setup babel, and maybe new babel error in log
1 parent 537a0f9 commit 035f645

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,12 @@ const packageMatchers = [
283283
{ regex: /.*! LaTeX Error: File [`']([^']+)' not found.*/g },
284284
{ regex: /.* [fF]ile ['`]?([^' ]+)'? not found.*/g },
285285
{ regex: /.*the language definition file ([^\s]*).*/g },
286+
{
287+
regex: /.*! Package babel Error: Unknown option [`']([^'`]+)'[.].*/g,
288+
filter: (match: string, _text: string) => {
289+
return `${match}.ldf`;
290+
},
291+
},
286292
{ regex: /.* \\(file ([^)]+)\\): cannot open .*/g },
287293
{ regex: /.*file [`']([^']+)' .*is missing.*/g },
288294
{ regex: /.*! CTeX fontset [`']([^']+)' is unavailable.*/g },
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: "Babel English Auto-Install (#13633)"
3+
format: pdf
4+
lang: en
5+
_quarto:
6+
tests:
7+
pdf: null
8+
---
9+
10+
```{r}
11+
#| include: false
12+
13+
# Remove babel-english package to test auto-installation
14+
if (tinytex::check_installed("babel-english")) {
15+
message("Removing 'babel-english' package for the render")
16+
tinytex::tlmgr_remove("babel-english")
17+
}
18+
```
19+
20+
This document tests that Quarto correctly detects and auto-installs babel-english when rendering with `lang: en`.

tests/unit/latexmk/parse-error.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ unitTest("Detect missing files with `findMissingFontsAndPackages`", async () =>
4242
(babel) There is a locale ini file for this language.
4343
(babel) If it’s the main language, try adding \`provide=*'
4444
(babel) to the babel package options.`, "ngerman.ldf")
45+
assertFound("! Package babel Error: Unknown option 'english'.", "english.ldf");
4546
assertFound("!pdfTeX error: pdflatex (file 8r.enc): cannot open encoding file for reading", "8r.enc");
4647
assertFound("! CTeX fontset `fandol' is unavailable in current mode", "fandol");
4748
assertFound("! CTeX fontset 'fandol' is unavailable in current mode", "fandol");

0 commit comments

Comments
 (0)