TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got an issue related to table of contents. I want a horizontal line before each section, so I put

%other stuff that I need

This is perfect in terms of what I see, but I get a warning because (I guess) the compiler expects to find \hline within a table. So I replaced it with


The problem now is that if length is long enough (I need the line to arrive on top of the page number), I get an overfull hbox.

Any idea? I already searched related problems with no luck.

share|improve this question
Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – mafp Jul 3 '13 at 13:07

You are providing only spare information. However I guess you are looking for \hrulefill. So you modification can be:

\renewcommand{\cftsecfont}{\hrulefill\par\nobreak\hskip -\leftskip\bfseries}

enter image description here

share|improve this answer
+1 for a really minimum MWE :) – Harish Kumar Jul 4 '13 at 0:10
Thank you that is what I was looking for (I had tried with \hrulefill only without success) – ALPI Jul 4 '13 at 9:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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