diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-12-15 12:16:40 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-12-15 12:21:41 -0800 |
commit | bba76463404fff64f60e097886fa196b973ce539 (patch) | |
tree | 71f453bfa8add0305576349e893c453bba3c8836 /src/Text/Pandoc/Writers | |
parent | 79c3f57c4712ed2a1377a2692c11c80cfbeb6cb9 (diff) | |
download | pandoc-bba76463404fff64f60e097886fa196b973ce539.tar.gz |
LaTeX writer: use \renewcommand for \textlatin with babel.
This avoids a clash with a deprecated \textlatin command defined
in Babel. Closes #4161.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 3b2cd214e..666aea07c 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -276,10 +276,13 @@ pandocToLaTeX options (Pandoc meta blocks) = do "\\AddBabelHook{" ++ poly ++ "}{afterextras}" ++ "{\\renewcommand{\\text" ++ poly ++ "}[2][]{\\foreignlanguage{" ++ poly ++ "}{##2}}}\n" - else "\\newcommand{\\text" ++ poly ++ "}[2][]{\\foreignlanguage{" - ++ babel ++ "}{#2}}\n" ++ - "\\newenvironment{" ++ poly ++ "}[2][]{\\begin{otherlanguage}{" - ++ babel ++ "}}{\\end{otherlanguage}}\n" + else (if poly == "latin" -- see #4161 + then "\\providecommand{\\textlatin}{}\n\\renewcommand" + else "\\newcommand") ++ "{\\text" ++ poly ++ + "}[2][]{\\foreignlanguage{" ++ babel ++ "}{#2}}\n" ++ + "\\newenvironment{" ++ poly ++ + "}[2][]{\\begin{otherlanguage}{" ++ + babel ++ "}}{\\end{otherlanguage}}\n" ) -- eliminate duplicates that have same polyglossia name $ nubBy (\a b -> fst a == fst b) |