Fancyheader cfoot 与主要内容重叠

Fancyheader cfoot 与主要内容重叠

更新的问题。这是一个 MWE - 我终于可以制作一个了。

\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}

如果没有图片,它就无法工作。图片在这里:

在此处输入图片描述

问题似乎与 有关,因为当表格底部接近页面末尾时,longtabu页脚会与 重叠。以下是重叠的示例:longtabu

在此处输入图片描述

答案1

默认情况下,页眉和页脚不包含在文本主体中。但您可以使用包的includefootincludehead键来包含它们geometry。在这种情况下,您还必须调整footskip。我们制作footskip= 25pt,否则会发出警告。解决方案是

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

showframe仅用于演示,应在实际文档中删除。如果您有页眉,请尝试添加includehead并调整页眉高度(and possiblyheadsep')。注意警告,因为任何不正确的设置都会收到通知。

\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}

在此处输入图片描述

相关内容