aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 789593118..e54829f94 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -490,7 +490,10 @@ blockToLaTeX (BlockQuote lst) = do
blockToLaTeX (CodeBlock (identifier,classes,keyvalAttr) str) = do
opts <- gets stOptions
lab <- labelFor identifier
- linkAnchor <- hypertarget True identifier lab
+ linkAnchor' <- hypertarget True identifier lab
+ let linkAnchor = if isEmpty linkAnchor'
+ then empty
+ else linkAnchor' <> "%"
let lhsCodeBlock = do
modify $ \s -> s{ stLHS = True }
return $ flush (linkAnchor $$ "\\begin{code}" $$ text str $$