答案1
那么你可以做的就是使用bmatrix
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
\begin{bmatrix}
\text{What I want to} \\
\text{do is this}
\end{bmatrix}
= +
\begin{bmatrix}
\text{A balance equation} \\
\text{I need}
\end{bmatrix}
-
\begin{bmatrix}
\text{Into brackets that} \\
\text{describe things}
\end{bmatrix}
-
\begin{bmatrix}
\text{In two rows between} \\
\text{big brackets}
\end{bmatrix}
\end{equation*}
\end{document}
在某些方面,这可能有点像黑客行为,因为它们可能不是真正的矩阵,但它看起来是正确的。
答案2
这是一个解决方案,它允许在每个“框”中自动换行。材料自动在每行居中。该\Centering
指令(由ragged2e
软件包提供)允许连字符,并且可以很好地平衡框内的行长。(LaTeX 的基本\centering
指令既不允许连字符也不允许平衡行长。)
在以下屏幕截图的上半部分,我0.2\textwidth
为所有四个框选择了相同的宽度。在下半部分,我稍微减小了前两个框的宽度。
\documentclass{article}
\usepackage{geometry} % set page parameters suitably
\usepackage{ragged2e} % for '\Centering' macro
\usepackage{array} % for '\newcolumntype' macro
\newcolumntype{Q}[1]{% % box widths expressed as fractions of '\textwidth'
>{\Centering\arraybackslash}p{#1\textwidth}}
\usepackage{amsmath} % for 'bmatrix' environment
\newcommand\mybox[2]{%
\begin{bmatrix}
\begin{tabular}{@{}Q{#1}@{}}
#2
\end{tabular}
\end{bmatrix}}
\begin{document}
%% first attempt: uniform widths
\[
\mybox{0.2}{What I want to do is this}
= +\mybox{0.2}{A balance equation I need}
-\mybox{0.2}{Intro brackets that describe things}
-\mybox{0.2}{In two rows between big brackets}
\]
%% second attempt: customized widths
\[
\mybox{0.14}{What I want to do is this}
= +\mybox{0.17}{A balance equation I need}
-\mybox{0.20}{Intro brackets that describe things}
-\mybox{0.20}{In two rows between big brackets}
\]
\end{document}
答案3
这与 Mico 的回答一致,建议创建自己的环境 - textmatrix
- 提供一些对齐灵活性(文本列内对齐的可选参数):
\documentclass{article}
\newenvironment{textmatrix}[1][c]
{
\left[
\begin{tabular}{@{} #1 @{}}
}{%
\end{tabular}
\right]
}
\begin{document}
\[
\begin{textmatrix}
What I want to \\
do is this
\end{textmatrix}
=
\begin{textmatrix}[l]
A balanced equation \\
I need
\end{textmatrix}
+
\begin{textmatrix}[r]
into brackets that \\
describe things
\end{textmatrix}
-
\begin{textmatrix}
in two rows between \\
big brackets
\end{textmatrix}
\]
\end{document}