diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-03-14 00:09:36 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-03-14 00:10:37 -0800 |
commit | 3622097da360ab83112eb26b4f6231488d747a95 (patch) | |
tree | c4fe423c89e6d9118fd03481cbc3c6c25557c525 /src/Text | |
parent | c55a73b642fc24d3557c3683f101d13d89ee3316 (diff) | |
download | pandoc-3622097da360ab83112eb26b4f6231488d747a95.tar.gz |
Handle 'nocite' better with --biblatex and --natbib.
Previously the nocite metadata field was ignored with
these formats. Now it populates a `nocite-ids` template
variable and causes a `\nocite` command to be issued.
Closes #4585.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 180aaa44d..6a205a798 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -1,4 +1,5 @@ {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE LambdaCase #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE ScopedTypeVariables #-} @@ -145,6 +146,11 @@ pandocToLaTeX options (Pandoc meta blocks) = do let dirs = query (extract "dir") blocks + let nociteIds = query (\case + Cite cs _ -> map citationId cs + _ -> []) + $ lookupMetaInlines "nocite" meta + let context = defField "toc" (writerTableOfContents options) $ defField "toc-depth" (tshow (writerTOCDepth options - @@ -177,9 +183,11 @@ pandocToLaTeX options (Pandoc meta blocks) = do else id) $ (case writerCiteMethod options of Natbib -> defField "biblio-title" biblioTitle . - defField "natbib" True + defField "natbib" True . + defField "nocite-ids" nociteIds Biblatex -> defField "biblio-title" biblioTitle . - defField "biblatex" True + defField "biblatex" True . + defField "nocite-ids" nociteIds _ -> id) $ defField "colorlinks" (any hasStringValue ["citecolor", "urlcolor", "linkcolor", "toccolor", |