Tag Info

Hot answers tagged

16

I recommend using the tocloft package, although I suspect the titletoc package could also be used quite easily. tocloft provides many hooks for content to be inserted into the table of contents. Here's an example: \documentclass{book} \usepackage{tocloft,calc} \renewcommand\chaptername{Day} \renewcommand\cftchappresnum{\chaptername\space} ...


15

You could use the tocloft package; an example: \documentclass{book} \usepackage{tocloft} \newlength{\mylen} \renewcommand{\cftfigpresnum}{\figurename\enspace} \renewcommand{\cftfigaftersnum}{:} \settowidth{\mylen}{\cftfigpresnum\cftfigaftersnum} \addtolength{\cftfignumwidth}{\mylen} \begin{document} \listoffigures \begin{figure}[!ht] \centering ...


13

If I understand your requirements correctly, the following simple code will do (feel free to change the lengths and settings according to your needs): \documentclass{article} \usepackage{titletoc} \usepackage{lipsum} \titlecontents{section} [0cm]{\raggedleft\parshape 1 1cm \dimexpr\linewidth-3cm\relax} ...


13

Some packages and macros check whether \chapter is defined or not in order to take some action; for example, to typeset the bibliography as a chapter (book and report classes) or as a section (article class). The test they perform is based on \@ifundefined, something like \@ifundefined{chapter} {\section*{\refname}} {\chapter*{\bibname}} It's ...


12

I figured it out by using: \setlength{\cftbeforetoctitleskip}{-3em} Which didn't work before since I forgot to change Z to toc: \cftbeforeZtitleskip to \cftbeforetoctitleskip I believe Z can be changed to other things, other than 'toc'


12

This is basically tocloft's \cftchapterprecis, but in the list of figures instead: \documentclass{article} \usepackage{tocloft} \makeatletter \newcommand{\figsourcefont}{\footnotesize} \newcommand{\figsource}[1]{% \addtocontents{lof}{% {\leftskip\cftfigindent \advance\leftskip\cftfignumwidth \rightskip\@tocrmarg ...


11

The error you are getting comes from loading the tocloft and subfigure packages simultaneously, as the following example swhows: \documentclass{article} \usepackage{tocloft} \usepackage{subfigure} \begin{document} test \end{document} As soon as one processes this document, the following error shows up: ! LaTeX Error: Command \c@lofdepth already ...


11

tocloft provides \cftsetpnumwidth{<len>} which sets the value of \@pnumwidth to <len>, so you could just execute \cftsetpnumwidth{3em}% 3em width for page numbers after loading tocloft (see 2.3 Typesetting the entries, p 8 of the tocloft documentation):


11

The following table (taken from the tocloft documentation) lists the standard values for the indent and numwidth: You can use \cftsetindents to control the indent and numwidth values for the entries; the syntax is \cftsetindents{<entry>}{<indent>}{<numwidth>} To include the paragraphs, you will have to change the counters tocdepth ...


10

There's really no need to define a new command for the chapter in the appendices section; just before the appendices you can redefine the \@chapter command (defined in report.cls), to include the appendices in the new list instead of including them in the ToC; here's an example of such a redefinition; note that the second mandatory argument of \newlistof ...


10

At the start of the appendix, a redefinition of \cftchappresnum must be forwarded to the .toc file. I have appended the definition of \appendix to do so. \documentclass{book} \usepackage{tocloft,calc} \renewcommand{\cftchappresnum}{\chaptername\space} \setlength{\cftchapnumwidth}{\widthof{\textbf{Appendix~999~}}} \makeatletter \g@addto@macro\appendix{% ...


10

You can try the following: \documentclass{book} \usepackage[svgnames]{xcolor} \newcounter{chapcntr} \setcounter{chapcntr}{-1} \newcommand*\toccolor{% \ifcase\value{chapcntr}% \color{red}%----- 0 -- \or \color{blue}%---- 1 -- \or \color{green}%--- 2 -- \or \color{cyan}%---- 3 -- \else \color{black}%-- default \fi} ...


10

The width of \hbox{$\mkern10000mu.\mkern10000mu$} is 16003.67247pt when the font used by LaTeX is at 14.4pt; when you ask for 17.28pt size, the box becomes 19204.52904pt wide, which is more than \maxdimen and so everything goes awry. Notice that \fontsize{18}{18}\selectfont (the \selectfont is implicitly done when the formula begins) chooses, with the ...


10

Using the tocloft package you can do something like this: \documentclass{article} \usepackage{tocloft} \renewcommand\cftsecfont{\normalfont} \renewcommand\cftsecpagefont{\normalfont} \renewcommand{\cftsecleader}{\cftdotfill{\cftsecdotsep}} \renewcommand\cftsecdotsep{\cftdot} \renewcommand\cftsubsecdotsep{\cftdot} \begin{document} \tableofcontents ...


10

There are numerous problems with the code you posted, which will explain why the titles don't line up. Specifically: \renewcommand{\cftchapfont}{ } % this should not have a space it should be \renewcommand{\cftchapfont}{} % notice there is no space here The following command: \renewcommand{\cftchapaftersnumb}{\phantom{CHAPTER}\rm} is a hack for ...


9

book defines the ToC-related sectioning commands as follows: \newcommand*\l@chapter[2]{% \ifnum \c@tocdepth >\m@ne \addpenalty{-\@highpenalty}% \vskip 1.0em \@plus\p@ \setlength\@tempdima{1.5em}% \begingroup \parindent \z@ \rightskip \@pnumwidth \parfillskip -\@pnumwidth \leavevmode \bfseries ...


8

Here are some broad-stroke suggestions: Rather use the following order/code to include your appendix: \clearpage \phantomsection \addcontentsline{toc}{chapter}{Appendices} \include{JaccardCode} It will ensure correct hyper-referencing from the bookmarks panel in your PDF viewer. \phantomsection is provided by hyperref. A similar approach should be used ...


8

See "7.4. Partial lists" in titletoc package, it may be what you want. And I guess minitoc may also solve this problem itself. I'm not sure. For user-defined floats, I could only hack into titletoc. Luckily, it's not very difficult. And I think this feature should be added into titletoc. \documentclass{article} \usepackage{float,titletoc} ...


8

The label information is all in the aux file, so you can extract it something like this: \documentclass{article} \usepackage{hyperref} \long\def\findlabel#1#2\findlabel{% \ifx\newlabel#1\lablist\expandafter{\the\lablist\showlabel#2}\fi} %hyerref has 4 felds in each label culd use them but don't here \def\showlabel#1#2{% \par \noindent Label: ...


8

Loading tocloft with the titles option (see p.7 of the manual for details) is a good start. As there also seems to be an incompatibility between the \tableofcontents definition of the standard classes and fncychap, I use an unnumbered \contentsname chapter plus a "bare" ToC. \documentclass{book} \usepackage[Glenn]{fncychap} \usepackage[titles]{tocloft} ...


8

amsart and tocloft are not compatible. You can either use another document class or, if you want to continue using amsart, you'll need to redefine \l@section, \l@subsection, and \l@subsubsection, \tocsection, \tocsubsection, and \tocsubsubsection; something along these lines: \documentclass[11pt]{amsart} \makeatletter ...


8

Here's a possible solution; only information for sections with \todo notes will be written to the List of Todos: \documentclass{scrartcl} \usepackage{todonotes,xpatch,hyperref} % initial definitions for storing the section info (name and number) \def\thissectiontitle{} \def\thissectionnumber{} \newtoggle{noTodos} \makeatletter % redefinition of \@sect so ...


8

I think that this is an oversight, or even a bug, in the way that the table of contents is generated. Inside a latex file the \appendix command changes \@chapapp from \chaptername to \appendixname and this is used to get the right title in the chapter and appendix headings. Unfortunately, this information is NOT passed through to the table of contents file ...


7

A 'quick and dirty' solution, with \newlistof command from tocloft package. \documentclass{article}% \usepackage{blindtext} \usepackage[titles]{tocloft} \usepackage{etoolbox} \newcounter{example}[section] \renewcommand{\theexample}{\arabic{section}.\arabic{example}}% \newenvironment{example}[1][]{% \refstepcounter{example}% \ifblank{#1}{% }{% ...


7

tocloft provides \cft<set>numwidth for the width of the number associated with an entry <set>. In your case, <set> is myequations, so we can adjust \cftmyequationsnumwidth in the following way: \documentclass[12pt]{report} \usepackage{tocloft} \usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry} %%gmedina ...


7

In this case, instead of using tocloft to change the part entries (these entries and tocloft don't cooperate well), I'd rather redefine the \@part command (as implemented in book.cls): \documentclass{book} \usepackage[british]{babel} \usepackage[titles]{tocloft} \usepackage{hyperref} \hypersetup{colorlinks=true} \makeatletter \def\@part[#1]#2{% \ifnum ...


7

Here's one possibility which enables you to use all of tocloft features for subfigure entries when using the subcaption package; in particular, you can suppress the page numbers and the leaders (the dots from the entry to the page number): \documentclass{article} \usepackage[list=true]{subcaption} \usepackage{tocloft} \setcounter{lofdepth}{2} ...


7

In simple cases like this one it actually is a one-liner to call a macro for each element of a comma-separated list: \forcsvlist{\cftpagenumbersoff}{subsection,section} is all you need. The \forcsvlist{<handler>}{<csv list>} command is provided by the etoolbox package. It takes as first argument a handler, which has to be a macro (or sequence of ...


7

One possible solution; \l@subsection is redefined to suppress the page number and then, the etoolbox package is used to patch \section and \subsection: each subsection (except the first one) adds \unskip.~\textbullet\ before the corresponding entry in the ToC, and every \section adds the final dot (\unskip.) to the last subsection of every section in the ...


7

Here's a solution using tikz and tocloft. It places hidden nodes in the tocloft formatting commands for part and then uses the overlay function of tikz to draw the box. \documentclass{book} \usepackage{tocloft} \usepackage[svgnames]{xcolor} \usepackage{tikz} % command to make a hidden node \newcommand*{\hnode}[1]{% \tikz[remember picture] \node[minimum ...



Only top voted, non community-wiki answers of a minimum length are eligible