quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.56k stars 293 forks source link

list of tables, list of figures and list of abbreviations in quarto book #2138

Open zawkzaw opened 1 year ago

zawkzaw commented 1 year ago

Bug description

Hello!

I can't find functions for automating list of tables, list of figures and list of abbreviations in quarto book. These functionalities would be very useful for technical and academic reports.

Best

Ko Ko Zaw

Checklist

jpmorr commented 1 year ago

I think these functions already exist, at least in the book format. The table of contents is created by default in the html output (I'm not sure about tables and figures for the html) and to generate them in a pdf, you can just add the following options to the _quarto.yml file for the book.

format:
  html:
    theme: cosmo
  pdf: 
    documentclass: scrbook
    number-sections: true
    lof: true
    lot: true
    toc: true 

List of abbreviations is not available as far as I'm aware.

jav-ed commented 1 year ago

This option is only possible for the pdf version? Is it also possible to have a single html page, where the toc, lot and loc are written with its proper linking?

dragonstyle commented 1 year ago

Yes, these options are currently only supported for PDF output at this time.

jav-ed commented 1 year ago

I tried to implement the toc, lof, and lot myself. However, I am struggling with it. So, I found this method: table_of_contents in https://pandoc.org/lua-filters.html#pandoc-module. Unfortunately, I does not work. Have you planned to offer these capabilities for the HTML output?

tobydriscoll commented 1 year ago

I'm interested in this capability as well for figures, tables, examples, etc.--anything cross-referenced.

I ended up using (see example) the custom listing capability to make it easier and more useful, but it still required plenty of manual work, and it requires quasi-manual maintenance as well.

I'm willing to help, if someone can point me in the right direction. I don't know pandoc or Lua at all, unfortunately.

jav-ed commented 1 year ago

The website which you provided as an example looks really nice. However, using custom listing as described here: https://quarto.org/docs/websites/website-listings-custom.html demands the user to define the table of contents, lof, lot.. manually. This is not what I intended to obtain. The goal was to call a method similar to {{< tof/lof/lot >}} inside a qmd file and then the tof/lof/lot should be generated automatically.

If you want to spend some time in learning about lua filters, have a look at: https://quarto.org/docs/extensions/filters.html and the source code of the available extensions (https://quarto.org/docs/extensions/), like: https://github.com/shafayetShafee/downloadthis

tobydriscoll commented 1 year ago

I've implemented this two ways for book projects. As a filter, it's workable and self-contained, but a little clunky. Using a Python pre-render script, it works nicely on a full render but doesn't get updated in preview mode. I've made that variant available as a template.

cderv commented 5 months ago

For reference, related discussion item at