我正在制作一个表格,但似乎无法让加号/减号出现在表格中。它只是告诉\pm
我想要实际符号出现的位置。
我不知道该怎么办——我会很感激任何帮助。
\documentclass[twoside]{article}
\usepackage{lipsum} % Package to generate dummy text throughout this template
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\linespread{1.05} % Line spacing - Palatino needs more space between lines
\usepackage{microtype} % Slightly tweak font spacing for aesthetics
\usepackage[hmarginratio=1:1,top=32mm,columnsep=20pt]{geometry} % Document margins
\usepackage{multicol} % Used for the two-column layout of the document
\usepackage[hang, small,labelfont=bf,up,textfont=it,up]{caption} % Custom captions under/above floats in tables or figures
\usepackage{booktabs} % Horizontal rules in tables
\usepackage{float} % Required for tables and figures in the multi-column environment - they need to be placed in specific locations with the [H] (e.g. \begin{table}[H])
\usepackage{hyperref} % For hyperlinks in the PDF
\usepackage{lettrine} % The lettrine is the first enlarged letter at the beginning of the text
\usepackage{paralist} % Used for the compactitem environment which makes bullet points with less space between them
\usepackage{esvect}
\usepackage{abstract} % Allows abstract customization
\renewcommand{\abstractnamefont}{\normalfont\bfseries} % Set the "Abstract" text to bold
\renewcommand{\abstracttextfont}{\normalfont\small\itshape} % Set the abstract itself to small italic text
\usepackage{titlesec} % Allows customization of titles
\renewcommand\thesection{\Roman{section}} % Roman numerals for the sections
\renewcommand\thesubsection{\Roman{subsection}} % Roman numerals for subsections
\titleformat{\section}[block]{\large\scshape\centering}{\thesection.}{1em}{} % Change the look of the section titles
\titleformat{\subsection}[block]{\large}{\thesubsection.}{1em}{} % Change the look of the section titles
\usepackage{fancyhdr} % Headers and footers
\pagestyle{fancy} % All pages have headers and footers
\fancyhead{} % Blank out the default header
\fancyfoot{} % Blank out the default footer
\fancyhead[C]{CH 341: Biochemistry I $\bullet$ November 2015 $\bullet$ Vol. XXI, No. 1} % Custom header text
\fancyfoot[RO,LE]{\thepage} % Custom footer text
\usepackage{tabularx}
\usepackage{pgfplots}
\usepackage{caption}
\usepackage{graphicx} %allows importing images
\usepackage{float} % allows to control the float positions
\usepackage{mhchem}
\usepackage{textgreek}
\usepackage{siunitx}
\usepackage{textcomp}
\usepackage{multirow}
\usepackage{grffile}
\usepackage[export]{adjustbox}
\usepackage{placeins}
\begin{document}
\begin{table}
\small\caption{Product Concentrations and Enzyme Reaction Velocities for the 5 Substrate Concentrations in Varying Inhibitor Environments}
\begin{center}
\footnotesize
\newcommand{\head}[1]{\textnormal{\textbf{#1}}}
\begin{tabular}{ccc}
\toprule[1.5pt]
\head{Metal} & \head{Average Velocity SD} & \head{Average Product Concentration Formed SD}\\
\midrule
\verb|Magnesium| & \verb|1.30 \pm 0.67| & \verb|25.97 \pm 13.33|\\
\verb|Zinc| & \verb|0.40 \pm 0.049| & \verb|8.06 \pm 0.97|\\
\bottomrule[1.5pt]
\end{tabular}
\end{center}
\end{table}
\end{document}
答案1
由于环境的标题行tabular
不使用“打字机”(即等宽)字母,因此我不会在正文中使用打字机样式的字母tabular
。删除\verb
指令并根据需要将数字括在$
数学起始符/终止符中似乎是可行的方法。\phantom
根据需要使用指令来微调\pm
符号前后数字的垂直对齐。
我还将删除\small
尤其是\footnotesize
指令,因为材料适合文本块。
在下面的例子中,我禁用了所有与当前示例无关的包的加载。
附言:说明
\usepackage[hang, small,labelfont=bf,up,textfont=it,up]{caption}
似乎是矛盾的,因为标题文本部分的字体形状应该都是 up[shape]和it[alics]。无论如何,labelfont 和 textfont 的第二个选项在两种情况下都会被忽略。最好将指令写为
\usepackage[hang, labelfont=bf,textfont=it]{caption}
\documentclass[twoside]{article}
\usepackage[T1]{fontenc}
% \linespread{1.05} % Line spacing - Palatino needs more space between lines
\usepackage{microtype}
\usepackage[hmarginratio=1:1,top=32mm,columnsep=20pt]{geometry}
% \usepackage{multicol} % Used for the two-column layout of the document
\usepackage[hang, labelfont=bf, textfont=it]{caption} % Custom captions under/above floats in tables or figures
\usepackage{booktabs} % Horizontal rules in tables
% \usepackage{float} % Required for tables and figures in the multi-column environment - they need to be placed in specific locations with the [H] (e.g. \begin{table}[H])
% \usepackage{lettrine} % The lettrine is the first enlarged letter at the beginning of the text
% \usepackage{paralist} % Used for the compactitem environment which makes bullet points with less space between them
% \usepackage{esvect}
% \usepackage{abstract} % Allows abstract customization
% \renewcommand{\abstractnamefont}{\normalfont\bfseries} % Set the "Abstract" text to bold
% \renewcommand{\abstracttextfont}{\normalfont\small\itshape} % Set the abstract itself to small italic text
%
% \usepackage{titlesec} % Allows customization of titles
% \renewcommand\thesection{\Roman{section}} % Roman numerals for the sections
% \renewcommand\thesubsection{\Roman{subsection}} % Roman numerals for subsections
% \titleformat{\section}[block]{\large\scshape\centering}{\thesection.}{1em}{} % Change the look of the section titles
% \titleformat{\subsection}[block]{\large}{\thesubsection.}{1em}{} % Change the look of the section titles
\usepackage{fancyhdr} % Headers and footers
\pagestyle{fancy} % All pages have headers and footers
\fancyhead{} % Blank out the default header
\fancyfoot{} % Blank out the default footer
\fancyhead[C]{CH 341: Biochemistry I $\bullet$ November 2015 $\bullet$ Vol. XXI, No. 1} % Custom header text
\fancyfoot[RO,LE]{\thepage} % Custom footer text
% \usepackage{tabularx}
% \usepackage{pgfplots}
% \usepackage{caption}
% \usepackage{graphicx} %allows importing images
% \usepackage{float} % allows to control the float positions
% \usepackage{mhchem}
% \usepackage{textgreek}
% \usepackage{siunitx}
% \usepackage{textcomp}
% \usepackage{multirow}
% \usepackage{grffile}
% \usepackage[export]{adjustbox}
% \usepackage{placeins}
% It's usually a good idea to load 'hyperref' last
\usepackage{hyperref} % For hyperlinks in the PDF
\newcommand{\head}[1]{\textnormal{\textbf{#1}}}
\begin{document}
\begin{table}
\caption{Product Concentrations and Enzyme Reaction Velocities for the 5 Substrate Concentrations in Varying Inhibitor Environments}
\centering
\begin{tabular}{lcc}
\toprule[1.5pt]
\head{Metal} & \head{Average Velocity SD}
& \head{Average Product Concentration Formed SD}\\
\midrule
Magnesium & $1.30 \pm 0.67\phantom{0}$ & $25.97 \pm 13.33$\\
Zinc & $0.40 \pm 0.049$ & $\phantom{0}8.06 \pm \phantom{0}0.97$\\
\bottomrule[1.5pt]
\end{tabular}
\end{table}
\end{document}
答案2
为什么 OP 使用\verb|...|
?→ 我不知道,也许是为了得到\texttt
(打字机字体)?
但是,该\verb
命令以逐字模式执行所有内容,因此\pm
不会被解释(扩展)而是按字面显示。
为了获得等宽字母,使用\texttt{...}
例如。
\documentclass[twoside]{article}
\usepackage{lipsum} % Package to generate dummy text throughout this template
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\linespread{1.05} % Line spacing - Palatino needs more space between lines
\usepackage{microtype} % Slightly tweak font spacing for aesthetics
\usepackage[hmarginratio=1:1,top=32mm,columnsep=20pt]{geometry} % Document margins
\usepackage{multicol} % Used for the two-column layout of the document
\usepackage[hang, small,labelfont=bf,up,textfont=it,up]{caption} % Custom captions under/above floats in tables or figures
\usepackage{booktabs} % Horizontal rules in tables
\usepackage{float} % Required for tables and figures in the multi-column environment - they need to be placed in specific locations with the [H] (e.g. \begin{table}[H])
\usepackage{hyperref} % For hyperlinks in the PDF
\usepackage{lettrine} % The lettrine is the first enlarged letter at the beginning of the text
\usepackage{paralist} % Used for the compactitem environment which makes bullet points with less space between them
\usepackage{esvect}
\usepackage{abstract} % Allows abstract customization
\renewcommand{\abstractnamefont}{\normalfont\bfseries} % Set the "Abstract" text to bold
\renewcommand{\abstracttextfont}{\normalfont\small\itshape} % Set the abstract itself to small italic text
\usepackage{titlesec} % Allows customization of titles
\renewcommand\thesection{\Roman{section}} % Roman numerals for the sections
\renewcommand\thesubsection{\Roman{subsection}} % Roman numerals for subsections
\titleformat{\section}[block]{\large\scshape\centering}{\thesection.}{1em}{} % Change the look of the section titles
\titleformat{\subsection}[block]{\large}{\thesubsection.}{1em}{} % Change the look of the section titles
\usepackage{fancyhdr} % Headers and footers
\pagestyle{fancy} % All pages have headers and footers
\fancyhead{} % Blank out the default header
\fancyfoot{} % Blank out the default footer
\fancyhead[C]{CH 341: Biochemistry I $\bullet$ November 2015 $\bullet$ Vol. XXI, No. 1} % Custom header text
\fancyfoot[RO,LE]{\thepage} % Custom footer text
\usepackage{tabularx}
\usepackage{pgfplots}
\usepackage{caption}
\usepackage{graphicx} %allows importing images
\usepackage{float} % allows to control the float positions
\usepackage{mhchem}
\usepackage{textgreek}
\usepackage{siunitx}
\usepackage{textcomp}
\usepackage{multirow}
\usepackage{grffile}
\usepackage[export]{adjustbox}
\usepackage{placeins}
\begin{document}
\begin{table}
\small\caption{Product Concentrations and Enzyme Reaction Velocities for the 5 Substrate Concentrations in Varying Inhibitor Environments}
\begin{center}
\footnotesize
\newcommand{\head}[1]{\textnormal{\textbf{#1}}}
\begin{tabular}{ccc}
\toprule[1.5pt]
\head{Metal} & \head{Average Velocity SD} & \head{Average Product Concentration Formed SD}\\
\midrule
\texttt{Magnesium} & \texttt{1.30} $\pm$ \texttt{0.67} & \texttt{25.97} $\pm$ \texttt{13.33}\\
% \verb|Zinc| & \verb|0.40 \pm 0.049| & \verb|8.06 \pm 0.97|\\
\bottomrule[1.5pt]
\end{tabular}
\end{center}
\end{table}
\end{document}
答案3
的用法\verb
不清楚;据我所知没有正式的表格使用它。
在下面的例子中,我使用了siunitx
,此外booktabs
;长标题被分成两行,以限制表格宽度。
\documentclass{article}
\usepackage{siunitx,booktabs}
\sisetup{separate-uncertainty}
\begin{document}
\begin{table}
\centering
\caption{Product Concentrations and Enzyme Reaction Velocities for the 5
Substrate Concentrations in Varying Inhibitor Environments}
\footnotesize
\newcommand{\head}[1]{{%
\normalfont\bfseries
\begin{tabular}{@{}c@{}}
#1
\end{tabular}%
}}
\begin{tabular}{
l
S[table-format=1.3(4)]
S[table-format=2.2(4)]
}
\toprule
\head{Metal} & \head{Average Velocity SD} & \head{Average Product \\ Concentration Formed SD}\\
\midrule
Magnesium & 1.30 \pm 0.67 & 25.97 \pm 13.33 \\
Zinc & 0.40 \pm 0.049 & 8.06 \pm 0.97 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}