This is an addendum for this question: How to add an itemized list to the ToC

enter image description here

I have done everything from the link above, so far, so good...and printed it....the author wants the lines to finish before the page number column....like the picture....is there a way to reduce these specific lines length NOT TO affect the others?

And also wants to reduce the size betwen the two first topics there, Apresentação and Introdução.. Is there a way to do it?

Here is the code to get the following result:

\documentclass[14pt, twoside, a5paper, extrafontsizes]{memoir} %Classe estilo memoir
\usepackage[brazilian]{babel} %Traduz doc para português do Brasil
\usepackage[utf8]{inputenc} %Reconhece acentuação draft
\usepackage{indentfirst} %Define identação em todo primeiro parágrafo
\usepackage{garamondx} %Define a nova fonte garamond
\usepackage{leading} %Define espaçamento entre linhas
\usepackage{eqparbox} %Serve para colocar o \frontmatter alinhado a esquerda no sumário

\newcommand{\desctotoc}[1]{% Serve para adicionar descrição nos itens do sumário

\setstocksize{21cm}{14cm} %Define tamanho do livro
\setulmarginsandblock{2.2cm}{2.2cm}{*} %Define margem vertical maior TOP/BOT
\setlrmarginsandblock{2.1cm}{1.3cm}{*} %Define margem horizontal maior
\setheadfoot{1.5cm}{1cm} %Distancia do texto pro número da página

\leading{16pt} %orientação de leading

\checkandfixthelayout %Define margem horizontal maior


\copypagestyle{chapter}{plain} % make chapter a page style of its own

\renewcommand{\chapnumfont}{\bfseries\huge} %Formata Nº título de Cap
\renewcommand{\chapnamefont}{\small} %Formata "Capítulo X"
\renewcommand{\chaptitlefont}{\normalfont\Huge} %Formata Título de Cap

\newlength{\aftertocskip} %Define espaço menor entre "Sumário" e Cap1
\setlength{\aftertocskip}{1\baselineskip}% Space after ToC title

\let\oldcftchapterfont\cftchapterfont% Save ToC-related chapter entry font
    \addtocontents{toc}{% Update chapter entry font

    \addtocontents{toc}{% Restore chapter entry font

\begin{document} %=====================================================================================================


    \protected\def\apresentacao{APRESENTAÇÃO \protect\\ à 16ª edição}
    [Apresentação à 16ª edição]

        \pagenumbering{arabic}%retoma numerção de página
        \setcounter{page}{21}%retoma numeração na núm{x}    

    \chapter{Potencial do Ser Humano}
            Ser humano – potencial latente, inexplorado ou \linebreak bloqueado.

    \chapter{O Poder de Sua Mente}
        Consciente – “Eu racional”.
        Subconsciente - É mecânico e funciona automaticamente.

    \chapter{Processo Psíquico do Poder Extra}
            Fases do processo psíquico. O poder da imaginação.

    \chapter{Funcionamento do Processo Psíquico}
                Dúvida Emocional e Ansiedade.

    \chapter{O Pensamento Positivo} %Aqui tem tabela customizada com linhas mais juntas
            Pela repetição de pensamentos, programa-se o \linebreak Subconsciente como, pela repetição de movimentos, \linebreak desenvolve-se habilidades. Registro do sucesso e da \linebreak Felicidade (Diário da Felicidade). \dotfill 91

  • 3
    Please provide a complete small LaTeX document (a.k.a. minimal working example) showing the settings and definitions that produce such an output. – gernot says Reinstate Monica Sep 8 '16 at 20:19
  • There you go... – Adriano Sep 9 '16 at 5:19

To reduce the space between the first two contentslines I suggest to just add something like


between the two chapter headings. This is just a quick hack; a clean solution would require to define when exactly space should be reduced and to modify how contents lines are written.

For the other issue, replace the current definition of \desctotoc by

  \parbox{\desctocwidth}{\small #1}%

With this modification the description is wrapped into the command \desctoc in the table of contents. By defining this command adequately you can determine how the description is typeset. In my definition it is typeset in a parbox a bit smaller than the text width, in a smaller font.

Edit: On special request, here is a second version of the commands, with an optional argument for the page number. Replace the definition of \desctotoc by

  \parbox[b]{\desctocwidth}{\small #2\ifx\relax#1\relax\else\ \dotfill\fi}%

If there is no page number attached to the description, use it as \desctotoc{<text describing chapter>}. If a page number should also be given, use it like \desctotoc[<page number>]{<text describing chapter>}. (Don't include \dotfill in the text, it will be added automatically when a page number is present.)

As an example, when changing your file to

\chapter[Apresentação à 16ª edição][APRESENTAÇÃO]{\apresentacao}
\addtocontents{toc}{\vskip-2ex}   %%% Reduce space
\chapter{Potencial do Ser Humano}
\desctotoc{Ser humano – potencial latente, inexplorado ou \linebreak bloqueado.}
\chapter{O Pensamento Positivo}
\desctotoc[91]{Pela repetição de pensamentos, programa-se o
  \linebreak Subconsciente como, pela repetição de movimentos,
  \linebreak desenvolve-se habilidades. Registro do sucesso e da
  \linebreak Felicidade (Diário da Felicidade).}

we obtain the following table of contents (using standard fonts instead of Garamond; didn't bother to install them).

enter image description here

  • Is there a way to keep the last chapter description to the end of the line so the number 91 be under de page numbers column? – Adriano Sep 9 '16 at 23:45
  • 1
    The toc now more or less complies with your wishes. I'm not convinced, though, that the description should be mixed with page numbers, but since I don't know the details, I can't suggest a more appropriate solution. It seems to me that you are mixing descriptions of chapters (without page number) with toc entries that should be produced automatically by headings (or at least commands) in the text. It looks fishy to have hard-coded page numbers in the document. – gernot says Reinstate Monica Sep 11 '16 at 22:10
  • 1
    Try to replace the \linebreaks in the descriptions by \\ . With a \linebreak TeX still fills the line, inserting quite some space if necessary. A double backslash just tells to end the line without right-justifying it. This might be better if you just want to start a new line. – gernot says Reinstate Monica Sep 11 '16 at 22:14
  • 1
    Regarding another hard-coded page number: Replace \mainmatter and the two following lines for getting arabic page numbers and for resetting the page number by the following three commands: \edef\temppagenumber{\arabic{page}}\mainmatter\setcounter{page}{\temppagenumber}. The first command stores the current page number in \temppagenumber, \mainmatter sets the style for page numbers to arabic (no need to do it yourself), which as a side effect resets the counter, and the last command sets the page counter to its old value. – gernot says Reinstate Monica Sep 11 '16 at 22:36
  • 1
    Regarding mainmatter without reset, see also this answer. – gernot says Reinstate Monica Sep 11 '16 at 22:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.