amsmath 方程式間の下括弧を揃える

amsmath 方程式間の下括弧を揃える

\amsmath alignedで整列したいくつかの方程式を含む環境があります&=。方程式の間に下括弧を配置して、括弧の内容と「ポイント」の両方を簡単に指定できるようにし、方程式の残りの部分をそれに応じて整列/シフトできるようにしたいと考えています。括弧と方程式の間隔は均一である必要があります。これが私が望むもののモックアップです: 行間の括弧

このような方程式/括弧を任意の数だけ積み重ねられるようにする必要があります。次の行は、&= 31 + 2 が 3 に減算されたことを示す下括弧付きの になります。括弧のない方程式の基本コードは次のとおりです。

\documentclass[a4paper]{article}
\usepackage{amsmath}

\begin{document}
  $\begin{aligned}
    1 + 1 + 1 &= 1 + 1 + 1 \\
              &= 1 + 2
  \end{aligned}$
\end{document}

答え1

グループ化に関する別の見方を以下に示します。興味深いかもしれません。

ここに画像の説明を入力してください

\documentclass{article}
\usepackage{mathtools,calc}
\begin{document}
\[
  %\setlength{\jot}{.5\jot} Adjust to bring the equations closer vertically
  \begin{aligned}
    1 + 1 + 1 &= 1 + \underbrace{1 + 1} \\
              &= \mathrlap{\underbrace{\phantom{1+\hspace{1.9em}}}}1 + \makebox[\widthof{$1+1$}]{$2$} \\
              &= \makebox[\widthof{$1+\hspace{1.9em}$}]{3}
  \end{aligned}
\]
\end{document}

-and-friends内の行間隔はalignに基づいて定義されます\jot。したがって、必要に応じて調整することを検討できます。

答え2

1 つの暗号番号をあまり多く追加しない限り、すべての暗号が同じ幅を持つという効果を利用できます。これにより、以前のものよりも少し一般的なソリューションが得られます。

\documentclass[a4paper]{article}
\usepackage{amsmath}

\begin{document}

\[
\begin{array}{r@{{}={}}c}
   1 + 1 + 1 +1& 1 + 1+ \underbrace{1 + 1} \\
              &1+\underbrace{1 + 2}\\
       &\underbrace{1+3}\\
      &4
\end{array}
\]



\end{document}

ここに画像の説明を入力してください

答え3

常に右側でグループ化している限り、右側を右揃えにして (alignat環境を使用して)、次に中括弧の下の配置を得るために右側に適切な量のスペースを追加することで、これを機能させることができます。このテクニックは、左側でグループ化する場合にも同様に機能します。

進行形グループ化の方程式

\documentclass[a4paper]{article}
\usepackage{amsmath}
\begin{document}\noindent
Grouping on the right:
\begin{alignat*}{2}
  6! 
  &={} & 6 \times 5 \times 4 \times 3 \times \underbrace{2 \times 1}
  \\&={} & 6 \times 5 \times 4 \times \underbrace{3 \times 2}      \mspace{16mu}
  \\&={} & 6 \times 5 \times \underbrace{4 \times 6}               \mspace{32mu}
  \\&={} & 6 \times \underbrace{5 \times 24}                       \mspace{44mu}
  \\&={} & \underbrace{6 \times 120}                               \mspace{56mu}
  \\&={} & 720                                                     \mspace{72mu}
\end{alignat*}
Grouping on the left:
\begin{align*}
  6!
  &=                 \underbrace{6 \times 5} \times 4 \times 3 \times 2 \times 1
  \\&= \mspace{10mu} \underbrace{30 \times 4} \times 3 \times 2 \times 1
  \\&= \mspace{20mu} \underbrace{120 \times 3} \times 2 \times 1
  \\&= \mspace{35mu} \underbrace{360 \times 2} \times 1
  \\&= \mspace{50mu} \underbrace{720 \times 1}
  \\&= \mspace{65mu} 720
\end{align*}
\end{document}

答え4

これが必要な場合は、aligned の代わりに array を使用できます。

    \documentclass[a4paper]{article}  
    \usepackage{amsmath}  

\begin{document}  
  $$\begin{array}{rcc}  
    1 + 1 + 1 &= &1 + 1 + 1 \\  
              &= &\underbrace{1 + 2}\\  
              &=&3  
    \end{array}$$  
\end{document}  

ここに画像の説明を入力してください

関連情報