如何装箱第二个split
环境?
奖励:只将环境内容的一部分装箱split
,这样我就可以\Longleftrightarrow
在箱子前面添加一个。
梅威瑟:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
\begin{split}
A ={}& B + C + D
\end{split}\nonumber\\
\begin{split}
A ={}& \phantom{{}+{}} B\_is\_long\\
& + C\_is\_long\_too\\
& + D\_is\_long\_too
\end{split}
\end{align}
\end{document}
答案1
您可以自定义输出,但想法很简单hf-tikz
。
\documentclass{article}
\usepackage{amsmath}
\usepackage{hf-tikz}
\begin{document}
\begin{align}
A ={}& B + C + D \notag \\
\begin{split}
\tikzmarkin{thisbox}
A ={}& \phantom{{}+{}} B\_is\_long\\
& + C\_is\_long\_too\\
& + D\_is\_long\_too\tikzmarkend{thisbox}
\end{split}
\end{align}
\end{document}
答案2
我建议您使用aligned
而不是split
环境,因为可以在指令中封装aligned
环境 - 但不是环境。split
\boxed
\documentclass{article}
\usepackage[T1]{fontenc} % for longer "underscore" characters
\usepackage{amsmath}
\begin{document}
\begin{align}
&\kern\fboxsep\kern\fboxrule % take care to align the "A"s
\begin{aligned}
A ={}& B + C + D
\end{aligned}\nonumber\\
& \boxed{\begin{aligned}
A ={}& \phantom{{}+{}} B\_is\_long \\
& + C\_is\_long\_too \\
& + D\_is\_long\_too
\end{aligned}}
\end{align}
\end{document}
答案3
希望有帮助
\documentclass[11pt]{article}
\usepackage[margin=0.5in]{geometry}
\usepackage{empheq}
\begin{document}
\begin{align*}
\begin{split}
A ={}& B + C + D
\end{split}\nonumber\\
\end{align*}
\begin{empheq}[box=\fbox]{align}
\begin{split}
A ={}& \phantom{{}+{}} B\_is\_long\\
& + C\_is\_long\_too\\
& + D\_is\_long\_too
\end{split}
\end{empheq}
\end{document}
答案4
一种方法是将空白叠加\boxed{}
在表达式之上,这样占用的空间与原始表达式本身相同。这可以通过\mathrlap{}
(from mathtools
) 和\phantom{}
\documentclass{article}
\usepackage{mathtools}
\usepackage{xcolor}
\begin{document}
\begin{align}
\begin{split}
A ={}& B + C + D
\end{split}\nonumber\\
\mathrlap{\boxed{\phantom{\begin{gathered}A = {}+ C\_is\_long\_too\\A\\A\end{gathered}}}}
\hspace{\dimexpr\fboxsep+\fboxrule-0.4pt}
\begin{split}
A ={}& \phantom{{}+{}} B\_is\_long\\
& + C\_is\_long\_too\\
& + D\_is\_long\_too
\end{split}
\end{align}
\end{document}