Skip to content

Multiple bibliographies #1097

Closed
Closed

Description

@mareikep

I am really excited to get to use typst, it looks great so far!

However, for larger documents it would be really helpful to have multiple bibliographies, e.g. to categorize publications into books, journals, etc. or to separate own prior publications from other peoples' works. This would be something like the bibunit or chapterbib packages in LaTeX. Unfortunately I cannot assign labels, but the [proposed Label] would be feature request

Activity

  1. added
    feature request
    bibliography
    on May 5, 2023
  2. ayoubelmhamdi commented on Jun 10, 2023

    @ayoubelmhamdi

    we need it for PhD too

  3. wlupton commented on Jul 3, 2023

    @wlupton

    I too have discovered that there can be only one #bibliography, but its path argument can be an array, so you can include multiple bibliographies. However, there can't be any duplicate keys (if there are duplicate keys, I think it would probably make sense for later definitions to override earlier ones; then you could list the "most definitive" bibliographies last).

  4. HROMANO commented on Jul 12, 2023

    @HROMANO

    Something like that (in latex) would be nice indeed:

            \printbibliography[heading=subbibliography, title={Articles}, type=article]
            \printbibliography[heading=subbibliography, title={Reports}, nottype=online, nottype=article]
            \printbibliography[heading=subbibliography, title={Internet}, type=online]
    
  5. kescobo commented on Jul 15, 2023

    @kescobo

    One more vote for this! I got 80% of the way through rebuilding my CV in typst, which is a dream compared to LaTeX, but this might kill the effort :-/. I'm looking into manually building building bibliographies from the yaml, but I am not quite confident enough in the syntax to have high hopes there.

    An interim solution (though I'm not sure if it's actually easier to implement) would be to enable the style of a #cite call to be the full reference. In other words, instead of

    == Some header
    
    @label1
    @label2
    
    == Other header
    
    @label3
    
    #bibliography[...]
    

    Giving
    image

    Maybe one could do something like

    == Some header
    
    #cite("label1", "label2", style: "full")
    
    == Other Header
    
    #cite("label3", style: "full")
    

    To get

    Some header

    [1] M. C. Woodruff, K. S. Bonham, et al., “Chronic inflammation, neutrophil activity, and
    autoreactivity splits long Covid,” Nature Commun., vol. 14, no. 1, Jul. 2023, doi: 10.1038/
    s41467-023-40012-7. [Online]. Available: https://doi.org/10.1038/s41467-023-40012-7

    [2] A. A. Schoenborn, S. M. Yannarell, et al., “Microclimate is a strong predictor of the native and
    invasive plant-associated soil microbiome on san cristóbal island, galápagos archipelago,”
    Environmental Microbiology, Mar. 2023, doi: 10.1111/1462-2920.16361. [Online]. Available:
    https://doi.org/10.1111/1462-2920.16361

    Other Header

    [3] L. Tso, K. S. Bonham, A. Fishbein, S. Rowland, and V. Klepac-Ceraj, “Targeted high-resolution
    taxonomic identification of Bifidobacterium longum subsp. infantis using human milk
    oligosaccharide metabolizing genes,” Nutrients, vol. 13, no. 8, p. 2833, Aug. 2021, doi: 10.3390/
    nu13082833. [Online]. Available: https://doi.org/10.3390/nu13082833

  6. kescobo commented on Jul 15, 2023

    @kescobo

    Is there a way to call hayagriva within typst? Something like my workaround is already possible with the hayagriva CLI:

    ❯ hayagriva testcite.yaml reference
    Joe Schmoe, and Jane Doe. 2042. “This Is a Really Fascinating Title.” FEBS Journal. https://doi.org/10.1111/j.1742-4658.2010.07623.x.
    Me Myself, and And Eye. 2001. “Boring Title,” https://doi.org/10.2222/j.x.
    
    ❯ hayagriva testcite.yaml reference --select "!misc"
    Joe Schmoe, and Jane Doe. 2042. “This Is a Really Fascinating Title.” FEBS Journal. https://doi.org/10.1111/j.1742-4658.2010.07623.x.
    
    ❯ hayagriva testcite.yaml reference --select "!misc" --style ieee
    Joe Schmoe, and Jane Doe, “This is a really fascinating title,” FEBS J., 2042, doi: 10.1111/j.1742-4658.2010.07623.x. [Online]. Available: https://doi.org/10.1111/j.1742-4658.2010.07623.x
    
  7. kescobo commented on Jul 16, 2023

    @kescobo

    I just hacked this together using the #yaml function:

    #let refs(contents) = {
        for (tag, fields) in contents {
            let auth_n = fields.author.len()
            let auths = ()
            if auth_n > 4 {
                auths = fields.author.slice(0, count:4)
                [#auths.join(", ") _et. al._]
            } else {
                auths = fields.author
                auths.join(", ", last: " and ")
            }
            
            [, "#fields.title.value"]
            [. #emph(fields.parent.at(0).title)]
            [. (#fields.date)]
            [ doi: #link(fields.url, fields.doi)]
            linebreak()
        }
    }
    
    #refs(
      yaml("citations.yaml")
    )
    

    gives

    image

  8. kescobo commented on Jul 16, 2023

    @kescobo

    OK, last one - this allows you to pass an array of citation keys, and pass a tag to include:

    #let refs(file, entries: (), tag: none) = {
        if entries.len() == 0 {
            entries = yaml(file).keys()
        }
    
        for (entry, fields) in yaml(file) {
            if entry not in entries {
                continue
            }
            if not tag == none {
                if "tags" not in fields or tag not in fields.tags {
                    continue
                }
            }
    
            if "tags" in fields and "cofirst" in fields.tags {
                [\* ]
            }
    
            if "tags" in fields and "corresponding" in fields.tags {
                [#sym.dagger ]
            }
    
            let auth_n = fields.author.len()
            let auths = ()
            if auth_n > 4 {
                auths = fields.author.slice(0, count:4)
                [#auths.join(", ") _et. al._]
            } else {
                auths = fields.author
                auths.join(", ", last: " and ")
            }
            
            [, "#eval("[" + fields.title.value + "]")"]
            [. #emph(fields.parent.at(0).title)]
            [. (#fields.date)]
            [ doi: #link(fields.url, fields.doi)]
            linebreak()
        }
    }
    

    So you can do eg #refs("citations.yaml", tag: "preprint") or #refs("citations.yaml", entries: ("entry1", "entry2")) (or a combination.

    It also has some logic to add a star at the beginning if you have the tag "cofirst", or a dagger if you have the tag "corresponding"

  9. camattelaer commented on Jul 25, 2023

    @camattelaer

    we need it for PhD too

    Just wanted to confirm.

    I am trying to reproduce my PhD thesis LaTex template in typst, but it was a necessity to have bibliographies for each chapter and numbering of references needed to start from 1 again.

    Would be really nice feature to have.

  10. ayoubelmhamdi commented on Jul 27, 2023

    @ayoubelmhamdi

    Multiple bibliographies could meaning:

    • the using of the different files.
    • or by having a bibliography for each chapter with reference numbers that start from 1 in each chapter

    so what's means Multiple bibliographies ?

  11. kescobo commented on Jul 28, 2023

    @kescobo

    @ayoubelmhamdi I think you can already use multiple bibliography files by passing an array to #bibliography.

  12. jadebarclay commented on Aug 6, 2023

    @jadebarclay

    I currently do this using the lua filters for multiple bibliographies in Quarto v1.3.
    I haven't tested them in Typst/Quarto v1.4 yet, but I hope they'll work here, too.

  13. akshaybabloo commented on Dec 4, 2023

    @akshaybabloo

    I wanted to add a page just with personal publications using the full: true and adding a multiple bib files as an array will list out everything that is not part of my publications.

  14. bcdavasconcelos commented on Dec 23, 2023

    @bcdavasconcelos

    Is this being considered by the development team? Multiple bibliographies are a basic feature of any academic work.

  15. 43 remaining items

  16. laurmaedje commented on Oct 14, 2025

    @laurmaedje
    Member

    @thuiop Thanks for wanting to contribute, but please first discuss your approach in an issue or on Discord, as otherwise it's likely a setup for disappointment as it might not match what we had in mind. There is existing discussion in the Bibliography forge on Discord.

  17. thuiop commented on Oct 14, 2025

    @thuiop

    Ah, thanks, I will check it out. I have mostly been prototyping for now, I did not really expect to stumble on the perfect way to do it on the first try anyway.

  18. maxnoe commented on Nov 10, 2025

    @maxnoe

    To give another example usecase, in our technical documentation, we need to differentiate applicable from reference documents.

    This is the biblatex-based solution we use:

    \documentclass{article}
    
    \usepackage{xparse}
    \usepackage[defernumbers]{biblatex}
    \addbibresource{references.bib}
    
    \DeclareBibliographyCategory{applicable}
    \defbibheading{applicable}{\subsection{Applicable Documents}}
    \defbibheading{reference}{\subsection{Reference Documents}}
    \NewDocumentCommand\citeapplicable{O{} m}{%
      \addtocategory{applicable}{#2}\cite[#1]{#2}%
    }
    
    
    \begin{document}
    
    \section{Introduction}
    
    You must follow \citeapplicable{baz}.
    See also \cite{foo}, and \cite{bar}.
    
    \section{Applicable~and~Reference~Documents}
    
    \begin{refcontext}[labelprefix={AD-}, sorting=none]{}
      \raggedright
      \printbibliography[heading=applicable, category=applicable]
    \end{refcontext}
    
    \begin{refcontext}[labelprefix={RD-}, sorting=None]{}
      \raggedright
      \printbibliography[heading=reference, notcategory=applicable]
    \end{refcontext}
    
    \end{document}
    Image
  19. maxnoe commented on Nov 10, 2025

    @maxnoe

    In general, I would highly recommend to split the reading of input bibliographic data from the output of bibliographies.

    This was a mistake in the bibtex approach and is correctly handled by biblatex (addbibresource vs. printbibliography)

  20. andreas-bulling commented on Dec 24, 2025

    @andreas-bulling

    Just to throw another (small) additional idea in here: In addition to having multiple bibliographies, it would also be nice to be able to modify the citation keys. For example, all journal publications could be numbered J01, J02, J03 etc while conference publications could be numbered C01, C02, C03 etc

    Not sure whether this is possible already with Alexandria or Pergamon.

  21. ensko commented on Dec 24, 2025

    @ensko
    SponsorContributor

    There is a related feature request for Alexandria, ensko/typst-alexandria#3, but I haven't worked on it.

  22. alexanderkoller commented on Dec 25, 2025

    @alexanderkoller

    Not sure whether this is possible already with Alexandria or Pergamon.

    Pergamon can currently split the bibliography by entry type, but not generate the bibliography-specific labels you mention. I think it would be relatively easy to implement. Feel free to create a Pergamon issue and let's continue the conversation there.

    Update: This was indeed pretty easy and will be in the next Pergamon release.

  23. johannahaffner commented on Jan 3, 2026

    @johannahaffner

    Just adding my name to the list of people who enthusiastically request this feature! It would also be very useful for the definition of separate bibliographies for main and supplementary in academic papers.

  24. andreas-bulling commented on Jan 4, 2026

    @andreas-bulling

    @johannahaffner Use pergamon and never look back

  25. Gabgobie commented on Jan 4, 2026

    @Gabgobie

    @johannahaffner Use pergamon and never look back

    Thanks for the recommendation. I‘ll have to check it out. I don‘t agree with never looking back though.

    The promise of Typst is in part to be batteries included, which it achieves in large parts. An over reliance on packages providing features the language itself lacks could lead us down the same road as TeX.

    That‘s why I actively avoid using packages for features and only use them for templates. The only reasonable exception to this rule I encountered so far has been graphing for which I use CeTZ or a specialised CeTZ wrapper.

  26. ensko commented on Jan 4, 2026

    @ensko
    SponsorContributor

    I won't respond to the general point since it's a bit off topic for this issue. As far as it applies specifically to multiple bibliographies though, I agree. Bibliographies have a lot of moving parts regarding styles, referencing, etc. so implementing them in "user space" is relatively expensive (and I've run into the 5 layout iteration limitation, too).

    I know that work has been happening on this issue, though; the link to the PR is a few messages up.

  27. andreas-bulling commented on Jan 4, 2026

    @andreas-bulling

    @johannahaffner Use pergamon and never look back

    Thanks for the recommendation. I‘ll have to check it out. I don‘t agree with never looking back though.

    What I wanted to say with this is that this package is not only feature-rich but also very well maintained. It offers everything that that one needs I think - including multiple bibliographies and lots of options for rendering references. I do think it's the best package for this at the moment.

  28. xosxos commented on Feb 20, 2026

    @xosxos

    FYI: I ran into this when exporting to HTML.

    I am building a layout where all the references are simultaneously presented in two places: in the text body and in a toggleable sidebar for quick access.

    Calling bibliography() in the main div and sidebar div results in multiple bibliographies are not yet supported. Bummer.

    In general, I would highly recommend to split the reading of input bibliographic data from the output of bibliographies.

    This was a mistake in the bibtex approach and is correctly handled by biblatex (addbibresource vs. printbibliography)

    I think for my use case, this would suffice. I had a feeling it could already be viable via states, but could not get it to work. Cheers

  29. dibbel26 commented on Jun 29, 2026

    @dibbel26

    amazing work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bibliographyfeature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions