5

I have a wide table which exceeds the \textwidth. I want to let the left side of table align the left margin. How should I do?

Note: This page is at left-hand side.

MWE

\documentclass[12pt,a4paper, twoside]{book}
\usepackage[a4paper,
 textwidth=120mm, lmargin=25mm, marginparwidth=5mm, marginpar=55mm]{geometry}
\usepackage[font=footnotesize, labelfont=bf]{caption}
\newcommand{\tabincell}[2]{\begin{tabular}{@{}#1@{}}#2\end{tabular}}

\begin{document}
 some text here ............

\newpage       % To make this page left-hand side. 
We choose 6-hourly MRI-CGCM3, MPI-ESM-LR, GFDL CM3 models for this studies. However, it remains a restriction, that is, the lack of lots of variables. The Vitart algorithm (Knutson 2007) requires environmental variables such as vorticity at 850 hPa, temperature, geopotential, wind speeds on various pressure levels, and sea level pressure. But the CMIP models doesn't provide geopotential data and wind speed at sea level, we are going to skip the thickness criteria in the algorithm (in Sec. A.2.2) and replace surface wind by 850-hPa wind.   \\

\footnotesize \captionof{table}{CMIP5 models we used to analysis in our study. (Taylor et al. 2012, Camargo 2013)} 
\begin{tabular}{ccccc}
 \hline \hline
Acronym & Model name  & Number {\footnote{The model number here follows which described in Camargo 2013.}} & Modeling center & Resolution  \\     
 \hline
GFDL CM3 & \tabincell{c}{Geophysical Fluid Dynamics Laboratory \\ Climate Model, version 3}  & M5 & \tabincell{c}{NOAA/Geophysical Fluid \\ Dynamics Laboratory} & $2.5^{\circ} \times 2.0^{\circ}$  \\[0.5cm]
MPI-ESM-LR & \tabincell{c}{Max Planck Institute Earth \\ System Model, low resolution} & M12 & \tabincell{c}{Max Planck Institute \\ for Meteorology } & $1.9^{\circ } \times 1.9^{\circ }$ \\[0.5cm]
MRI-CGCM3 & \tabincell{c}{Meteorological Research Institute \\ Coupled Atmospheric-Ocean General \\ Circulation Model, version 3} & M13 & Meteorological Research Institute & $1.1^{\circ }\times 1.2^{\circ }$ \\[0.5cm]
\hline
\end{tabular} \\[0.2cm]
\end{document}

enter image description here

Thanks!

1
  • 1
    You should consider building a sideways table if you really need marginparwidth=55mm. B.t.w., the margin key for geometry does not exist.
    – Bernard
    Sep 27, 2016 at 16:55

2 Answers 2

5

In case, that you persist with table extension to outside margin ... than package changepage and its macro adjustwidth* is your frend. Partly considering improvements of your table design given in Mico answer, using siunitx packages for units, the table is:

enter image description here

\documentclass[12pt,twoside]{book}
\usepackage[a4paper,
            lmargin=25mm,
            textwidth=120mm,
            marginparsep=5mm, marginparwidth=55mm% <-- changed
            ]
            {geometry}
\usepackage[font=footnotesize, labelfont=bf]{caption}
\usepackage{booktabs, tabularx}% <-- added
\newcolumntype{L}{>{\raggedright\arraybackslash}X}

\usepackage{showframe}% <-- for showing page layout
\renewcommand*\ShowFrameColor{\color{red}}

\usepackage{calc}% <-- added
\usepackage{siunitx}% <-- added
\usepackage[strict]{changepage}% <-- added
\usepackage{lipsum}% <-- for dummy text

\begin{document}
\lipsum[1]

\clearpage       % To make this page left-hand side.
\lipsum[2]
    \begin{table}[htb]
\begin{adjustwidth*}{}{-\marginparwidth-\marginparsep}
%    \footnotesize
\caption{CMIP5 models we used to analysis in our study.
                  (Taylor et al. 2012, Camargo 2013)}
\begin{tabularx}{\linewidth}{r
                             >{\setlength\hsize{1.2\hsize}}Lc
                             >{\setlength\hsize{0.8\hsize}}Lc}
    \toprule
Acronym     &   Model name
                &   Number\footnote{The model number here follows
                                    which described in Camargo 2013.}
                    &   Modeling center
                        &   Resolution      \\
    \midrule
GFDL CM3    &   Geophysical Fluid Dynamics Laboratory 
                Climate Model, version 3
                &   M5  &   NOAA/Geophysical Fluid 
                            Dynamics Laboratory
                            &   $\SI{2.5}{\degree}\times\SI{2.0}{\degree}$  
                                            \\
    \addlinespace
MPI-ESM-LR  &   Max Planck Institute Earth 
                System Model, low resolution
                &   M12 &   Max Planck Institute 
                            for Meteorology
                            &   $\SI{1.9}{\degree}\times\SI{1.9}{\degree}$ 
                                            \\
    \addlinespace
MRI-CGCM3   &   Meteorological Research Institute 
                Coupled Atmospheric-Ocean General 
                Circulation Model, version 3 
                &   M13 &   Meteorological Research Institute 
                            &   $\SI{2.0}{\degree}\times\SI{2.0}{\degree}$
                                            \\
    \bottomrule
\end{tabularx}
\end{adjustwidth*}
    \end{table}
\end{document}

The above code should be self-explanatory :-). Beside mentioned I correct geometry settings and use the same font size in the table and in the main text. Package showframe and its frame color setting should be in real document deleted.

Addendum:

Today (after almost three year) I would make the following changes in above MWE:

  • remove cal package and instead it in calculation of the table width use LaTeX primitive \dimexpr
  • instead of \footnote (which doesn't work as expected) rather use \tnotecommand defined in the\threeoarttable` and put node immediately after table
  • instead of $\SI{2.5}{\degree}\times\SI{2.0}{\degree}$ in use shorter notation \SI{2.5 x 2.0}{\degree}

In MWE below are cases when table is on odd and on even page. For showed result you need to compile MWE (at least) twice.

on odd pages:

enter image description here

and on even pages:

enter image description here

The new MWE is:

\documentclass[12pt,twoside]{book}
\usepackage[a4paper,
            lmargin=25mm,
            textwidth=120mm,
            marginparsep=5mm, marginparwidth=55mm
            ]
            {geometry}
\usepackage[font=footnotesize, labelfont=bf]{caption}
\usepackage{booktabs, tabularx, 
            threeparttable}% <-- added
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{siunitx}
\usepackage[strict]{changepage}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}

\begin{document}
\lipsum[1]
    \begin{table}[htb]
\begin{adjustwidth*}{}{-\dimexpr\marginparwidth+\marginparsep\relax}
    \begin{threeparttable}
\caption{CMIP5 models we used to analysis in our study.
                  (Taylor et al. 2012, Camargo 2013)}
\begin{tabularx}{\linewidth}{@{} r Lc
                                   Lc @{}}
    \toprule
Acronym     &   Model name
                &   Number\tnote{a}
                    &   Modeling center
                        &   Resolution      \\
    \midrule
GFDL CM3    &   Geophysical Fluid Dynamics Laboratory
                Climate Model, version 3
                &   M5  &   NOAA/Geophysical Fluid
                            Dynamics Laboratory
                            &   $\SI{2.5 x 2.0}{\degree}$
                                            \\
    \bottomrule
\end{tabularx}
\begin{tablenotes}[flushleft]\footnotesize
\item[a]   The model numbers follows to the 
           the models described in Camargo 2013.
\end{tablenotes}
\end{threeparttable}
\end{adjustwidth*}
    \end{table}
\lipsum[2]

\clearpage       % To make this page left-hand side.
\lipsum[3]
    \begin{table}[htb]
\begin{adjustwidth*}{}{-\dimexpr\marginparwidth+\marginparsep\relax}
    \begin{threeparttable}
\caption{CMIP5 models we used to analysis in our study.
                  (Taylor et al. 2012, Camargo 2013)}
\begin{tabularx}{\linewidth}{@{} r Lc
                                   Lc @{}}
    \toprule
Acronym     &   Model name
                &   Number\tnote{a}
                    &   Modeling center
                        &   Resolution      \\
    \midrule
GFDL CM3    &   Geophysical Fluid Dynamics Laboratory
                Climate Model, version 3
                &   M5  &   NOAA/Geophysical Fluid
                            Dynamics Laboratory
                            &   \SI{2.5 x 2.0}{\degree}
                                            \\
    \addlinespace
MPI-ESM-LR  &   Max Planck Institute Earth
                System Model, low resolution
                &   M12 &   Max Planck Institute
                            for Meteorology
                            &   \SI{1.9 x 1.9}{\degree}
                                            \\
    \addlinespace
MRI-CGCM3   &   Meteorological Research Institute
                Coupled Atmospheric-Ocean General
                Circulation Model, version 3
                &   M13 &   Meteorological Research Institute
                            &   \SI{2.0 x 2.0}{\degree}
                                            \\
    \bottomrule
\end{tabularx}
\begin{tablenotes}[flushleft]\footnotesize
\item[a]   The model numbers follows to the
           the models described in Camargo 2013.
\end{tablenotes}
\end{threeparttable}
\end{adjustwidth*}
    \end{table}
\footnotetext{The model number here follows
              the model described in Camargo 2013.}
\lipsum[4]
\end{document}
2
  • Thanks for providing such clear answer also fix something I have done wrong :-)
    – Wayne Tsai
    Sep 28, 2016 at 1:20
  • 1
    which left margin? defined by adjustwidth? in later case you need add singlelinecheck=off into caption package options.
    – Zarko
    Sep 28, 2016 at 2:39
1

I would not let the tabular material protrude into the margin. Since line breaks are unavoidable anyway for the material in columns 2 and 4, it's best to let LaTeX find suitable line breaks on its own. Use a tabularx environment and use a ragged-right version of the X column type.

enter image description here

\documentclass[12pt,twoside]{book}
\usepackage[a4paper, textwidth=120mm, lmargin=25mm, 
   marginparwidth=5mm, marginpar=55mm]{geometry}
\usepackage[labelfont=bf]{caption}
\usepackage{tabularx,booktabs,ragged2e}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X} % ragged-right version of "X" column type
\usepackage[english]{babel}
\begin{document}
\null

\newpage       % To make this page left-hand side. 

We choose 6-hourly MRI-CGCM3, MPI-ESM-LR, GFDL CM3 models for this studies. However, it remains a restriction, that is, the lack of lots of variables. The Vitart algorithm (Knutson 2007) requires environmental variables such as vorticity at 850 hPa, temperature, geopotential, wind speeds on various pressure levels, and sea level pressure. But the CMIP models doesn't provide geopotential data and wind speed at sea level, we are going to skip the thickness criteria in the algorithm (in Sec. A.2.2) and replace surface wind by 850-hPa wind. 

\begingroup % Keep the following parameter changes local to current group
\setlength\tabcolsep{3pt} % default value: 6pt
\captionsetup{size=footnotesize}
\footnotesize 

\captionof{table}{CMIP5 models we used to analysis in our study. 
(Taylor et al.\ 2012, Camargo 2013)} 

\noindent
\begin{tabularx}{\textwidth}{@{}lLlLr@{}}
\toprule
Acronym & Model name  & Number\footnote{The model number here follows 
which described in Camargo 2013.} & Modeling center & Resolution  \\     
\midrule
GFDL CM3 & Geophysical Fluid Dynamics Laboratory Climate Model, version 3  
& M5 & NOAA\slash Geophysical Fluid Dynamics Laboratory 
& $2.5^{\circ}{\times}2.0^{\circ}$  \\ 
\addlinespace
MPI-ESM-LR & Max Planck Institute Earth System Model, low resolution & 
M12 & Max Planck Institute for Meteorology  
& $1.9^{\circ } {\times} 1.9^{\circ }$ \\
\addlinespace
MRI-CGCM3 & Meteorological Research Institute Coupled Atmospheric-Ocean 
General Circulation Model, version~3 & 
M13 & Meteorological Research Institute 
& $1.1^{\circ }{\times} 1.2^{\circ }$ \\
\bottomrule
\end{tabularx}
\endgroup

\end{document}
1
  • Another question: if using this layout, how to move the caption to the left margin? Thanks again!
    – Wayne Tsai
    Sep 28, 2016 at 2:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .