Text FormattingSpecial formatting of toc entries for tables and figures

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Montag
Posts: 340
Joined: Wed Jul 15, 2009 9:25 am

Special formatting of toc entries for tables and figures

Post by Montag »

Hello,

I'd like the toc entries, which are automatically generated via

Code: Select all

\listoffigures
\listoftables
, to be formatted with

Code: Select all

\Large\scshape
to match them to my own customized toc (formatted via titletoc), but I don't know how to do that.

As the list of acronyms usually also isn't numbered, I've managed to get the right formatting for this particular toc entry via

Code: Select all

\addchap{\Large\scshape Acronyms}
(I use the package acronym), but for the automatically generated lists, I can't seem to find a good clue how to get there. Any help would be appreciated. :)
Last edited by Montag on Wed Oct 27, 2010 9:47 pm, edited 1 time in total.
OS: Win 7 64-bit LaTeX: MikTeX 2.9 64-bit Editor: TXC 1 RC1

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

Special formatting of toc entries for tables and figures

Post by gmedina »

Please post a minimal working example including all the relevant packages and settings related to this particular issue.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Montag
Posts: 340
Joined: Wed Jul 15, 2009 9:25 am

Re: Special formatting of toc entries for tables and figures

Post by Montag »

Alright, took me some good long time :/ but I had to do it, of course. I hope that helps anyone to help me. :)
Attachments
toc-listoftables-listoffigures.tex
(2.31 KiB) Downloaded 197 times
OS: Win 7 64-bit LaTeX: MikTeX 2.9 64-bit Editor: TXC 1 RC1
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Special formatting of toc entries for tables and figures

Post by meho_r »

You haven't set TOC entry for chapters correctly. All text-related settings go inside the first set of curly braces, spacing between the number of a sectioning unit and its title goes into the second set of curly braces. E.g.:

Code: Select all

\titlecontents{chapter}[0pt]{\addvspace{2pc}\rmfamily\Large\scshape{\thecontentslabel}}{\hspace{0.5em}}{}{\Large\xquad{\textcolor{FireBrick}\thecontentspage}}[\addvspace{2pt}]
Montag
Posts: 340
Joined: Wed Jul 15, 2009 9:25 am

Re: Special formatting of toc entries for tables and figures

Post by Montag »

Hm, ok, then I'm wondering why it worked so far for the other toc entries? :)

But thank you!
OS: Win 7 64-bit LaTeX: MikTeX 2.9 64-bit Editor: TXC 1 RC1
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Special formatting of toc entries for tables and figures

Post by meho_r »

From titlesec manual:

Code: Select all

\titlecontents{<section>}[<left>]{<above>}
              {<before with label>}{<before without label>}
              {<filler and page>}[<after>]
  • above is code for the global formatting of the entry. Vertical material is allowed. At this point the value of \thecontentslabel (see below) is known which enables you to take decisions depending on its value (with the help of the ifthen package). You may use the titlesec \filleft, \filright, \filcenter and \fillast commands.
  • before with label is in horizontal mode and it will be used just before the entry title. As in \titleformat, the last command can take an argument with the title.
  • before without label is like the above if there is, well, no label.
You specified custom formatting for before with label (and label in this case is the number before sectioning units), and it was passed to all numbered entries (i.e. chapter entires which are numbered), but left before without label empty, so list of tables and list of figures, which aren't numbered, remained "plain". This means that, if you copy the content of the second pair of braces to the third pair too (but probably without horizontal space), you'll achieve similar result as the one I presented in my earlier post.
Montag
Posts: 340
Joined: Wed Jul 15, 2009 9:25 am

Special formatting of toc entries for tables and figures

Post by Montag »

You really understood that manual, huh. :) I think I read that manual and especially that part about 20 times now ... or up until I've read your post, but now is the first time I can make some sense out of it. Thanks again, I appreciate your explanation a lot.
OS: Win 7 64-bit LaTeX: MikTeX 2.9 64-bit Editor: TXC 1 RC1
Post Reply