pandoc-latex-template
pandoc-latex-template copied to clipboard
Counting Images in Books
Hi there,
there is a problem with the counting in the book-variant of eisvogel.
This is my minimal Example:
---
title: Ein Minimalbeispiel
author: MAWSpitau
date: 2020
lang: de-DE
book: true
---
# Kapitel 1
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
![Bild eins in Kapitel eins](https://i.imgur.com/018rQFV.png)
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
# Kapitel 2
sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
![Bild eins in Kaiptel zwei](https://i.imgur.com/YjrBUUk.png)
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
![Bild zwei in Kapitel zwei](https://i.imgur.com/CV3u3ho.png)
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
I would have expected the numbering something like this:
- Abbildung 1.1
- Abbildung 2.1
- Abbildung 2.2
But the result looks like:
- Abbildung 0.1
- Abbildung 0.2
- Abbildung 0.3
That is kind of a weird counting... I my opinion ;)
This is how the PDF is rendered.
pandoc minimalBsp.md --pdf-engine=xelatex --template eisvogel --top-level-division=chapter -o minimalBsp.pdf
Which infos do oyou else need for some troubleshooting?
that's strange. i also use eisvogel.tex
in my bachelor thesis template, where it works just fine. tested the latest version, works still fine in my setup.
i tried your mwe with --pdf-engine=pdflatex
and also with -V documentclass=scrbook
to be sure. also tested with local images, again with the same result: the numbers are off. must be some small detail here, that we've overlooked?
seems to be working, when using scrreport
...
Interestingly LaTeX behaves differently if I compile via pandoc with --number-sections
or without the flag.
Your command
pandoc minimalBsp.md --pdf-engine=xelatex --template eisvogel --number-sections --top-level-division=chapter -o minimalBsp.pdf
produces the desired result with --number-sections
while the numbers before the headings are undesired. I'll have to experiment a bit because this behavior seems strange to me.
At least this is kind of a workaround! Thanks for looking at it!
well, the difference between --number-sections
and your version is just
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
(line 113, compiled with pandoc minimalBsp.md --template eisvogel.tex --top-level-division=chapter -o eisvogel_chapter.tex
)
and
\setcounter{secnumdepth}{3}
(line 113, compiled with pandoc minimalBsp.md --template eisvogel.tex --top-level-division=chapter -o eisvogel_number.tex --number-sections
)
btw, when using the pandoc default latex template, you get the same behaviour.
pandoc minimalBsp.md --top-level-division=chapter -o standard.tex --standalone
yields also
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
and the wrong figure offset is to be observed in the generated pdf. (update: when using document class scrbook
...)
seems to be an upstream bug?
Ah - I see. So it is not a problem with eisvogel at all? It is more an LaTeX issue? Where can we report the bug?
hmmm, using scrbook
as document class:
-
pandoc minimalBsp.md --top-level-division=chapter --pdf-engine=pdflatex -o scrbook_numbered.pdf -V documentclass=scrbook --number-sections
looks good -
pandoc minimalBsp.md --top-level-division=chapter --pdf-engine=pdflatex -o scrbook.pdf -V documentclass=scrbook
figure numbers show wrong offset
however (using default document class):
-
pandoc minimalBsp.md --top-level-division=chapter --pdf-engine=pdflatex -o book_numbered.pdf --number-sections
looks good (ok, same as above, using--number-sections
) -
pandoc minimalBsp.md --top-level-division=chapter --pdf-engine=pdflatex -o book.pdf
figure numbers are as expected
seems, i got it mixed up in my last comment. sry.
so, when using the pandoc default latex template (w/o specifiying a document class), everything is as expected. however, using the default latex template in combination with a book document class like scrbook
, we can observe the reported behaviour.
testing further:
-
pandoc minimalBsp.md --pdf-engine=pdflatex -o standard.pdf
: numbers are ok, but default class seems to be "report" (i.e.book: true
seem to be ignored?) -
pandoc minimalBsp.md --pdf-engine=pdflatex -o standard.pdf -V book=true
dito -
pandoc minimalBsp.md --pdf-engine=pdflatex -o standard.pdf -V documentclass=book
is ok (and proper book) -
pandoc minimalBsp.md --pdf-engine=pdflatex -o standard.pdf -V documentclass=scrbook
is book, but wrong figure offset ... -
pandoc minimalBsp.md --pdf-engine=pdflatex -o standard.pdf --template eisvogel.tex
dito (nice eisvogel book, but wrong figure numbers)
maybe some document classes don't like the generated \setcounter{secnumdepth}{-\maxdimen}
?
to summarize: using book
document class and the default pandoc latex template is working without further options. when using scrbook
document class (and the default pandoc latex template), the option --number-sections
will do the trick. however, when using eisvogel.tex
template you would need --number-sections
and --top-level-division=chapter
...
So it is a koma Problem?
I will fix my scripts producing my pdf with this option. Thanks for figure it out!
well, as long as you can live with numbered sections :)
i'm not sure, if this is just a koma issue. eisvogel seems to be affected as well, so it may be connected to this generated line \setcounter{secnumdepth}{-\maxdimen}
when using unnumbered sections ...
mhm... yeah. :D
It's not like it supposed to be, but it's a workaround, that helps. Thanks for everything.
maybe this is connected to #116?