我的一个附录 LaTeX 中有一个非常宽的表格,所以我想把它放在侧面。但是,当我使用时sidewaystable
,表格被放在附录后面的另一页上,使我的文档几乎是空白的,上面只有附录的名称。我知道翻转的表格可以放在那里,但出于某种原因,LaTeX 决定不这样做。
然后我使用了hvfloat
,但我无法改变标题的样式来适应我的其他普通表格的样式。
我也使用了rotating
,这是最好的选择。但是,表格中包含以下格式的数字(2.6 $\pm$ 5.6)$\cdot 10^{-4}$
,我无法正确对齐。我使用了siunitx
它,但无法弄清楚如何将其放在正中央。所以现在,我陷入了手动调整的困境,这不仅工作量大而且看起来很丑陋:
\documentclass{report}
\usepackage{hvfloat,rotating}
\usepackage[dutch]{babel}
\usepackage[latin1]{inputenc}
\usepackage{caption}
\usepackage[table]{xcolor}
\usepackage[perpage]{footmisc}
\usepackage[T1]{fontenc}
\usepackage[fleqn]{mathtools}
\usepackage{a4wide, afterpage, amsmath, amssymb, babelbib, booktabs, cite, color, colortbl, dcolumn, emptypage, eurosym, graphicx, float, footmisc, hyperref, hvfloat ,natbib, listings, lmodern, longtable, pdflscape, rotating, siunitx, subcaption, tablefootnote, threeparttable, titlesec, url}
\definecolor{lightgray}{gray}{0.9}
\begin{document}
\begin{table}[H]
\rowcolors{7}{}{lightgray}
\centering
\rotatebox{90}{
\begin{minipage}{0.7\paperheight}
\caption{Overzicht van de concentraties en hun standaardeviaties van pesticiden in mg/kg in de (on)behandelde wortelen en de meelwormen gekweekt op deze wortelen. Bij NA lag de concentratie onder de detectielimiet van de LCMS-MS.} \label{conc_carrot_meal}
\scalebox{0.8}{
\begin{tabular}{c*{6}{r@{.}l@{ $\pm$ }r@{.}l}}
\hline
\textbf{Pesticiden} & \multicolumn{24}{c}{\textbf{Concentraties pesticiden (mg/kg)}} \\ \cmidrule{2-25}
& \multicolumn{12}{c}{\textbf{Onbehandeld}} & \multicolumn{12}{c}{\textbf{Behandeld}} \\ \cmidrule{2-13} \cmidrule(lr){14-25}
& \multicolumn{4}{c}{\textbf{Wortel}} & \multicolumn{4}{c}{\begin{tabular}{c}
\textbf{ Meelwormen } \\
\textbf{(voor gut-loading)} \\
\end{tabular}} & \multicolumn{4}{c}{\begin{tabular}{c}
\textbf{ Meelwormen} \\
\textbf{(na gut-loading)} \\
\end{tabular}} & \multicolumn{4}{c}{\textbf{Wortel}} & \multicolumn{4}{c}{\begin{tabular}{c}
\textbf{ Meelwormen} \\
\textbf{(voor gut-loading)} \\
\end{tabular}} & \multicolumn{4}{c}{\begin{tabular}{c}
\textbf{ Meelwormen} \\
\textbf{(na gut-loading)} \\
\end{tabular}} \\
\hline \hline
2,4-D & \hspace{2ex}(2&55 & 2&6)$\cdot 10^{-4}$ & \hspace{2ex}(9&73 & 6&39)$\cdot 10^{-4}$ & \hspace{2ex}(8&24 & 2&77)$\cdot 10^{-4}$ & \hspace{2ex}(8&36 & 0&841) & \hspace{2ex}(5&01 & 0&542)$\cdot 10^{-4}$ & \hspace{2ex}(6&77 & 1&86)$\cdot 10^{-4}$\\
Bentazon & \multicolumn{4}{c}{\hspace{2.5ex}NA} & \multicolumn{4}{c}{\hspace{2.5ex}NA} & \hspace{2ex}(1&59 & 2&76)$\cdot 10^{-5}$ & \hspace{2ex}(0&919 & 0&117) & \multicolumn{4}{c}{\hspace{2.5ex}NA} & \multicolumn{4}{c}{\hspace{2.5ex}NA} \\
Bifenthrin & \hspace{2ex}(1&66 & 0&146)$\cdot 10^{-3}$ & \hspace{2ex}(2&84 & 1&15)$\cdot 10^{-3}$ & \hspace{2ex}(3&04 & 1&30)$\cdot 10^{-3}$ & \hspace{2ex}(0&808 & 0&104) & (2&22 & 0&769)$\cdot 10^{-3}$ & \hspace{2ex}(1&93 & 0&151)$\cdot 10^{-3}$ \\
Clopyralid & \hspace{2ex}(9&18 & 0&149)$\cdot 10^{-5}$ & \multicolumn{4}{c}{\hspace{2.5ex}NA} & \hspace{2ex}(4&61 & 7&99)$\cdot 10^{-5}$ & \hspace{2ex}(1&75 & 0&155) & \hspace{2ex}(1&07 & 0&686)$\cdot 10^{-2}$ & \hspace{2ex}(6&84 & 2&40)$\cdot 10^{-3}$ \\
\hline
\end{tabular}}
\end{minipage}}
\end{table}
\end{document}
这是可行的,但我需要将行涂成灰色,但正因为如此,一些数字消失了:
。
我真的不知道我可以使用什么其他解决方案,经过几个小时的搜索后它让我发疯了。
答案1
间歇性数字消失问题是由复杂的表格结构引起的。我建议您大幅简化表格代码,在此过程中将列数从 25 减少到 7。某些单元格的位置可以通过明智提供的\phantom{0}
语句进行微调。顺便说一句,如果您只是列出小数点后恰好有两位数字的所有数字,则这种微调完全没有必要。
我还想建议您(重新)组织一下表格标题。就我个人而言,我并不喜欢将每个标题单元格都渲染成大胆的。过多的(视觉)喊叫会导致信息变得很难被听到。
经过这些调整后,表格仅仅即使在横向模式下,它也能适合可用的文本块。除非您执行某些操作(可能很丑陋),例如减小表格中使用的字体大小,否则它将不适合带有章节或分节标题的页面。
\documentclass{report}
%%% I've commented out packages that are either loaded automatically by
%%% other packages or conflict with other packages.
%%% Note that "hyperref" should generally be loaded _last_
%\usepackage{hvfloat,rotating}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[dutch]{babel}
%\usepackage{caption}
\usepackage[table]{xcolor}
\usepackage[perpage]{footmisc}
\usepackage[fleqn]{mathtools}
\usepackage[table]{xcolor}
\usepackage{a4wide, afterpage, %amsmath,
amssymb, babelbib, booktabs, cite, %color, colortbl,
dcolumn, emptypage, eurosym, %graphicx,
float, footmisc, hvfloat ,%natbib,
listings, lmodern, longtable, pdflscape, rotating,
siunitx, subcaption, tablefootnote, threeparttable,
titlesec, url, hyperref}
\definecolor{lightgray}{gray}{0.9}
\newcommand\PA{\phantom{0}} % shortcut macro
\begin{document}
\begin{sidewaystable}
\rowcolors{7}{}{lightgray}
\caption[Overzicht van de concentraties en hun standaardeviaties van pesticiden]{Overzicht van de concentraties en hun standaardeviaties van pesticiden in mg/kg in de (on)behandelde wortelen en de meelwormen gekweekt op deze wortelen. Bij NA lag de concentratie onder de detectielimiet van de LCMS-MS.}
\label{conc_carrot_meal}
\centering
\begin{tabular}{ l *{6}{c} }
\toprule
{Pesticiden} & \multicolumn{6}{c}{{Concentraties pesticiden (mg/kg)}} \\
\cmidrule(l){2-7} &
\multicolumn{3}{c}{{Onbehandeld}} & \multicolumn{3}{c}{{Behandeld}} \\
\cmidrule(lr){2-4} \cmidrule(l){5-7}
&{Wortel} &\multicolumn{2}{c}{{Meelwormen}} &{Wortel} &\multicolumn{2}{c}{{Meelwormen}}\\
\cmidrule(lr){3-4} \cmidrule(l){6-7}
& & voor gut-loading & na gut-loading & & voor gut-loading & na gut-loading\\
\midrule
2,4-D & $(2.55 \pm 2.6\PA\PA){\cdot} 10^{-4}$
& $(9.73 \pm 6.39){\cdot} 10^{-4} $
& $(8.24 \pm 2.77 ){\cdot} 10^{-4}$
& $(8.36\PA\pm 0.841) $
& $(5.01 \pm 0.542 ){\cdot} 10^{-4}$
& $(6.77 \pm 1.86\PA){\cdot} 10^{-4}$\\
Bentazon & NA
& NA
& $(1.59 \pm 2.76){\cdot} 10^{-5}$
& $(0.919 \pm 0.117)$
& NA
& NA \\
Bifenthrin & $(1.66 \pm 0.146){\cdot} 10^{-3}$
& $(2.84 \pm 1.15){\cdot} 10^{-3}$
& $(3.04 \pm 1.30){\cdot} 10^{-3}$
& $(0.808 \pm 0.104) $
& $(2.22 \pm 0.769){\cdot} 10^{-3}$
& $(1.93 \pm 0.151){\cdot} 10^{-3}$ \\
Clopyralid & $(9.18 \pm 0.149){\cdot} 10^{-5}$
& NA
& $(4.61 \pm 7.99){\cdot} 10^{-5}$
& $(1.75\PA\pm 0.155)$
& $(1.07 \pm 0.686){\cdot} 10^{-2}$
& $(6.84 \pm 2.40\PA){\cdot} 10^{-3}$ \\
\bottomrule
\end{tabular}
\end{sidewaystable}
\end{document}
附录:可以将整个表格设置为纵向,即,通过将字体大小更改为\footnotesize
,仅显示小数点后两位数字,并使用tabular*
环境,设置为非旋转形式。
\documentclass{report}
%%% I've commented out packages that are either loaded
%%% automatically by or conflict with other packages.
%%% Note that "hyperref" should generally be loaded _last_.
%\usepackage{hvfloat,rotating}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[dutch]{babel}
%\usepackage{caption}
\usepackage[table]{xcolor}
\usepackage[perpage]{footmisc}
\usepackage[fleqn]{mathtools}
\usepackage[table]{xcolor}
\definecolor{lightgray}{gray}{0.9}
\usepackage{a4wide, afterpage, %amsmath,
amssymb, babelbib, booktabs, cite, %color, colortbl,
dcolumn, emptypage, eurosym, %graphicx,
float, footmisc, hvfloat ,%natbib,
listings, lmodern, longtable, pdflscape, rotating,
siunitx, subcaption, tablefootnote, threeparttable,
titlesec, url, hyperref}
\begin{document}
\begin{table}
\setlength\tabcolsep{0pt} % let LaTeX figure out intercolumn space
\footnotesize
\captionsetup{size=footnotesize}
\caption[Overzicht van de concentraties en hun standaardeviaties van pesticiden]{Overzicht van de concentraties en hun standaardeviaties van pesticiden in mg/kg in de (on)behandelde wortelen en de meelwormen gekweekt op deze wortelen. Bij NA lag de concentratie onder de detectielimiet van de LCMS-MS.}
\label{conc_carrot_meal}
\begin{tabular*}{\textwidth}{ l@{\extracolsep{\fill}} *{6}{c} }
\toprule
{Pesticiden} & \multicolumn{6}{c}{{Concentraties pesticiden (\si[per-mode = symbol]{\milli\gram\per\kilo\gram})}} \\
\cmidrule(l){2-7} &
\multicolumn{3}{c}{{Onbehandeld}} &
\multicolumn{3}{c}{{Behandeld}} \\
\cmidrule(lr){2-4} \cmidrule(l){5-7}
&{Wortel} &\multicolumn{2}{c}{{Meelwormen}}
&{Wortel} &\multicolumn{2}{c}{{Meelwormen}}\\
\cmidrule{3-4} \cmidrule{6-7}
& & voor gut-loading & na gut-loading
& & voor gut-loading & na gut-loading\\
\midrule
2,4-D & $(2.55 {\pm} 2.60){\cdot} 10^{-4}$
& $(9.73 {\pm} 6.39){\cdot} 10^{-4} $
& $(8.24 {\pm} 2.77 ){\cdot} 10^{-4}$
& $8.36 {\pm} 0.84 $
& $(5.01 {\pm} 0.54 ){\cdot} 10^{-4}$
& $(6.77 {\pm} 1.86){\cdot} 10^{-4}$\\
Bentazon & NA
& NA
& $(1.59 {\pm} 2.76){\cdot} 10^{-5}$
& $0.92 {\pm} 0.12$
& NA
& NA \\
Bifenthrin & $(1.66 {\pm} 0.15){\cdot} 10^{-3}$
& $(2.84 {\pm} 1.15){\cdot} 10^{-3}$
& $(3.04 {\pm} 1.30){\cdot} 10^{-3}$
& $0.81 {\pm} 0.10 $
& $(2.22 {\pm} 0.77){\cdot} 10^{-3}$
& $(1.93 {\pm} 0.15){\cdot} 10^{-3}$ \\
Clopyralid & $(9.18 {\pm} 0.15){\cdot} 10^{-5}$
& NA
& $(4.61 {\pm} 7.99){\cdot} 10^{-5}$
& $1.75 {\pm} 0.16$
& $(1.07 {\pm} 0.69){\cdot} 10^{-2}$
& $(6.84 {\pm} 2.40){\cdot} 10^{-3}$ \\
\bottomrule
\end{tabular*}
\end{table}
\end{document}
答案2
一个快速而粗略的技巧:您可以将表格排版为整页文档,并将其作为旋转的图形包含在内。为表格维护单独的 tex 文件会很烦人,但您会多久编辑一次表格呢?
\begin{figure}[h]
\centering
\includegraphics[angle=90]{figure}
\caption{The caption goes here}
\end{figure}