Skip to content

Commit

Permalink
LaTeX writer: Prevent babel language from being imported twice.
Browse files Browse the repository at this point in the history
Close #8925.
  • Loading branch information
jgm committed Jun 28, 2023
1 parent 1d9112f commit 1bc84bf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Text/Pandoc/Writers/LaTeX.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1bc84bf

Please sign in to comment.