所以我想要的是一个类似下面的等式:
稀释细胞悬浮液的体积 或培养皿数量 = 未稀释的体积 X 未稀释的密度 细胞悬浮细胞 (全部/除以) 1.7X10^6 细胞/毫升
我该如何在 LaTeX 中做到这一点?我尝试过\equation
if\textsl
以及\align
许多其他方法,但我无法将换行符放在正确的位置,或者换行符根本不会出现。
答案1
使用分隔符
另一种带括号的变体是使用pmatrix
包amsmath
。
\documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx}
\DeclareSIUnit{\cells}{cells}
\sisetup{per-mode = symbol}
\begin{document}
\[
\begin{pmatrix}
\text{volume of diluted cell suspension}\\
\text{or number of Petri dishes}
\end{pmatrix}
=
\frac{
\begin{pmatrix}
\text{volume of diluted}\\
\text{cell suspension}
\end{pmatrix}
\times
\begin{pmatrix}
\text{density of}\\
\text{undiluted cells}
\end{pmatrix}
}{
\SI[mode=text]{1.7e6}{\cells\per\ml}
}
\]
\end{document}
无分隔符
文本块可以通过matrix
包环境设置。没有视觉分隔符,我增加了关系运算符( ) 和二元运算符( )amsmath
周围的间距:=
\thickmuskip
+
\medmuskip
\documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx}
\DeclareSIUnit{\cells}{cells}
\sisetup{per-mode = symbol}
\begin{document}
\[
\setlength{\thickmuskip}{2\thickmuskip}
\setlength{\medmuskip}{2\medmuskip}
\begin{matrix}
\text{volume of diluted cell suspension}\\
\text{or number of Petri dishes}
\end{matrix}
=
\frac{
\begin{matrix}
\text{volume of diluted}\\
\text{cell suspension}
\end{matrix}
\times
\begin{matrix}
\text{density of}\\
\text{undiluted cells}
\end{matrix}
}{
\SI[mode=text]{1.7e6}{\cells\per\ml}
}
\]
\end{document}
变体tabular
以下使用tabular
而不是 ,matrix
并减少行间空间:
\documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx}
\DeclareSIUnit{\cells}{cells}
\sisetup{per-mode = symbol}
\newcommand*{\textstack}[1]{%
\text{%
\renewcommand*{\arraystretch}{.9}%
\begin{tabular}{@{}c@{}}%
#1%
\end{tabular}%
}%
}
\begin{document}
\[
\setlength{\thickmuskip}{2\thickmuskip}
\setlength{\medmuskip}{2\medmuskip}
\textstack{
volume of diluted cell suspension\\
or number of Petri dishes
}
=
\frac{
\textstack{
volume of diluted\\
cell suspension
}
\times
\textstack{
density of\\
undiluted cells
}
}{
\SI[mode=text]{1.7e6}{\cells\per\ml}
}
\]
\end{document}
答案2
我会使用 smallmatrix 环境并在文本周围添加括号以提高可读性。
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{displaymath}
\Bigl(\begin{smallmatrix}
\text{Volume of diluted cell suspension}\\
\text{ or number of Petri dishes}
\end{smallmatrix}\Bigr)
= \frac{%
\Bigl(\begin{smallmatrix}
\text{Volume of diluted cell suspension}\\
\text{or number of Petri dishes}
\end{smallmatrix}\Bigr)
\times
\Bigl(\begin{smallmatrix}
\text{density of}\\
\text{undiluted cells}
\end{smallmatrix}\Bigr)
}
{1.7\times10^6\,\text{cells}/\text{ml}}
\end{displaymath}
\end{document}
答案3
在第一个解决方案中,我尝试保留您提供的布局:
\documentclass{article}
\usepackage{stackengine}
\begin{document}
\small
\stackon{or number of Petri dishes}{Volume of diluted cell suspension}
= \stackunder{%
\stackunder{volume of undiluted}{cell suspension} $\times$%
\stackunder{density of undiluted}{cells}%
}{\stackunder{--------------------------------------------------------}%
{$1.7\times10^6$ cells/ml}%
}
\end{document}
经过思考,你可能想要一个稍微不同的布局。这可能会更好:
\documentclass{article}
\usepackage{stackengine}
\begin{document}
\small
\stackanchor{Volume of diluted cell suspension}{or number of Petri dishes}
=
\savestack{\num}{%
\stackanchor{volume of undiluted}{cell suspension} ~$\times$~%
\stackanchor{density of}{undiluted cells}%
}%
\stackunder{%
\stackon{-----------------------------------------------------}{\num}%
}{$1.7\times10^6$ cells/ml}%
\end{document}
答案4
这有点像 hack,但是你可以使用命令\substack
让 LaTeX 做一些事情,
\documentclass{article}
\usepackage{amsmath}
\begin{document}
$$
\substack{\text{Volume of diluted cell suspension}\\\text{or number of petri dishes}}
= \frac{\substack{\text{volume of undiluted}\\ \text{cellsuspension}}
\times\substack{\text{density of undiluted}\\ \text{cells}}}{1.7\times 10^6 \text{cells/ml}}
$$
\end{document}
希望这就是您所寻找的!