我有一个在环境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
表格问题。