如何在禁忌中將桌子兩側均勻居中

如何在禁忌中將桌子兩側均勻居中

tabu我有一個在環境中編寫和包裝的表格table,但它使用1.1\textwidth, 並延伸到頁面的右邊距之外,同時錨定到左邊距。如何使其居中,使其均勻地超出兩側邊距?謝謝。

這是我的程式碼:

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}

\usepackage{geometry}
\geometry{a4paper}
\geometry{margin=2cm}

\usepackage[version=4]{mhchem}
\usepackage{float}
\usepackage{tabu}

\begin{document}

\begin{table}[H]
\begin{tabu} to 1.1\textwidth{| X[l] | X[l] | X[l] |}
\hline
\textbf{Apparatus/material} & \textbf{Quantity/amount/mass used} & \textbf{Uncertainty}\\
\hline 
Magnesium sulfate & 0.05, 0.10, 0.15, 0.20, 0.25 mol & $\pm$0.01g\\
\hline
Yeast, dried & 2.000g & $\pm$0.01g\\
\hline
Glucose (dextrose) & 3.000g & $\pm$0.01g\\
\hline
200cm\textsuperscript{3} beaker & 1 & NIL\\  
\hline
Test tube & 4 & NIL\\
\hline
250cm\textsuperscript{3} measuring cylinder & 1 & $\pm$1cm\textsuperscript{3}\\
\hline
10cm\textsuperscript{3} measuring cylinder & 1 & $\pm$0.1cm\textsuperscript{3}\\
\hline
Glass rod & 1 & NIL\\
\hline
Filter funnel & 1 & NIL\\
\hline
Vernier gas pressure sensor & 4 & $\pm$0.4mmHg\\
\hline
Vernier LabQuest datalogger & 1 & NIL\\
\hline
Excell BH-600 electronic balance & 1 & $\pm$0.01g\\
\hline
Apollo vortex mixer & 1 & NIL\\
\hline
Parafilm & NIL & NIL\\
\hline
\end{tabu}
\caption{Table of materials and apparatus}
\label{tab:ma}
\end{table}

這給了表格:

在此輸入影像描述

答案1

像這樣?

在此輸入影像描述

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}

\usepackage{geometry}
\geometry{a4paper, margin=2cm}

%\usepackage[version=4]{mhchem}% <-- I had issues with this package, it gives error
%\usepackage{float} % not needed in this example
\usepackage{tabu}

\usepackage[strict]{changepage}% <-- added

\usepackage{showframe}% only for this example

\begin{document}
    \begin{table}%[H]
\begin{adjustwidth}{-0.05\linewidth}{-0.05\linewidth}
\begin{tabu} to 1.1\textwidth{| X[l] | X[l] | X[l] |}
\hline
\textbf{Apparatus/material} & \textbf{Quantity/amount/mass used} & \textbf{Uncertainty}\\
\hline
Magnesium sulfate & 0.05, 0.10, 0.15, 0.20, 0.25 mol & $\pm$0.01g\\
\hline
Yeast, dried & 2.000g & $\pm$0.01g\\
\hline
Glucose (dextrose) & 3.000g & $\pm$0.01g\\
\hline
200cm\textsuperscript{3} beaker & 1 & NIL\\
\hline
Test tube & 4 & NIL\\
\hline
250cm\textsuperscript{3} measuring cylinder & 1 & $\pm$1cm\textsuperscript{3}\\
\hline
10cm\textsuperscript{3} measuring cylinder & 1 & $\pm$0.1cm\textsuperscript{3}\\
\hline
Glass rod & 1 & NIL\\
\hline
Filter funnel & 1 & NIL\\
\hline
Vernier gas pressure sensor & 4 & $\pm$0.4mmHg\\
\hline
Vernier LabQuest datalogger & 1 & NIL\\
\hline
Excell BH-600 electronic balance & 1 & $\pm$0.01g\\
\hline
Apollo vortex mixer & 1 & NIL\\
\hline
Parafilm & NIL & NIL\\
\hline
\end{tabu}
\caption{Table of materials and apparatus}
    \label{tab:ma}
\end{adjustwidth}
    \end{table}
\end{document}

對於單位,您應該考慮siunitx打包。

附錄: 我想知道為什麼表格寬度是1.1\textwidth例如,最後一列中的儲存格內容可以儲存在較窄的列中。例如

\begin{tabu} to \textwidth {| X[5] | X[5] | X[4] |}

並刪除adjustwidth你的桌子變成:

在此輸入影像描述

透過這種方法,您也不會遇到longtabu表格問題。

相關內容