Skip to content
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

Provide a bibliography partial so fixing biblatex-apa issues doesn't require a template-wide changes #5058

Closed
5 tasks done
netique opened this issue Mar 31, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request latex LaTeX engines related libraries and technologies
Milestone

Comments

@netique
Copy link

netique commented Mar 31, 2023

Bug description

If I use biblatex with APA citation style and use a language for which biblatex-apa doesn't have a special definition, I get some errors about undefined control sequences. Check the following MWE (.bib file content does not matter as soon as it contains the "citation", entry):

---
format:
  pdf:
    lang: cs-CZ
    cite-method: biblatex
    biblio-style: apa
    bibliography: refs.bib
---

[@citation]

results in

compilation failed- Error compiling latex
Undefined control sequence.
<argument> \datecircaprint \mkbibdateapalongextra 
                                                  {labelyear}{labelyeardivis...
l.167 \autocite{citation}

Note that this is all because biblatex-apa doesn't have any czech-apa format. It's easy to solve using

\DeclareLanguageMapping{czech}{american-apa}

Now I get to the point of my issue – there is no way how to include the line above at the correct place in the .tex document without replacing the whole template.tex. It has to be placed after babel and biblatex, so I cannot use include-in-header, it has to be in the preamble, so before-body isn't an option either.

I think the solution may be to create a new template partial wrapping around this bibliography setup that would be easier to replace, benefiting from the template's other components getting updated along with quarto.

Versions RStudio 2023.05.0-daily+165 macOS Ventura 13.3

quarto check:
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.1.1: OK
Dart Sass version 1.55.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.3.299
Path: /Applications/quarto/bin

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

[✓] Checking Python 3 installation....OK
Version: 3.10.9 (Conda)
Path: /Users/netik/.julia/conda/3/bin/python3
Jupyter: 5.3.0
Kernels: julia-1.8, python3

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

[✓] Checking R installation...........OK
Version: 4.2.3
Path: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources
LibPaths:
- /Users/netik/Documents/git/diplomka/renv/library/R-4.2/aarch64-apple-darwin20
- /Users/netik/Library/Caches/org.R-project.R/R/renv/sandbox/R-4.2/aarch64-apple-darwin20/fd29d0b8
knitr: 1.42
rmarkdown: 2.21

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

Checklist

  • Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
  • Please format your issue so it is easier for us to read the bug report.
  • Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
  • Please document the operating system you're running. If on Linux, please provide the specific distribution.
  • Please provide the output of quarto check so we know which version of quarto and its dependencies you're running.
@netique netique added the bug Something isn't working label Mar 31, 2023
@cscheid cscheid added the latex LaTeX engines related libraries and technologies label Mar 31, 2023
@cscheid cscheid added this to the v1.4 milestone Mar 31, 2023
@cderv
Copy link
Collaborator

cderv commented Mar 31, 2023

Not a good long term solution as the name is not helpful but a possible current workaround would be to leverage the tilte.tex partials. Did you see this LaTeX partials ?

This is a partial you can replace and that will be the last things put before \begin{document}

$title.tex()$
\begin{document}

It is the last things in preamble. Content is quite simple, and you could copy and add to it.
See file https://github.com/quarto-dev/quarto-cli/blob/main/src/resources/formats/pdf/pandoc/title.tex

That is not the perfect solution, but could be helpful to not modify the whole template but just this partial. Adding a new partials is still a better idea.

Hope it helps.

@netique
Copy link
Author

netique commented Mar 31, 2023

Thanks, makes sense! If I set biblio-config: false and initialize biblatex on my own with the "language mapping" line added in the title partial, then it works. I can imagine that the "partialization" of pandoc's LaTeX template can be challenging. I believe this bibliography issue is an edge case, so I'm pretty fine with this solution.

@cderv cderv added the triaged-to Issues that were not self-assigned, signals that an issue was assigned to someone. label Apr 3, 2023
@cderv
Copy link
Collaborator

cderv commented Apr 3, 2023

Glad it works for you that way !

I can imagine that the "partialization" of pandoc's LaTeX template can be challenging. I believe this bibliography issue is an edge case, so I'm pretty fine with this solution.

@dragonstyle I let you decide if this is worth adding a new partial at this place in the template. Probably not for next release 1.4 as I don't think we'll work on template tweaking for next release.

@dragonstyle
Copy link
Collaborator

I think anothe approach for us to consider would be to directly enable setting bib latex language mappings (pandoc/quarto already has a number of biblatex specific options, so perhaps we should just also support something like that here). I'll leave this target for 1.4 for the time being so we can consider it.

@dragonstyle dragonstyle added enhancement New feature or request and removed bug Something isn't working labels Apr 3, 2023
@cderv cderv removed the triaged-to Issues that were not self-assigned, signals that an issue was assigned to someone. label Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request latex LaTeX engines related libraries and technologies
Projects
None yet
Development

No branches or pull requests

4 participants