lierdakil/pandoc-crossref

Extra dot at the end of the figure caption

Opened this issue · 6 comments

I generate a doc file via pandoc and use the crossref filter to link to pictures. For a regular drawing I get a signature without a dot.


---
figureTitle: Figure
tableTitle: Table
tableEqns: true
titleDelim: " –"
link-citations: true
linkReferences: true
chapters: true
quot-lang: ru-RU

...

Example 1:
My drawing[-@fig:pic1].

![Caption for my picture](../.pandoc-plantuml-filter-temp/1.png){#fig:pic1}

But sometimes I link to images that I get through UML transformation.
Example 2:


The diagram is shown in figure [-@fig:figure1].

```plantuml
@startuml
[producer] -> [consumer]: data
@enduml ```
<div id="fig:figure1">
Complex diagram!
</div>

The signature is inserted, but at the end I get a dot. Why is there such a problem with div signatures? I don't need a dot. How can I remove it?
точка в конце подписи к рисунку

More
If you sign a simple picture using a div, will it also have a dot and the letter “a” has also come out from somewhere?

<div id="fig:pic1">
![](../.pandoc-plantuml-filter-temp/1.png)

Complex diagram!
</div>
точка в конце подписи к рисунку2

So the problem is precisely in the div

I found my answer here /issues/225 although I don’t have subfigures, div are used for them, so I didn’t immediately pay attention to this.

There's no div syntax for figures, because figures have both a caption and identifier already. This is essentially to avoid dumb situations like this:

:::{#fig:foo}
![Caption 1](img.png){#fig:bar}

Caption2
:::

What's this? A figure with caption "Caption2" and identifier #fig:foo or figure with caption "Caption1" and identifier #fig:bar? Some mix of the two?

Divs with figures are interpreted as a subfigure environment. You can set some options to make it look less like a subfigure, but you'll likely have issues converting to LaTeX.

IDK what you're using to generate images from plantuml fenced code blocks, but whatever it is, there might be a way to set id/caption on the figure it generates, which is the expected approach to do that sort of thing.

If you're using https://github.com/timofurrer/pandoc-plantuml-filter, then something like this should work:

```{#fig:figure1 .plantuml caption="Complex diagram!"}
@startuml
[producer] -> [consumer]: data
@enduml
```

Если вы используете https://github.com/timofurrer/pandoc-plantuml-filter , то должно работать что-то вроде этого:

```{#fig:figure1 .plantuml caption="Complex diagram!"}
@startuml
[producer] -> [consumer]: data
@enduml

I use filter https://github.com/mikewootc/pandoc-plantuml-filter-ng.
In your version I get Undefined cross-reference: fig:figure1
I don't know why your syntax doesn't work for me, but I just don't get any caption for the picture.
That's why I used subfigure syntax. This is probably not entirely correct, but it works for doc, pdf, html. I don't use LaTeX.

Yeah, pandoc-plantuml-filter-ng always inserts a figure with an empty caption and identifier, as is evident from looking at the code. You can try creating an issue there, it's a relatively easy fix 🤷