Page LayoutEach title on a separate page of its own with titlesec

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
manuavazquez
Posts: 9
Joined: Wed Nov 10, 2010 2:49 pm

Each title on a separate page of its own with titlesec

Post by manuavazquez »

Hi,

I'm trying to get titlesec to put the title of each chapter, section and subsection in a different page. Right now, I'm close, but there are two problems:

- titles show up twice in the index
- the index also is affected by the settings and its title is in a different page

Any help would be appreciated.

Cheers.

Code: Select all

Code, edit and compile here:
% !TeX spellcheck = es_ES
\documentclass[12pt,a4paper,oneside]{book}
\usepackage[spanish,activeacute]{babel}
\usepackage[utf8]{inputenc}
\usepackage{makeidx}
\usepackage[bf,big,center]{titlesec}
\titleformat{\chapter}[display]
{\normalfont\Large\filcenter\sffamily}
{\thechapter}
{1pc}
{\titlerule
\vspace{1pc}%
\Huge}
[\newpage] % creates the new page
\titleformat{\section}
{\vspace*{\fill}\centering\normalfont\Large\bfseries}
{\thechapter.\Alph{section}}
{1em}
{\Large}
[\vspace*{\fill}\newpage]
\titleformat{\subsection}
{\vspace*{\fill}\centering\normalfont\Large\bfseries}
{\thechapter.\Alph{section}.\arabic{subsection}}
{1em}
{\Large}
%[\vspace*{\fill}\newpage]
\titleformat{\subsubsection}
{\vspace*{\fill}\centering\normalfont\Large\bfseries}
{}
{1em}
{\Large}
[\vspace*{\fill}]
%[\vspace*{\fill}\newpage]
\makeindex
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Each title on a separate page of its own with titlesec

Post by Johannes_B »

I guess the index is the table of contents. You can avoid it being affected by defining the layout after calling the toc. I cannot reproduce that the entries are twice in there.

Code: Select all

Code, edit and compile here:
% !TeX spellcheck = es_ES
\documentclass[12pt,a4paper,oneside]{book}
\usepackage[spanish,activeacute]{babel}
\usepackage[utf8]{inputenc}
\usepackage{makeidx}
\usepackage[bf,big,center]{titlesec}
\makeindex
%\renewcommand{\thesubsection}{\thesection.\alph{subsection}}
\renewcommand{\thesection}{\thechapter.\Alph{section}}
\renewcommand{\thesubsection}{\thechapter.\Alph{section}.\arabic{subsection}}
\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{2}
\begin{document}
\pagenumbering{roman}
\pagestyle{headings}
\vspace*{6cm}
\thispagestyle{empty}
\begin{center}
\huge\textbf{Title}
\end{center}
\vspace*{4cm}
\begin{center}
\Large Mr. Foo
\end{center}
\vspace*{2cm}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
manuavazquez
Posts: 9
Joined: Wed Nov 10, 2010 2:49 pm

Re: Each title on a separate page of its own with titlesec

Post by manuavazquez »

Thank you! That solves the index title issue. However, I still get duplicated entries for "Section title", one with a label and another one without it, something like this

1. Chapter Title
1.A. Section Title . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Section Title . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.A.1. Subsection Title . . . . . . . . . . . . . . . . . . . . . .

Quite weird :?
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Each title on a separate page of its own with titlesec

Post by Johannes_B »

I can reproduce the behaviour by clicking on Open in Online-editor with the above code block.
Make an update of package titlesec.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
manuavazquez
Posts: 9
Joined: Wed Nov 10, 2010 2:49 pm

Re: Each title on a separate page of its own with titlesec

Post by manuavazquez »

That did the trick!!

Thank you so much.
Post Reply