表格宽度超出 \textwidth,与边距对齐

表格宽度超出 \textwidth,与边距对齐

我有一个宽度超出的表格\textwidth。我想让表格左侧对齐左边距。我应该怎么做?

注意:此页面位于左侧。

平均能量损失

\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}

在此处输入图片描述

谢谢!

答案1

如果您坚持将表格扩展到外部边缘……那么包changepage及其宏adjustwidth*就是您的朋友。部分考虑到 Mico 答案中给出的表格设计的改进,使用siunitx包作为单位,表格如下:

在此处输入图片描述

\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}

上述代码应该是不言自明的 :-)。除了提到的之外,我还纠正了geometry设置,并在表格和正文中使用了相同的字体大小。包showframe及其框架颜色设置应该在实际文档中删除。

附录:

今天(差不多三年后),我将对上述 MWE 做出以下更改:

  • 删除cal包,改为使用 LaTeX 原始包来计算表格宽度\dimexpr
  • 而不是\footnote(这不能按预期工作)而是使用 \tnote command defined in the\threeoarttable` 并将节点放在表之后
  • 而不是$\SI{2.5}{\degree}\times\SI{2.0}{\degree}$使用较短的符号\SI{2.5 x 2.0}{\degree}

在 MWE 中,以下是表格位于奇数页和偶数页的情况。要显示结果,您需要编译 MWE(至少)两次。

在奇数页上:

在此处输入图片描述

在偶数页上:

在此处输入图片描述

新的 MWE 为:

\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

我会不是让表格内容突出到边距中。由于第 2 列和第 4 列的内容无论如何都不可避免地要换行,因此最好让 LaTeX 自行找到合适的换行符。使用环境tabularx并使用列类型的右对齐版本X

在此处输入图片描述

\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}

相关内容