-
Notifications
You must be signed in to change notification settings - Fork 77
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
Short captions for use in list-of? #162
Comments
To be honest, I have my doubts about the usefulness of such a feature. Frankly, the only reason pandoc-crossref even has For books etc, that need indices, the only output format that could possibly offer something meaningful is LaTeX-powered PDF. In all other output formats, there's no information about pagination, and so a proper index is just impossible. |
I take your point. Here's why I raised it, for what it's worth: dissertations. I've been encouraging my students to use pandoc for their dissertations, and the university requires Maybe this is a moment where I commit to learning enough Haskell to try to help. |
BTW: docx also supports short captions in listofsomething. |
@tolot27, FWIW, pandoc doesn't really support docx all that well, so @gtuckerkellogg, contributions are always welcome. But this is going to be rather tricky even for figures (best option being making relevant changes to Pandoc's LaTeX writer, otherwise would have to reimplement significant portions of that in pandoc-crossref). And for other objects, like tables and listings this is going to be... let's just say I get a bit of a headache while thinking about it. |
@lierdakil, would this be a possible summer of Haskell project to add to the current thread at pandoc-discuss? |
For figures, no, not really -- that's relatively trivial, frankly, since images already can have arbitrary attributes and all that needs to be done is choosing a name for "short caption" attribute and modifying the relevant writers (LaTeX comes to mind, not sure about docx/odt) to respect that. Now that I think about it, I believe code blocks (aka listings) in Pandoc Markdown also can have arbitrary attributes, so those should also be relatively straightforward (although maybe less so, because listings are decidedly less standard than figures) I should mention though that when I say "arbitrary attributes" what I actually mean is "arbitrarily named string-valued attributes". The problem is with "string-valued" -- that means no formatting, which includes no math. Your call if that sounds acceptable or not. I suspect proposal to extend AST just for "short captions" won't go too well, and that's the only way to have formatting in those too. For tables, that's primarily tricky because Pandoc's AST doesn't support arbitrary attributes on those at the moment (or any attributes for that matter), and there's been a lot of back and forth about whether it should. This one, maybe together with the other two, sounds like something resembling SoC project, but there's been a lot of back and forth on the subject, so I have my doubts. In any case, it's not my decision, maybe try asking on pandoc-discuss or on https://github.com/jgm/pandoc if that's something they would be interested in. There's also a matter of syntax for specifying table attributes (there isn't any widely adopted one atm), and while I think that's all the objects in Pandoc's AST that can even have captions, actually. So if you were thinking about lists of something else, that's going to be another thing that would have to be implemented. Sorry if my grammar is particularly bad, it's mostly due to lack of sleep. |
Here's a lua filter that seems to work except for the crossref. Not sure how to get the
|
Well, that's nice and all, but that has exactly the problem I was talking about here:
You're basically reimplementing parts of Pandoc's LaTeX writer here (somewhat poorly, as you admit yourself). It works as a band-aid, but it's not a good long-term solution, not by a long shot. So I would prefer avoiding doing something like that in pandoc-crossref if at all possible -- I do have to consider maintenance cost, and it goes right up the more such hacks are used. Whether or not this filter works with pandoc-crossref depends entirely on order of invocation. If it runs before pandoc-crossref, latter won't be able to guess that the jumble of Some general tips if you want to pursue this filter angle further:
|
In ODT output, if a figure/table caption contains a hard line-break (using |
This lua-filter is working well for me together with pandoc-crossref. It allows you to set a short caption inside the ![Caption](file.ext){#fig:label short-caption='my short caption'} then compile with |
I don't see any way to get a short caption into the list of figures or tables when the caption at the place might be very long. I was thinking of something like this for cross-references items with captions.
Not all writers could support it, of course, but those that could should. A question about this type of feature has popped up on pandoc-discuss from time to time.
The text was updated successfully, but these errors were encountered: