側身如何做

側身如何做

我的一個附錄 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}

相關內容