From 211fe266e064ef894153a3d711cea427595ab966 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 11 Aug 2014 12:20:24 -0700 Subject: LaTeX writer: Don't produce `\label{}` for Div or Span. Just `\hyperdef`. A slight amendment to #1519. --- src/Text/Pandoc/Writers/LaTeX.hs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 65ceb85a0..3ed20ae87 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -308,12 +308,11 @@ blockToLaTeX (Div (identifier,classes,_) bs) = do ref <- toLabel identifier let linkAnchor = if null identifier then empty - else "\\hyperdef{}" <> braces (text ref) <> - braces ("\\label" <> braces (text ref)) + else "\\hyperdef{}" <> braces (text ref) contents <- blockListToLaTeX bs if beamer && "notes" `elem` classes -- speaker notes then return $ "\\note" <> braces contents - else return (linkAnchor <> contents) + else return (linkAnchor $$ contents) blockToLaTeX (Plain lst) = inlineListToLaTeX $ dropWhile isLineBreakOrSpace lst -- title beginning with fig: indicates that the image is a figure @@ -670,11 +669,11 @@ inlineToLaTeX (Span (id',classes,_) ils) = do let noEmph = "csl-no-emph" `elem` classes let noStrong = "csl-no-strong" `elem` classes let noSmallCaps = "csl-no-smallcaps" `elem` classes - label' <- if null id' - then return empty - else toLabel id' >>= \x -> - return (text "\\label" <> braces (text x)) - fmap (label' <>) + ref <- toLabel id' + let linkAnchor = if null id' + then empty + else "\\hyperdef{}" <> braces (text ref) + fmap (linkAnchor <>) ((if noEmph then inCmd "textup" else id) . (if noStrong then inCmd "textnormal" else id) . (if noSmallCaps then inCmd "textnormal" else id) . -- cgit v1.2.3