Re: fancyhdr: testatine di opera collettanea

#23669
Up
0
Down
::


Questo codice funziona, anche se non è molto pulito… 🙁 il problema sta a mantenere le testatine nella bibliografia e farle cominciare anche a sinistra.

Forse qualcuno può darti un codice migliore, comunque fammi sapere.

`
\documentclass[twoside, a4paper, openany]{report}

\usepackage{fancyhdr}
\pagestyle{fancy}

\newcommand{\autoreattuale}{}
\newcommand{\capitoloattuale}{}
\newcommand{\autorecapitolo}[1]{\renewcommand{\autoreattuale}{#1}}

\usepackage{lipsum}

\fancyhead{}
\fancyhead[OR]{\thechapter. \capitoloattuale}
\fancyhead[EL]{\autoreattuale}

\makeatletter
\newcommand{\my@chapter}{}
\let\my@chapter\chapter
\newcommand{\@scapitolo}[1]{\my@chapter*{#1}}
\newcommand{\@capitolo}[2][]{\cleardoublepage\renewcommand{\capitoloattuale}{#2}\my@chapter[#1]{#2}}
\renewcommand{\chapter}{\@ifstar{\@scapitolo}{\@capitolo}}
\makeatother

\begin{document}
\chapter{a}\autorecapitolo{autore1}
\lipsum
\lipsum

\chapter{b}\autorecapitolo{autore2}
\lipsum
\lipsum

\begin{thebibliography}{a}
\bibitem{a} a
\bibitem{b} \lipsum\lipsum
\end{thebibliography}

\chapter{c}\autorecapitolo{autore3}
\lipsum\lipsum
\end{document}
`

Go to top