\documentclass[11pt]{article}
\usepackage{geometry}
\geometry{a4paper}
\usepackage{mathpazo}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{booktabs}
\usepackage{tabularx}
\begin{document}
\begin{table}[htdp]
\centering
\caption{Absorbances of samples of different Concentrations\label{mytable}}
\begin{tabular}{lll}
\toprule
Sample & Concentration \linebreak (mg/L) & Absorbance at \linebreak $\lambda_{max}$ \\
\midrule
blank & 0.0000 & 0.000 \\
a & 0.2849 & 0.059 \\
b & 0.7122 & 0.160 \\
c & 1.424 & 0.311 \\
d & 2.137 & 0.468 \\
e & 2.849 & 0.608 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
为啥我的 s 不\linebreak
工作?
编辑:我试图将代码改为两列表格
\documentclass[11pt]{article}
\newcommand{\specialcell}[2][c]{\begin{tabular}[#1]{@{}c@{}}#2\end{tabular}}
\usepackage{siunitx}
\usepackage{amsmath}
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\caption{Absorbances of 20 \si{\ml} sample at different Wavelengths}
\label{mytable}
\begin{tabular}{lS[table-format=1.3]}
\toprule
{\specialcell[t]{Wavelength \\in \si{\nano\meter}}} & Absorbance \\
\midrule
400 & 0.240 \\
425 & 0.382 \\
450 & 0.486 \\
475 & 0.574 \\
500 & 0.608 \\
505 & 0.608 \\
510 & 0.602 \\
525 & 0.508 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
但是当我在吸光度中添加“e”时,它会引发错误
答案1
\linebreak
不是用于表格的命令。您必须p
在此处使用列,或者为每个单元格定义一个表格。在这个答案它很好地展示了如何为此定义命令。
% arara: pdflatex
\documentclass[11pt,a4paper]{article}
\usepackage{mathpazo}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{caption}
\newcommand{\specialcell}[2][c]{%
\begin{tabular}[#1]{@{}c@{}}#2\end{tabular}} % replace c bei l if you want the text to appear ragged right (flush left)
\usepackage{siunitx}
\begin{document}
\begin{table}
\centering
\caption{Absorbances of samples of different Concentrations}
\label{mytable}
\begin{tabular}{lS[table-format=1.4]S[table-format=1.3]}
\toprule
Sample & {\specialcell[t]{Concentration\\in \si{\milli\gram\per\liter}}} & {\specialcell[t]{Absorbance at\\$\lambda_\text{max}$}} \\
\midrule
blank & 0.0000 & 0.000 \\
a & 0.2849 & 0.059 \\
b & 0.7122 & 0.160 \\
c & 1.424 & 0.311 \\
d & 2.137 & 0.468 \\
e & 2.849 & 0.608 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}