lierdakil / pandoc-crossref

Pandoc filter for cross-references
https://lierdakil.github.io/pandoc-crossref/
GNU General Public License v2.0
936 stars 74 forks source link

Including the word "figure" or "table" in the lists of figures/tables #364

Closed mhoban closed 1 year ago

mhoban commented 1 year ago

This filter has been a godsend, but I have one question about the lists of figures, tables, etc. The generated lists just include the numbers, so it it looks like:

List of Figures

1 A figure

1.1 First figure

1.2 Second figure ...

Is it possible to have the lists include the name of the thing (i.e., "Figure" or "Table")? To look like this:

List of Figures

Figure 1 A figure

Figure 1.1 First figure

FIgure 1.2 Second figure ...

mhoban commented 1 year ago

I should say that this stuff is ultimately ending up in docx format, so this question may be specific to the docx writer, over which I know there isn't a ton of control.

lierdakil commented 1 year ago

It's not currently possible. There isn't a reason why this wouldn't be possible in principle, although it wouldn't be a list in docx due to pandoc limitations, just plaintext. I'll see what I can do.

lierdakil commented 1 year ago

Eventually (hopefully) this run will finish (likely in about 1.5 - 2 hours) and it will produce some binaries which have some new metadata variables. Particularly, try setting lofItemTitle: "Figure " and see if it works for you. Docs I'll add later, really can't spend any more time on this today.

mhoban commented 1 year ago

Thanks, this is great!

lierdakil commented 1 year ago

This is done through the same templating approach that's used in other places in pandoc-crossref. See https://github.com/lierdakil/pandoc-crossref/blob/master/test/m2m/listOfTemplates/input.md?plain=1 for an example. Dump default values via pandoc -t markdown -F pandoc-crossref -s <<< "". I'll try to write the docs and make a release proper this weekend (hopefully).

lierdakil commented 1 year ago

v0.3.14.0 which include this is released.