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

12
  • 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 :(
    – user11232
    Oct 28, 2015 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, 2015 at 11:05
  • Finally I could produce a MWE
    – nagylzs
    Oct 28, 2015 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, 2015 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.
    – user11232
    Oct 28, 2015 at 12:26

1 Answer 1

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

4
  • Also found this figure that explains margings, footers headers and how they are related. tex.stackexchange.com/questions/132170/…
    – nagylzs
    Oct 29, 2015 at 7: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, 2015 at 7:34
  • @nagylzs: There is area reserved for footer. But the text height is inclusive of that.
    – user11232
    Oct 29, 2015 at 7:42
  • @HarishKumar By the way, this is going on in chat right now :-)
    – Johannes_B
    Oct 29, 2015 at 9:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .