git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer: use \renewcommand for \textlatin with babel.

This avoids a clash with a deprecated \textlatin command defined in Babel. Closes #4161.

commitbba76463404fff64f60e097886fa196b973ce539 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 15 Dec 2017, 12:16 (9 years ago) parent79c3f57
1 file changed+7−4
src/Text/Pandoc/Writers/LaTeX.hs+7−4
src/Text/Pandoc/Writers/LaTeX.hs+7−4
@@ -276,10 +276,13 @@ pandocToLaTeX options (Pandoc meta blocks) = do
276276 "\\AddBabelHook{" ++ poly ++ "}{afterextras}" ++
277277 "{\\renewcommand{\\text" ++ poly ++ "}[2][]{\\foreignlanguage{"
278278 ++ poly ++ "}{##2}}}\n"
279− else "\\newcommand{\\text" ++ poly ++ "}[2][]{\\foreignlanguage{"
280− ++ babel ++ "}{#2}}\n" ++
281− "\\newenvironment{" ++ poly ++ "}[2][]{\\begin{otherlanguage}{"
282− ++ babel ++ "}}{\\end{otherlanguage}}\n"
279+ else (if poly == "latin" -- see #4161
280+ then "\\providecommand{\\textlatin}{}\n\\renewcommand"
281+ else "\\newcommand") ++ "{\\text" ++ poly ++
282+ "}[2][]{\\foreignlanguage{" ++ babel ++ "}{#2}}\n" ++
283+ "\\newenvironment{" ++ poly ++
284+ "}[2][]{\\begin{otherlanguage}{" ++
285+ babel ++ "}}{\\end{otherlanguage}}\n"
283286 )
284287 -- eliminate duplicates that have same polyglossia name
285288 $ nubBy (\a b -> fst a == fst b)