diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2023-09-18 15:59:26 -0700 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2023-09-18 15:59:26 -0700 |
| commit | e57953b9f04cd05607eb1b75fd9fb194d48feb0a (patch) | |
| tree | bd1a9e1e0f9d4b6651a0adf2a52e71b3750bb747 /src | |
| parent | 0d27947b96f7066edeed8a63c196e045ac8822b5 (diff) | |
Fix uneven indents in LaTeX line block output.
Closes #9088.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 937729c12..1b1966e05 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -744,16 +744,13 @@ inlineListToLaTeX :: PandocMonad m inlineListToLaTeX lst = hcat <$> mapM inlineToLaTeX (fixLineInitialSpaces . fixInitialLineBreaks $ lst) -- nonbreaking spaces (~) in LaTeX don't work after line breaks, - -- so we turn nbsps after hard breaks to \hspace commands. - -- this is mostly used in verse. + -- so we insert a strut: this is mostly used in verse. where fixLineInitialSpaces [] = [] fixLineInitialSpaces (LineBreak : Str s : xs) | Just ('\160', _) <- T.uncons s - = LineBreak : fixNbsps s <> fixLineInitialSpaces xs + = LineBreak : RawInline "latex" "\\strut " : Str s + : fixLineInitialSpaces xs fixLineInitialSpaces (x:xs) = x : fixLineInitialSpaces xs - fixNbsps s = let (ys,zs) = T.span (=='\160') s - in replicate (T.length ys) hspace <> [Str zs] - hspace = RawInline "latex" "\\hspace*{0.333em}" -- We need \hfill\break for a line break at the start -- of a paragraph. See #5591. fixInitialLineBreaks (LineBreak:xs) = |
