Page LayoutHow to add a line instead of dot seperator in TOC?

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
pansartaxen
Posts: 4
Joined: Tue Aug 10, 2010 2:44 am

How to add a line instead of dot seperator in TOC?

Post by pansartaxen »

Hi,

I need to have a line as separator in my TOC as one the requirements for my thesis. What I mean is something like this:

Title 1 _______________________________ 1
Title 2 ______________________________ 2

I tried to use tocloft and do something like this:

Code: Select all

\renewcommand{\cftsecdotsep}{\cftdotsep}
\renewcommand{\cftdot}{\_}
\renewcommand{\cftsecleader}{\cftdotfill{0pt}}
The result is terrible and I wonder how to do this in a better way where the result is what i want?
Last edited by pansartaxen on Fri Sep 24, 2010 5:20 pm, edited 1 time in total.

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

meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

How to add a line instead of dot seperator in TOC?

Post by meho_r »

E.g.:

Code: Select all

\renewcommand{\cftdot}{\rule{1pt}{0.4pt}}
\renewcommand{\cftdotsep}{0}
You may also want to make spacing after the title and before the line bigger (in the example I simply added a space in cftXleader definition):

Code: Select all

\renewcommand{\cftsecleader}{ \cftdotfill{\cftsecdotsep}}
\renewcommand{\cftsubsecleader}{ \cftdotfill{\cftsubsecdotsep}}
pansartaxen
Posts: 4
Joined: Tue Aug 10, 2010 2:44 am

Re: How to add a line instead of dot seperator in TOC?

Post by pansartaxen »

Thanks!
Post Reply