jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.67k stars 3.38k forks source link

list of tables / list of figures #1407

Closed Bengt closed 10 years ago

Bengt commented 10 years ago

Pandoc's latex writer understands --toc / --table-of-contents command line argument, which basically inserts a \tableofcontents control sequence in the written document. From the corresponding template at line 161:

$if(toc)$
{
\hypersetup{linkcolor=black}
\setcounter{tocdepth}{$toc-depth$}
\tableofcontents
}
$endif$

I need to include a list of figures and a list of tables in my document. This feature has been requested without response on the discuss before. I think it would be great if Pandoc would support that in a similar fashion. Command line arguments could be --lof / --list-of-figures respectively --lot / --list-of-tables. For internationalization purposes, variables --variable lot-title / --variable lof-title could be introduced that changes their titles similar to --variable biblio-title:

$if(biblio-title)$
$if(book-class)$
\renewcommand\bibname{$biblio-title$}
$else$
\renewcommand\refname{$biblio-title$}
$endif$

The corresponding latex control sequences are:

\listfigurename
\listoffigures
\listtablename
\listoftables

However, I did not need to set these as they get their titles via --variable lang. Here is a naive proof-of concept for the template side of things.

I have found two orders in guidelines for scientific writing:

and

I think either one would be fine as they both imply that the lot and lof appear in the toc.

Bengt commented 10 years ago

As a workaround, one can put the lists before any other content:

\listoffigures

\listoftables

# Introduction
jgm commented 10 years ago

Pandoc allows you to use custom templates (--template) -- why not just do that? You can make a template that includes lists of figures and tables. Different people may have different ideas about the order in which these should appear, and they can customize differetly.

Bengt commented 10 years ago

Yes, using a custom template works around this. However maintaining a template is laborious and requires familiarity with git and a merge tool. I think more of Pandoc's users would be able to include a lot/lof by prefixing their content, as in the the workaround I posted. Finding this workaround is now possible but requires some google-fu. I think many users would expect Pandoc to expose lot/lof functionality analogous to the toc feature and search for it in the user guide. People who want to reorder the lists could still use a custom template, but I guess few would, because the order does not seem to matter much to me. There are multiple places for the table of contents, too:

"Tables of contents appear in the front or the back of a book. They shall be placed where the reader searches for them; definitely at the very front, immediately after the title, or to the very back, in no case after the preamble or at the back of the book before a series of ads."

--- Source: Quote in the german wikipedia on "Inhaltsverzeichnis" (table of contents), translated by me

Pandoc provides a default place for the table of contents and could do so for list of tables and figures.

danrot commented 10 years ago

Actually I was also looking for a option like this. IMHO it wouldn't be too hard to implement, and creating an own template just for two lists is a tedious task...

mbacou commented 9 years ago

List of tables, list of equations, list of figures, and list of listings are needed in all writers, not just LaTeX. These are important elements in any technical or scientific paper and report, as important as citations and bibliographies. Could you clarify whether this feature might be implemented in all common formats (.html, .odt, .docx, etc.)? Thanks!

mpickering commented 9 years ago

@mbacou I think this makes sense but please can you open a new issue? I think it will require some quite involved refactoring.