From 4a9aaf6fd6be3c0c6df21c93ac1275acd199ab64 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 27 May 2015 12:15:21 -0700 Subject: LaTeX/beamer: added `setotherlanguages` in polyglossia. This uses an `otherlang` variable that takes a list of languages. As requseted in #2174. --- src/Text/Pandoc/Writers/LaTeX.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 20ee4e4d8..35cd4ebae 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -137,6 +137,11 @@ pandocToLaTeX options (Pandoc meta blocks) = do st <- get titleMeta <- stringToLaTeX TextString $ stringify $ docTitle meta authorsMeta <- mapM (stringToLaTeX TextString . stringify) $ docAuthors meta + let (mainlang, otherlang) = + case (reverse . splitBy (==',') . filter (/=' ')) `fmap` + getField "lang" metadata of + Just (m:os) -> (m, reverse os) + _ -> ("", []) let context = defField "toc" (writerTableOfContents options) $ defField "toc-depth" (show (writerTOCDepth options - if stBook st @@ -161,9 +166,8 @@ pandocToLaTeX options (Pandoc meta blocks) = do defField "euro" (stUsesEuro st) $ defField "listings" (writerListings options || stLHS st) $ defField "beamer" (writerBeamer options) $ - defField "mainlang" - (maybe "" (reverse . takeWhile (/=',') . reverse) - (getField "lang" metadata)) $ + defField "mainlang" mainlang $ + defField "otherlang" otherlang $ (if stHighlighting st then defField "highlighting-macros" (styleToLaTeX $ writerHighlightStyle options ) -- cgit v1.2.3