2

Suppose we were using small caps (rather than, e.g., bold face) to format a sectioning level in our TOC, say, section.

Consequently, we would use the appropriate alternative spelling of the section titles, to make sure the TOC entries will appear in small-caps only (rather mixed with upper-case letters, which looks clumsy) -- as, so far, there's no such thing as an upper- or lower-case command that can be used functionally identically to (and in combination with) the text style commands we already have (there's no \lcshape\scshape).

\section[lorem ipsum]{Lorem Ipsum}

But how to proceed with things like the names of \listoffigures and the likes? What would be the most elegant way to patch them before they get written to the TOC file?

\documentclass[listof=totoc]{scrartcl}
\usepackage{tocstyle,blindtext}

\settocfeature[toc][1]{entryhook}{\normalfont\scshape}

\setkomafont{section}{\normalfont\itshape}

\begin{document}
\tableofcontents

\section[lorem ipsum]{Lorem Ipsum}
\blindtext

\begin{figure}
  \dots
  \caption{\dots}\label{fig1}
\end{figure}

\blindtext

\listoffigures

\end{document} 

enter image description here

2 Answers 2

2

With \MakeLowercase you could automatically make your sections titles for the toc lowercase without manually specifying a short title.

\documentclass[listof=totoc]{scrartcl}
\usepackage{tocstyle,blindtext}

\settocfeature[toc][1]{entryhook}{\normalsize\scshape\MakeLowercase}

\setkomafont{section}{\normalfont\large\itshape}

\begin{document}
\tableofcontents

\section{Lorem Ipsum}
\blindtext

\begin{figure}
  \dots
  \caption{\dots}\label{fig1}
\end{figure}

\blindtext

\listoffigures

\end{document} 

enter image description here

Thanks to @DavidCarlisle for pointing out the advantages of \MakeLowercase compared to \lowercase!

9
  • 1
    @DavidCarlisle Do you want to post a \MakeLowercase answer? I'll happily delete my answer. Jul 5, 2018 at 20:21
  • 1
    @samcarter no, but you could edit yours:-) Jul 5, 2018 at 20:26
  • 1
    @NilsL why tricky? You can just replace \lowercase by \MakeLowercase in the above answer. Jul 5, 2018 at 20:27
  • 1
    @DavidCarlisle Edited - Thanks for your comments! Jul 5, 2018 at 20:34
  • 1
    +1 for the excellent suggestion to use \MakeLowercase :-) Jul 5, 2018 at 20:36
0

Actually I wrote a little package for this use case: lccaps. It basically does what samcarter's answer does. (One minor difference is that it uses \MakeTextLowercase, thus being a little more robust, one could say.) The solution then looks a little more compact any case:

% arara: pdflatex
% arara: pdflatex
\documentclass[listof=totoc]{scrartcl}
  \setkomafont{section}{\normalfont\itshape}
\usepackage{lccaps}
\usepackage{tocstyle}
  \settocfeature[toc][1]{entryhook}{\textlcc}

\usepackage{blindtext}

\begin{document}
\tableofcontents

\section*{Lorem Ipsum}
\addcontentsline{toc}{section}{Lorem Ipsum}
\blindtext    
\listoffigures
\end{document}

output

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .