git.iko.soy/typeable/pandoc
on master help sign in
Merge branch 'AndreasLoow-master'
commit2998618e39009e36911d261491503fb8f178ce07 authorJohn MacFarlane <jgm@berkeley.edu> dateSat 19 Dec 2015, 00:08 (11 years ago) parentce21b2c4c103f6
2 files changed+13−7
README+7−6 src/Text/Pandoc/Writers/LaTeX.hs+6−1
README+7−6
@@ -184,10 +184,10 @@ document contains images), [`hyperref`], [`ulem`],
184184[`mathspec`], [`polyglossia`] (with `lang`), [`xecjk`], and
185185[`bidi`] (with the `dir` variable set). The [`upquote`] and
186186[`microtype`] packages are used if available, and [`csquotes`] will
187−be used for [smart punctuation] if added to the template. The
188−[`natbib`], [`biblatex`], [`bibtex`], and [`biber`] packages can
189−optionally be used for [citation rendering]. These are included with
190−all recent versions of [TeX Live].
187+be used for [smart punctuation] if added to the template or included in
188+any header file. The [`natbib`], [`biblatex`], [`bibtex`], and [`biber`]
189+packages can optionally be used for [citation rendering]. These are
190+included with all recent versions of [TeX Live].
191191
192192Alternatively, pandoc can use ConTeXt to create a PDF.
193193To do this, specify an output file with a `.pdf` extension,
@@ -2473,8 +2473,9 @@ correct output, converting straight quotes to curly quotes, `---` to
24732473em-dashes, `--` to en-dashes, and `...` to ellipses. Nonbreaking spaces
24742474are inserted after certain abbreviations, such as "Mr."
24752475
2476−Note: if your LaTeX template calls for the [`csquotes`] package, pandoc will
2477−detect this automatically and use `\enquote{...}` for quoted text.
2476+Note: if your LaTeX template or any included header file call for the
2477+[`csquotes`] package, pandoc will detect this automatically and use
2478+`\enquote{...}` for quoted text.
24782479
24792480Inline formatting
24802481-----------------
src/Text/Pandoc/Writers/LaTeX.hs+6−1
@@ -130,7 +130,12 @@ pandocToLaTeX options (Pandoc meta blocks) = do
130130 | otherwise -> return ()
131131 -- check for \usepackage...{csquotes}; if present, we'll use
132132 -- \enquote{...} for smart quotes:
133− when ("{csquotes}" `isInfixOf` template) $
133+ let headerIncludesField :: FromJSON a => Maybe a
134+ headerIncludesField = getField "header-includes" metadata
135+ let headerIncludes = fromMaybe [] $ mplus
136+ (fmap return headerIncludesField)
137+ headerIncludesField
138+ when (any (isInfixOf "{csquotes}") (template : headerIncludes)) $
134139 modify $ \s -> s{stCsquotes = True}
135140 let (blocks'', lastHeader) = if writerCiteMethod options == Citeproc then
136141 (blocks', [])