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

Extra dot at the end of the figure caption #421

Open
aleyner opened this issue Jan 17, 2024 · 6 comments
Open

Extra dot at the end of the figure caption #421

aleyner opened this issue Jan 17, 2024 · 6 comments

Comments

@aleyner
Copy link

aleyner commented Jan 17, 2024

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?
точка в конце подписи к рисунку

@aleyner
Copy link
Author

aleyner commented Jan 17, 2024

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

@aleyner
Copy link
Author

aleyner commented Jan 17, 2024

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.

@lierdakil
Copy link
Owner

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.

@lierdakil
Copy link
Owner

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
```

@aleyner
Copy link
Author

aleyner commented Jan 22, 2024

Если вы используете 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.

@lierdakil
Copy link
Owner

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 🤷

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

No branches or pull requests

2 participants