调整页面标签和图片列表中第一个项目之间的间距

调整页面标签和图片列表中第一个项目之间的间距

考虑一下代码

\documentclass{article}
\usepackage{xcolor,graphicx}
\usepackage{transparent}
\usepackage{tocloft}

% To change the LOF layout
\renewcommand{\listfigurename}{LIST OF FIGURES}
%% The next two command centers the title, sets its font, adds vertical space afterwards and typesets 'Page' above the page numbers.
\renewcommand{\cftloftitlefont}{\hfill\Large\bfseries}
\renewcommand{\cftafterloftitle}{%
  \hfill \vspace*\baselineskip\par \mbox{}\hfill{\normalfont {\bf Page}}}
\setlength{\cftbeforefigskip}{1em} % more space between entries

\begin{document}
\thispagestyle{empty}

\begin{figure}[!htb]
\centering
\includegraphics[width=10em,height=10em]{example-image}\llap{\texttransparent{0.5}{\color{blue}\rule{10em}{10em}}}
\caption{Blue image}
\end{figure}

\newpage
\listoffigures
\end{document}

产生输出

在此处输入图片描述

在此处输入图片描述

问题:我想调整(在本例中是减少)标签之间的垂直空间“页”以及实际列表中的第一个(唯一)项目。我该怎么做?

谢谢。

备注:我尝试插入\vspace*{-10pt}各种地方,但都无济于事。我查阅了文档,但还是没有找到答案。

答案1

我不确定你想要什么。你希望“页面”更靠近“图片列表”还是更靠近列表中的第一个条目,或者两者兼而有之?

% lofprob2.tex  SE 631937
\documentclass{article}
\usepackage{xcolor,graphicx}
\usepackage{transparent}
\usepackage{tocloft}

\usepackage{comment}

%%% YOUR CODE FROM A PREVIOUS ANSWER
% To change the LOF layout
\renewcommand{\listfigurename}{LIST OF FIGURES}
%% The next two command centers the title, sets its font, adds vertical space afterwards and typesets 'Page' above the page numbers.
\renewcommand{\cftloftitlefont}{\hfill\Large\bfseries}
\renewcommand{\cftafterloftitle}{%
  \hfill \vspace*\baselineskip\par \mbox{}\hfill{\normalfont \textbf{Page}}}
\setlength{\cftbeforefigskip}{1em} % more space between entries

%%% MY REVISED CODE

%% move Page upwards nearer LIST OF FIGURES
\renewcommand{\cftafterloftitle}{%
  \hfill \vspace*{0.5\baselineskip}\par \mbox{}\hfill{\normalfont \textbf{Page}}}
%% Move Page upwards and reduce space before figure entries 
\renewcommand{\cftafterloftitle}{%
  \hfill \vspace*{0.5\baselineskip}\par \mbox{}\hfill{\normalfont \textbf{Page}}\vspace*{-1.5\baselineskip}}
\begin{document}
\thispagestyle{empty}
%\listoffigures
%\newpage
\begin{figure}[!htb]
\centering
\includegraphics[width=10em,height=10em]{example-image}\llap{\texttransparent{0.5}{\color{blue}\rule{10em}{10em}}}
\caption{Blue image}
\end{figure}

\begin{figure}
  \centering
  A FIGURE
  \caption{An illustration}
\end{figure}

\listoffigures
\end{document}

上述 MWE 处理这两者。

在此处输入图片描述

不要使用{\bf text},它几年前就被贬低了,使用\textbf{text}

答案2

更新在末尾添加一些负空间 \renewcommand{\cftafterloftitle}

埃

使用\setlength{\cftbeforefigskip}{4em} % more space between entries

F

\documentclass{article}
\usepackage{xcolor,graphicx}
\usepackage{transparent}
\usepackage{tocloft}

% To change the LOF layout
\renewcommand{\listfigurename}{LIST OF FIGURES}
%% The next two command centers the title, sets its font, adds vertical space afterwards and typesets 'Page' above the page numbers.
\renewcommand{\cftloftitlefont}{\hfill\Large\bfseries}
\renewcommand{\cftafterloftitle}{%
    \hfill \vspace*\baselineskip\par
     \mbox{}\hfill{\normalfont \textbf{Page}}
     \vspace*{\dimexpr -1em -\cftbeforefigskip}% added <<<<<<<<<<<<<<<<
 }

\setlength{\cftbeforefigskip}{1em} % more space between entries


    \begin{document}
        \thispagestyle{empty}
        
        \begin{figure}[!htb]
            \centering
            \includegraphics[width=10em,height=10em]{example-image}\llap{\texttransparent{0.5}{\color{blue}\rule{10em}{10em}}}
            \caption{Blue image}
        \end{figure}
    
            \begin{figure}[!htb]
        \centering
        \includegraphics[width=10em,height=10em]{example-image}\llap{\texttransparent{0.5}{\color{red}\rule{10em}{10em}}}
        \caption{Red image}
    \end{figure}
        \begin{figure}[!htb]
    \centering
    \includegraphics[width=10em,height=10em]{example-image}\llap{\texttransparent{0.5}{\color{green}\rule{10em}{10em}}}
    \caption{Green image}
\end{figure}

    
    \newpage
    \listoffigures
\end{document}

相关内容