多方向文章文件中第一個橫向頁面缺少頁腳

多方向文章文件中第一個橫向頁面缺少頁腳
\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}

相關內容