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

figure references in brackets #210

Closed
tolot27 opened this issue Nov 25, 2018 · 3 comments
Closed

figure references in brackets #210

tolot27 opened this issue Nov 25, 2018 · 3 comments

Comments

@tolot27
Copy link

tolot27 commented Nov 25, 2018

If I put a figure reference in rounded brackets, it gets not renderend. I have to escape the opening bracket.

I know I can change the general templates but for particular exceptions it should work the other way. Here is an example:

---
hyperrefoptions: pagebackref=true,linktoc=all
colorlinks: true
linkReferences: True
nameInLink: True
cref: True
...

# Figures

![Figure caption](image.png){#fig:figureRef}

A figure reference to a "normal" figure with `@fig:figureRef` results in (@fig:figureRef).

# Subfigures

<div id="fig:figureRef">
![subfigure 1 caption](image1.png){#fig:figureRefA}

![subfigure 2 caption](image2.png){#fig:figureRefB}

Caption of figure
</div>

References to subfigures will be rendered as figureNumber (subfigureNumber), e.g., in this particular example, `[@fig:figureRefA]` will produce [@fig:figureRefA] but `(@fig:figureRefA)` will produce (@fig:figureRefA). A workaround is to escape the open bracket `\([@fig:figureRefA])`, which results in the correct \([@fig:figureRefA]).

## Pandoc figure referencing

![Alt text of pandoc figure](image){#image}

And its reference using pandoc syntax `([image](#image))`: ([image](#image)).
@lierdakil
Copy link
Owner

Escaping the opening parenthesis does nothing, the primary difference is coming from the fact that you've put @fig:... part inside brackets there.

This issue is frankly in the wrong place. Pandoc-crossref (ab)uses citation syntax for references, and in this particular case, pandoc fails to parse (@fig:...) as a citation. My working theory is that it happens because of the intersection with example list syntax, but that's mostly a guess.

Workaround: use a slightly more awkward syntax of ([@fig:...]). You could also complain on the pandoc repo if you want.

@lierdakil
Copy link
Owner

Nevermind, it's actually a pretty annoying bug, so I'll create the upstream issue myself.

@lierdakil
Copy link
Owner

Fixed upstream

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

No branches or pull requests

2 participants