Re: Testatine e marche

#16420
DMW
    Up
    0
    Down
    ::


    Lorenzo,

    Una sezione non definita è uguale a zero, o meglio \thechapter.0, e quindi basta sfruttare il pacchetto ifthen. Quindi puoi scrivere:
    `
    \documentclass{book}

    \usepackage{fancyhdr,lipsum}
    \usepackage{ifthen}

    \pagestyle{fancy}
    \renewcommand{\chaptermark}[1]{
    \ifthenelse{\equal{\thesection}{\thechapter.0}}{\markboth{#1}{#1}}{\markboth{#1}{}}
    }
    \renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
    \fancyhf{}
    \fancyhead[LE,RO]{\scshape\thepage}
    \fancyhead[LO]{\bfseries\footnotesize\nouppercase{\rightmark}}
    \fancyhead[RE]{\bfseries\footnotesize\nouppercase{\leftmark}}

    \begin{document}
    …..`

    che fa tutto in automatico. Vedi se funziona bene perché ho fatto poche prove.

    Ciao

    Andrea
    ________________________
    Inoltre vi annuncio, che oltre al pacchetto ifthen, esiste anche xifthen
    http://tug.ctan.org/macros/latex/contrib/xifthen/xifthen.pdf
    gli ho dato un’occhiata e sembra ottimo.

    Go to top