quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.74k stars 305 forks source link

lang argument in quarto chapter yaml header is not taken into account #8953

Open lucasvoirin opened 6 months ago

lucasvoirin commented 6 months ago

Bug description

It seems that the lang argument in quarto chapter _metadata.yml or yaml header is not taken into account for pdf output. Only the lang argument in _quarto.yml is taken into account.

Steps to reproduce

Here are the files used to reproduce this bug :

_quarto.yml

project:
  type: book

lang: fr

book:
  chapters:
    - index.qmd
    - fr.qmd
    - en.qmd

bibliography: references.bib

filters:
  - section-bibliographies

format:
  html:
    theme: cosmo
  pdf:
    documentclass: scrreprt
    citeproc: false

editor: visual

index.qmd

# Preface {.unnumbered}

en.qmd

---
lang: en
---

# English

[@ethier2020]

fr.qmd

---
lang: fr
---

# French

[@ethier2020]

references.bib

@article{ethier2020,
    title = {Using microphone arrays to investigate microhabitat selection by declining breeding birds},
    author = {Ethier, Jeffrey P. and Wilson, David R.},
    year = {2020},
    month = {07},
    date = {2020-07-01},
    journal = {Ibis},
    pages = {873--884},
    volume = {162},
    number = {3},
    doi = {10.1111/ibi.12785},
    note = {DOI: 10.1111/ibi.12785
MAG ID: 2977097847}
}

Expected behavior

The outputs of these files running quarto render index.qmd must be a html website and pdf file with correct citation, i.e. "and" between authors names for english chapter and "et" between authors names for french chapter.

Actual behavior

The outputs of these files running quarto render index.qmd are a html website with correct citation, i.e. "and" between authors names for english chapter and "et" between authors names for french chapter, and a pdf file with only french formated citations (as lang: fr is specified in _quarto.yml).

Your environment

Quarto check output

Quarto 1.4.549 [✓] Checking versions of quarto binary dependencies... Pandoc version 3.1.11: OK Dart Sass version 1.69.5: OK Deno version 1.37.2: OK [✓] Checking versions of quarto dependencies......OK [✓] Checking Quarto installation......OK Version: 1.4.549 Path: /opt/quarto/bin

[✓] Checking tools....................OK TinyTeX: (not installed) Chromium: (not installed)

[✓] Checking LaTeX....................OK Using: Installation From Path Path: /usr/bin Version: 2022

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK Version: 3.11.2 Path: /usr/bin/python3 Jupyter: 4.12.0 Kernels: julia-1.10

  NOTE: No Jupyter kernel for Python found

[✓] Checking R installation...........OK Version: 4.3.2 Path: /usr/lib/R LibPaths:

[✓] Checking Knitr engine render......OK

mcanouil commented 6 months ago

PDF book (LaTeX) is a single document contrary to HTML where each chapters are pages. That's a LaTeX limitation which could be resolved manually (by you) with for instance something like https://www.overleaf.com/learn/latex/International_language_support, use keep-tex: true, include-* and/or partials/template to get your desired results (if really possible in LaTeX).

cscheid commented 3 months ago

This is a bug, but I don't think it's something we'll be able to fix in latex at all. What we should do instead is warn the user that this is not supported.

cderv commented 3 months ago

Just a note that Pandoc allows to change language for part of the document https://pandoc.org/MANUAL.html#language-variables

but I believe it won't work for citation specifically, as they retrieve the citeproc meta from the YAML meta field https://github.com/jgm/pandoc/blob/7b85353780f8b6003ee3439cf7530d0b64925c4a/src/Text/Pandoc/Citeproc.hs#L175-L178

So this adds probably to current stated limitation of single document.