-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quarto v1.5 installs a nonexistent package hyphen-chinese-hans
when compiling PDF
#10291
Comments
@leovan Thanks for the report. unfortunately we currently can't use your report as you did not provide us with the means to reproduce the issue as requested in the template. |
I've added a minimum repo to reproduce the issue: https://github.com/leovan/quarto-issue |
Thanks! I can even reproduce with the following: ---
tile: "范叶亮"
format: pdf
lang: zh
---
# 范叶亮 The issue is not in the LaTeX part but in the processing after that to render the document, in particular the automatic package discovery/install. The change comes from an attempt to fix issues with hyphenation: The following might need another exception for chinese (in addition to german):
|
Thanks for checking the issue, look forward to the fix. |
I had the same error, look forward to the fix |
I think the quick fix is to make quarto-cli/src/command/render/latexmk/pdf.ts Lines 177 to 191 in 9724c3d
For line 182, it can be revised to: if (missingHyphenationFile && pkgMgr.autoInstall) { |
The suggested change won't change the fact that Quarto tries to determine the hyphen file and will try to install it. Making the auto install will only make sure the correct package is installed but won't correct the bad name so it should lead to the exact same error. |
OK, it seems adding another exception for chinese is a better way to fix this. |
This is indeed a problem of Quarto trying to guess which package needs to be installed when the babel warning is encounter
We build the package name based on value from the log.
Installing |
According to https://ctan.math.utah.edu/ctan/tex-archive/macros/latex/required/babel/base/babel.pdf, in section chinese-simplified (zh-Hans)
chinese-hans (zh-Hans)
chinese-traditional (zh-Hant)
chinese-hant (zh-Hant)
chinese-simplified-hongkongsarchina (zh-Hans-HK)
chinese-hans-hk (zh-Hans-HK)
chinese-simplified-macausarchina (zh-Hans-MO)
chinese-hans-mo (zh-Hans-MO)
chinese-simplified-singapore (zh-Hans-SG)
chinese-hans-sg (zh-Hans-SG)
chinese-hant-hk (zh-Hant-HK)
chinese-traditional-hongkongsarchina (zh-Hant-HK)
chinese-hant-mo (zh-Hant-MO)
chinese-traditional-macausarchina (zh-Hant-MO) Will the following code works? if (lang === "ngerman") {
return "hyphen-german";
} else if (lang.startsWith("chinese") {
return "hyphen-chinese";
}
return `hyphen-${lang.toLowerCase()}`; I think this will install Really need a quick fix, otherwise Quarto v1.5 won't compile doc with |
I did try that. But installing |
OK, I will try later to see whether we can get a quick fix for this issue. |
I can't find it on CTAN. Are you sure this is the name of the package ? |
Oh great thanks. This is a sytem package then. It does not solve the warning though, so not sure if we should ask for installation for this warning problem. Another problem we have is that if this is already install the rendering should not stop... 🤔 |
@leovan I do think this is the right thing to do here. At least to unblock. Quarto LaTeX engine does auto install missing hyphenation package based on log warnings, but the
Regarding this problem, Quarto does have a recipe to guess which package to install based on log warning. Here, it builds a wrong name so we need an exception. Though even when And we do prevent PDF rendering for a hyphenation warning in the log, not resolved. quarto-cli/src/command/render/latexmk/pdf.ts Lines 178 to 190 in 1c1609c
We could also relax this constraint, and continue the rendering anyway... 🤔 |
I made a test, code changes: diff --git a/src/command/render/latexmk/pdf.ts b/src/command/render/latexmk/pdf.ts
index 52062aa3f..ec9eb0554 100644
--- a/src/command/render/latexmk/pdf.ts
+++ b/src/command/render/latexmk/pdf.ts
@@ -179,7 +179,7 @@ async function initialCompileLatex(
// See (https://github.com/rstudio/tinytex/commit/0f2007426f730a6ed9d45369233c1349a69ddd29)
const logText = Deno.readTextFileSync(response.log);
const missingHyphenationFile = findMissingHyphenationFiles(logText);
- if (missingHyphenationFile) {
+ if (pkgMgr.autoInstall && missingHyphenationFile) {
if (await pkgMgr.installPackages([missingHyphenationFile])) {
// We installed hyphenation files, retry
continue; qmd example: ---
tile: "范叶亮"
format: pdf
lang: zh
keep-tex: true
latex-auto-install: false
---
# 范叶亮 Without
With
Thus, would it be possible to make a quick fix with |
By the way, the fix won't change the defaut behavior since |
Yes we do agree on this. Definitely something we would need to improve, i.e. not blocking the pdf rendering because of a warning in the log file. Though, I would still like to understand what needs to be done for this specific warning
This triggers our "package to install" detection, but wrongly as we don't know which is the required package to solve it. If we can't find it, I wonder if we should make an exception to skip this warning completely. Do you have insight on this ? or does the PDF produced anyway is useful and you stop there ? Any insight would be helpful ! |
I guess it's a upstream problem. In babel package, for English: hyphenrules = english for Chinese: hyphenrules =
Package babel Info: Hyphen rules for 'chinese-hans' set to \l@nil Should we just ignore the warning message from babel package about hyphen rules? |
Also there is indeed no hyphen for Chinese. For a Chinese word like xxx xxx xxx xxx 你
好 xxx xxx No need for a hyphen like: xxx xxx xxx xxx 你-
好 xxx xxx Why |
So you mean we should ignore the Hyphen rules warning for Seems like the right think to do, if there is no hyphen expected anyway |
Yes, but not only for Chinese. More precisely, I think we should check all languages with empty value for |
Oh interesting. I don't know very well in detail how babel works and it seems you know better. Can you detail you idea ? Thanks for your help ! |
Not quite sure, just guessed from its document and source code. |
ok thanks. I'll search about this. If we do code some logic about this, it needs to be relevant to expected babel behavior |
As an immediate workaround, I think we should add a special-case rule to not attempt to install the bad hyphenation package in this specific case. |
💯 Agreed. This is exactly what I was going to do if not further information on babel package. With adding support also for |
Just for reference, related notes I made in the past about hyphenation: |
Hi, @cderv any updates with this issue? Would it be possible to make a quick fix with |
Asking for updates and pressuring with things like "It truely influence many Chinese language projects." does not really help. The team is pretty much transparent and communicates/replies more than average projects (see the thread itself), so if you don't see any update, it means there is nothing to communicate about. Thanks for your interest in this issue and Quarto but please be patient. |
Here is a quick fix like: diff --git a/src/command/render/latexmk/pdf.ts b/src/command/render/latexmk/pdf.ts
index 52062aa3f..ec9eb0554 100644
--- a/src/command/render/latexmk/pdf.ts
+++ b/src/command/render/latexmk/pdf.ts
@@ -179,7 +179,7 @@ async function initialCompileLatex(
// See (https://github.com/rstudio/tinytex/commit/0f2007426f730a6ed9d45369233c1349a69ddd29)
const logText = Deno.readTextFileSync(response.log);
const missingHyphenationFile = findMissingHyphenationFiles(logText);
- if (missingHyphenationFile) {
+ if (pkgMgr.autoInstall && missingHyphenationFile) {
if (await pkgMgr.installPackages([missingHyphenationFile])) {
// We installed hyphenation files, retry
continue; I'm not sure will you accept this as a fix. If do, I can make the PR. |
My problem seems like closely to this.
And loading forever, no returning the trace of error. Here i found a workaround:
But using this method, I can not custom Chinese fonts. |
@MaxforCherubim Your issue is unrelated. The issue here causes a complete crash. |
OK. Let me try |
…o install it closes #10291 - Quarto v1.5 installs a nonexistent package `hyphen-chinese-hans` when compiling PDF
Bug description
For a book type project with
lang: zh
, Quarto v1.5 installs a nonexistent packagehyphen-chinese-hans
when compiling PDF.hyphen-chinese
is a valid package, buthyphen-chinese-hans
is not. Quarto v1.4 works well. Error output is shown as below:Steps to reproduce
Repo: https://github.com/leovan/quarto-issue
Expected behavior
No response
Actual behavior
No response
Your environment
No response
Quarto check output
Quarto 1.5.54 [✓] Checking versions of quarto binary dependencies... Pandoc version 3.2.0: OK Dart Sass version 1.70.0: OK Deno version 1.41.0: OK Typst version 0.11.0: OK [✓] Checking versions of quarto dependencies......OK [✓] Checking Quarto installation......OK Version: 1.5.54 Path: /Applications/quarto/bin [✓] Checking tools....................OK TinyTeX: (not installed) Chromium: (not installed) [✓] Checking LaTeX....................OK Using: Installation From Path Path: /Library/TeX/texbin Version: 2024 [✓] Checking basic markdown render....OK [✓] Checking Python 3 installation....OK Version: 3.10.14 Path: /Users/leo/Applications/Python/python310-dev/bin/python Jupyter: (None) Jupyter is not available in this Python installation. Install with python3 -m pip install jupyter [✓] Checking R installation...........OK Version: 4.4.1 Path: /Library/Frameworks/R.framework/Resources LibPaths: - /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library knitr: 1.47 rmarkdown: 2.27 [✓] Checking Knitr engine render......OK
The text was updated successfully, but these errors were encountered: