我非常喜欢手册中介绍的简短目录列表的外观memoir
。我想要的是一个简短的图表列表命令,以类似的方式改变 LoF 样式。居中标题后跟页码,中间没有这些点。我试图采用简短 toc 命令的代码,但没有成功。这是 shorttoc 命令。
\documentclass [a4paper,11pt,oneside]{memoir}
\setsecnumdepth{section}
\setcounter{tocdepth}{3}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Short and long ToC
\makeatletter
\newcommand*{\setupshorttoc}{%
\renewcommand*{\contentsname}{Short contents}
\let\oldchangetocdepth\changetocdepth
\let\oldprecistoctext\precistoctext
\renewcommand{\precistoctext}[1]{}
\let\oldcftchapterfillnum\cftchapterfillnum
\renewcommand*{\changetocdepth}[1]{}
\setcounter{tocdepth}{0}% chapters
\renewcommand*{\cftchapterfont}{\hfill\sffamily}
\renewcommand*{\cftchapterpagefont}{\normalfont}
\renewcommand*{\cftchapterleader}{ \textperiodcentered\space}
\renewcommand*{\cftchapterafterpnum}{\cftparfillskip}
%% \setpnumwidth{0em}
%% \setpnumwidth{1.5em}
\renewcommand*{\cftchapterfillnum}[1]{%
{\cftchapterleader}\nobreak
\hbox to 1.5em{\cftchapterpagefont ##1\hfil}\cftchapterafterpnum\par}
\setrmarg{0.3\textwidth}
\setlength{\unitlength}{\@tocrmarg}
\addtolength{\unitlength}{1.5em}
\let\oldcftpartformatpnum\cftpartformatpnum
\renewcommand*{\cftpartformatpnum}[1]{%
\hbox to\unitlength{{\cftpartpagefont ##1}}}
\let\oldcftbookformatpnum\cftbookformatpnum
\renewcommand*{\cftbookformatpnum}[1]{%
\hbox to\unitlength{{\cftbookpagefont ##1}}}}
\newcommand*{\setupparasubsecs}{%
\let\oldnumberline\numberline
\renewcommand*{\cftsubsectionfont}{\itshape}
\renewcommand*{\cftsubsectionpagefont}{\itshape}
\renewcommand{\l@subsection}[2]{
\ifnum\c@tocdepth > 1\relax
\def\numberline####1{\textit{####1}~}%
\leftskip=\cftsubsectionindent
\rightskip=\@tocrmarg
%% \advance\rightskip 0pt plus \hsize % uncomment this for raggedright
%% \advance\rightskip 0pt plus 2em % uncomment this for semi-ragged
\parfillskip=\fill
\ifhmode ,\ \else\noindent\fi
\ignorespaces
{\cftsubsectionfont ##1}~{\cftsubsectionpagefont##2}%
\let\numberline\oldnumberline\ignorespaces
\fi}}
\AtEndDocument{\addtocontents{toc}{\par}}%%% OK
\newcommand*{\setupmaintoc}{%
\renewcommand{\contentsname}{Inhaltsverzeichnis}
\let\changetocdepth\oldchangetocdepth
\let\precistoctext\oldprecistoctext
\let\cftchapterfillnum\oldcftchapterfillnum
\addtodef{\cftchapterbreak}{\par}{}
\renewcommand*{\cftchapterfont}{\normalfont\sffamily}
\renewcommand*{\cftchapterleader}{\sffamily\cftdotfill{\cftchapterdotsep}}
\renewcommand*{\cftchapterafterpnum}{}
\renewcommand{\cftchapterbreak}{\par\addpenalty{-\@highpenalty}}
\setpnumwidth{2.55em}
\setrmarg{3.55em}
\setcounter{tocdepth}{2}
\let\cftpartformatpnum\oldcftpartformatpnum
\addtodef{\cftpartbreak}{\par}{}
\let\cftbookformatpnum\oldcftbookformatpnum
\addtodef{\cftbookbreak}{\par}{}
}
\makeatother
\begin{document}
\setupshorttoc
\tableofcontents
\setupparasubsecs
\setupmaintoc
\tableofcontents
\setlength{\unitlength}{1pt}
%%%%%% Test
\chapter{Chaper 1}
\section{Section2}
\subsection{Subsection3}
\chapter{Chapter 2}
\section{Section2}
\section{Section1}
\end{document}
这是我尝试过的方法。
\documentclass [a4paper,11pt,oneside]{memoir}\makeatletter
\newcommand*{\setupshortlof}{%
\renewcommand*{\contentsname}{ShortLof}
\let\oldchangelofdepth\changelofdepth
\let\oldprecisloftext\precisloftext
\renewcommand{\precisloftext}[1]{}
\let\oldcftchapterfillnum\cftchapterfillnum
% \renewcommand*{\changelofdepth}[1]{}
%\setcounter{tocdepth}{0}% chapters
\renewcommand*{\cftchapterfont}{\hfill\sffamily}
\renewcommand*{\cftchapterpagefont}{\normalfont}
\renewcommand*{\cftchapterleader}{ \textperiodcentered\space}
\renewcommand*{\cftchapterafterpnum}{\cftparfillskip}
}
\makeatother
\begin{document}
\clearpage
\setupshortlof
\listoffigures
\end{document}
这根本不起作用。
这里有人做过这样的事或者知道怎么做吗?
更新:
到目前为止,谢谢。这个很好用。
\documentclass [a4paper,11pt,oneside]{memoir}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Short LoF
\makeatletter
\newcommand*{\setupshortlof}{%
\renewcommand*{\listfigurename}{ShortLof}
%\let\oldchangelofdepth\changelofdepth
%\let\oldcftfigurefillnum\cftfigurefillnum
\renewcommand*{\cftfigurefont}{\hfill\sffamily}
\renewcommand*{\cftfigurepagefont}{\normalfont}
\renewcommand*{\cftfigureleader}{ \textperiodcentered\space}
\renewcommand*{\cftfigureafterpnum}{\cftparfillskip}
\renewcommand*{\cftfigurefillnum}[1]{%
{\cftfigureleader}\nobreak
\hbox to 1.5em{\cftfigurepagefont ##1\hfil}\cftfigureafterpnum\par}
\setrmarg{0.3\textwidth}
\setlength{\unitlength}{\@tocrmarg}
\addtolength{\unitlength}{1.5em}
\let\oldcftpartformatpnum\cftpartformatpnum
\renewcommand*{\cftpartformatpnum}[1]{%
\hbox to\unitlength{{\cftpartpagefont ##1}}}
\let\oldcftbookformatpnum\cftbookformatpnum
\renewcommand*{\cftbookformatpnum}[1]{%
\hbox to\unitlength{{\cftbookpagefont ##1}}}
}
\makeatother
\begin{document}
\clearpage
\setupshortlof
\listoffigures
\chapter{Chaper1}
\section{Section1}
\begin{figure}
\caption{Test1}%
\label{Test1}%
\end{figure}
\begin{figure}
\caption{Test2}%
\label{Test2}%
\end{figure}
\begin{figure}
\caption{Test3}%
\label{Test3}%
\end{figure}
\end{document}
现在我想删除图形编号。我不想让它们显示在 LoF 中。我该怎么做?
答案1
将以下内容添加到您的定义中\setupshortlof
:
\renewcommand*{\cftfigurepresnum}{\expandafter\@gobbletwo\@gobble}