\newgeometry 之后的页码位置问题

\newgeometry 之后的页码位置问题

我有一张宽表,所以我决定\newgeometry{left=12mm,right=12mm,top=12mm,footskip=0.5in}在表开始之前使用 以使其适合页面。在表结束后,我用 将其删除\restoregeometry。问题是,每当我应用 时\newgeometry,页码就会从通常的位置(在页面底部,居中)移动到右上角,我无法将其移回底部。我尝试调整 footskip(如您在\newgeometry选项中看到的那样),但这也不起作用。似乎表格下方有足够的空间,所以我看不出问题出在哪里。代码是:

\documentclass[a4paper,11pt]{article}
\usepackage[cp1250]{inputenc} 
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{amsmath, amsthm, amssymb, bm} 
\usepackage{booktabs}
\usepackage{makecell}
\usepackage[flushleft]{threeparttable}
\usepackage[
singlelinecheck=false 
]{caption}
\usepackage{subcaption}
\usepackage{epstopdf}
\usepackage{rotating}
\usepackage{fullpage}
\usepackage{enumerate}
\usepackage{setspace}
\usepackage{authblk}
\usepackage[round]{natbib}
\usepackage{natbib} 
\usepackage{hyperref} 


\usepackage{dcolumn}
\usepackage[detect-all]{siunitx}
\captionsetup[table]{skip=4pt}
\usepackage{multirow} 
\usepackage{textcomp}
\usepackage{threeparttable} 
\usepackage{floatpag}
\usepackage{geometry}




\newenvironment{spmatrix}[1]
 {\def\mysubscript{#1}\mathop\bgroup\begin{bmatrix}}
 {\end{bmatrix}\egroup_{\textstyle\mathstrut\scriptstyle\mysubscript}}


\hypersetup{pdfstartview={XYZ null null 1.00},bookmarksnumbered,hypertexnames=false} 

\setlength\parindent{34pt}
\onehalfspacing

\title{}




\date{\today}

\begin{document}

\clubpenalty 9999 %no orphants (typographic properties)
\widowpenalty 9999 %no widows (typographic properties)
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} %shortcut for Stata tables

\maketitle



\newpage
\onehalfspacing

\section{Table}

\newgeometry{left=12mm,right=12mm,top=12mm,footskip=0.5in}
\begin{table}
\begin{footnotesize}
\captionsetup{font=footnotesize}
\begin{center}
\begin{tabular}{l *{7}{c}}
\toprule \toprule
forecast  & forecast & \multicolumn{6}{c}{proportion of forecast error variance $h$ periods ahead accounted for by innovations in} \\ \cline{3-8}
error     & horizon  & \multirow{2}{*}{real GDP} & \multirow{2}{*}{house prices} & \multirow{2}{*}{residential investment} & \multirow{2}{*}{CPI} & \multirow{2}{*}{mortgage rate} & \multirow{2}{*}{policy rate} \\
in        & $h$      &         &         &         &         &           &          \\
\midrule
real GDP  &   6      &         &         &         &         &           &        \\
          &  12      &         &         &         &         &           &        \\
          &  18      &         &         &         &         &           &        \\
          &  24      &         &         &         &         &           &        \\
          &  30      &         &         &         &         &           &        \\
          &  36      &         &         &         &         &           &        \\
          &  60      &         &         &         &         &           &        \\
\hline
house prices &   6      &         &         &         &         &           &        \\
          &  12      &         &         &         &         &           &        \\
          &  18      &         &         &         &         &           &        \\
          &  24      &         &         &         &         &           &        \\
          &  30      &         &         &         &         &           &        \\
          &  36      &         &         &         &         &           &        \\
          &  60      &         &         &         &         &           &        \\
\hline
residential investment  &   6      &         &         &         &         &           &        \\
          &  12      &         &         &         &         &           &        \\
          &  18      &         &         &         &         &           &        \\
          &  24      &         &         &         &         &           &        \\
          &  30      &         &         &         &         &           &        \\
          &  36      &         &         &         &         &           &        \\
          &  60      &         &         &         &         &           &        \\
\hline
CPI  &   6      &         &         &         &         &           &        \\
          &  12      &         &         &         &         &           &        \\
          &  18      &         &         &         &         &           &        \\
          &  24      &         &         &         &         &           &        \\
          &  30      &         &         &         &         &           &        \\
          &  36      &         &         &         &         &           &        \\
          &  60      &         &         &         &         &           &        \\
\hline
mortgage rate  &   6      &         &         &         &         &           &        \\
          &  12      &         &         &         &         &           &        \\
          &  18      &         &         &         &         &           &        \\
          &  24      &         &         &         &         &           &        \\
          &  30      &         &         &         &         &           &        \\
          &  36      &         &         &         &         &           &        \\
          &  60      &         &         &         &         &           &        \\
\hline
policy rate  &   6      &         &         &         &         &           &        \\
          &  12      &         &         &         &         &           &        \\
          &  18      &         &         &         &         &           &        \\
          &  24      &         &         &         &         &           &        \\
          &  30      &         &         &         &         &           &        \\
          &  36      &         &         &         &         &           &        \\
          &  60      &         &         &         &         &           &        \\
\bottomrule
\end{tabular}
\caption{}
\label{}
\end{center}
\end{footnotesize}
\end{table}

\restoregeometry


\end{document}

答案1

使用

\begin{table}
\captionsetup{font=footnotesize}%
 \resizebox{\textwidth}{!}{%
    \begin{tabular}{l *{7}{c}}
    [...]
    \end{tabular}%
}
\caption{}
\label{}
\end{table}

那么你就不需要新的页面设置了。下面是示例的完整代码:

\documentclass[a4paper,11pt]{article}
\usepackage[cp1250]{inputenc} 
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{amsmath, amsthm, amssymb, bm} 
\usepackage{booktabs}
\usepackage{makecell}
\usepackage[flushleft]{threeparttable}
\usepackage[singlelinecheck=false]{caption}
\usepackage{subcaption}
\usepackage{epstopdf}
\usepackage{rotating}
\usepackage{fullpage}
\usepackage{enumerate}
\usepackage{setspace}
\usepackage{authblk}
\usepackage[round]{natbib}
\usepackage{natbib} 
\usepackage{hyperref} 
\usepackage{dcolumn}
\usepackage[detect-all]{siunitx}
\captionsetup[table]{skip=4pt}
\usepackage{multirow} 
\usepackage{textcomp}
\usepackage{threeparttable} 
\usepackage{floatpag}
\usepackage{geometry}
\newenvironment{spmatrix}[1]
{\def\mysubscript{#1}\mathop\bgroup\begin{bmatrix}}
    {\end{bmatrix}\egroup_{\textstyle\mathstrut\scriptstyle\mysubscript}}
\hypersetup{pdfstartview={XYZ null null 1.00},bookmarksnumbered,hypertexnames=false} 

\setlength\parindent{34pt}
\onehalfspacing
\title{}
\date{\today}
\begin{document}
    \clubpenalty 9999 %no orphants (typographic properties)
    \widowpenalty 9999 %no widows (typographic properties)
    \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} %shortcut for Stata tables   
    \maketitle
    \newpage
    \onehalfspacing

\section{Table}
\noindent
\begin{minipage}{\linewidth}
\resizebox{\linewidth}{!}{%
\footnotesize
\captionsetup{font=footnotesize}
\begin{tabular}{l *{7}{c}}\toprule \toprule
    forecast  & forecast & \multicolumn{6}{c}{proportion of forecast error variance $h$ 
    periods ahead accounted for by innovations in} \\ \cline{3-8}
    error     & horizon  & \multirow{2}{*}{real GDP} & \multirow{2}{*}{house prices} & 
    \multirow{2}{*}{residential investment} & \multirow{2}{*}{CPI} & 
    \multirow{2}{*}{mortgage rate} & \multirow{2}{*}{policy rate} \\
    in        & $h$      &         &         &         &         &           &          \\
    \midrule
    real GDP  &   6      &         &         &         &         &           &        \\
    &  12      &         &         &         &         &           &        \\
    &  18      &         &         &         &         &           &        \\
    &  24      &         &         &         &         &           &        \\
    &  30      &         &         &         &         &           &        \\
    &  36      &         &         &         &         &           &        \\
    &  60      &         &         &         &         &           &        \\\hline
    house prices &   6      &         &         &         &         &           &        \\
    &  12      &         &         &         &         &           &        \\
    &  18      &         &         &         &         &           &        \\
    &  24      &         &         &         &         &           &        \\
    &  30      &         &         &         &         &           &        \\
    &  36      &         &         &         &         &           &        \\
    &  60      &         &         &         &         &           &        \\\hline
    residential investment  &   6      &         &         &         &         &           
    &        \\
    &  12      &         &         &         &         &           &        \\
    &  18      &         &         &         &         &           &        \\
                    &  24      &         &         &         &         &           
                    &        \\
                    &  30      &         &         &         &         &           
                    &        \\
                    &  36      &         &         &         &         &           
                    &        \\
                    &  60      &         &         &         &         &           
                    &        \\
                    \hline
                    CPI  &   6      &         &         &         &         &           
                    &        \\
                    &  12      &         &         &         &         &           
                    &        \\
                    &  18      &         &         &         &         &           
                    &        \\
                    &  24      &         &         &         &         &           
                    &        \\
                    &  30      &         &         &         &         &           
                    &        \\
                    &  36      &         &         &         &         &           
                    &        \\
                    &  60      &         &         &         &         &           
                    &        \\
                    \hline
                    mortgage rate  &   6      &         &         &         &         
                    &           &        \\
                    &  12      &         &         &         &         &           
                    &        \\
                    &  18      &         &         &         &         &           
                    &        \\
                    &  24      &         &         &         &         &           
                    &        \\
                    &  30      &         &         &         &         &           
                    &        \\
                    &  36      &         &         &         &         &           
                    &        \\
                    &  60      &         &         &         &         &           
                    &        \\
                    \hline
                    policy rate  &   6      &         &         &         &         
                    &           &        \\
                    &  12      &         &         &         &         &           
                    &        \\
                    &  18      &         &         &         &         &           
                    &        \\
                    &  24      &         &         &         &         &           
                    &        \\
                    &  30      &         &         &         &         &           
                    &        \\
                    &  36      &         &         &         &         &           
                    &        \\
                    &  60      &         &         &         &         &           
                    &        \\
                    \bottomrule
    \end{tabular}%
}
\captionof{table}{A Caption}\label{aLabel}
\end{minipage}

\end{document}

enter image description here

相关内容