5

A friend of mine is required by his faculty to format his lists of figures (= "Abbildungsverzeichnis") and tables (= "Tabellenverzeichnis") as shown in the picture below. Is there a way to realize this by redefining the respective commands in LaTeX? Besides the caption (~ "Kurzüberschrift") the source (= "Quelle") needs to be included in the lists as well. Abbildungsverzeichnis = list of figures, Tabellenverzeichnis = list of tables

I've prepared this MWE as a start – it's far away from the desired result though.

\documentclass{scrartcl}

\usepackage{mwe}

\begin{document}

\begin{figure}
\centering
\includegraphics{example-image}
\caption{An awesome image. Source: Thatoneguy, W. (2003)}  
\end{figure}

\begin{table}[ht]
\centering
\begin{tabular}{|c|c|}
\hline
Foo & Bar\\ \hline
Meh & More meh \\ \hline
\end{tabular}
\caption{An awesome table. Source: Someone, A. (2012)}
\end{table}

\listoffigures 

\listoftables

\end{document}
6

Update: The version with hyperref is at the bottom of this post.

The question is some months old but here is a tabular approach by adding code to the \caption command and using separate files \jobname.tof and \jobname.tot and \tableoffigures and \tableoftables instead of \listoffigures and \listoftables, i.e. I kept the standard \listof... commands untouched.

The usual \caption command has been extended by a 4th optional argument holding the source of the figure or table and defaults to Eigene Darstellung (→ own work)

The \@starttof (start table of ...) command uses a longtable wrapper for the table to be displayed and provides for page breaks. The format of the table might have to be changed to the real specifications.

The crucial entries are given by \writetoffile and \writetotfile (with some more efforts, the might be just one command`)

A similar question (with other setup) can be found here: I need to display \listoffigures as a table

\documentclass{article}

\usepackage[lmargin=1.5cm,rmargin=1.5cm]{geometry}

\usepackage{biblatex}
\usepackage{longtable}
\usepackage{etoolbox}
\usepackage{letltxmacro}
\usepackage{xparse}

\addbibresource{biblio.bib}

\newcounter{fullfigurecounter}
\newcounter{fulltablecounter}

\makeatletter


\def\@starttof#1#2{%
  \begingroup
  \makeatletter
  \renewcommand{\arraystretch}{1.5}
  % Table format may be changed%%%
  \begin{longtable}{|p{2cm}|p{6cm}|p{7cm}|}
    \hline
    \multicolumn{3}{c}{}\tabularnewline
    \multicolumn{3}{c}{\Large \bfseries #2}\tabularnewline
    \multicolumn{3}{c}{}\tabularnewline
    \hline
    \multicolumn{3}{c}{}\tabularnewline[0.5ex]
    \hline
    \large Nummer  & \large Kurz\"uberschrift & \large Quelle \tabularnewline
    \hline
    \endhead % Repeating head
    \@input{\jobname.#1}%  Input the ToF or ToT file 
    \tabularnewline
  \hline
  \end{longtable}
  \setcounter{table}{0}%
  \if@filesw
  \expandafter\newwrite\csname tf@#1\endcsname
  \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
  \fi
  \endgroup
}



\newcommand{\tableoffigures}{%
  \cleardoublepage
  \@starttof{tof}{Abbildungs- und Quellenverzeichnis}
}%


\newcommand{\tableoftables}{%
  \clearpage
  \@starttof{tot}{Tabellenverzeichnis}%
}%


\def\temp@@a{figure}%
\def\temp@@b{table}%

\LetLtxMacro\captionpkg@caption\caption

\newcommand{\writetofline}[3]{%
  \ifnum\value{fullfigurecounter} > 1
  \tabularnewline
  \protect\hline
  \fi
  \figurename\ #1 & #2 & #3 
}

\newcommand{\writetotline}[3]{%
  \ifnum\value{fulltablecounter} > 1
  \tabularnewline
  \protect\hline
  \fi
  \tablename\ #1 & #2 & #3 
}


\RenewDocumentCommand{\caption}{somO{Eigene Darstellung}}{%
  \IfBooleanTF{#1}{%
    \captionpkg@caption{#3}%
  }{%
    \ifx\@currenvir\temp@@a
    \stepcounter{fullfigurecounter}%
    \else
    \ifx\@currenvir\temp@@b
    \stepcounter{fulltablecounter}%
    \fi
    \fi
    \IfValueTF{#2}{%
      \captionpkg@caption[#2]{#3}%
      \ifx\@currenvir\temp@@a
      \addtocontents{tof}{\writetofline{\thefigure}{#2}{#4}}%
      \else
      \ifx\@currenvir\temp@@b
      \addtocontents{tot}{\writetotline{\thetable}{#2}{#4}}%
      \fi
      \fi
    }{%
      \captionpkg@caption{#3}%
      \ifx\@currenvir\temp@@a
      \addtocontents{tof}{\writetofline{\thefigure}{#3}{#4}}%
      \else%
      \ifx\@currenvir\temp@@b
      \addtocontents{tot}{\writetotline{\thetable}{#3}{#4}}%
      \fi
      \fi
    }%
  }%
}




\makeatother

\usepackage{pgffor}
\begin{document}

\tableoffigures
\clearpage
\tableoftables
\clearpage

\foreach \x in {1,...,20} {%
  \begin{figure}
    \caption{Irgendein Bild}
  \end{figure}
  \begin{figure}
  \caption[Die Sonnenblumen]{Irgendein Bild}[Vincent van Gogh]
  \end{figure}
}
\clearpage

\foreach \x in {1,...,6} {%
  \begin{table}
    \caption[A nice table]{A nice table}[Me!]
  \end{table}
}

\clearpage

\foreach \x in {1,...,20} {%
  \begin{figure}
  \caption[Impressionen]{Impressions du Soleil}[Monet]
  \end{figure}
}


\printbibliography
\end{document}

The biblio.bib file is included in every TeX distribution.

enter image description here

Update (Due to request for 4th column holding the page number)

Additionally, hyperref is supported now as well

\documentclass{article}

\usepackage[lmargin=1.5cm,rmargin=1.5cm]{geometry}

\usepackage{biblatex}
\usepackage{array}
\usepackage{longtable}
\usepackage{caption}
\usepackage{letltxmacro}
\usepackage{xparse}

\newif\ifhyperrefloaded

\addbibresource{biblio.bib}

\newcounter{fullfigurecounter}
\newcounter{fulltablecounter}

\usepackage[hypertexnames=true]{hyperref}

\makeatletter

\@ifpackageloaded{hyperref}{\hyperrefloadedtrue}{\hyperrefloadedfalse}

\newcommand{\PhantomSection}{%
  \ifhyperrefloaded
  \phantomsection%
  \fi
}


\def\@starttof#1#2{%
  \begingroup
  \makeatletter
  \renewcommand{\arraystretch}{1.5}
  % Table format may be changed%%%
  \renewcommand{\theHtable}{longtable.\theLT@tables}% Use a different Hyperref name for table due the \refstepcounter{table}- issue with longtable
  \begin{longtable}{|p{2cm}|p{6cm}|p{5.5cm}|>{\raggedleft}p{1cm}|}
    \hline
    \multicolumn{4}{c}{}\tabularnewline
    \multicolumn{4}{c}{\Large \bfseries #2}\tabularnewline
    \multicolumn{4}{c}{}\tabularnewline
    \hline
    \multicolumn{4}{c}{}\tabularnewline[0.5ex]
    \hline
    \large Nummer  & \large Kurz\"uberschrift & \large Quelle & Seite \tabularnewline
    \hline
    \endhead % Repeating head
    \@input{\jobname.#1}%  Input the ToF or ToT file 
    \tabularnewline
  \hline
  \end{longtable}
  \setcounter{table}{0}%
  \if@filesw
  \expandafter\newwrite\csname tf@#1\endcsname
  \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
  \fi
  \endgroup
}


\newcommand{\tofiguresname}{Abbildungs- und Quellenverzeichnis}
\newcommand{\totablesname}{Tabellenverzeichnis}


\newcommand{\tableoffigures}{%
  \cleardoublepage
  \PhantomSection%
  \addcontentsline{toc}{section}{\tofiguresname}%
  \@starttof{tof}{\tofiguresname}
}%


\newcommand{\tableoftables}{%
  \clearpage
  \PhantomSection%
  \addcontentsline{toc}{section}{\totablesname}%
  \@starttof{tot}{\totablesname}%
}%


\def\temp@@a{figure}%
\def\temp@@b{table}%

\LetLtxMacro\captionpkg@caption\caption

\newcommand{\writetofline}[4]{%
  \ifnum\value{fullfigurecounter} > 1
  \tabularnewline
  \protect\hline
  \fi
  \figurename\ #1 & #2 & #3 &
  \ifhyperrefloaded 
  \protect\hyperlink{figure.\thefigure}{#4}%
  \else
  #4%
  \fi
}

\newcommand{\writetotline}[4]{%
  \ifnum\value{fulltablecounter} > 1
  \tabularnewline
  \protect\hline
  \fi
  \tablename\ #1 & #2 & #3 & 
  \ifhyperrefloaded 
  \protect\hyperlink{table.\thetable}{#4}%
  \else
  #4%
  \fi
}


\RenewDocumentCommand{\caption}{somO{Eigene Darstellung}}{%
  \IfBooleanTF{#1}{%
    \captionpkg@caption{#3}%
  }{%
    \ifx\@currenvir\temp@@a
    \stepcounter{fullfigurecounter}%
    \else
    \ifx\@currenvir\temp@@b
    \stepcounter{fulltablecounter}%
    \fi
    \fi
    \IfValueTF{#2}{%
      \captionpkg@caption[#2]{#3}%
      \ifx\@currenvir\temp@@a
      \addtocontents{tof}{\writetofline{\thefigure}{#2}{#4}{\thepage}}%
      \else
      \ifx\@currenvir\temp@@b
      \addtocontents{tot}{\writetotline{\thetable}{#2}{#4}{\thepage}}%
      \fi
      \fi
    }{%
      \captionpkg@caption{#3}%
      \ifx\@currenvir\temp@@a
      \addtocontents{tof}{\writetofline{\thefigure}{#3}{#4}{\thepage}}
      \else%
      \ifx\@currenvir\temp@@b
      \addtocontents{tot}{\writetotline{\thetable}{#3}{#4}{\thepage}}%
      \fi
      \fi
    }%
  }%
}




\makeatother

\usepackage{pgffor}
\begin{document}
\tableofcontents
\clearpage

\tableoffigures
\clearpage
\tableoftables
\clearpage

\section{A section}


\foreach \x in {1,...,20} {%
  \begin{figure}
    \caption{Irgendein Bild}[\cite{Lam94}]
  \end{figure}
  \begin{figure}
    \caption[Die Sonnenblumen]{Irgendein Bild}[Vincent van Gogh]
  \end{figure}
}
\clearpage

\foreach \x in {1,...,6} {%
  \begin{table}
    \caption[A nice table]{A nice table}[Me!]
  \end{table}
}

\clearpage

\foreach \x in {1,...,20} {%
  \begin{figure}
  \caption[Impressionen]{Impressions du Soleil}[Monet]
  \end{figure}
}


\printbibliography
\end{document}
| improve this answer | |
  • Thank you Christian, this is a really good solution :) I'm sorry that I didn't include it in the initial question but is there a way to include a column for the page number as well? – JKR Jan 4 '16 at 13:13
  • 1
    @JKR: I've updated the example with pagenumber column and (optionally, hyperref support) – user31729 Jan 5 '16 at 15:57
  • As soon as possible, I'll try to improve the hyperref version – user31729 Jun 25 '17 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.