LyXIssue with TOC - 'Appendix' rows

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
rtitaly
Posts: 6
Joined: Sat Sep 01, 2012 10:10 am

Issue with TOC - 'Appendix' rows

Post by rtitaly »

Hi!
I'm writing my dissertation with Lyx.
I put the TOC and everything works fine except one thing.
In the TOC the 'Appendix' line overwrites the title of the Appendix (see below).

Does anyone know how to fix this please?
THANKS!
RT
Screen shot 2012-09-01 at 9.09.55 AM.png
Screen shot 2012-09-01 at 9.09.55 AM.png (54.31 KiB) Viewed 5583 times

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

scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

Re: Issue with TOC - 'Appendix' rows

Post by scottkosty »

Hi ritaly,

I think a MWE would help here. See http://www.latex-community.org/forum/vi ... =37&t=5838
You don't happen to have any negative space (e.g. \hspace{-2cm}, do you?

Thanks,

Scott
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Issue with TOC - 'Appendix' rows

Post by kaiserkarl13 »

The problem is that the table of contents assumes your chapter/section/etc. entries are "well-behaved" (numbers or letters, having a reasonable width). When you redefined "thesection," it gets messed up. The documentation for the tocloft package will explain why your document failed as well as why the following document will do what I suspect you were looking for:

Code: Select all

\documentclass{article}
\usepackage{tocloft}
\begin{document}
\author{me}
\title{ho, hum}
\tableofcontents
\section{Hello}
\appendix
\let\oldsection\thesection
\renewcommand{\thesection}{Appendix~\oldsection}
\addtocontents{toc}{\setlength{\cftsecnumwidth}{18ex}}
\section{Haha}
\end{document}
rtitaly
Posts: 6
Joined: Sat Sep 01, 2012 10:10 am

Re: Issue with TOC - 'Appendix' rows

Post by rtitaly »

Hi guys!
Thank you very much to both of you! Sorry for not being precise but I'm new in this forum (even if I'm not new to Lyx).

- Attached you can find a minimal working file containing the issue (you can see it in page 1).
- kaiserkarl13, thanks! But do you know how to fix it?


Also, the issue is slightly deeper since my dissertation contains 3 chapters. Each chapter has a distinct Appendix. I tried to put each chapter has a 'child' document in a Lyx file but when creating the TOC the numbers do not reflect the number of the chapters (MWE needed?).

Any idea how this could work please?
MANY THANKS IN ADVANCE!!
RT
Attachments
example.lyx
(2.64 KiB) Downloaded 302 times
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Issue with TOC - 'Appendix' rows

Post by kaiserkarl13 »

I don't think you actually ran my example. It DOES fix it, unless I missed something. (The line with \setlength{} in it is the part that fixes it, that plus \usepackage{tocloft}.)
rtitaly
Posts: 6
Joined: Sat Sep 01, 2012 10:10 am

Re: Issue with TOC - 'Appendix' rows

Post by rtitaly »

Hi kaiserkarl13!
First of all thanks again for your code. You're right it does fix it. I run in with TexShop and I see it does work. However, I'm not sure how to 'import' it in a standard Lyx file. I tried to copy and paste it in the preamble but it doesn't work. What am I doing wrong?

THANKS a million again for this!!
Ciao,
RT
rtitaly
Posts: 6
Joined: Sat Sep 01, 2012 10:10 am

Re: Issue with TOC - 'Appendix' rows

Post by rtitaly »

Btw,
In the meanwhile I've found a nice example (I think it can be adapted quite easily) that does what I need in Lyx. It's attached.
Thanks again to all of you for your suggestions!!
RT
Attachments
suthesis-lyx.zip
(114.21 KiB) Downloaded 223 times
Post Reply