2

The document uses scrlayer-scrpage to create a footer with (originally) a logo, and two lines of inner and outer footer text.

This works fine unless there is a longtable that continues on the next page. If that happens, the text of the footer on the page with the first part of the table is placed too low. On the page after, the line spacing of the outer foot (right side) is decreased.

EDIT: it happens even on non-broken longtables, and even if setting footlines=2 or more.

The MWE is a little long because I needed to fill the longtables.

\documentclass[11pt,a4paper,parskip=half,DIV=15]{scrartcl}

\usepackage{xltxtra,fontspec,xunicode}
\usepackage[T1]{fontenc}

\usepackage{tabularx,booktabs,longtable}


% Load T1-fontenc (after loading ngerman) for hyphenation of words containing umlaut
\usepackage[ngerman]{babel}


%----------------------------------------------------
%      Graphics and Hyperlinks
%----------------------------------------------------



%% use xetex version of hyperref
\usepackage[xetex,unicode,colorlinks,%
plainpages=false,hyperindex=true,pdfpagelabels,bookmarks=true,%
bookmarksopen=true,bookmarksopenlevel=1,%
bookmarksnumbered=true,pdfstartview=]{hyperref}
%anchorcolor=darkgreen,urlcolor=darkgreen,%
%\fi

% Kopfzeilen / Fußzeilen
\usepackage[headsepline,plainheadsepline]{scrlayer-scrpage}
\ModifyLayer[addvoffset=2pt]{scrheadings.head.below.line}
\ModifyLayer[addvoffset=2pt]{plain.scrheadings.head.below.line}
\clearpairofpagestyles

\setkomafont{pagehead}{\normalfont\scriptsize}
\setkomafont{pagefoot}{\normalfont\scriptsize}
\addtokomafont{pagenumber}{\bfseries}
\renewcommand{\rightmark}{%
1st line\\2nd line\\}

\ohead*{\leftmark \qquad{} \pagemark}
\ifoot*{
  \bgroup%
  \setlength\tabcolsep{0pt}
  \begin{tabular}{p{2cm}p{2cm}}
    \vspace{0pt}
    \rule{4.5\baselineskip}{2\baselineskip}
    &
    \vspace{0pt}
    {\raggedright One line\\another}
    \\
  \end{tabular}
  \egroup
}
\ofoot*{
  % need the tabular to top align ifoot and ofoot
  \begin{tabular}{r}
    \rightmark
  \end{tabular}
}
\pagestyle{scrheadings}


\newcolumntype{Z}[1]{>{\centering\arraybackslash}p{#1}} % used in contract
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\section{regular page}

This page has the correct footer.

\newpage


\renewcommand{\arraystretch}{0.5}


\section{page with tables}

With the first part of a longtable that continues on the next page, the text in the footer is set too low. Also, on the next page, the ofoot (right side) will still have decreased line spacing.


\begin{longtable}[h]{@{}L{0.3\linewidth}L{0.2\linewidth}Z{0.11\linewidth}L{0.3\linewidth}@{}}
\multicolumn{4}{@{}l}{\bfseries table 1}\\
\toprule
\\\addlinespace

{\bfseries Col1} & {\bfseries Col2} & {\bfseries Col3} & {\bfseries Col4} \\

\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\bottomrule

\end{longtable}


\begin{longtable}[h]{@{}L{0.3\linewidth}L{0.2\linewidth}Z{0.11\linewidth}L{0.3\linewidth}@{}}
\multicolumn{4}{@{}l}{\bfseries table 2}\\
\toprule
\\\addlinespace

{\bfseries Col1} & {\bfseries Col2} & {\bfseries Col3} & {\bfseries Col4} \\

\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\bottomrule

\end{longtable}


\begin{longtable}[h]{@{}L{0.3\linewidth}L{0.2\linewidth}Z{0.11\linewidth}L{0.3\linewidth}@{}}
\multicolumn{4}{@{}l}{\bfseries table 3}\\
\toprule
\\\addlinespace

{\bfseries Col1} & {\bfseries Col2} & {\bfseries Col3} & {\bfseries Col4} \\

\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\bottomrule

\end{longtable}

\end{document}

I've also tried to use supertabular directly but the longer table was not broken but instead pushed to the next page, and I did not follow up on that solution. (In my actual document, I'm loading supertabular to modify the table headers and footers.)

Note: XeTeX is required because custom fonts are loaded in the actual document.

Correctly placed foot

Displaced text in inner and outer foot

Decreased line spacing in right foot

2

First of all you should note the warning message about the height of the footer.

Then I would not use tabular here. Instead of the tabular you can place a \parbox beside the \rule (or image):

\documentclass[parskip=half,DIV=15,footheight=30pt]{scrartcl}

\usepackage{fontspec}
\usepackage[T1]{fontenc}

\usepackage{tabularx,booktabs,longtable}

\usepackage[ngerman]{babel}


%----------------------------------------------------
%      Graphics and Hyperlinks
%----------------------------------------------------

\usepackage[headsepline,plainheadsepline]{scrlayer-scrpage}

%% hyperref does recognize xetex on its own and should be loaded after (most)
%% other packages
\usepackage[unicode,colorlinks,%
plainpages=false,hyperindex=true,pdfpagelabels,bookmarks=true,%
bookmarksopen=true,bookmarksopenlevel=1,%
bookmarksnumbered=true,pdfstartview=]{hyperref}
%anchorcolor=darkgreen,urlcolor=darkgreen,%
%\fi

% Kopfzeilen / Fußzeilen
\ModifyLayer[addvoffset=2pt]{scrheadings.head.below.line}
\ModifyLayer[addvoffset=2pt]{plain.scrheadings.head.below.line}
\clearpairofpagestyles

\setkomafont{pagehead}{\normalfont\scriptsize}
\setkomafont{pagefoot}{\normalfont\scriptsize}
\addtokomafont{pagenumber}{\bfseries}

\ohead*{\leftmark \qquad{} \pagemark}
\ifoot*{%
  \makebox[2cm][l]{\rule[-\dp\strutbox]{4.5\baselineskip}{2\baselineskip}}%
  \parbox[b]{\dimexpr\linewidth-2cm\relax}{%
    \raggedright One line\\great line
  }%
}
\ofoot*{%
  \rule[-\dp\strutbox]{0pt}{2\baselineskip}\parbox[b]{\linewidth}{\raggedleft
    1st line\\2nd line
  }%
}

\newcolumntype{Z}[1]{>{\centering\arraybackslash}p{#1}} % used in contract
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\section{regular page}

This page has the correct footer.

\newpage


\renewcommand{\arraystretch}{0.5}


\section{page with tables}

With the first part of a longtable that continues on the next page, the text in the footer is set too low. Also, on the next page, the ofoot (right side) will still have decreased line spacing.


\begin{longtable}[h]{@{}L{0.3\linewidth}L{0.2\linewidth}Z{0.11\linewidth}L{0.3\linewidth}@{}}
\multicolumn{4}{@{}l}{\bfseries table 1}\\
\toprule
\\\addlinespace

{\bfseries Col1} & {\bfseries Col2} & {\bfseries Col3} & {\bfseries Col4} \\

\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\bottomrule

\end{longtable}


\begin{longtable}[h]{@{}L{0.3\linewidth}L{0.2\linewidth}Z{0.11\linewidth}L{0.3\linewidth}@{}}
\multicolumn{4}{@{}l}{\bfseries table 2}\\
\toprule
\\\addlinespace

{\bfseries Col1} & {\bfseries Col2} & {\bfseries Col3} & {\bfseries Col4} \\

\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\bottomrule

\end{longtable}


\begin{longtable}[h]{@{}L{0.3\linewidth}L{0.2\linewidth}Z{0.11\linewidth}L{0.3\linewidth}@{}}
\multicolumn{4}{@{}l}{\bfseries table 3}\\
\toprule
\\\addlinespace

{\bfseries Col1} & {\bfseries Col2} & {\bfseries Col3} & {\bfseries Col4} \\

\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\cmidrule(r){1-1} \cmidrule(l){2-4}
cell 1 & cell 2 & 1 & comment \\
\bottomrule

\end{longtable}

\end{document}

enter image description here

And note: If you use tabular inside the page head or foot things like changes of \arraystretch are valid for those tabulars too. If you are using a static page head or footer you could save the content in a box register (see \savebox etc. in the LaTeX manual) and use it with \usebox inside the header/footer.

1
  • Great, I see the light! I did realize the problem with arraystretch, and I've also found a way with vbox/hbox (and I'm starting to use savebox/usebox) but your solution looks like what you would actually expect. (I've obviously assembled solutions from other problems, including the tabular stuff, over time. I've gotten rid of tabular in the headers and footers! Thanks for pointing it out!) – Risadinha Apr 10 '19 at 16:29

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.