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

readerLatex produces error on \caption optional argument #1335

Closed
aspnes opened this issue Jun 13, 2014 · 3 comments · Fixed by #1336
Closed

readerLatex produces error on \caption optional argument #1335

aspnes opened this issue Jun 13, 2014 · 3 comments · Fixed by #1336

Comments

@aspnes
Copy link

aspnes commented Jun 13, 2014

LaTeX allows \caption to have an optional short title, e.g.

\caption[Short caption]{This caption is too long to fit in the list of figures}

The LaTeX reader doesn't like this. The fix is trivial, add skipopts *> to the relevant line in Readers/LaTeX.hs:

diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index c3c0ba4..6b59589 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -305,7 +305,7 @@ blockCommands = M.fromList $
   , ("item", skipopts *> loose_item)
   , ("documentclass", skipopts *> braced *> preamble)
   , ("centerline", (para . trimInlines) <$> (skipopts *> tok))
-  , ("caption", tok >>= setCaption)
+  , ("caption", skipopts *> tok >>= setCaption)
   , ("PandocStartInclude", startInclude)
   , ("PandocEndInclude", endInclude)
   , ("bibliography", mempty <$ (skipopts *> braced >>=
@katrinleinweber
Copy link
Contributor

@aspnes Do I understand correctly, that there is no way to define a short figure caption for the list of figures in Markdown syntax and transfer it into LaTeX? I'm looking for a way to having figure caption and legend in the figure environment together, but displaying only the caption in a list of figures.

@aspnes
Copy link
Author

aspnes commented Jun 6, 2015

From what I remember neither pandoc's Markdown syntax nor its internal data structure supports short captions. So adding these would require bigger changes than I proposed above.

@katrinleinweber
Copy link
Contributor

OK, thanks for confirming. I'll convert the MD figures into LaTeX then. There's a set-up that passes the commands through :-)

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

Successfully merging a pull request may close this issue.

2 participants