在中间环境中更改 \textwidth 和 \textheight

在中间环境中更改 \textwidth 和 \textheight

首先,这不是在文档中间更改 \textwidth 和 \textheight因为我无法设置手册\pagebreak及之后的\newgeometry内容\restoregeometry

我想更改文档第一页的页脚大小以包含某种图例。主要内容是一个内容长度可变的长表。图例应仅包含在第一页中,页脚也应仅在此页上扩展。这在 lontable 完成后有效(参见lipsum文本),但在继续时无效。页脚保持较大,尽管它不再包含图例。目前,我非常怀疑 pdflatex 是否能做我想做的事情,但我希望看到我错了,并且有一种方法可以按预期进行。

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

答案1

用于\enlargethispage更改一页的高度。另外别忘了空格也很重要。

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

相关内容