multiline TOC entry

  • Permalink
  • submit to reddit
  • Email
  • Follow


  My documents sometimes have long titles, and these titles
don't fit into one line of TOC (table of content). I managed
to fix the problem by creating a macro:

% Generalized TOC entry
% #1 -- label
% #2 -- label width
% #3 -- ID
% #4 -- text
% #5 -- text font tuning
% setup font
% start a hyperlink and a link rectangle
\hyperlink{#3}{\hbox to \hsize{\vbox{%
% start a paragraph, reserve space for label and page number
\noindent\leftskip=#2\rightskip=3em% 3em > space + 9--99
% make a label
\hbox to 0pt{\kern-#2#1\hfil}%
% TOC entry text
% page number
\hbox to 0pt{\hbox to 3em{\hfil\pageref*{#3}}\hss}%
% finish the box and the hyperlink

  TOC entries consist of three parts: label, text and page
number. If text is long and should be splitted on several lines,
then the text occupies only the text area.

  Having "tocX", I define styles for actual TOC entries:

% Toc Entries
% #1 -- label
% #2 -- ID
% #3 -- text

  and use in a document:

\tocHII{9.1}{id2295983}{Weitere Dokumentation von ...}
\tocHII{9.2}{id2296568}{Dokumentation von Zulieferern}

  All works fine. I'm sharing the code in hope it will be useful.

  My request: please comment how the code can be improved. For
example, I suppose that using "\vbox" is LaTeX is not very good,
but I have no idea for replacement.


Reply usenet5437 (22) 8/31/2004 9:18:22 AM

See related articles to this posting

comp.text.tex 37350 articles. 72 followers. Post

0 Replies

Similar Articles

[PageSpeed] 33


Similar Artilces:

ToC questions -- formatting ToC entries
Hi All, I'm writing a reference document -- think 'encyclopedia-like' -- with a large number of entries in each section. I'd like the individual entries to show up in the ToC, but since they all (tend to) have very short names I don't want to have a huge number of pages that consist mostly of leaders between entry name and page number. The default ToC behavior would give me something like Chapter ...................................................... 1 Section 1 .................................................. 1 EntryA ...

Entries in TOC
I am contributing one part (Part 'D') of a publication. The formal requirement is that my chapters/sections/tables/figures are numbered with the prefix 'D-'. I have found the packages titlesec, titletoc, and caption for that purpose. - titlesec works fine - titletoc is troublesome. The code below produces unexpected results, whereever I put the 'D'. Both versions give an unexpected '0' and no D as a prefix %\titlecontents{chapter}[0.7cm] % {\vspace{0.3cm}} % {D~\thechapter\sffamily\bfseries\Large \contentslabel{1.7cm}} %...

How to list TOC entries?
Hi, When building our project with static libraries we regulary get TOC overflow warnings. I think that all global functions and variables go into the TOC. But correct me if I am wrong. We have also no problem to change the code to make the TOC smaller. But before we do that we want to know what in the TOC is. Is there a way to list all symbols contained in the TOC? I tried both dump and nm but they don't seem to give the answer I want. Joerg Joerg Richter wrote: > Hi, > > When building our project with static libraries we regulary get TOC > overflow warnings. I think t...

Removing entries from TOC
Hi all, I'm writing my PhD thesis with TeX and I have a table of contents in which I want to remove lines for "list of figures" and "list of tables". I also have "Table of contents" as entry in my TOC(!) and don't want that either... How can I remove these without manually editing the toc generated file? If it helps, I've copied my settings file below. Thank you Spiros Here are is my document (apart from actual text content) \documentclass[a4paper,12pt]{report} % document type \usepackage[pdftex]{graphicx} % driver \graphicspat...

toc entry is lost
Consider this \documentclass[a4paper]{article} \begin{document} \tableofcontents test \clearpage \addcontentsline{toc}{section}{hest} \begin{figure} \centering \rule{2cm}{2cm} \end{figure} \end{document} on my system (TL09) the toc ends up empty, why? -- /daleif (remove RTFSIGNATURE from email address) LaTeX FAQ: LaTeX book: (in Danish) Remember to post minimal examples, see URL below Lars Madsen <...

titlesec/Uppercase TOC entries
I am trying to follow the very inane thesis requirements my school has, but I am having trouble with the TOC chapter entries. The requirement for chapter headings and TOC entries are that they must be Uppercase. I would rather not type everything in as uppercase if I don't have to (I guess it wouldn't kill me, but I do plan to leave a latex template behind so the next poor sap doesn't have to go through all of this like I did). Because of other requirements (double spacing, only 12pt font allowed...), I am using the titlesec package. I have figured out how to fix the ch...

amsart toc double entry
hi, i am using the amsart documentclass. at the end of the document i include a bibtex file with: \bibliography{biblio} doing this results in two entries in the table of contents (\tableofcontents) for the References section. anybody an idea how i can get rid of one of these two entries? they are both pointing to the starting page of the reference section ... thanks m Makus wrote: > hi, > i am using the amsart documentclass. > at the end of the document i include a bibtex file with: > \bibliography{biblio} > > doing this results in two entries in the table of contents >...

toc: centering entries for parts
How can I get table-of-content entries for parts be centered? That is, what I'd like to have is something along the lines of: Part 1 Mathematical Modeling 1. Chapter 1 2. Chapter 2 3. Chapter 3 Part 2 Numerical Methods 4. Chapter 4 etc. Thanks Andreas ...

setting TOC entries in a paragraph
Hi, I'm used to using tocloft to format the table of contents but scanning through the docs I don't see a solution to what I'm trying to do here. Rather than have every TOC entry on a new line I'd like to typeset the section entries in an indented paragraph under each chapter entry. Something like this. 1. The first chapter 1 The first section 1; Another section 3; A third sec 5; etc etc. 2. The second chapter 10 The first section 1; Another section 3; A third sec 5; etc etc. Does anyone ...

suppressing numbering of entries in toc
I am putting together some pdf-files usinfg the pdfpages-package like this: \documentclass[a4paper,11pt,twoside,oldtoc]{article} \usepackage[final]{pdfpages} \makeatletter \renewcommand*\l@section {\@dottedtocline{1}{0em}{2.3em}} \makeatother \begin{document} \tableofcontents \cleardoublepage \includepdf[pagecommand={},addtotoc={1,section,1,title of first document,label1}, pages={1-9}]document1.pdf} \cleardoublepage \includepdf[pagecommand={},addtotoc={1,section,1,title of 2nd document,label2}, pages={1-7}]{document2.pdf} \cleardoublepage .. .. .. \end{document} This all works fine...

Special formatting of toc entries
Hi, I am using latex book class to write a laboratory manual for a class. I need to have my toc entries in such a way that I can get a short paragraph entry under the Chapter title as (I am not using sectional or subsectional entries at all to avoid extra clutter): Experiment 1 Title of Experiment 1 In this experiment we do bla bla bla bla bla bla bla bla bla Experiment 2 Title of Experiment 3 In this experiment we do more bla bla bla bla bla bla bla bla I ...

alternative for unnumbered entries in toc
Hi, I'm using the standard \getcontentsline in conjunction with the starred version of sectioning type to produce unnumbered entries in ToC. Unfortunately, i have to type the same title twice as a result of this. E.g. \subsubsection*{some really annoyingly long heading} \addcontentsline{toc}{subsubsection}{some really annoyingly long heading} Can anyone recommend some more user friendly alternative to produce the same result? Cheers :) On Nov 11, 1:41=A0am, pretentious_indifference <> wrote: > Hi, > > I'm using the standard \getcontentslin...

Raggedright entries in toc with memoir
Hi all, I'm using memoir with pdfLaTeX to typeset a book. The book has some chapters with long titles, so that they take several lines in the table of contents. However, I can't get them raggedright and sometimes the lines have ugly interword space. Here is a test case: ========================= 8< ============================== \documentclass{memoir} \renewcommand{\cftchapterbreak}{\hyphenpenalty10000\sloppy} \renewcommand{\cftchapterfont}{\Large} \begin{document} \tableofcontents* \chapter{This is a chapter with a long title, which should be~typeset~raggedright in the table ...

Remove entries form TOC
Hello! Is it possiblie to remove some chapters from the table of contents? Something like \removecontentsline{toc}{Chapter}{Errata} Best Regards AD Am 16 Oct 2008 08:52:44 GMT schrieb Alexandros Droseltis: > Hello! > > Is it possiblie to remove some chapters from the table of contents? > Something like \removecontentsline{toc}{Chapter}{Errata} You can change locally tocdepth to e.g. -1 with the tocvsec2 package. -- Ulrike Fischer Ulrike Fischer <> schrieb: > Am 16 Oct 2008 08:52:44 GMT schrieb Alexandros Droseltis: > >> Hello! >> ...

to entry without a from entry
Hello, I've got a logfile from the provider of a customer written over some hours. I found a lot of to-entries without a from-entry, like this: Oct 13 13:58:17 sun7 sendmail[17371]: i9DBnHA16671: to=<>, delay=00:08:59, xdelay=00:00:00, mailer=local, pri=140954, dsn=2.0.0, stat=Sent (I've changed the to address for posting here.) Why there are no from-entries with the same ID i9... in the logfile? What mean these entries? Bye Martin Martin Truckenbrodt wrote: > Hello, > I've got a logfile from the provider of a customer written over some > hours. I...

Typesetting TOC with memoir (how to flushleft entries)
I've trying to understand the TOC typesetting stuff in the Memoir class. I've almost succeeded to get what I want except for one thing. I would like not my entries justified. You'll find a page example here: The problem is in the section definition (which serves here to make the level before part and chapter (this book is a set of three novels, and one of them have special division. Since I don't use the section level in the book, i coded my fake section adding contents to TOC using the section level.) I have not seen a way t...

memoir: format of paragraph entries in TOC
This post is concerned with the memoir class. I would like to modify the font used to typeset the paragraph-level entries in the table of contents to be smaller, so in accordance with the instructions on pages 96 and 97 of the memoir documentation, I added the following line to my document preamble: \renewcommand{\cftparagraphfont}{\small} I get an error message telling me that \cftparagraphfont is not defined. After looking at the source code in memoir.cls, it appears that the paragraph entries are set using the font specified by \cftsubsubsectionfont. I am going to try redefining the ...

Help w/ TOC and Unnumbered Entries
I wish to add unnumbered entries in the TOC that refer to particular pages in the document without adding an additional section, subsection, etc. in the document. For example: 1. CH 1 1.1 Topic 1 Selection A Selection B 1.2 Topic 2 These commands accomplish the task: \subsection*{Selection A} \addcontentsline{toc}{subsection}{Selection A} but insert "Selection A" in the text as well as an extra line. Leaving the argument of \subsection* blank, I get rid of "Selection A" in the text, but I still have an extra line. What I would like is some way to mark and name a particu...

Hi, after seeing that it is possible to have in the title row text entries separated by newline \n within a single cell, I wondered why this seems not to be possible for an ordinary cell. Does anyone have an idea about out? Please check out the code example: use Tk; use Tk::TableMatrix; my $mw = MainWindow->new; my $titleHash = { "0,0" => "abc", "0,1" => "123\ndef", }; my $table; $table = $mw->Scrolled('EMatrix', -titlerows => 1, -roworigin => 0, -colorigin =&...

[Memoir] Extra space in TOC entry for \part
I noticed an extra space in the table of contents for \part entries after updating to the latest memoir.cls (2008/05/26 v1.61803 - mempatch.sty v5.1). The space is placed before foo in the following example: \documentclass[11pt,danish,a4paper,twoside,openright,onecolumn,final]{memoir} \usepackage[danish]{babel} % SOLUTION %\makeatletter %\renewcommand{\partnumberline}[1]{% % \hb@xt@\@tempdima{% % \cftpartname\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb} %\makeatother \begin{document} \tableofcontents \cleardoublepage \part{foo\\bar} \chapter{foo\\bar} \end{document} As far as I can tel...

python logging, handling multiline log entries
Hi python fellows, I'm looking to do the following : import logging l = logging.getLogger('aHeader') l.handlers = [] l.addHandler(logging.StreamHandler()) l.handlers[-1].setFormatter(logging.Formatter("%(asctime)s - %(name)s - %(message)s")) l.error('1st line\n2nd line') output: 2010-11-04 12:22:05,593 - aHeader - 1st line 2nd line I'd like to get something like: 2010-11-04 12:22:05,593 - aHeader - 1st line 2nd line I don't want to get the header on every line, otherwise I would just nee...

memoir: dotted Part and Chapter ToC entry?
Dear All, I am a bit confused as my publisher wants me to typeset /all/ lines of the table of contents of my upcoming book with dotted leaders, including the Part and Chapter entries (and I have 36 chapters). However, the memoir manual (the version I use says: last changed 2011/03/06) has on the last text line of page 155: "Dotted leaders are not available for Part and Chapter ToC entries." Is there a possibility to bypass this restriction? Also, the page numbers of part and chapter entries are printed boldface, my publisher prefers regular weight. Is there a chan...

hyperref: getting non-toc entries in bookmarks
I use the hyperref package with options (among others) bookmarks, bookmarksnumbered. I would like to get non-toc entries in the bookmarks list of a pdflatex'ed file (e.g., title page, copyright page, dedications page). If this is possible, can I create a hierarchy (e.g., `chapter' Pre, with `sections' title, copyright, dedication)? Thanks in advance, Erik ...

chapter title, ToC entry, and page header
Hi, I have a rather long chapter title, which I want to appear in a shorter version in the header of (even) pages, but *not* in the toc; there, the long title should appear. Hence, the usual way with \chapter[Abbrev. title]{Very long title} doesn't work. I have tried to set it explicitly with \fancyhead[CE]{Abbrev. title}, but then, of course, it will appear in the subsequent chapters as well instead of the current chapter title. The \addtocontents way is maybe possible, but certainly too clumsy in this case. There must be a way to do this, and it's probably pretty trivial, but I can&#...