summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2023-06-28 15:18:23 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2023-06-28 15:18:23 -0700
commit1bc84bf100c288dd29040138619f6313cbcbef92 (patch)
treec6104b90c8a0084bc655d743480446e6d31f67a6 /src
parent1d9112f602fd4837b14731aff20df903d37ad754 (diff)
LaTeX writer: Prevent babel language from being imported twice.
Close #8925.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index ad5108f1d..a09e366a7 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -151,6 +151,7 @@ pandocToLaTeX options (Pandoc meta blocks) = do
Nothing | null docLangs -> Nothing
| otherwise -> Just "en"
-- we need a default here since lang is used in template conditionals
+ let otherLangs = [l | l <- docLangs, mblang /= Just l]
let dirs = query (extract "dir") blocks
@@ -225,7 +226,7 @@ pandocToLaTeX options (Pandoc meta blocks) = do
$ maybe id (\l -> defField "babel-lang"
(literal l)) (mblang >>= toBabel)
$ defField "babel-otherlangs"
- (map literal $ mapMaybe toBabel docLangs)
+ (map literal $ mapMaybe toBabel otherLangs)
$ defField "latex-dir-rtl"
((render Nothing <$> getField "dir" context) ==
Just ("rtl" :: Text)) context