0

im trying to set my work with the headers like the picture. In one page left header would like to see the section and in the just next page a right header with the subsection. How can i do it? Im workin with a document class "article"enter image description here

1
  • 1
    Hi and welcome to TeX.SE! You could look at the fancyhdr package. But the picture you show have a chapter and not a section, so it is a bit unclear what you want. (If chapters, then you should use some other class like report or book or memoir instead of article.)
    – mickep
    Mar 10, 2022 at 19:48

1 Answer 1

0

Tailor this code to your's needs:

\documentclass{book}
\usepackage[paperwidth=17cm,paperheight=24cm, inner=2cm,outer=1.5cm,top=2cm,bottom=1.5cm,headsep=3pt]{geometry}

\usepackage{lipsum}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[italian]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

\usepackage{emptypage}
\usepackage{lmodern,microtype}


\usepackage{fancyhdr}
\pagestyle{fancy}
%

\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancyhf{}
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\nouppercase{\rightmark}}
\fancyhead[RE]{\bfseries\nouppercase{\leftmark}}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
%\addtolength{\headheight}{0.5pt}





\begin{document}
    
    \frontmatter
    \tableofcontents
    \mainmatter
    \chapter{Preface}
    
    \lipsum
    

    
    \chapter{Si comincia}
    
    \lipsum
    \section{Sezione 1}
    \lipsum[1-10]
    
    
    \section{Sezione 2}
    \lipsum[5-10]
    \chapter{Si continua...}
    \section{Sezione 3}
    \lipsum[1-10]

    
    \section{Sezione 4}
    \lipsum[1-10]
    \section{Sezione 5}
    \lipsum[5-10]
    \lipsum[1-25]
        \backmatter

    \chapter{Appendix Something}
    \pagestyle{plain}
    Testo
    \lipsum[1-10]
    \chapter{Appendix di controllo}
    \pagestyle{plain}
    \lipsum[10-15]
    Testo
    \lipsum[5-10]
    
\end{document}

Output:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .