2

I need to remove a string ("p.") that is appearing before each page number in the Table of Contents. I have this on the .sty file:

%table of contents
\renewcommand\@dotsep{2}

\renewcommand\l@chapter[2]{
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{1.5em}%
\begingroup
  \ifthenelse{\boolean{ABNTpagenumstyle}}
    {\renewcommand{\@pnumwidth}{3.5em}}
    {}
  \parindent \z@ \rightskip \@pnumwidth
  \parfillskip -\@pnumwidth
  \leavevmode \normalsize\ABNTtocchapterfont
  \advance\leftskip\@tempdima
  \hskip -\leftskip
  #1\nobreak\dotfill \nobreak%
  \ifthenelse{\boolean{ABNTpagenumstyle}}
     {%
      \hb@xt@\@pnumwidth{\hss 
        \ifthenelse{\not\equal{#2}{}}{{\normalfont p.\thinspace#2}}{}}\par
     }
     {%
      \hb@xt@\@pnumwidth{\hss #2}\par
     }
  \penalty\@highpenalty
\endgroup
\fi}

\renewcommand*\l@section{\@dottedtocline{1}{0em}{2.3em}}
\renewcommand*\l@subsection{\@dottedtocline{2}{0em}{3.2em}}
\renewcommand*\l@subsubsection{\@dottedtocline{3}{0em}{4.1em}}

When I remove "p." from the following line:

\ifthenelse{\not\equal{#2}{}}{{\normalfont p.\thinspace#2}}{}}\par

I get this: "p." removed from upper levels

I was able to remove "p." from upper levels. How can I remove "p." from the lower levels?

These are the packages being used:

\documentclass[tocpage=plain,espaco=simples,appendix=Name]{abnt}
\usepackage[latin1]{inputenc}
\usepackage[brazil]{babel}
\usepackage{hyperref}
\usepackage[alf]{abntcite}
\usepackage{mdwlist}
\usepackage{dsfont}
\usepackage{graphicx}    
\usepackage{uff} % the .sty file
\usepackage[pagewise]{lineno}
\usepackage{longtable}
  • you need to do the same with \@dottedtocline command. – touhami Mar 19 '17 at 22:09
  • Where can we find this abnt class? – user31729 Mar 19 '17 at 22:12
  • @ChristianHupfer: See mtm.ufsc.br/~krukoski/pub/Latex – Marco Daniel Mar 19 '17 at 22:18
  • abnt is a really old class -- why not use abntex2? – Joseph Mar 23 '17 at 22:29
  • @Joseph I am using a model provided by my University. I changed only the strictly needed. But thank you for the advice. – Aline Mar 25 '17 at 0:21
1

You have to add the following redefinition to your style file:

\renewcommand{\@dottedtocline}[5]{%
  \ifthenelse{\boolean{ABNTpagenumstyle}}
     {%
      {\renewcommand{\@pnumwidth}{2.5em}%
       \renewcommand{\@tocrmarg}{3.5em}
       \old@dottedtocline{#1}{#2}{#3}{#4}%
             {\ifthenelse{\equal{#5}{}}{}{\thinspace#5}}}%
     }%
     {\old@dottedtocline{#1}{#2}{#3}{#4}{#5}}%
}

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.