我在尝试执行此操作时遇到问题:我想aligned
以特定方式合并文本和两行方程式():
\documentclass{article}
\usepackage{,mathtools}
\begin{document}
\begin{equation*}
\begin{aligned}
First line equation &. \\
Second line equation &. \quad \text{ Aligned text with this line very long long long
long long long long and I don't want it to be out of paper}
\end{aligned}
\end{equation*}
\end{document}
这是我的解决方案,但只有当文本足够短时才有效。我还想将文本与第一行对齐(不是同时对齐)。
此外,我在尝试将项目与数字对齐时也遇到问题:
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{enumerate}
\item
$
\begin{rcases}
\begin{aligned}
1 \text{ I want ones in the same line} & . \\
\text{And be able to aling things too} & . \\
\end{aligned}
\end{rcases}
$
\end{enumerate}
\end{document}
这可能吗?
答案1
rcases
不是适合此目的的工具,因为它始终会创建“垂直居中”的对象。尝试使用这个delarray
来模拟rcases
:
\documentclass{article}
\usepackage{delarray,mathtools}
\begin{document}
\begin{enumerate}
\item
$
\begin{array}[t].{@{}ll@{}}\}
1 & \text{I want ones in the same line}\\
& \text{And be able to align things too}\\
\end{array}
$
\end{enumerate}
\end{document}
答案2
正如 Hassan 所建议的,您可以使用 a,parbox
但如果您不想对方程式进行编号,atabular
可能是另一种对齐数学表达式和文本的选项。在下一个示例中,我使用,tabularx
因为这就是为什么您可以修复表格的总宽度并让环境计算每列的宽度。
\documentclass{article}
\usepackage{mathtools}
\usepackage{tabularx}
\begin{document}
\begin{tabularx}{\linewidth}{cX}
$x=2+y$ & Aligned text with this line very long long long
long long long long and I don't want it to be out of paper \\
$x=\sqrt{3+y}+5y^2$ & Aligned text with this line very long long long
long long long long and I don't want it to be out of paper
\end{tabularx}
\end{document}
结果是
答案3
你可以使用\parbox
\documentclass{article}
\usepackage{,mathtools}
\begin{document}
\begin{equation*}
\begin{aligned}
First line equation &. \\
Second line equation &. \quad \text{\parbox[t]{2in}{ Aligned text with this line
very long long long long long long long and I don't want it to be out of paper}}
\end{aligned}
\end{equation*}
\end{document}
或者,如果你的文字太长,\intertext
\documentclass{article}
\usepackage{,mathtools}
\begin{document}
\begin{align}
First line equation &.x \\
\intertext{ Aligned text with this line very long long long
long long long long and I don't want it to be out of paper}
Second line equation &. x\\
\end{align}
\end{document}