2

I have got a long horizontal table, and I would like to shift it to a bit left to make it fit the page well. Does anyone know how to do this? Thanks!

\begin{table}
\centering
\footnotesize\setlength{\tabcolsep}{0.01pt}
\begin{tabular}{l@{\hspace{0.01pt}} *{18}{c}}
\toprule
\bfseries Model & \multicolumn{18}{c}{\bfseries Parameters} \\
\cmidrule(l){2-18}
& $\omega$ & $\phi$ & $\alpha$ & $\beta$ & $\gamma_1$ & $\gamma_2$ & $\gamma_3$ & 
$\gamma_4$ & $\gamma_5$ & $\gamma_6$ & $\theta_1$  & $\theta_2$ & $\theta_3$ & $\theta_4$ 
& $\varphi_1$ & $\varphi_2$ & $\varphi_3$ \\
\midrule
\bfseries 2
& - & 0.998  & 0.0032 & 0.0002 &  -0.0058 & -0.1887& - & - & - & - & 0.593 &
0.232 & - & - &  0.1476 & -0.1377 & -0.0288 \\
\bfseries 4
& 1 & - & - & - & 0.0003 & -0.0006 &  -0.0005 & 0.0002
-&-& &  0.823 & - & - & - & 0.0454 & -0.1384 \\
\bfseries 5
& 1 & - &  0.0054 & - & 0.0010 & -0.0002 & 0.0006 & -0.0020 & 0.0003 & -0.0007     
& 0.8524 & 0.2764 & -0.2393& 0.0348 & 0.0395 & -0.4177&- \\
\bottomrule
\addlinespace
\multicolumn{18}{l}{1: DSHW(7, 364) ; 2: BATS(7, 365); 3: BATS(7, 91, 365);\\
\end{tabular}
\caption{Parameters chosoen for all models}\label{tab:Hparameters}
\end{table}
5
  • 1
    into the margins? won't be pretty, but you could do \hspace{-5cm}\begin{tabular}… and removing \centering. I would rather scale it doewn, or switch the columns and rows, so that it will be a long table instead of a thick one. Captions should in most cases be on top of tables, (below figures). Also, why do you do insert lengths of 0.01pt? why not just use 0pt
    – Runar
    Aug 17 '16 at 13:44
  • are you sure you only want 2 hundredths of a point space between columns, this will mean effectively that text in one column will touch text in the adjacent column (\setlength{\tabcolsep}{0.01pt}) ? Aug 17 '16 at 14:02
  • @RunarTrollet Thanks! That works! I am just trying to compress the table, so used 0.01pt, but it doesn't look nice actually. Is it possible to adjust the font size of the table contents?
    – Jeannie
    Aug 17 '16 at 14:33
  • @DavidCarlisle That's the only way I know to compress the table. Any better idea?
    – Jeannie
    Aug 17 '16 at 14:34
  • First can you fix your example so that people can run it. It is missing \documentclass, \begin{docuemnt} and if that is fixed it generates ! File ended while scanning use of \multicolumn. Aug 17 '16 at 14:54
1

You can enclose the tabular environment in a \makebox[0pt]{…} (and keep \centering). However, I would advise to swap rows and columns, it will look nicer. Also, you should use the S column type, from siunitx: your numbers will aligned on the decimal dot, and the minus signs won't be hyphens. Note the preamble of the table should have 17 centred columns, not 18.

Added: I propose this code, in which the font size can be set to \small:

    \documentclass{article}
    \usepackage[utf8]{inputenc}
    \usepackage[a4paper]{geometry}
    \usepackage{booktabs, caption, siunitx, threeparttable} %
     \usepackage{showframe}
    \renewcommand\ShowFrameLinethickness{0.2pt}

     \begin{document}

    \begin{table}[!htb]
      \centering
      \begin{threeparttable}
        \small\setlength\tabcolsep{4pt}
        \sisetup{table-format=-1.4,table-number-alignment=center}
        \caption{Parameters chosen for all models}\label{tab:Hparameters}
        \begin{tabular}{>{$}c<{$} *{3}{S}c>{$}c<{$} *{3}{S}}
          \addlinespace[-\aboverulesep]
          \cmidrule[\heavyrulewidth]{1-4}\cmidrule[\heavyrulewidth]{6-9}
          \textbf{Parameters} & \multicolumn{3}{c}{\bfseries Model}  & \rule{1cm}{0pt} &  \textbf{Parameters} & \multicolumn{3}{c}{\bfseries Model} \\
          \cmidrule(lr){2-4}\cmidrule(lr){7-9}
                   & {\bfseries 2} & {\bfseries 4} & {\bfseries 5} &   &           & {\bfseries 2} & {\bfseries 4} & {\bfseries 5} \\
          \cmidrule[\lightrulewidth]{1-4}\cmidrule[\lightrulewidth]{6-9}
          \omega   & {–}         & {1}           & {1}           &   & \theta_1  & 0.593         & 0.823         & 0.8524        \\
          \phi     & 0.998         & {–}         & {–}         &   & \theta_2  & 0.232         & {–}         & 0.2764        \\
          \alpha   & 0.0032        & {–}         & 0.0054        &   & \theta_3  & {–}         & {–}         & -0.2393       \\
          \beta    & 0.0002        & {–}         & {–}         &   & \theta_4  & {–}         & {–}         & 0.0348        \\
          \addlinespace
          \gamma_1 & -0.0058       & 0.0003        & 0.0010        &   & \varphi_1 & 0.1476        & 0.0454        & 0.0395        \\
          \gamma_2 & -0.1887       & -0.0006       & -0.0002       &   & \varphi_2 & -0.1377       & -0.1384       & -0.4177       \\
          \gamma_3 & {–}         & -0.0005       & 0.0006        &   & \varphi_3 & -0.0288       & {–}         & {–}         \\
          \gamma_4 & {–} & 0.0002 & -0.0020 \\
          \gamma_5 &{–} &{–} & 0.0003 \\
          \gamma_6 &{–} &{–} & -0.0007 \\
          \cmidrule[\heavyrulewidth]{1-4}\cmidrule[\heavyrulewidth]{6-9}
        \end{tabular}
        \begin{tablenotes}[para]\footnotesize
          \item[]1: DSHW(7, 364) ;
          \item[]2: BATS(7, 365);
          \item[]3: BATS(7, 91, 365).
        \end{tablenotes}
      \end{threeparttable}
    \end{table}

    \end{document}


\begin{table}
  \centering
  \begin{threeparttable}
    %\small
    \sisetup{table-format=-1.4,table-number-alignment=center}
    \caption{Parameters chosen for all models}\label{tab:Hparameters}
    \begin{tabular}{>{$}c<{$} *{3}{S}}
      \toprule
      \textbf{Parameters} & \multicolumn{3}{c}{\bfseries Model} \\
      \cmidrule(lr){2-4}
                & {\bfseries 2} & {\bfseries 4} & {\bfseries 5} \\
      \midrule
      \omega    & {–}         & {1}           & {1}           \\
      \phi      & 0.998         & {–}         & {–}         \\
      \alpha    & 0.0032        & {–}         & 0.0054        \\
      \beta     & 0.0002        & {–}         & {–}         \\
      \addlinespace
      \gamma_1  & -0.0058       & 0.0003        & 0.0010        \\
      \gamma_2  & -0.1887       & -0.0006       & -0.0002       \\
      \gamma_3  & {–}         & -0.0005       & 0.0006        \\
      \gamma_4  & {–}         & 0.0002        & -0.0020       \\
      \gamma_5  & {–}         & {–}         & 0.0003        \\
      \gamma_6  & {–}         & {–}         & -0.0007       \\
      \addlinespace
      \theta_1  & 0.593         & 0.823         & 0.8524        \\
      \theta_2  & 0.232         & {–}         & 0.2764        \\
      \theta_3  & {–}         & {–}         & -0.2393       \\
      \theta_4  & {–}         & {–}         & 0.0348        \\
      \addlinespace
      \varphi_1 & 0.1476        & 0.0454        & 0.0395        \\
      \varphi_2 & -0.1377       & -0.1384       & -0.4177       \\
      \varphi_3 & -0.0288       & {–}         & {–}         \\
      \bottomrule
    \end{tabular}
    \begin{tablenotes}[para]\footnotesize
      \item[]1: DSHW(7, 364) ;
      \item[]2: BATS(7, 365);
      \item[]3: BATS(7, 91, 365).
    \end{tablenotes}
  \end{threeparttable}
\end{table}

enter image description here

0
0
\documentclass{article}

\usepackage{booktabs}
\usepackage{rotating}
\usepackage{lipsum}

\begin{document}

\lipsum

\begin{sidewaystable}\hspace*{3cm}
\footnotesize\setlength{\tabcolsep}{0.01pt}
\begin{tabular}{l@{\hspace{0.01pt}} *{18}{c}}
\toprule
\bfseries Model & \multicolumn{18}{c}{\bfseries Parameters} \\
\cmidrule(l){2-18}
& $\omega$ & $\phi$ & $\alpha$ & $\beta$ & $\gamma_1$ & $\gamma_2$ & $\gamma_3$ & 
$\gamma_4$ & $\gamma_5$ & $\gamma_6$ & $\theta_1$  & $\theta_2$ & $\theta_3$ & $\theta_4$ 
& $\varphi_1$ & $\varphi_2$ & $\varphi_3$ \\
\midrule
\bfseries 2
& - & 0.998  & 0.0032 & 0.0002 &  -0.0058 & -0.1887& - & - & - & - & 0.593 &
0.232 & - & - &  0.1476 & -0.1377 & -0.0288 \\
\bfseries 4
& 1 & - & - & - & 0.0003 & -0.0006 &  -0.0005 & 0.0002
-&-& &  0.823 & - & - & - & 0.0454 & -0.1384 \\
\bfseries 5
& 1 & - &  0.0054 & - & 0.0010 & -0.0002 & 0.0006 & -0.0020 & 0.0003 & -0.0007     
& 0.8524 & 0.2764 & -0.2393& 0.0348 & 0.0395 & -0.4177&- \\
\bottomrule
\addlinespace
\multicolumn{18}{l}{1: DSHW(7, 364) ; 2: BATS(7, 365); 3: BATS(7, 91, 365);}\\
\end{tabular}
\caption{Parameters chosoen for all models}\label{tab:Hparameters}
\end{sidewaystable}

\lipsum

\end{document}

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.