Re: Fancy e Capitolo 0: Indice, lo so di nuovo ma…

#25312
Up
0
Down
::


Prova questo codice:

`
\documentclass[a4pape]{book}
\usepackage[latin1]{inputenc}
\usepackage[italian]{babel}
\usepackage{lipsum} %per iserire testo fittizio
\usepackage{fancyhdr}
\clearpage{\pagestyle{empty}\cleardoublepage}

\makeatletter
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
\hbox{}
\vspace*{\fill}
\vspace{\fill}
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother

\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyfoot[C]{} % except the center
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}}

\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancyhf{}
\fancyhead[LE,RO]{\scshape\thepage}
\fancyhead[LO]{\scshape\footnotesize\nouppercase{\rightmark}}
\fancyhead[RE]{\scshape\footnotesize\nouppercase{\leftmark}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}

\fancypagestyle{mymain}{%
\fancyhf{}
\fancyhead[LE,RO]{\scshape\thepage}
\fancyhead[RE]{\scshape\footnotesize\nouppercase{\chaptername{} \thechapter: \leftmark}}
\fancyfoot[CO,CE]{\scshape\footnotesize\nouppercase{Applicazione ad uso del marketing}}}

\begin{document}
\frontmatter
\tableofcontents\cleardoublepage
\pagestyle{mymain}
\mainmatter
\chapter{Titolo capitolo}
\lipsum
%% ecc. ecc.
\end{document}`

Per vedere l’effetto finale aggiungi altre righe con \chapter{Titolo capitolo} \lipsum, in modo che l’indice occupi almeo due pagine.
Ho apportato qualche aggiunta e qualche modifica al tuo codice, in paticolare per avere una pagina bianca nel caso sia priva di testo. Ho anche eliminato qualche riga. Dai un’occhiata. Come vedrai ho semplicemente definito un nuovo stile di pagina (chiamato mymain) da usare per il testo. \cleardoublepage dopo \tableofcontents serve perché altrimenti ritorna il fatidico Capitolo 0.
Spero di eserti stato d’aiuto.
Ciao,
Ivan

Go to top