-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Can pandoc support figure reference in org-ref style ? #7133
Comments
Sorry, this is currently out of scope for pandoc. The figure support is part of pandoc-crossref, you could raise the issue there. The problem is well suited for a (Lua) filter: a filter which matches on "ref" Str and Link elements, and converts them to Cite elements, would be only a couple of lines. Please reach out if you need help with this approach. |
To be more precise, this isn't really out of scope, but requires other features first. See also this long-standing issue: #813 |
Do you suggest that "ref:XXX" should be converted to "cite:XXX", which is for citation ? :D Could you help provide the Lua filter if possible ? Many thanks ! |
Yes, that's basically it. We need to make sure that For Str, we'd match on the text content: function Str (s)
if s.text:match 'ref:.*' then
return pandoc.Cite({}, {pandoc.Citation(s.text, "NormalCitation")})
end
end Converting links would be similar, but one would match on Does this help? |
Could you explain your idea more ? The filter that you posted converts a reference to a figure to a citation, which citeproc will not be able to recognize. For example, using the MWE files in the first post |
Please try with this improved filter: function Link (link)
if link.target:match 'fig:.*' then
return pandoc.Cite(
link.content,
{pandoc.Citation(link.target, "NormalCitation")}
)
end
end |
Amazing ! The new filter recognizes the function Str (s)
if s.text:match 'ref:(.*)' then
return pandoc.Cite({}, {pandoc.Citation(s.text:match 'ref:(.*)', "NormalCitation")})
end
end |
Currently pandoc has basic support for the cite:citeKey syntax in .org file, which is the org-ref style of citing citations. It is thus possible for one to be able to use org & org-ref to write and use pandoc to export to multiple formats such as .pdf, .docx, and so forth. However, the syntax to refer to a figure is incompatible between pandoc and org-ref. Specifically, pandoc supports the
[@Fig:XXX]
syntax to refer to a figure in .org file, while org-ref uses org-links such asref:XXX
to utilize org-machinery. Could you consider make pandoc support theref:XXX
syntax to refer to a figure in .org file, which is the org-ref style of referring to figures ?mwe_name.org
native output
mwe_label.org
native output
The text was updated successfully, but these errors were encountered: