Re: [Risolto] Miglioramento codice per testatine

#60186
Up
0
Down
::

Salve a tutti.
Esiste un modo meno contorto di ottenere delle testatine del genere:
`\documentclass[a4paper]{book}

\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage{calc}

\newlength{\spazio}
\setlength{\spazio}{\marginparwidth+\marginparsep-\widthof{\textbf{\sffamily\thepage}}}

\pagestyle{fancy}
\addtolength{\headwidth}{\marginparsep}
\addtolength{\headwidth}{\marginparwidth}
\fancyhf{}
\renewcommand{\chaptermark}[1]{\markboth{\textbf{\chaptername\ \thechapter}.\ #1}{}}
\fancyhead[RO]{\sffamily\small\nouppercase\leftmark\hspace{\the\spazio}\textbf{\sffamily\thepage}}
\fancyhead[LE]{\textbf{\sffamily\thepage}\hspace{\the\spazio}\sffamily\small\nouppercase\leftmark}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.0pt}
\fancypagestyle{plain}{%
\fancyhead{}\fancyfoot[C]{}%
\renewcommand{\headrulewidth}{0pt}}

\begin{document}
\chapter{Esempio}
\lipsum\lipsum\lipsum
\end{document}`
?

Grazie
Orlando

`\newlength{\spazio}
\setlength{\spazio}{\marginparwidth+\marginparsep}
\fancyhead[RO]{\sffamily\small
\nouppercase\leftmark\makebox[\spazio][r]{\bfseries\thepage}}
\fancyhead[LE]{\sffamily\small
\makebox[\spazio][l]{\bfseries\thepage}\nouppercase\leftmark}`
Sicuro che il punto dopo il numero del capitolo non vada anch’esso in nero? Sicuro che il numero di pagina vada tanto in là?

Ciao
Enrico

Go to top