精美的图形布局/设计列表

精美的图形布局/设计列表

您是否认为可以设计“图表列表”页面,使其看起来更美观?我折腾了好几天,但找不到示例或好的解决方案,甚至没有找到tocloft,以实现我梦想的目标。我知道 - 如果可能的话 - 这将是很大的努力。

这是我理想中想要的(哪怕朝这个方向迈出一步就好了): 目标

这就是我被困住的地方:

最先进的

相关最小示例代码:

\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}

答案1

这只是初步版本,我必须添加hyperref支持等和其他功能。(基本上它与我在这里对这个问题的回答类似: 将 \listoffigures 和 \listoftables 重新定义为表格) 主要思想是将所有caption图像放入光栅中tcolorbox(我认为表格也可以)——请注意,目前它们list of tables也会获得tcolorbox东西!;-)

\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}

在此处输入图片描述

更新

我使用了 OP 有关覆盖的想法并将其添加到lofbox设置中。

\includegraphics命令现在存储当前文件的名称并将其作为缩略图文件提供 - 无需手动将其添加到命令中\caption[]{}

lofbox目前仍然缺少一些用于图形设置的可选参数。

\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}

在此处输入图片描述

相关内容