TransWikia.com

Package titleps: redefined plain page style footer being used by redefined empty page style

TeX - LaTeX Asked by Lu Cavalheiro on December 15, 2020

I’m using titlesec package with pagestyles option to redefine both plain and empty page styles. But when compile the code below, the empty page uses plain footer.

Code:

% Início do preâmbulo
documentclass[a4paper,11pt,twoside]{book}

%% usepackages diversos
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage[brazilian]{babel}
usepackage[top=30mm,left=20mm,right=20mm,bottom=20mm]{geometry}
usepackage[table]{xcolor}
usepackage{graphicx}
usepackage{wrapfig}
usepackage{array}
usepackage{float}
usepackage{fontspec}
usepackage{setspace}
usepackage{hyperref}
usepackage[clearempty,pagestyles]{titlesec}

%% Definições de fonte
setmainfont{LiberationSerif-Regular.ttf}[BoldFont=LiberationSerif-Bold.ttf,ItalicFont=LiberationSerif-Italic.ttf,BoldItalicFont=LiberationSerif-BoldItalic.ttf]
setsansfont{LiberationSans-Regular.ttf}[BoldFont=LiberationSans-Bold.ttf,ItalicFont=LiberationSans-Italic.ttf,BoldItalicFont=LiberationSans-BoldItalic.ttf]
setmonofont{LiberationMono-Regular.ttf}[BoldFont=LiberationMono-Bold.ttf,ItalicFont=LiberationMono-Italic.ttf,BoldItalicFont=LiberationMono-BoldItalic.ttf]
setstretch{1.15}

%% setlenghts diversos
setlength{parindent}{1.25cm}
setlength{parskip}{6pt}
setlength{tabcolsep}{1mm}
setlength{columnsep}{5mm}

%% setcounters diversos
setcounter{secnumdepth}{-1}
setcounter{tocdepth}{3}

%% Definições para o pacote hyperref
hypersetup{linktoc=all,colorlinks=true,allcolors=black}

%% renewcommands diversos
renewcommand{labelenumi}{arabic{enumi}}
renewcommand{labelenumii}{arabic{enumii}}
renewcommand{labelenumiii}{arabic{enumiii}}
renewcommand{labelenumiv}{arabic{enumiv}}
addtocaptionsbrazilian{renewcommand{contentsname}{Índice}}

%% Definições de novos estilos de página
renewpagestyle{empty}{%
    setheadrule{0pt}%
    setfootrule{0pt}%
    sethead[][][]{}{}{}%
    setfoot[][][]{}{}{}%
}%
renewpagestyle{plain}[scriptsize]{%
    setheadrule{0pt}%
    setfootrule{1pt}%
    footrule{}%
    setfoot[][ - thepage{} - ][]{}{ - thepage{} - }{}%
}%
newpagestyle{agradecimento}[scriptsize]{%
    setheadrule{0pt}%
    setfootrule{1pt}%
    footrule{}%
    setfoot[][ - thepage - ][]{}{ - thepage - }{}%
}%

% Fim do preâmbulo

% Início do documento
begin{document}

pagestyle{empty}
pagenumbering{gobble}
chapter[Capa]{}
begin{center}
    vfill
    {bfseriesHuge Thalassiapar}
    vspace{1em}
    {Large Um mundo de exploração e aventuras para emph{Dungeon World}par}
    vspace{1em}
    por Lu Cavalheiropar
    vfill
    {small Licença: Creative Commons BY-SA 4.0par}
    {small 2020par}
    vfill
    hspace{0pt}
end{center}
clearpage
pagestyle{agradecimento}
pagenumbering{Alph}
chapter{Agradecimentos}
end{document}

Result:
Page 1
Page 2

As seen on image, page 1 (used as title page) has same footer page 2 has, but page 1 is set to empty page style and page 2, plain. How to prevent page 1 from using page 2 footer?

One Answer

Don't redefine the empty page style – just use thispagestyle{empty} right after the first  chapter. Also, you don't have to use setheadrule{0pt} if you want no head rule: contrar=y to fancyhdr, you just have not to use headrule.

Also, always load hyperref last (very few exceptions – most notably cleveref) and it is recommended to load the language option with documentclass, so that all language dependent packages be informed.

documentclass[a4paper,11pt,twoside, brazilian]{book}

%% usepackages diversos
usepackage[T1]{fontenc}
usepackage{babel}
usepackage[top=30mm,left=20mm,right=20mm,bottom=20mm]{geometry}
usepackage[table]{xcolor}
usepackage{graphicx}
usepackage{wrapfig}
usepackage{array}
usepackage{float}
usepackage[clearempty ,pagestyles]{titlesec}%
usepackage{fontspec}
usepackage{setspace}
usepackage{hyperref}

%% Definições de fonte
setmainfont{LiberationSerif-Regular.ttf}[BoldFont=LiberationSerif-Bold.ttf,ItalicFont=LiberationSerif-Italic.ttf,BoldItalicFont=LiberationSerif-BoldItalic.ttf]
setsansfont{LiberationSans-Regular.ttf}[BoldFont=LiberationSans-Bold.ttf,ItalicFont=LiberationSans-Italic.ttf,BoldItalicFont=LiberationSans-BoldItalic.ttf]
setmonofont{LiberationMono-Regular.ttf}[BoldFont=LiberationMono-Bold.ttf,ItalicFont=LiberationMono-Italic.ttf,BoldItalicFont=LiberationMono-BoldItalic.ttf]
setstretch{1.15}

%% setlenghts diversos
setlength{parindent}{1.25cm}
setlength{parskip}{6pt}
setlength{tabcolsep}{1mm}
setlength{columnsep}{5mm}

%% setcounters diversos
setcounter{secnumdepth}{-1}
setcounter{tocdepth}{3}

%% Definições para o pacote hyperref
hypersetup{linktoc=all,colorlinks=true,allcolors=black}

%% renewcommands diversos
renewcommand{labelenumi}{arabic{enumi}}
renewcommand{labelenumii}{arabic{enumii}}
renewcommand{labelenumiii}{arabic{enumiii}}
renewcommand{labelenumiv}{arabic{enumiv}}
addtocaptionsbrazilian{renewcommand{contentsname}{Índice}}

%% Definições de novos estilos de página
renewpagestyle{plain}[scriptsize]{%
    setfootrule{1pt}%
    footrule{}%
    setfoot[][ - thepage{} - ][]{}{ - thepage{} - }{}%
}%
newpagestyle{agradecimento}[scriptsize]{%
    setfootrule{1pt}%
    footrule{}%
    setfoot[][ - thepage - ][]{}{ - thepage - }{}%
}%

% Fim do preâmbulo
usepackage{lipsum}
% Início do documento
begin{document}
%pagenumbering{gobble}
chapter[Capa]{}thispagestyle{empty}
begin{center}
    vfill
    {bfseriesHuge Thalassiapar}
    vspace{1em}
    {Large Um mundo de exploração e aventuras para emph{Dungeon World}par}
    vspace{1em}
    por Lu Cavalheiropar
    vfill
    {small Licença: Creative Commons BY-SA 4.0par}
    {small 2020par}
    vfill
    hspace{0pt}
end{center}

chapter{Agradecimentos}
pagestyle{agradecimento}
pagenumbering{Alph}

end{document} 

Answered by Bernard on December 15, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP