diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 24ed4bebc..14c8de08a 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -215,7 +215,15 @@ pandocToLaTeX options (Pandoc meta blocks) = do _ -> []) $ lookupMetaInlines "nocite" meta - let context = defField "toc" (writerTableOfContents options) $ + -- see #7414, avoid escaped underscores + let unescapeUnderscore = T.replace "\\_" "_" + let bibliography' = map unescapeUnderscore <$> + getField "bibliography" metadata + + let context = (case bibliography' of + Nothing -> id + Just xs -> resetField "bibliography" xs) $ + defField "toc" (writerTableOfContents options) $ defField "lof" (writerListOfFigures options) $ defField "lot" (writerListOfTables options) $ defField "toc-depth" (tshow diff --git a/test/djot-reader.native b/test/djot-reader.native index edd1323a5..bd0ae351f 100644 --- a/test/djot-reader.native +++ b/test/djot-reader.native @@ -98,7 +98,7 @@ Pandoc [ Para [ Str "Code in a block quote:" ] , CodeBlock ( "" , [ "" ] , [] ) - "sub status {\nprint \"working\";\n}\n" + "sub status {\n print \"working\";\n}\n" , Para [ Str "A list:" ] , OrderedList ( 1 , Decimal , Period )