Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SOLVED] \hyperlink raise an error inside \caption #2490

Closed
hadim opened this issue Oct 28, 2015 · 4 comments
Closed

[SOLVED] \hyperlink raise an error inside \caption #2490

hadim opened this issue Oct 28, 2015 · 4 comments

Comments

@hadim
Copy link

hadim commented Oct 28, 2015

\hyperlink introduced in d5efa9b does not place nicely with \caption command and raise this kind of error :

! Argument of \caption@ydblarg has an extra }.
<inserted text> 
                \par 

An easy fix is to use is to use \protect wich fix the issue. I tested the following diff and it works for me :

$ git diff
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 9b345fc..7cbfce9 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -881,7 +881,7 @@ inlineToLaTeX Space = return space
 inlineToLaTeX (Link txt ('#':ident, _)) = do
   contents <- inlineListToLaTeX txt
   lab <- toLabel ident
-  return $ text "\\hyperlink" <> braces (text lab) <> braces contents
+  return $ text "\\protect\\hyperlink" <> braces (text lab) <> braces contents
 inlineToLaTeX (Link txt (src, _)) =
   case txt of
         [Str x] | escapeURI x == src ->  -- autolink
@hadim
Copy link
Author

hadim commented Oct 28, 2015

@jgm, since the diff is really small, I don't open a PR and let you do the commit.

@hadim
Copy link
Author

hadim commented Oct 28, 2015

I have a question related to citation. Why does the citation links only applied on the year and note the whole citation ?

@jgm
Copy link
Owner

jgm commented Oct 28, 2015

+++ Hadrien Mary [Oct 28 15 07:24 ]:

I have a question related to citation. Why does the citation links only
applied on the year and note the whole citation ?

Well, you can have citations like [Smith 1980, 2000, 2007]
where each year links to a different bib entry.

@jgm jgm closed this as completed in 1d53d45 Oct 28, 2015
@hadim
Copy link
Author

hadim commented Oct 28, 2015

Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants