fancyhdr e \textwidth, perché viene ignorato?

  • Questo topic ha 2 risposte, 2 partecipanti ed è stato aggiornato l'ultima volta 14 anni fa da gygabyte017.
  • Creatore
    Topic
  • #78016
    Up
    0
    Down
    ::


    Ciao a tutti, mi scuso se la domanda è banale o è stata già fatta ma non ho trovato risposta per ora.

    Dunque ho questo codice di esempio:
    `
    \documentclass[a4paper, 12pt,twoside]{report}
    \usepackage[latin1]{inputenc}
    \usepackage[english]{babel}
    \usepackage{fancyhdr}

    \begin{document}

    %%%%%%%%%%%%%%%%%%
    \baselineskip=25pt
    \fancypagestyle{plain}{
    \fancyhf{}
    \renewcommand{\headrulewidth}{0pt}
    \fancyfoot[LE,RO]{\thepage}
    }
    \fancyhf{}
    \pagestyle{fancy}
    \textheight=583pt
    \textwidth=435pt
    \evensidemargin=0pt
    \oddsidemargin=0pt
    \footskip=67pt
    \fancyhead[R]{\rightmark} \fancyfoot[L]{\leftmark}
    \fancyfoot[EL,OR]{\thepage}
    \renewcommand{\headrulewidth}{0.3pt}
    \renewcommand{\footrulewidth}{0.3pt}

    \pagenumbering{Roman}
    \tableofcontents
    \newpage
    %%%%%%%%%%%%%%%%%%

    \chapter{A}
    \section{A1}
    \section{A2}
    \section{A3}
    \section{A4}
    \section{A5}
    \chapter{B}
    \section{B1}
    \section{B2}
    \section{B3}
    \section{B4}
    \section{B5}
    \chapter{C}
    \section{C1}
    \section{C2}
    \section{C3}
    \section{C4}
    \section{C5}

    \end{document}
    `

    Come si vede dal codice, setto “\textwidth=435pt”, tuttavia se compilate e misurate il testo con il righello di yap, il testo risulta di circa 380pt invece di 435pt.

    Cosa sbaglio?

    Grazie mille a tutti

Visualizzazione 1 filone di risposte
  • Autore
    Risposte
    • #78017
      Up
      0
      Down
      ::

      gygabyte017″ post=77142Ciao a tutti, mi scuso se la domanda è banale o è stata già fatta ma non ho trovato risposta per ora.

      Dunque ho questo codice di esempio:
      `
      \documentclass[a4paper, 12pt,twoside]{report}
      \usepackage[latin1]{inputenc}
      \usepackage[english]{babel}
      \usepackage{fancyhdr}

      \begin{document}

      %%%%%%%%%%%%%%%%%%
      \baselineskip=25pt
      \fancypagestyle{plain}{
      \fancyhf{}
      \renewcommand{\headrulewidth}{0pt}
      \fancyfoot[LE,RO]{\thepage}
      }
      \fancyhf{}
      \pagestyle{fancy}
      \textheight=583pt
      \textwidth=435pt
      \evensidemargin=0pt
      \oddsidemargin=0pt
      \footskip=67pt
      \fancyhead[R]{\rightmark} \fancyfoot[L]{\leftmark}
      \fancyfoot[EL,OR]{\thepage}
      \renewcommand{\headrulewidth}{0.3pt}
      \renewcommand{\footrulewidth}{0.3pt}

      \pagenumbering{Roman}
      \tableofcontents
      \newpage
      %%%%%%%%%%%%%%%%%%

      \chapter{A}
      \section{A1}
      \section{A2}
      \section{A3}
      \section{A4}
      \section{A5}
      \chapter{B}
      \section{B1}
      \section{B2}
      \section{B3}
      \section{B4}
      \section{B5}
      \chapter{C}
      \section{C1}
      \section{C2}
      \section{C3}
      \section{C4}
      \section{C5}

      \end{document}
      `

      Come si vede dal codice, setto “\textwidth=435pt”, tuttavia se compilate e misurate il testo con il righello di yap, il testo risulta di circa 380pt invece di 435pt.

      Cosa sbaglio?

      Grazie mille a tutti

      Sbagli parecchie cose. Per esempio a impostare [tt]\texwidth[/tt] dopo [tt]\begin{document}[/tt]
      `\documentclass[a4paper, 12pt,twoside]{report}
      \usepackage[latin1]{inputenc}
      \usepackage[english]{babel}

      \usepackage{geometry}
      \geometry{textheight=583pt,textwidth=435pt,heightrounded,footskip=67pt,headheight=14.5pt}
      \linespread{2.0833}

      \usepackage{fancyhdr}
      \pagestyle{fancy}
      \fancypagestyle{plain}{
      \fancyhf{}
      \renewcommand{\headrulewidth}{0pt}
      \fancyfoot[LE,RO]{\thepage}
      }
      \fancyhf{}
      \fancyhead[R]{\rightmark} \fancyfoot[L]{\leftmark}
      \fancyfoot[EL,OR]{\thepage}
      \renewcommand{\headrulewidth}{0.4pt}
      \renewcommand{\footrulewidth}{0.4pt}`
      Il risultato è piuttosto discutibile.

      Ciao
      Enrico

    • #78018
      Up
      0
      Down
      ::


      Hai ragione, ho deciso di lasciare perdere con queste impostazioni manuali e usare geometry, almeno sono sicuro del risultato.

      Grazie

Visualizzazione 1 filone di risposte
  • Devi essere connesso per rispondere a questo topic.

Go to top