Skip to content

Commit 915e367

Browse files
authored
LaTeX writer: protect \phantomsection (#10688)
`\phantomsection` is used for anchors. When these occur inside a caption, a LaTeX error is raised unless the `\phantomsection` is protected using `\protect`. So we now `\protect` every `\phantomsection` (even outside of captions -- this seems to be harmless).
1 parent 3f1f58e commit 915e367

File tree

1 file changed

+1
-1
lines changed
  • src/Text/Pandoc/Writers/LaTeX

1 file changed

+1
-1
lines changed

src/Text/Pandoc/Writers/LaTeX/Util.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ hypertarget ident = do
267267
return $ text "\\protect\\hypertarget" <> braces ref <> "{}"
268268
else do
269269
label <- labelFor ident
270-
return $ text "\\phantomsection" <> label
270+
return $ text "\\protect\\phantomsection" <> label
271271

272272
labelFor :: PandocMonad m => Text -> LW m (Doc Text)
273273
labelFor "" = return empty

0 commit comments

Comments
 (0)