You can't put a \chapter or \addtocomments command in your preamble.
That's why you're getting the error. These commands go in the document
itself.

What you want to do here, I think, is put
    \addtocontents{toc}{\protect\mbox{}\protect\hrulefill\par}
as ERT immediately following the chapter title in the LyX file. The
\chapter command is already there, in effect: It's created by the
Chapter "environment" in your LyX file.

The titlesec/titletoc and tocloft packages are the ones you want.
Whether you use titletoc or tocloft, well, that's a matter of personal
preference, mostly.

Richard

Kamran SHAFQAT wrote:
> Hi,
> I am trying to write my thesis using lyx (koma-script report class).
> But i would like to format the toc, lof and lot to have something like
> the table in attachment. I tried to make use of tocloft and  just
> having a look at titlesec/titletoc package but i am not sure if  this
> is the best  solution available.
>
> The following commands are mentioned in the manual of tocloft to add a
> horizontal line across the whole width of the ToC below an entry for a
> Part
>
> \part{Part title}
> \addtocontents{toc}{\protect\mbox{}\protect\hrulefill\par}
>
>
> i tired to put this in the preamble with Part tile replaced by title
> of first chapter of my document but i got error saying
>
> [EMAIL PROTECTED] already define .......
>
> can someone please have a look at the attachment and provide me some
> hint or the package that could be used for this.
>
> formating  thanks  for all the help
>
>
> regards,
>
>
> Kamran

Reply via email to