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

| improve this question | | | | |
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!

| improve this answer | | | | |
  • 1
    @DavidCarlisle Do you want to post a \MakeLowercase answer? I'll happily delete my answer. – samcarter_is_at_topanswers.xyz Jul 5 '18 at 20:21
  • 1
    @samcarter no, but you could edit yours:-) – David Carlisle Jul 5 '18 at 20:26
  • 1
    @NilsL why tricky? You can just replace \lowercase by \MakeLowercase in the above answer. – David Carlisle Jul 5 '18 at 20:27
  • 1
    @DavidCarlisle Edited - Thanks for your comments! – samcarter_is_at_topanswers.xyz Jul 5 '18 at 20:34
  • 1
    +1 for the excellent suggestion to use \MakeLowercase :-) – David Carlisle Jul 5 '18 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

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.