apaquarto icon indicating copy to clipboard operation
apaquarto copied to clipboard

Error when rendering to apaquarto-typst

Open cbrnr opened this issue 10 months ago • 6 comments

I get an error when rendering to apaquarto-typst, for example with the following document:

---
title: "My Paper's Title: A Full Analysis of Everything"
shorttitle: "My Paper's Title"
author:
  - name: W. Joel Schneider
    corresponding: true
    orcid: 0000-0002-8393-5316
    email: [email protected]
    affiliations:
      - name: Temple University
        department: College of Education and Human Development
        address: 1301 Cecil B. Moore Ave.
        city: Philadelphia
        region: PA
        postal-code: 19122-6091
abstract: "This is my abstract."
keywords: [keyword1, keyword2]
format:
  apaquarto-typst: default
---

This will result in the following error:

[typst]: Compiling mwe.typ to mwe.pdf...error: file not found (searched at /Users/clemens/Projects/adds/article/\_extensions/wjschne/apaquarto/apa.csl)
    ┌─ article/mwe.typ:432:25
    │
432 │ #set bibliography(style: "\_extensions/wjschne/apaquarto/apa.csl") 
    │                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I'm using Quarto 1.6.42 and apaquarto 4.3.10 on macOS.

cbrnr avatar Mar 06 '25 10:03 cbrnr

I cannot duplicate this error. It is strange that the apa.csl file is reported as missing because it is used by the .docx and .html formats, which seem to run well for you. I would try re-installing the template. If that does not work, then I am happy to meet over Zoom and try to identify the problem.

wjschne avatar Mar 06 '25 22:03 wjschne

I am having the same issue--upgraded to new version of Quarto which might have something to do with it.

jgeller112 avatar Mar 07 '25 04:03 jgeller112

Yes, this seems to be related to the Quarto version used. I bisected the issue down to v1.6.1, which breaks apaquarto-typst (v1.6.0 and earlier work just fine).

cbrnr avatar Mar 07 '25 07:03 cbrnr

I have the same (Mac OS, latest quarto, latest apaquarto) , but it is easily fixed when the extra \ is removed from the last line ( #set bibliography(style: "\_extensions/wjschne/apaquarto/apa.csl") and compilation is done separately (quarto typst compile example.typ). I suspect it is being added when the local folder is being created and the script thinks the _ requires an escape character (\).

tuomaseerola avatar Mar 07 '25 14:03 tuomaseerola

The Quarto team members are aware of the issue and are deciding what to do about it. This problem slipped past me because it does not occur on Windows for reasons unknown to me.

wjschne avatar Mar 07 '25 17:03 wjschne

A workaround for now to mitigate this problem is to have the apa.csl be considered as a format-resources: https://quarto.org/docs/journals/formats.html#format-resources

This is a configuration to make some resources available locally to project some resources that could be needed in the same location as the document. This is the case here until we manage to make a path in _extensions/ work for resources. This was added as a configuration for LaTeX rendering, where the .cls file or .bib needs to be relative to the .tex file.

Not ideal, but should unblock. Did you try that already?

There may be a Lua workaround too but less straightforward.

Hope this can help.

cderv avatar Apr 16 '25 13:04 cderv