0

I've search on many ways for this.

I want to quit the title toc bc the title format is working over it. I want a clear title in toc, but my format is affecting. I share my code next:

\titleformat{\section}[display]{\raggedleft\bfseries \Large \scshape}{}{1pt}{  
  \begin{spacing}{0} %https://topanswers.xyz/tex?q=993
  \parskip=0pt
  \rule{\textwidth}{1pt}\\ 
  \vspace{5pt}
  SECCIÓN \\
  \vspace{5pt}
  \thesection \\
  \vspace{7pt}
  \rule{\textwidth}{1pt}
  \end{spacing}
  \vspace{25pt}
  }[]  

Next to begin the document, i have:

\thispagestyle{empty}
\tableofcontents

So, at present the result that I want to avoid, there is no TOC as itself, just a section counting:

My page with the title format without the toc title]

2
  • You should define another format with \titleformat{name=\section, numberless}…
    – Bernard
    Aug 8, 2021 at 20:19
  • Respond as a answer, just to help the format here. Thanks! I didn't thought that! Aug 8, 2021 at 21:04

2 Answers 2

1

As the table of contents is an unnumbered section in the article class, you can specify the formatting of all unnumbered sections with the dedicated key:

\titleformat{name=\section,numberless}[style]{}{0pt}{…}.

2
  • Precisely that modification was needed, the numberless. I found in documentation is necesary to put name=\section, numberless as a separator. The one give more complications was the explicit in options of titlesec, it have be there as the post i found link, and of course, the documentation explains it. My titleformat for the numbered sections needs a modification, and it had solved with this post link Aug 8, 2021 at 22:33
  • Fine! Anyway, one should always read the documentation, not just skim through them·
    – Bernard
    Aug 8, 2021 at 22:49
0

Solution founded!

Simple share the code, note the format to define titleformat by explicit form.

\usepackage[explicit]{titlesec}
\titleformat{\section}[display]{\raggedleft\bfseries \Large \scshape}{  
  \begin{spacing}{0} %https://topanswers.xyz/tex?q=993
  \parskip=0pt
  \rule{\textwidth}{1pt}\\ 
  \vspace{5pt}
  SECCIÓN \\
  \vspace{5pt}
  \thesection \\
  \vspace{7pt}
  \rule{\textwidth}{1pt}
  \end{spacing}
  \vspace*{-20pt}
  }{3pt}{#1}
\titleformat{name=\section,numberless}[display]{\Huge\scshape\centering}{}{1pt}{#1}

Here is the results:

enter image description here

enter image description here

One of the post I use was of 6 years ago, and the other from 4 years. It is amazing to think resources like this great page still helping and the way to do it.

The links was:

  1. Found how to select numberless sections. titlesec and \section* in \titleformat

  2. As the explicit mode was needed, I have to change the numbered sections. Section title disappears when using titlesec?

Not the answer you're looking for? Browse other questions tagged .