5

First, this is not a copy of Change \textwidth and \textheight in mid-document as I can't set a manual \pagebreak and \newgeometry or \restoregeometry thereafter.

I want to change the footer size for the first page of a document to include some kind of legend. The main content is a longtable with varying(!) content length. The legend should only be included on the first page and the footer should only be extended on this page also. This works after the lontable finishes (see lipsum text) but not while it continues. The footer stays big, although it does not contain the legend anymore. I'm in serious doubt at the moment that it is possible with pdflatex to do what I want, but I'd like to see that I'm wrong and there is a way to do it as intended.

\documentclass[a4paper,11pt]{article}

\usepackage[top=2cm,left=2cm,right=2.5cm,bottom=5.5cm,includeheadfoot]{geometry}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fancyhdr}
\usepackage{lipsum}


% Header, Footer 
\setlength{\headheight}{26pt}
% Pagestyle firstpage
\fancypagestyle{firstpagestyle}
{
  \setlength{\textheight}{620pt}
  \setlength{\footskip}{160pt}
  \lhead{This is my header}%
  \chead{}%
  \rhead{\today}%
  \lfoot{
      \smash
    {%  % hide vertical stretch of the following content
      \parbox[b]{\textwidth}
      {
        \Legende
        This is my normal footer text.
      }
    }    
  }%
  \cfoot{}
  \rfoot{\thepage}%
  \renewcommand\headrulewidth{0.35pt}%
  \renewcommand\footrulewidth{0.35pt}%
}


% Pagestyle all other pages
\fancypagestyle{mypagestyle}
{
  \setlength{\textheight}{660.2pt}
  \setlength{\footskip}{30pt}
  \lhead{This is my header}%
  \chead{}%
  \rhead{\today}%
  \lfoot{This is my normal footer text.}
  \cfoot{}
  \rfoot{\thepage}%
  \renewcommand\headrulewidth{0.35pt}%
  \renewcommand\footrulewidth{0.35pt}%
}


\newcommand{\Legende}{
   \parbox{0.9\textwidth}{some \\ lines \\with \\ a \\ lot \\of \\text
}\\[1.5ex]}

%Dummy text for table
\newcommand{\bla}{bla \\ blubb \\ bla \\blubb \\bla \\}
\newcommand{\blubb}{\bla\bla\bla\bla\bla\bla}


\begin{document}
\pagestyle{mypagestyle}
\thispagestyle{firstpagestyle}

\renewcommand{\arraystretch}{1.25}
\begin{longtable}{c}
  \toprule
  \blubb \blubb \blubb
  \bottomrule \\[0em]
\end{longtable}

\lipsum \lipsum[1-4]

\end{document}
3

Use \enlargethispage to change the height of one page. Also don't forget that spaces can matter.

\documentclass[a4paper,11pt]{article}

\usepackage[top=2cm,left=2cm,right=2.5cm,bottom=5.5cm,includeheadfoot]{geometry}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fancyhdr}
\usepackage{lipsum}

\renewcommand\headrulewidth{0.35pt}%
\renewcommand\footrulewidth{0.35pt}%
\setlength{\headheight}{26pt}

% Header, Footer
\fancypagestyle{mypagestyle}
{\lhead{This is my header}%
  \chead{}%
  \rhead{\today}%
  \lfoot{This is my normal footer text.}
  \cfoot{}
  \rfoot{\thepage}%
 }


% Pagestyle firstpage
\fancypagestyle{firstpagestyle}
{\pagestyle{mypagestyle}
  \lfoot{%
      \smash
    {%  % hide vertical stretch of the following content
      \parbox[b]{\textwidth}
      {%
        \raggedright\Legende
        This is my normal footer text.%
      }%
    }%
  }}



\newcommand{\Legende}{%
   \parbox{0.9\textwidth}{some \\ lines \\with \\ a \\ lot \\of \\text
}\\[1.5ex]}

%Dummy text for table
\newcommand{\bla}{bla \\ blubb \\ bla \\blubb \\bla \\}
\newcommand{\blubb}{\bla\bla\bla\bla\bla\bla}


\begin{document}
\pagestyle{mypagestyle}\thispagestyle{firstpagestyle}\enlargethispage{-130pt}

\renewcommand{\arraystretch}{1.25}
\begin{longtable}{c}
  \toprule
  \blubb \blubb \blubb
  \bottomrule \\[0em]
\end{longtable}

\lipsum \lipsum[1-4]

\end{document}
  • Thanks a lot - that is exactly what I was looking for for hours! For sake of completeness: One can omit the \usepackage[top=2cm,left=2cm,right=2.5cm,bottom=5.5cm,includeheadfoot]{geometry} to get the footer part enlarged only on the first page. "Also don't forget that spaces can matter. " I don't get you there however – nirolo Oct 27 '13 at 15:55
  • I meant the spaces after the opening and closing braces. – Ulrike Fischer Oct 27 '13 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.