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

Inconsistent prose citations for authored vs edited works #243

Open
1 task done
LaurenceOMFoisy opened this issue Oct 25, 2024 · 1 comment
Open
1 task done

Inconsistent prose citations for authored vs edited works #243

LaurenceOMFoisy opened this issue Oct 25, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@LaurenceOMFoisy
Copy link

LaurenceOMFoisy commented Oct 25, 2024

Description

Description

When using prose citations (form: "prose"), Typst handles authored and edited works differently. For authored works, it correctly shows "Author (Year)" but for edited works, it only shows "(Year)".

Minimal Working Example

#let pc = (citation) => {
  set cite(form: "prose")
  citation
}

#pc[@downs57] // correctly shows "Downs (1957)"
#pc[@brady_collier10] // incorrectly shows only "(2010)"

#bibliography("references.bib", style: "apa")
@book{downs57,
  title = {An Economic Theory of Democracy},
  author = {Downs, Anthony},
  date = {1957},
  edition = {1},
  publisher = {Harper \& Row},
  location = {New York},
  langid = {english}
}

@book{brady_collier10,
  title = {Rethinking Social Inquiry. Diverse Tools, Shared Standards},
  editor = {Brady, Henry E. and Collier, David},
  date = {2010},
  edition = {2},
  publisher = {Rowman \& Littlefield Publishers},
  location = {Maryland}
}

Expected Behavior
Both citations should show the names followed by the year in parentheses:

#pc[@downs57] → "Downs (1957)"
#pc[@brady_collier10] → "Brady and Collier (2010)"

Actual Behavior

#pc[@downs57] → "Downs (1957)" (correct)
#pc[@brady_collier10] → "(2010)" (incorrect - missing editors' names)

Additional Information

The issue persists regardless of CSL style used
The issue appears to be related to how Typst handles editor vs author fields in prose citations
Using the @ symbol for regular citation works correctly with editors instead of authors.

Reproduction URL

No response

Operating system

Linux

Typst version

  • I am using the latest version of Typst
@LaurenceOMFoisy LaurenceOMFoisy added the bug Something isn't working label Oct 25, 2024
@laurmaedje laurmaedje transferred this issue from typst/typst Oct 26, 2024
@bact
Copy link

bact commented Nov 28, 2024

We may need to modify the do_author closure, starting from these lines:

hayagriva/src/csl/mod.rs

Lines 1249 to 1250 in 21f0185

let do_author = |ctx: &mut Context<'b, T>| {
let author_var = Variable::Name(NameVariable::Author);

to use NameVariable::Editor if NameVariable::Author is not available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants