1

I am having a wide table, so I decided to use \newgeometry{left=12mm,right=12mm,top=12mm,footskip=0.5in} before the beginning of that table to make it fit the page. After the table ending, I removed it with \restoregeometry. The problem is that whenever I apply \newgeometry, the page number shifts from the usual position (at the bottom of the page, centered) to the top-right corner and I cannot move it back to the bottom. I tried adjusting footskip (as you can see in \newgeometry options), but that does not work either. It seems that there is enough space at the bottom below the table, so I cannot see where is the problem. The code is:

\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}
  • there is no need for newgeometry at all, just use \hspace*{-2cm}\begin{tabular}.....\end{tabular}\hspace*{-2cm} (or better, adjust the table to fit within the normal margins) – David Carlisle Dec 28 '17 at 20:35
  • The header and footer (page number) are a function of the page style. \pagestyle{plain} should be at the bottom. – John Kormylo Dec 28 '17 at 20:43
  • Neither of this helps. If I use \hspace*{-2cm‌​} the table nicely fit the page without the need for \newgeometry, but the page number still appears on the top-right of the page, and with \pagestyle{plain} it is the same. – doremi Dec 28 '17 at 21:02
0

Use

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

then you do not needed a new page setting. Now the complete code for your example:

\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

| improve this answer | |
  • This shows me an error: Something's wrong--perhaps a missing \item, so it maybe thinks that I am trying to make some numbered list.... – doremi Dec 29 '17 at 8:18
  • see edited answer – user2478 Dec 29 '17 at 8:48
  • Yes, this is working! Thank you very much. Do you please know if there would be similar procedure with large figures, for which I am also applying \newgeometry to make them fit the page? I have tried this minipage to work with figures, but it doesn't. – doremi Dec 29 '17 at 9:24
  • It works also with a \includegraphics instead of the complete \resizebox{...} – user2478 Dec 29 '17 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.