2

UPDATED question. Here is an MWE - finally I could produce one.

\documentclass{article}

\usepackage{geometry}
\usepackage{graphicx}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{fancyhdr}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{booktabs}
\usepackage{multirow}

\usepackage{polyglossia}
\setmainlanguage{magyar}

\usepackage{lipsum}

\newcommand{\globFooter}{
    \def\alignFooter##1{\vtop{\null\hbox{##1}}}
    \cfoot{%
    \begin{tiny}
    \begin{tabular}{lll}
    \alignFooter{\includegraphics[width=2cm]{rBdytQH.png}}
    &
    \alignFooter{\begin{tabular}{lll}
    Address line 1     Address line 1 & Telephone 1     Telephone 1  & Web 1 Web 1 Web 1 Web 1 \\
    Address line 2 & Fax line    &    skype text\\
    Address line 3    &    Mobile line    &    Web 2
    \end{tabular}}
    \end{tabular}
    \end{tiny}
    }
}


\geometry{tmargin=1in,bmargin=2.5in,lmargin=0.7in,rmargin=0.7in}

\pagestyle{fancy}

\globFooter

\begin{document}

\lipsum[1-6]

Here is some more text that will position the last rows of the table near the footer: Nulla euismod, dolor vitae faucibus tincidunt, ante sem commodo massa, vitae maximus ante nisi eget magna. 

\begin{enumerate}
\item Item 1
\item Item 2

\begin{longtabu} to \linewidth {@{}X[p,l]ccrlrrc@{}} %
                              \multicolumn{6}{p{12cm}}{First row in the table} \\
                            \multicolumn{3}{l}{}
                            & \small 1.0 &  egy.  99\,999 & 99\,999 HUF &                \\
                        \multicolumn{6}{p{12cm}}{Second row in the table} \\
                        \multicolumn{3}{l}{}%
                        & 1.0 &   alk.  &                 5\,000 & 9\,999 HUF & \\
            \end{longtabu}

\end{enumerate}


\bigskip

\bigskip

\end{document}

It does not work without the image. The image is here:

enter image description here

It seems that the problem is related to the longtabu, because the footer overlaps with the longtabu when the bottom of the table is close to the end of the page. Here is the example overlap:

enter image description here

Werner
  • 603,163
nagylzs
  • 1,225
  • May be you have to adjust the bottom margin. May be you have to adjust the \footskip. How do we know? We don't have the full code :( –  Oct 28 '15 at 10:43
  • Shouldn't cfoot automatically resize the footer to fit the contents? Also I don't understand how it is related to the margins. I just tried, and the same problem can be reproduced with different margin settings (also with different paper sizes). Just I have to add / remove some rows to the table to make it appear. One thing is sure: it is NEVER bad if I put plain text into the document. Already tried with many pages of lorem lipsum. It is clearly related to the longtabu plus the cfoot together. – nagylzs Oct 28 '15 at 11:05
  • Finally I could produce a MWE – nagylzs Oct 28 '15 at 11:35
  • I was experimenting some more, and it seems that adding an invisible (zero point high) horizontal rule to the top of the cfoot solves the problem: \cfoot{\rule{0.5\textwidth}{0pt} but I don't understand why! – nagylzs Oct 28 '15 at 12:17
  • Add ,includefoot,footskip=0.1in to \geometry{tmargin=1in,bmargin=2.5in,lmargin=0.7in,rmargin=0.7in,includefoot,footskip=0.1in,showframe}. showframe is just for demo. Remove it. –  Oct 28 '15 at 12:26
  • ! Package xkeyval Error:foo‌​tskip' undefined in families Gm'. – nagylzs Oct 28 '15 at 12:37
  • \cfoot... does not (cannot??) adjust the margins automatically. In the case of headers, it will adjust them, although too late to avoid inconsistency. Hence, it issues a warning in that case. But footers are different, I think. – cfr Oct 28 '15 at 12:37
  • @cfr: Are you saying that the footer is rendered on the margin? I thought that the footer is ABOVE the margin. – nagylzs Oct 28 '15 at 12:38
  • By default, yes. The footer and header are included in the margin. includehead or includefoot etc. change that. See page 3 of geometry's manual. – cfr Oct 28 '15 at 12:47
  • @harnish-kumar: Please post "includefoot" and possibly "includehead" as a soltion. By adding that one thing to my document, everything seems to be fine. – nagylzs Oct 28 '15 at 12:47
  • Oh, I see now! cfoot does not calculate the height of the footer at all. I have to set it manually. Is that right? – nagylzs Oct 28 '15 at 13:25
  • @nagylzs: Only headheight and footskip are adjusted automatically. But this will result in inconsistent page layout. So it is better we adjust them. –  Oct 28 '15 at 14:24

1 Answers1

2

By default, the header and the footer are not included in the text body. But you can include them using includefoot and includehead keys of geometry package. In this case you have to adjust the footskip also. We make footskip = 25pt, otherwise a warning is issued. The solution is

\geometry{tmargin=1in,bmargin=2.5in,lmargin=0.7in,rmargin=0.7in,includefoot,footskip=25pt,showframe}

showframe is just for demo and should be removed in actual document. If you have headers, try adding includehead also and adjust the headheight(and possiblyheadsep`). Watch out for warnings, for, any incorrect settings would be notified.

\documentclass{article}

\usepackage{geometry} 
\usepackage{graphicx}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{fancyhdr}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{booktabs}
\usepackage{multirow}

%\usepackage{polyglossia}
%\setmainlanguage{magyar}

\usepackage{lipsum}

\newcommand{\globFooter}{%
    \def\alignFooter##1{\vtop{\null\hbox{##1}}}
    \cfoot{%
    \begin{tiny}
    \begin{tabular}{lll}
    \alignFooter{\includegraphics[width=2cm]{example-image-a}}
    &
    \alignFooter{\begin{tabular}{lll}
    Address line 1     Address line 1 & Telephone 1     Telephone 1  & Web 1 Web 1 Web 1 Web 1 \\
    Address line 2 & Fax line    &    skype text\\
    Address line 3    &    Mobile line    &    Web 2
    \end{tabular}}
    \end{tabular}
    \end{tiny}
    }
}


\geometry{tmargin=1in,bmargin=2.5in,lmargin=0.7in,rmargin=0.7in,includefoot,footskip=25pt,showframe}

\pagestyle{fancy}

\globFooter

\begin{document}

\lipsum[1-6]

Here is some more text that will position the last rows of the table near the footer: Nulla euismod, dolor vitae faucibus tincidunt, ante sem commodo massa, vitae maximus ante nisi eget magna.

\begin{enumerate}
\item Item 1
\item Item 2

\begin{longtabu} to \linewidth {@{}X[p,l]ccrlrrc@{}} %
                              \multicolumn{6}{p{12cm}}{First row in the table} \\
                            \multicolumn{3}{l}{}
                            & \small 1.0 &  egy.  99\,999 & 99\,999 HUF &                \\
                        \multicolumn{6}{p{12cm}}{Second row in the table} \\
                        \multicolumn{3}{l}{}%
                        & 1.0 &   alk.  &                 5\,000 & 9\,999 HUF & \\
            \end{longtabu}

\end{enumerate}


\bigskip

\bigskip

\end{document}

enter image description here

  • Also found this figure that explains margings, footers headers and how they are related. http://tex.stackexchange.com/questions/132170/what-do-headheight-headsep-etc-do-in-the-vmargin-package – nagylzs Oct 29 '15 at 07:29
  • I'm still confused. If we use includefoot then the footer becomes part of the text body, and the footer will be above the margin. In that case, what is the meaning of footskip? It is supposed to be "the vertical length between the bottom of the text area and the bottom of the area reserved for footers". But if we include the footer into the text area, then there is no such thing as "area reserved for footers below the text area". Then what does it mean? :-( – nagylzs Oct 29 '15 at 07:34
  • @nagylzs: There is area reserved for footer. But the text height is inclusive of that. –  Oct 29 '15 at 07:42
  • @HarishKumar By the way, this is going on in chat right now :-) – Johannes_B Oct 29 '15 at 09:26