
Aquí hay dos páginas del mismo documento, la Imagen 1 muestra la segunda página, donde \section{Tareas realizadas}
se superpone la altura del texto, mientras que la Imagen 2 muestra la tercera página (comportamiento correcto).
¿Por qué el primero \section
se superpone al borde superior?
Aquí está el código (los datos de la tabla se generan sobre la marcha mediante un programa Python externo):
% use article styling for this document
\documentclass[11pt,a4paper]{article}
% enable system font access
\usepackage{fontspec}
\usepackage{lastpage}
\usepackage{fancyhdr}
\usepackage[spanish]{babel}
% agregar showframe para ver los márgenes
\usepackage[showframe, top=3cm, bottom=3cm, left=2cm, right=2cm]{geometry}
\usepackage{tocloft}
\usepackage{xcolor,colortbl}
\usepackage{longtable}
\usepackage{titlesec}
\definecolor{Gray}{gray}{0.85}
\definecolor{LightCyan}{RGB}{60,179,113}
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
\fancypagestyle{myheader}{%
\fancyhf{}% Clear all headers/footers
\fancyhead[C]{Informe Semanal - \input{fecha.dat}}% Header Centred
\fancyfoot[R]{\thepage /\pageref{LastPage}}% Footer Centred
\renewcommand{\headrulewidth}{2pt}% 2pt header rule
\renewcommand{\headrule}{\hbox to\headwidth{%
\color{LightCyan}\leaders\hrule height \headrulewidth\hfill}}
\renewcommand{\footrulewidth}{0pt}% No footer rule
}
% styling: Palatino (main text), Helvetica (stress)
\setmainfont{OptimaLTStd}
\newfontfamily{\maintext}{OptimaLTStd}
\newfontfamily{\stressed}{HelveticaLTStd-Roman}
% start of actual document
\renewcommand{\abstractname}{Sumario}
\begin{document}
\pagestyle{myheader}
\begin{titlepage}
\setcounter{page}{0}
\title{Informe semanal}
\author{Leonardo M. Ramé\\ Medical I.T.}
\immediate\write18{./get_date.sh > fecha.dat}
\date{\input{fecha.dat}}
\maketitle
\renewcommand\contentsname{Tabla de contenidos}
\tableofcontents
\section*{Resumen}
\immediate\write18{./get_agregados.sh > temp.dat}
\input{temp.dat}
\thispagestyle{empty}
\end{titlepage}
%\titleformat{name=\section}[block]
% {}
% {}
% {0pt}
% {\colorsection}
%\titlespacing{\section}{0pt}{\baselineskip}{\baselineskip}
%\newcommand{\colorsection}[1]{%
% \colorbox{Gray}{\parbox{\dimexpr\textwidth-2\fboxsep}{\thesection\ #1}}}
\newpage
\section{Tareas realizadas}
% generamos el listado y lo guardamos en temp.dat
\immediate\write18{./get_reports.sh closed|python parser.py CLOSED > temp.dat}
\input{temp.dat}
\newpage
\section{Tareas pendientes}
% generamos el listado y lo guardamos en temp.dat
\immediate\write18{./get_reports.sh open|python parser.py OPEN > temp.dat}
\input{temp.dat}
\end{document}
Editar: Aquí está la advertencia de Fancyhdr
Package Fancyhdr Warning: \headheight is too small (12.0pt):
Make it at least 23.11996pt.
We now make it that large for the rest of the document.
This may cause the page layout to be inconsistent, however.
Modifiqué mi estilo de página elegante a esto:
\fancypagestyle{myheader}{%
\fancyhf{}% Clear all headers/footers
\setlength{\headheight}{40pt}
\setlength{\textheight}{620pt}
\fancyhead[C]{Informe Semanal - \input{fecha.dat}}% Header Centred
\fancyfoot[R]{\thepage /\pageref{LastPage}}% Footer Centred
\renewcommand{\headrulewidth}{2pt}% 2pt header rule
\renewcommand{\headrule}{\hbox to\headwidth{%
\color{LightCyan}\leaders\hrule height \headrulewidth\hfill}}
\renewcommand{\footrulewidth}{0pt}% No footer rule
}
¡Y funcionó como se esperaba!
Respuesta1
Aquí está la advertencia de Fancyhdr
Package Fancyhdr Warning: \headheight is too small (12.0pt):
Make it at least 23.11996pt.
We now make it that large for the rest of the document.
This may cause the page layout to be inconsistent, however.
Modifiqué mi estilo de página elegante a esto:
\fancypagestyle{myheader}{%
\fancyhf{}% Clear all headers/footers
\setlength{\headheight}{40pt}
\setlength{\textheight}{620pt}
\fancyhead[C]{Informe Semanal - \input{fecha.dat}}% Header Centred
\fancyfoot[R]{\thepage /\pageref{LastPage}}% Footer Centred
\renewcommand{\headrulewidth}{2pt}% 2pt header rule
\renewcommand{\headrule}{\hbox to\headwidth{%
\color{LightCyan}\leaders\hrule height \headrulewidth\hfill}}
\renewcommand{\footrulewidth}{0pt}% No footer rule
}
¡Y funcionó como se esperaba!