多方向文章文档中第一个横向页面缺少页脚

多方向文章文档中第一个横向页面缺少页脚
\documentclass{article}[12pt]

\usepackage{setspace}
\usepackage{lastpage}
\usepackage{rotating}
\usepackage{etoolbox}
\usepackage{lscape}
\usepackage{pdflscape}
%\usepackage{textcomp}
\usepackage[titletoc]{appendix}
\usepackage{longtable}
\usepackage{easytable}
\usepackage{array}
\usepackage{multirow}
\usepackage{amssymb}
\usepackage{fancyhdr}
%\usepackage{helvetica} % uses helvetica postscript font (download helvetica.sty)
\usepackage[includeheadfoot]{geometry}
\geometry{a4paper,hmargin={2cm,2cm},vmargin={2cm,2cm}}
\usepackage{caption}
\captionsetup{skip=0pt}
\usepackage[table]{xcolor}
\usepackage{booktabs,arydshln}

\usepackage{lipsum}

\newcommand\VRule[1][\arrayrulewidth]{\vrule width #1}

\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\fancypagestyle{mydoc}{%

\fancyhf{}
\fancyhead{}

\fancyfoot{}
\fancyfoot[C]{
    \scriptsize
    Page \thepage\ of \pageref{LastPage}
    }
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}

\fancypagestyle{lscape}{%
 \renewcommand{\headrulewidth}{0pt}
 \renewcommand{\footrulewidth}{0pt}
 \fancyhf{}
\fancyhead{}

\fancyfoot{}
\fancyfoot[C]{
    \scriptsize
    Page \thepage\ of \pageref{LastPage}
    }

\fancyfoot[L]{
    \footnotesize
    Created:        14 August 2002 \\
    Modified:       20 December 2012 \\
    }
}


\begin{document}

\onehalfspacing
\title{
\vspace{48pt}
    \textbf{Application \\ \vspace{48pt}
    }   
    \vspace{96pt}
    \large{Modality: \\}
    \vspace{18pt}
    \large{Submodality: \\}
    \vspace{48pt}
    }

\author{Name \\
    \vspace{36pt}}

\maketitle
\thispagestyle{empty}
\newpage

\thispagestyle{mydoc}

\tableofcontents

\newpage
\clearpage

\pagestyle{mydoc}
\section{Section Title 1}

\lipsum[1-10]

\section{Section Title 2}

\lipsum[11-20]

\section{Appendices: Index and Supporting Evidence}

\begin{appendices}

\newgeometry{a4paper,hmargin={2cm,2cm},vmargin={-0.5cm,0cm},landscape,includeheadfoot}

\paperwidth=\pdfpageheight
\paperheight=\pdfpagewidth
\pdfpageheight=\paperheight
\pdfpagewidth=\paperwidth

\fancyhfoffset[R]{8.75cm}

\textheight=17.5cm

\makeatletter
\setlength{\@fptop}{0cm}
\makeatother

\pagestyle{lscape}

\setcounter{section}{1}
\addcontentsline{toc}{section}{\protect\numberline{\thesection}{Index}}

\begin{table}[h!]
    \normalsize
    \begin{center}
        \begin{tabular}{!{\VRule[1pt]} m{2cm} | m{4.7cm} | m{3cm} | m{4.6cm} | m{2.5cm} | m{6.2cm} !{\VRule[1pt]} @{}m{0pt}@{} }
            \specialrule{1pt}{0pt}{0pt}
            \multicolumn{6}{ !{\VRule[1pt]} c !{\VRule[1pt]} }{\cellcolor{gray!25} \textbf{\Large TEST TEXT}} & \\ [6pt]
            \specialrule{1pt}{0pt}{1pt} \specialrule{1pt}{1pt}{0pt}
            \cellcolor{gray!25}\parbox{2cm}{\centering \textbf{TEXT:}} &  & 
            \cellcolor{gray!25}\parbox{3cm}{\centering \textbf{TEXT:\\(if applicable)}} &  & 
            \cellcolor{gray!25}\parbox{2.5cm}{\centering \textbf{TEXT \\ MORE:}} &  & \\[22pt]
            \specialrule{1pt}{0pt}{0pt}
        \end{tabular}
    \end{center}
    \begin{center}
        \begin{tabular}{!{\VRule[2pt]} m{251mm} !{\VRule[2pt]} @{}m{0pt}@{} }
            \specialrule{2pt}{0pt}{0pt}
            \vspace{2pt}
            \parbox{251mm}{\centering{\LARGE{}\textbf{APPENDIX 1}}\\
            \large{}\textbf{Long text \\ Long text \\ Long text. \\ \vspace{2pt}}} & \\
            \specialrule{2pt}{0pt}{0pt}
        \end{tabular}
    \end{center}
    \begin{center}
        \begin{tabular}{!{\VRule[1pt]} l L{22.2cm} !{\VRule[1pt]} @{}m{0pt}@{} }
            \specialrule{1pt}{0pt}{0pt}
            \parbox[l]{2.6cm}{\large{}\textbf{TEXT: \\ ~} }& \large{}\parbox[l]{20.5cm}{Test TEXT.} & \\[16pt]
            \specialrule{1pt}{0pt}{0pt}
        \end{tabular}
        \begin{tabular}{!{\VRule[1pt]} C{2cm} !{\VRule[1pt]} L{11.8cm} !{\VRule[1pt]} L{10.5cm} !{\VRule[1pt]} @{}m{0pt}@{} }
            \specialrule{1pt}{0pt}{0pt}
            \multicolumn{3}{ !{\VRule[1pt]} c !{\VRule[1pt]} }{\cellcolor{gray!25} \textbf{\LARGE 1 - TEXT}} & \\ [20pt]
            \specialrule{1pt}{0pt}{0pt}
            \cellcolor{gray!25} ~ & \cellcolor{gray!25} \centering \large \textbf{sample} 
    & \parbox{10.3cm}{\cellcolor{gray!25} \centering \large \textbf{sample more} } & \\ [16pt]
            \specialrule{1pt}{0pt}{0pt}
            Tx1 & more &   & \\ [16pt]
            \specialrule{1pt}{0pt}{0pt}
            Tx2 & more &   & \\ [16pt]
            \specialrule{1pt}{0pt}{0pt}
            Tx3 & more &   & \\ [16pt]
            \specialrule{1pt}{0pt}{0pt}
            Tx4 & more &   & \\ [16pt]
            \specialrule{1pt}{0pt}{0pt}
            \multicolumn{3}{ !{\VRule[1pt]} c !{\VRule[1pt]} }{\cellcolor{gray!25} \tiny{}} & \\
            \specialrule{1pt}{0pt}{0pt}
        \end{tabular}
    \end{center}
\end{table}

\newpage
\clearpage

\makeatletter
\setlength{\@fptop}{0pt}
\makeatother

\begin{table}[th!]
    \begin{center}
        \begin{tabular}{!{\VRule[1pt]} l L{22.2cm} !{\VRule[1pt]} @{}m{0pt}@{} }
            \specialrule{1pt}{0pt}{0pt}
            \parbox[l]{2.6cm}{\large{}\textbf{TEXT: \\ ~} }& \large{}\parbox[l]{20.5cm}{Long text.} & \\[16pt]
            \specialrule{1pt}{0pt}{0pt}
        \end{tabular}
        \begin{tabular}{!{\VRule[1pt]} C{2cm} !{\VRule[1pt]} L{11.8cm} !{\VRule[1pt]} L{10.5cm} !{\VRule[1pt]} @{}m{0pt}@{} }
            \specialrule{1pt}{0pt}{0pt}
            \multicolumn{3}{ !{\VRule[1pt]} c !{\VRule[1pt]} }{\cellcolor{gray!25} \textbf{\LARGE 1 - TEXT}} & \\ [20pt]
            \specialrule{1pt}{0pt}{0pt}
            \cellcolor{gray!25} ~ & \cellcolor{gray!25} \centering \large \textbf{sample} 
    & \parbox{10.3cm}{\cellcolor{gray!25} \centering \large \textbf{sample more} } & \\ [16pt]
            \specialrule{1pt}{0pt}{0pt}
            Tx1 & more &   & \\ [16pt]
            \specialrule{1pt}{0pt}{0pt}
            Tx2 & more &   & \\ [16pt]
            \specialrule{1pt}{0pt}{0pt}
            Tx3 & more &   & \\ [16pt]
            \specialrule{1pt}{0pt}{0pt}
            Tx4 & more &   & \\ [16pt]
            \specialrule{1pt}{0pt}{0pt}
            \multicolumn{3}{ !{\VRule[1pt]} c !{\VRule[1pt]} }{\cellcolor{gray!25} \tiny{}} & \\
            \specialrule{1pt}{0pt}{0pt}
        \end{tabular}
    \end{center}
\end{table}


\newpage
\clearpage

\newgeometry{a4paper,hmargin={2.5cm,2.5cm},vmargin={1.5cm,2cm},includeheadfoot}

\paperwidth=\pdfpageheight
\paperheight=\pdfpagewidth
\pdfpageheight=\paperheight
\pdfpagewidth=\paperwidth

\fancyhfoffset[R]{0pt}

\section{Supporting Evidence}

\pagestyle{mydoc}

\subsection{Appendix 2}
\lipsum[1-5]

\clearpage

\subsection{Appendix 3}
\lipsum[1-5]

\end{appendices}

\end{document}

答案1

\newgeometry不支持a4paper和之类的选项landscape(日志中有关于此问题的警告)。因此,第一个\newgeometry设置了一个纵向页面,这使得\textheight太高(并且\textwidth太小,导致overfull hbox警告)。您可以通过手动设置来更正此问题,但这并未考虑到设置它的页面。即您的页脚始终在那里,但远低于物理页面。

因此我想出了一个新命令\newgeometryswitchlc,它可以从纵向切换到横向或反之亦然。由于此命令(与原始命令一样)会从序言中恢复设置,因此无法使用它来切换回来。这可以通过普通的 来完成\newgeometry,但之后您必须手动设置\pdfpageheight\pdfpagewidth才能在 PDF 查看器中获得正确的尺寸。

顺便说一句:我注释掉了一些这里并不真正需要的包(而且我没有安装)。

\documentclass{article}[12pt]

\usepackage{setspace}
\usepackage{lastpage}
\usepackage{rotating}
\usepackage{etoolbox}
\usepackage{lscape}
\usepackage{pdflscape}
%\usepackage{textcomp}
%\usepackage[titletoc]{appendix}
%\usepackage{longtable}
%\usepackage{easytable}
\usepackage{array}
%\usepackage{multirow}
\usepackage{amssymb}
\usepackage{fancyhdr}
%\usepackage{helvetica} % uses helvetica postscript font (download helvetica.sty)
\usepackage[includeheadfoot]{geometry}
\geometry{a4paper,hmargin={2cm,2cm},vmargin={2cm,2cm}}
\usepackage{caption}
\captionsetup{skip=0pt}
\usepackage[table]{xcolor}
\usepackage{booktabs,arydshln}

\usepackage{lipsum}

\newcommand\VRule[1][\arrayrulewidth]{\vrule width #1}

\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\fancypagestyle{mydoc}{%

\fancyhf{}
\fancyhead{}

\fancyfoot{}
\fancyfoot[C]{
    \scriptsize
    Page \thepage\ of \pageref{LastPage}
    }
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}

\fancypagestyle{lscape}{%
 \renewcommand{\headrulewidth}{0pt}
 \renewcommand{\footrulewidth}{0pt}
 \fancyhf{}
\fancyhead{}

\fancyfoot{}
\fancyfoot[C]{
    \scriptsize
    Page \thepage\ of \pageref{LastPage}
    }

\fancyfoot[L]{
    \footnotesize
    Created:        14 August 2002 \\
    Modified:       20 December 2012 \\
    }
}

\makeatletter
% like \newgeometry, but also switches between landscape and portait
\newcommand{\newgeometryswitchlc}[1]{%
  \clearpage
  \Gm@restore@org
  \Gm@initnewgm
  \Gm@newgmtrue
  \setkeys{Gm}{#1}%
  \Gm@newgmfalse
  % switch between landscape and portait
  \Gm@swap@papersizetrue
  \Gm@process
  % set the correct dimension for the PDF viewer
  % must be done manually when switching back with \newgeometry
  \pdfpageheight=\paperheight
  \pdfpagewidth=\paperwidth
  \ifnum\mag=\@m\else\Gm@magtooffset\fi
  \Gm@changelayout
  \Gm@showparams{newgeometry}}%
\makeatother


\begin{document}

\onehalfspacing
\title{
\vspace{48pt}
    \textbf{Application \\ \vspace{48pt}
    }   
    \vspace{96pt}
    \large{Modality: \\}
    \vspace{18pt}
    \large{Submodality: \\}
    \vspace{48pt}
    }

\author{Name \\
    \vspace{36pt}}

\maketitle
\thispagestyle{empty}
\newpage

\thispagestyle{mydoc}

\tableofcontents

\newpage
\clearpage

\pagestyle{mydoc}
\section{Section Title 1}

\lipsum[1-10]

\section{Section Title 2}

\lipsum[11-20]

\section{Appendices: Index and Supporting Evidence}

%\begin{appendices}
\appendix

% changed vmargin
\newgeometryswitchlc{hmargin={2cm,2cm},vmargin={0cm,1cm},includeheadfoot}

%\paperwidth=\pdfpageheight no longer necessary
%\paperheight=\pdfpagewidth
%\pdfpageheight=\paperheight done in \newgeometrylandscape
%\pdfpagewidth=\paperwidth

\fancyhfoffset[R]{8.75cm}

%\textheight=17.5cm to high, but

\makeatletter
\setlength{\@fptop}{0cm}
\makeatother

\pagestyle{lscape}

\setcounter{section}{1}
\addcontentsline{toc}{section}{\protect\numberline{\thesection}{Index}}

\begin{table}[h!]
    \normalsize
    \begin{center}
        \begin{tabular}{!{\VRule[1pt]} m{2cm} | m{4.7cm} | m{3cm} | m{4.6cm} | m{2.5cm} | m{6.2cm} !{\VRule[1pt]} @{}m{0pt}@{} }
            \specialrule{1pt}{0pt}{0pt}
            \multicolumn{6}{ !{\VRule[1pt]} c !{\VRule[1pt]} }{\cellcolor{gray!25} \textbf{\Large TEST TEXT}} & \\ [6pt]
            \specialrule{1pt}{0pt}{1pt} \specialrule{1pt}{1pt}{0pt}
            \cellcolor{gray!25}\parbox{2cm}{\centering \textbf{TEXT:}} &  & 
            \cellcolor{gray!25}\parbox{3cm}{\centering \textbf{TEXT:\\(if applicable)}} &  & 
            \cellcolor{gray!25}\parbox{2.5cm}{\centering \textbf{TEXT \\ MORE:}} &  & \\[22pt]
            \specialrule{1pt}{0pt}{0pt}
        \end{tabular}
    \end{center}
    \begin{center}
        \begin{tabular}{!{\VRule[2pt]} m{251mm} !{\VRule[2pt]} @{}m{0pt}@{} }
            \specialrule{2pt}{0pt}{0pt}
            \vspace{2pt}
            \parbox{251mm}{\centering{\LARGE{}\textbf{APPENDIX 1}}\\
            \large{}\textbf{Long text \\ Long text \\ Long text. \\ \vspace{2pt}}} & \\
            \specialrule{2pt}{0pt}{0pt}
        \end{tabular}
    \end{center}
    \begin{center}
        \begin{tabular}{!{\VRule[1pt]} l L{22.2cm} !{\VRule[1pt]} @{}m{0pt}@{} }
            \specialrule{1pt}{0pt}{0pt}
            \parbox[l]{2.6cm}{\large{}\textbf{TEXT: \\ ~} }& \large{}\parbox[l]{20.5cm}{Test TEXT.} & \\[16pt]
            \specialrule{1pt}{0pt}{0pt}
        \end{tabular}
        \begin{tabular}{!{\VRule[1pt]} C{2cm} !{\VRule[1pt]} L{11.8cm} !{\VRule[1pt]} L{10.5cm} !{\VRule[1pt]} @{}m{0pt}@{} }
            \specialrule{1pt}{0pt}{0pt}
            \multicolumn{3}{ !{\VRule[1pt]} c !{\VRule[1pt]} }{\cellcolor{gray!25} \textbf{\LARGE 1 - TEXT}} & \\ [20pt]
            \specialrule{1pt}{0pt}{0pt}
            \cellcolor{gray!25} ~ & \cellcolor{gray!25} \centering \large \textbf{sample} 
    & \parbox{10.3cm}{\cellcolor{gray!25} \centering \large \textbf{sample more} } & \\ [16pt]
            \specialrule{1pt}{0pt}{0pt}
            Tx1 & more &   & \\ [16pt]
            \specialrule{1pt}{0pt}{0pt}
            Tx2 & more &   & \\ [16pt]
            \specialrule{1pt}{0pt}{0pt}
            Tx3 & more &   & \\ [16pt]
            \specialrule{1pt}{0pt}{0pt}
            Tx4 & more &   & \\ [16pt]
            \specialrule{1pt}{0pt}{0pt}
            \multicolumn{3}{ !{\VRule[1pt]} c !{\VRule[1pt]} }{\cellcolor{gray!25} \tiny{}} & \\
            \specialrule{1pt}{0pt}{0pt}
        \end{tabular}
    \end{center}
\end{table}

\newpage
\clearpage

\makeatletter
\setlength{\@fptop}{0pt}
\makeatother

\begin{table}[th!]
    \begin{center}
        \begin{tabular}{!{\VRule[1pt]} l L{22.2cm} !{\VRule[1pt]} @{}m{0pt}@{} }
            \specialrule{1pt}{0pt}{0pt}
            \parbox[l]{2.6cm}{\large{}\textbf{TEXT: \\ ~} }& \large{}\parbox[l]{20.5cm}{Long text.} & \\[16pt]
            \specialrule{1pt}{0pt}{0pt}
        \end{tabular}
        \begin{tabular}{!{\VRule[1pt]} C{2cm} !{\VRule[1pt]} L{11.8cm} !{\VRule[1pt]} L{10.5cm} !{\VRule[1pt]} @{}m{0pt}@{} }
            \specialrule{1pt}{0pt}{0pt}
            \multicolumn{3}{ !{\VRule[1pt]} c !{\VRule[1pt]} }{\cellcolor{gray!25} \textbf{\LARGE 1 - TEXT}} & \\ [20pt]
            \specialrule{1pt}{0pt}{0pt}
            \cellcolor{gray!25} ~ & \cellcolor{gray!25} \centering \large \textbf{sample} 
    & \parbox{10.3cm}{\cellcolor{gray!25} \centering \large \textbf{sample more} } & \\ [16pt]
            \specialrule{1pt}{0pt}{0pt}
            Tx1 & more &   & \\ [16pt]
            \specialrule{1pt}{0pt}{0pt}
            Tx2 & more &   & \\ [16pt]
            \specialrule{1pt}{0pt}{0pt}
            Tx3 & more &   & \\ [16pt]
            \specialrule{1pt}{0pt}{0pt}
            Tx4 & more &   & \\ [16pt]
            \specialrule{1pt}{0pt}{0pt}
            \multicolumn{3}{ !{\VRule[1pt]} c !{\VRule[1pt]} }{\cellcolor{gray!25} \tiny{}} & \\
            \specialrule{1pt}{0pt}{0pt}
        \end{tabular}
    \end{center}
\end{table}


\newpage
\clearpage

\newgeometry{hmargin={2.5cm,2.5cm},vmargin={1.5cm,2cm},includeheadfoot}

%\paperwidth=\pdfpageheight no longer necessary
%\paperheight=\pdfpagewidth
\pdfpageheight=\paperheight
\pdfpagewidth=\paperwidth

\fancyhfoffset[R]{0pt}

\section{Supporting Evidence}

\pagestyle{mydoc}

\subsection{Appendix 2}
\lipsum[1-5]

\clearpage

\subsection{Appendix 3}
\lipsum[1-5]

%\end{appendices}

\end{document}

相关内容