3

do you see a chance to design the "List of Figures" pages in a way such that it looks more fancy? I fiddled around for days now but could not find an example or good solution, not even with tocloft, to get what I dream of. I know - in case it is even possible - it would be a lot of effort.

This is ideally what I would like to have (even a step in this direction would be great): Goal

This is where I am stuck:

stete-of-the-art

Related minimal example code:

\documentclass[a4paper,11pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{graphicx}
\usepackage{hyperref}

    % add "Fig." before number in caption
    \usepackage[labelfont=bf]{caption}
    \renewcommand{\figurename}{Fig.}

    % add "Fig." before number in lof
    \usepackage{tocloft}
    \newlength{\mylen}
    \renewcommand*\cftfigpresnum{Fig.~}
    \settowidth{\mylen}{\cftfigpresnum\cftfigaftersnum}
    \addtolength{\cftfignumwidth}{\mylen}

    % command for thumbnails
    \newif\iflofimage
    \DeclareRobustCommand*{\lofimage}[2][]{%
        \iflofimage
        \includegraphics[{height=2.5em,keepaspectratio=true,#1}]{#2}
        \fi
        \ignorespaces }

\begin{document}

% columned lof
\lofimagetrue
\twocolumn
\begingroup
\let\onecolumn\twocolumn
\listoffigures
\endgroup
\onecolumn
\lofimagefalse

% body
Lorem

\begin{figure}[ht]
\label{a}\centering
\includegraphics{figure.jpg}
\caption[\lofimage{figure.jpg}Lorem ipsum dolor]{Lorem ipsum dolor sit amet, consetetur sadipscing.}
\end{figure}

Lorem ipsum dolor sit amet, consetetur sadipscing.\newpage

\begin{figure}[ht]
\label{b}\centering
\includegraphics{figure.jpg}
\caption[\lofimage{figure.jpg}consetetur sadipscing.]{Lorem ipsum dolor sit amet, consetetur sadipscing.}
\end{figure}

Lorem ipsum dolor sit amet, consetetur sadipscing.\newpage

\begin{figure}[ht]
\label{c}\centering
\includegraphics{figure.jpg}
\caption[\lofimage{figure.jpg}sit amet]{Lorem ipsum dolor sit amet, consetetur sadipscing.}
\end{figure}

Lorem
\end{document}
  • Difficult, but should be possible – user31729 Jan 8 '16 at 12:07
2

Only a preliminary version, I've to add the hyperref support etc. and other features. (Basically it's similar to my answer to this question here: Redefining \listoffigures and \listoftables as tables ) The principal idea is to put all the caption images into a tcolorbox raster (a table would do as well, I think) -- please note, that currently the list of tables would get tcolorbox stuff as well! ;-)

\documentclass[a4paper,11pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{graphicx}
\usepackage[most]{tcolorbox}
\usepackage{letltxmacro}
\usepackage{xparse}
\usepackage{hyperref}

    % add "Fig." before number in caption
\usepackage[labelfont=bf]{caption}
\renewcommand{\figurename}{Fig.}

% add "Fig." before number in lof
\usepackage{tocloft}
\newlength{\mylen}
\renewcommand*\cftfigpresnum{Fig.~}
\settowidth{\mylen}{\cftfigpresnum\cftfigaftersnum}
\addtolength{\cftfignumwidth}{\mylen}

    % command for thumbnails
\newif\iflofimage
\DeclareRobustCommand*{\lofimage}[2][]{%
  \iflofimage
  \includegraphics[{height=2.5em,keepaspectratio=true,#1}]{#2}
  \fi
  \ignorespaces 
}


\makeatletter
\LetLtxMacro\captionpkg@caption\caption


\def\@starttof#1#2{%
  \begingroup
  \makeatletter
  \begin{tcbraster}[raster columns=3, raster equal height]
    \@input{\jobname.#1}%  Input the ToF or ToT file 
  \end{tcbraster}
  \if@filesw
  \expandafter\newwrite\csname tf@#1\endcsname
  \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
  \fi
  \endgroup
}

\newcommand{\tofiguresname}{\contentsname}


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

\newtcolorbox{lofbox}[1][]{enhanced jigsaw, sharp corners, colback={white!70!black},#1}

\newcommand{\writetofline}[3]{%
  \protect\begin{lofbox}
    #1

    \par
    \figurename\ #2
    \protect\end{lofbox}
}



\RenewDocumentCommand{\caption}{som}{%
  \IfBooleanTF{#1}{%
    \captionpkg@caption{#3}%
  }{%
    \IfValueTF{#2}{%
      \captionpkg@caption[#2]{#3}%
      \addtocontents{tof}{\writetofline{#2}{\thefigure}{\thepage}}%
    }{%
      \captionpkg@caption{#3}%
      \addtocontents{tof}{\writetofline{#2}{\thefigure}{\thepage}}%
    }%
  }%
}

\lofimagetrue


\makeatother


\begin{document}

\tableoffigures

\clearpage

Lorem

\begin{figure}[ht]
\label{a}\centering
\includegraphics{beeduck.jpg}
\caption[\lofimage{beeduck.jpg}Lorem ipsum dolor]{Lorem ipsum dolor sit amet, consetetur sadipscing.}
\end{figure}

Lorem ipsum dolor sit amet, consetetur sadipscing.\newpage

\begin{figure}[ht]
\label{b}\centering
\includegraphics{beeduck.jpg}
\caption[\lofimage{beeduck.jpg}consetetur sadipscing.]{Lorem ipsum dolor sit amet, consetetur sadipscing.}
\end{figure}

Lorem ipsum dolor sit amet, consetetur sadipscing.\newpage

\begin{figure}[ht]
\label{c}\centering
\includegraphics{beeduck.jpg}
\caption[\lofimage{beeduck.jpg}sit amet]{Lorem ipsum dolor sit amet, consetetur sadipscing.}
\end{figure}

Lorem
\end{document}

enter image description here

Update

I've used the ideas by the O.P. concerning the overlay and added it to the lofbox settings.

The \includegraphics command now stores the name of the the current file and will provide it as a thumbnail file -- there's no need to add it by hand to the \caption[]{} command.

Some optional arguments for the lofbox and graphics settings are still missing right now.

\documentclass[a4paper,11pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{graphicx}
\usepackage[most]{tcolorbox}
\usepackage{letltxmacro}
\usepackage{xparse}
\usepackage{xpatch}

% add "Fig." before number in caption
\usepackage[labelfont=bf]{caption}
\renewcommand{\figurename}{Fig.}

\usepackage{hyperref}




\makeatletter
\newif\iflofimage
\newif\ifhyperrefloaded

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

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



\LetLtxMacro\captionpkg@caption\caption

\def\nextthumbnailfile{}%


\LetLtxMacro\graphicx@@includegraphics\includegraphics%

\RenewDocumentCommand{\includegraphics}{O{}m}{%
  \def\nextthumbnailfile{#2}%
  \graphicx@@includegraphics[#1]{#2}%
}


\def\@starttof#1#2{%
  \begingroup
  \makeatletter
  \begin{tcbraster}[raster columns=3, raster equal height]
    \@input{\jobname.#1}%  Input the ToF or ToT file 
  \end{tcbraster}
  \if@filesw
  \expandafter\newwrite\csname tf@#1\endcsname
  \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
  \fi
  \endgroup
}

\newcommand{\tofiguresname}{\contentsname}


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

\newtcolorbox{lofbox}[2][]{enhanced jigsaw, 
  sharp corners, 
  colback={white!70!black},
  boxsep=0.5em,
  left=0em,
  right=0em,
  top=0em,
  bottom=0em,
  boxrule=0em,
  overlay={\node[text=black,fill={white!90!black}, draw=white, line width=1mm, inner sep=1.5mm, anchor = north west] at (9.4em,1.4em) {#2};},
  #1
}


\newcommand{\writetofline}[4]{%
  \protect\begin{lofbox}{#4}
    \includegraphics[height=9em, width=9.5em,keepaspectratio=true]{#1}%

    \ifhyperrefloaded 
    \protect\hyperlink{figure.#3}{\figurename~#3}%

    #2%
    \else
    \figurename~#3%

    #2%
    \fi
    \protect\end{lofbox}
}


\def\temp@@a{figure}%

\RenewDocumentCommand{\caption}{som}{%
  \IfBooleanTF{#1}{%
    \captionpkg@caption{#3}%
  }{%
    \IfValueTF{#2}{%
      \captionpkg@caption[#2]{#3}%
      \iflofimage
      \ifx\@currenvir\temp@@a
      \hypertarget{figure.\number\value{figure}}{}%
      \addtocontents{tof}{\writetofline{\nextthumbnailfile}{#2}{\number\value{figure}}{\thepage}}%
      \fi
      \fi
    }{%
      \captionpkg@caption{#3}%
      \iflofimage
      \ifx\@currenvir\temp@@a
      \hypertarget{figure.\thefigure}{}%
      \addtocontents{tof}{\writetofline{\nextthumbnailfile}{#3}{\number\value{figure}}{\thepage}}%
      \fi
      \fi
    }%
  }%
}

\lofimagetrue


\makeatother


\begin{document}

\tableoffigures

\clearpage

Lorem

\begin{figure}[ht]
\label{a}\centering
\includegraphics{beeduck.jpg}
\caption[Lorem ipsum dolor]{Lorem ipsum dolor sit amet, consetetur sadipscing.}
\end{figure}

Lorem ipsum dolor sit amet, consetetur sadipscing.
\clearpage

\begin{figure}[ht]
\label{b}\centering
\includegraphics{beeduck.jpg}
\caption[consetetur sadipscing.]{Lorem ipsum dolor sit amet, consetetur sadipscing.}
\end{figure}

Lorem ipsum dolor sit amet, consetetur sadipscing.\clearpage

\begin{figure}[ht]
\label{c}\centering
\includegraphics{beeduck.jpg}
\caption[sit amet]{Lorem ipsum dolor sit amet, consetetur sadipscing.}
\end{figure}

Lorem
\end{document}

enter image description here

| improve this answer | |
  • I'll return to this later on – user31729 Jan 8 '16 at 12:44
  • @Martin: Welcome to the Dark Side of the Force;-) I'll try to improve my first version, but I am right occupied for an hour or so. – user31729 Jan 8 '16 at 14:22
  • I am also working on it, here is my progress: in thumbnail definition, replace \includegraphics[{height=9em, width=9.5em,keepaspectratio=true,#1}]{#2}\par\textbf{Fig.~\thefigure}. In tcolorbox options add boxsep=0.5em,left=0em,right=0em,top=0em,bottom=0em,boxrule=0em – Martin Jan 8 '16 at 14:46
  • i got the page number to the right bottom: add {#3} as an argument to the lofbox environment in the writetofline definition, and then add a node to the tcolorbox with \newtcolorbox{lofbox}[1]{..., overlay={\node[text=black,fill={white!90!black}, draw=white, line width=1mm, inner sep=1.5mm, anchor = north west] at (9.4em,1.4em) {#1}; }} – Martin Jan 8 '16 at 15:31
  • Let us continue this discussion in chat. – Martin Jan 8 '16 at 15:40

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.