Document ClassesMemoir Short List of Figures

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
Pete82
Posts: 4
Joined: Thu Mar 03, 2011 2:52 am

Memoir Short List of Figures

Post by Pete82 »

Hello

I realy like the appearance of the short list of contents, introduced in the memoir manual. What I want is a short list of figures command changing the LoF style similarly. Centered captions followed by page numbers, without these dots.
I was trying to adopt the code of the short toc command, but it didn't work out.
It's beyond my capabilities to write such code.

Has anyone here already done this or knows how to do it?

Thx

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Memoir Short List of Figures

Post by gmedina »

Hi,

please post a minimal working example showing the aspect of the short table of contents that you want to imitate.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Pete82
Posts: 4
Joined: Thu Mar 03, 2011 2:52 am

Memoir Short List of Figures

Post by Pete82 »

Sorry. Here is the code I'm trying to adobt.

Code: Select all

\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}
I would like to make a \setupshortlof command. A short list of figures, showing centered figure cpations followed by page numbers. Similary to the short ToC appearance.

My problems: \setupshorttoc \setupparasubsecs \setupmaintoc
are connected somehow, as they don't work out on there own.

I can't understand how this code works, so I can't make my short list of figures.
Pete82
Posts: 4
Joined: Thu Mar 03, 2011 2:52 am

Memoir Short List of Figures

Post by Pete82 »

No ideas at all? I tried a few things by myself, but so far every approach turned out to be rubbish.

e.g.

Code: Select all

\documentclass [a4paper,11pt,oneside]{memoir} 
%%% short LOF
\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}

Pete82
Posts: 4
Joined: Thu Mar 03, 2011 2:52 am

Memoir Short List of Figures

Post by Pete82 »

Solution:

Code: Select all

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% 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

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Memoir Short List of Figures

Post by localghost »

Pete82 wrote:Solution: […]
Then please mark the topic (not the last post) accordingly as written in Section 3 of the Board Rules (to bread before posting).


Best regards and welcome to the board
Thorsten
Post Reply