Hot answers tagged

4

Here is a solution. I will try to explain if needed. \documentclass{article} \usepackage{xcolor} \newenvironment{myenv}% {\color{red}% \addtocontents{toc}{\protect\begin{mytocenv}}}% {\addtocontents{toc}{\protect\end{mytocenv}}} \makeatletter \let\mtl@section\l@section \newenvironment{mytocenv}% ...


4

Now it's working -- with automatic section title setting and hyperlinks, if needed. \documentclass{article} \usepackage[lmargin=1.5cm,rmargin=1.5cm]{geometry} \usepackage{blindtext} \usepackage{array} \usepackage{longtable} \usepackage{tabularx} \usepackage{xpatch} \usepackage{xparse} \newif\ifhyperrefloaded \usepackage[hypertexnames=true]{hyperref} ...


4

The tocdepth counter decides to which depth down the entries appear in the ToC. Usually, following values hold \setcounter{tocdepth}{-1} -- only parts \setcounter{tocdepth}{0} -- only parts and chapters \setcounter{tocdepth}{1} -- part,chapters,sections \setcounter{tocdepth}{2} -- part,chapters,sections, subsections \setcounter{tocdepth}{3} -- ...


3

If I understand your objective correctly, it may be achieved by using \pageref instructions to point to the page numbers where various \section instructions occur. \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[russian]{babel} \usepackage{tabularx} % fonts for sectioning headers \usepackage{sectsty} ...


3

You could also define a command instead of an environment; makes it easier IMO if you have consecutive sections which you want colored: \documentclass{article} \usepackage{xcolor,titlesec,titletoc} \newcommand{\mystyle}[1][black]{% \titleformat {\section}% {\normalfont\Large\bfseries\color{#1}}% {\thesection}% {1em}{}% % \titlecontents ...


2

Well, this is a somewhat hidden feature, but minitoc provides for the \adjustmtc command, that is meant for starred chapters etc., i.e. for the case that the mtc counter is off by one. This command can be 'misused' to provide the minitoc for the following chapter. The \adjustmtc[n] command is documented on page 34 of the current manual of minitoc. The ...


1

You can use etoc for this, via its label/ref mechanism for tocs. \documentclass{book} \usepackage{etoc} \usepackage{blindtext} \makeatletter \newcommand*\cleartoevenpage {% \clearpage \if@twoside \ifodd \c@page \hbox {}\newpage \if@twocolumn \hbox {}\newpage \fi \fi \fi } \makeatother \begin{document} \tableofcontents % switch to ...


1

Adapting the answer from here: \documentclass{article} \usepackage{tikz} \usepackage{tikzpagenodes} \begin{document} %\maketitle \tableofcontents \tikz[remember picture,overlay] \draw[color=cyan] ([xshift=-14pt]current page text area.north west) -- ([xshift=-14pt,yshift=6cm]current page text area.west); \section{Introduction} ...


1

You can change the value of the counter tocdepth mid-document, writing it to the ToC at the appropriate spot. This allows you to vary what shows and what doesn't show. \documentclass{report} \begin{document} \tableofcontents \chapter{This chapter is listed in the contents page} \section{So are all its sections} \subsection{--- and subsections!} ...


1

hyperref generates and transfers the hyperlinks verbatim to whichever package you use for setting your ToC. This allows hyperref to be compatible with a host of packages. Since it's known that you're using the combination \usepackage[titles]{tocloft} \usepackage[linktoc=all]{hyperref} we can knowing update what hyperref transfers and update the way ...



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