1

I'm trying to personalise my page setup using fancyhdr, but it only works for the document class book.

I read the fancyhdr documentation and I didn’t find any specific difference between the two document classes, although, as I said, it only works for book.

For more details, the line "COSTRUZIONE DI MACCHINE" and the page number appear on the same side every page, while I'm trying to alternate them.

Thanks in advance to everyone.

%impostazioni impaginazione
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[LE,RO]{\thepage}
\fancyfoot[LO,RE]{COSTRUZIONE DI MACCHINE}
\renewcommand{\chaptermark}[1]{%
\markboth{\thechapter. \ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
\setlength{\headheight}{15pt}
\fancyhead[LE]{\slshape \leftmark}
\fancyhead[RO]{\slshape \rightmark}

%ridefinizione plain \fancypagestyle{plain}{% \fancyhf{} \fancyfoot[LE,RO]{\thepage} \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt}}

egreg
  • 1,121,712

1 Answers1

2

The main difference between report and book is that the former uses by default the oneside option, while the latter uses twoside.

With oneside all pages are considered to be right-hand ones (odd numbered, even if the actual page number is even), so specifying LE and RE is moot. And fancyhdr actually tells you so:

Package fancyhdr Warning: \fancyfoot's `E' option without twoside option is useless.
(fancyhdr)                Please consider using the `twoside' option on input line 6.

Package fancyhdr Warning: \fancyfoot's E' option without twoside option is useless. (fancyhdr) Please consider using thetwoside' option on input line 7.

Package fancyhdr Warning: \fancyhead's E' option without twoside option is useless. (fancyhdr) Please consider using thetwoside' option on input line 12.

(line numbers may differ, of course).

Use book, it's better because it provides you \frontmatter and \mainmatter, but is the same as report under all respects, except for the default option mentioned at the beginning.

egreg
  • 1,121,712
  • I wanted to use report becuase I didn't want it to leave blank pages between chapters, but at this point I reckon it is better to just use book with openany. Thank you for your reply! – Giacomo Recine May 23 '23 at 23:16
  • @GiacomoRecine report leaves a blank page every other page. ;-) – egreg May 23 '23 at 23:52