Text FormattingMakeLowercase in \cftchapfont (tocloft)

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Dan
Posts: 10
Joined: Wed Feb 04, 2009 3:20 pm

MakeLowercase in \cftchapfont (tocloft)

Post by Dan »

Hello all,

I want to have my chapter titles in the table of contents formatted in small-caps with no full-height capital letters.

Using

Code: Select all

\renewcommand{\cftchapfont}{\normalsize \scshape}
gets me halfway there, but I still get the full-size caps. \MakeLowercase doesn't work, neither do the commands provided by the textcase package.

I've also had a look through the tocloft package definition to see how it handles the command, but can't make any sense of it :(

Any idea how to do this?

Also, I'd like to remove the numbering in the TOC for chapters (since all my chapters start with a section, so the number is redundant) is there an easy way to do this?

Thanks!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

MakeLowercase in \cftchapfont (tocloft)

Post by localghost »

I don't see the problem. The following works fine for me.

Code: Select all

\documentclass[11pt,a4paper,english]{report}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage{tocloft}
\usepackage{blindtext}

\parindent0em
\renewcommand{\cftchapfont}{\normalsize\scshape}

\begin{document}
  \tableofcontents
  \Blinddocument
\end{document}
Reduce your code to a minimal working example (MWE) that shows the undesired behaviour.


Best regards
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
Dan
Posts: 10
Joined: Wed Feb 04, 2009 3:20 pm

MakeLowercase in \cftchapfont (tocloft)

Post by Dan »

The example you posted exhibits exactly the behaviour I mean.

I wish to make the TOC entry for the chapter entirely lowercase (composed only of small caps, no full-height caps).

For instance:

Code: Select all

\documentclass[11pt,a4paper,english]{report}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}

\parindent0em

\begin{document}
\scshape This Is The Name Of The Chapter

\scshape \MakeLowercase{This Is The Name Of The Chapter}
\end{document}
The second line is what I wish to have in my TOC for chapter titles, but even with \MakeLowercase or \MakeTextLowercase in the \ctftocchapfont{} command, you still get full-height capitals.

Hope that clears it up!
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Re: MakeLowercase in \cftchapfont (tocloft)

Post by localghost »

Obviously I understood you completely wrong and at the moment I can't offer a solution to that issue.
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
Dan
Posts: 10
Joined: Wed Feb 04, 2009 3:20 pm

Re: MakeLowercase in \cftchapfont (tocloft)

Post by Dan »

Ok! Thanks for giving it a shot.
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

MakeLowercase in \cftchapfont (tocloft)

Post by phi »

try this:

Code: Select all

\renewcommand*{\cftchapaftersnumb}{\normalsize\scshape\MakeLowercase}
Dan
Posts: 10
Joined: Wed Feb 04, 2009 3:20 pm

Re: MakeLowercase in \cftchapfont (tocloft)

Post by Dan »

Gah, that works perfectly for the first word of the chapter title!

Any chapters with more than one word in the title have the second word capitalised :(
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

MakeLowercase in \cftchapfont (tocloft)

Post by Stefan Kottwitz »

Hi Dan,

try redefining \l@chapter:

Code: Select all

\makeatletter
\let\oldl@chapter\l@chapter
\renewcommand*\l@chapter[2]{\oldl@chapter{\MakeLowercase{#1}}{#2}}
\makeatother
Stefan
LaTeX.org admin
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

MakeLowercase in \cftchapfont (tocloft)

Post by phi »

or with a KOMA-Script class:

Code: Select all

\documentclass{scrreprt}

\setkomafont{chapterentry}{\mdseries\scshape\MakeLowercase}

\begin{document}

\tableofcontents
\chapter{AAAA BBB ccc DDdDDd}

\end{document}
Dan
Posts: 10
Joined: Wed Feb 04, 2009 3:20 pm

MakeLowercase in \cftchapfont (tocloft)

Post by Dan »

Phi, all that does is change my chapter headings (in the document itself) to my Sans-Serif font, which I'm guessing is a side-effect of using a KOMA-Script class.

Stefan, I get an undefined control sequence with that, but I see what you're doing. My first thought (before using tocloft) was to try and redefine the chapter heading but I didn't know where to start.

Code: Select all

! Undefined control sequence.
\hyper@linkstart ...>\protected@edef \Hy@testname 
                                                  {#2}\ifx \Hy@testname \@em...
l.1 ...ter}{\numberline {1}Prologue}{6}{chapter.1}
Post Reply