複数行の方程式を整列させる方法

複数行の方程式を整列させる方法

きれいな複数行の方程式を作成しようとしています。方程式が大きすぎるため、半分 (方程式の最初の部分) でカットする必要がありました。そのため、最終的に、等号の後で方程式を分割しました。この部分の後、方程式を簡略化しています。等号を最初の等号と揃えたいのですが、さまざまな解決策を試してもうまくいきませんでした。

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

現在私が使用している LaTeX コードは次のとおりです。

\begin{equation}
\label{eqn:Acc_rot_matrix_3}
\resizebox{0.9\columnwidth}{!}{ $
\begin{aligned}
&\begin{bmatrix}
    a_x \\
    a_y \\
    a_z
\end{bmatrix} =\\
&\begin{bmatrix}
    C_{\theta}C_{0} & C_{\theta}S_{0} & -S_{\theta} \\
    S_{\phi}S_{\theta}C_{0} - C_{\phi}S_{0} & S_{\phi}S_{\theta}S_{0} + C_{\phi}C_{0} & S_{\phi}C_{\theta}\\
    C_{\phi}S_{\theta}C_{0} + S_{\phi}S_{0}\ & C_{\phi}S_{\theta}S_{0} - S_{\phi}C_{0} & C_{\phi}C_{\theta}
\end{bmatrix}
\begin{bmatrix}
    0 \\
    0 \\
    -g
\end{bmatrix} \\ \\ 
&=
\begin{bmatrix}
    C_{\theta}*1 & C_{\theta}*0 & - S_{\theta} \\
    S_{\phi}S_{\theta}*1 - C_{\phi}*0 & S_{\phi}S_{\theta}*0 + C_{\phi}*1 & S_{\phi}C_{\theta}\\
    C_{\phi}S_{\theta}*1 + S_{\phi}*0 & C_{\phi}S_{\theta}*0 - S_{\phi}*1 & C_{\phi}C_{\theta}
\end{bmatrix}
\begin{bmatrix}
    0 \\
    0 \\
    -g
\end{bmatrix} \\ \\
&=
\begin{bmatrix}
    C_{\theta} & 0 & -S_{\theta} \\
    S_{\theta}S_{\phi} & C_{\phi} & S_{\phi}C_{\theta}\\
    S_{\theta}C_{\phi} & -S_{\phi} & C_{\phi}C_{\theta}
\end{bmatrix}
\begin{bmatrix}
    0 \\
    0 \\
    -g
\end{bmatrix}
\end{aligned}
$}
\end{equation}

複数のアラインメントに alignat を使用しようとしましたが、うまくいきませんでした。alignat も同様です。これに使用したコードは次のとおりです。

\begin{equation}
\label{eqn:Acc_rot_matrix_3}
\resizebox{0.9\columnwidth}{!}{ $
\begin{alignedat}{2}
&\begin{bmatrix}
    a_x \\
    a_y \\
    a_z
\end{bmatrix}   &=\\
&\begin{bmatrix}
    C_{\theta}C_{0} & C_{\theta}S_{0} & -S_{\theta} \\
    S_{\phi}S_{\theta}C_{0} - C_{\phi}S_{0} & S_{\phi}S_{\theta}S_{0} + C_{\phi}C_{0} & S_{\phi}C_{\theta}\\
    C_{\phi}S_{\theta}C_{0} + S_{\phi}S_{0}\ & C_{\phi}S_{\theta}S_{0} - S_{\phi}C_{0} & C_{\phi}C_{\theta}
\end{bmatrix}
\begin{bmatrix}
    0 \\
    0 \\
    -g
\end{bmatrix} \\ \\ 
&           &=
\begin{bmatrix}
        C_{\theta}*1 & C_{\theta}*0 & - S_{\theta} \\
        S_{\phi}S_{\theta}*1 - C_{\phi}*0 & S_{\phi}S_{\theta}*0 + C_{\phi}*1 & S_{\phi}C_{\theta}\\
        C_{\phi}S_{\theta}*1 + S_{\phi}*0 & C_{\phi}S_{\theta}*0 - S_{\phi}*1 & C_{\phi}C_{\theta}
    \end{bmatrix}
    \begin{bmatrix}
        0 \\
        0 \\
        -g
    \end{bmatrix} \\ \\
&           &=
    \begin{bmatrix}
        C_{\theta} & 0 & -S_{\theta} \\
        S_{\theta}S_{\phi} & C_{\phi} & S_{\phi}C_{\theta}\\
        S_{\theta}C_{\phi} & -S_{\phi} & C_{\phi}C_{\theta}
    \end{bmatrix}
    \begin{bmatrix}
        0 \\
        0 \\
        -g
    \end{bmatrix}
    \end{alignedat}
$}
\end{equation}

これは私が試した別の例です:

\begin{equation}
\label{eqn:Acc_rot_matrix_3}
\resizebox{0.9\columnwidth}{!}{ $
\begin{aligned}
&\begin{bmatrix}
    a_x \\
    a_y \\
    a_z
\end{bmatrix} &&=\\
&\begin{bmatrix}
    C_{\theta}C_{0} & C_{\theta}S_{0} & -S_{\theta} \\
    S_{\phi}S_{\theta}C_{0} - C_{\phi}S_{0} & S_{\phi}S_{\theta}S_{0} + C_{\phi}C_{0} & S_{\phi}C_{\theta}\\
    C_{\phi}S_{\theta}C_{0} + S_{\phi}S_{0}\ & C_{\phi}S_{\theta}S_{0} - S_{\phi}C_{0} & C_{\phi}C_{\theta}
\end{bmatrix}
\begin{bmatrix}
    0 \\
    0 \\
    -g
\end{bmatrix} \\ \\ 
&&=
\begin{bmatrix}
    C_{\theta}*1 & C_{\theta}*0 & - S_{\theta} \\
    S_{\phi}S_{\theta}*1 - C_{\phi}*0 & S_{\phi}S_{\theta}*0 + C_{\phi}*1 & S_{\phi}C_{\theta}\\
    C_{\phi}S_{\theta}*1 + S_{\phi}*0 & C_{\phi}S_{\theta}*0 - S_{\phi}*1 & C_{\phi}C_{\theta}
\end{bmatrix}
\begin{bmatrix}
    0 \\
    0 \\
    -g
\end{bmatrix} \\ \\
&&=
\begin{bmatrix}
    C_{\theta} & 0 & -S_{\theta} \\
    S_{\theta}S_{\phi} & C_{\phi} & S_{\phi}C_{\theta}\\
    S_{\theta}C_{\phi} & -S_{\phi} & C_{\phi}C_{\theta}
\end{bmatrix}
\begin{bmatrix}
    0 \\
    0 \\
    -g
\end{bmatrix}
\end{aligned}
$}
\end{equation}

結果は以下のとおりです。

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

方程式の最初の部分を図 1 のように揃えるにはどうすればよいでしょうか。また、簡略化方程式を方程式の最初の部分の等号に揃えるにはどうすればよいでしょうか。

答え1

個人的には、このように簡略化すると見栄えが良くなると思います。

編集: 最初の方程式が壊れたバージョン:

\documentclass{article}
\usepackage{mathtools}
\begin{document}

\begin{equation}
\begin{aligned}
&\mathop{\phantom{=}}{}\begin{bmatrix}
    a_x \\
    a_y \\
    a_z
\end{bmatrix}\\
&=
\begin{bmatrix}
    C_{\theta}C_{0} & C_{\theta}S_{0} & -S_{\theta} \\
    S_{\phi}S_{\theta}C_{0} - C_{\phi}S_{0} & S_{\phi}S_{\theta}S_{0} + C_{\phi}C_{0} & S_{\phi}C_{\theta}\\
    C_{\phi}S_{\theta}C_{0} + S_{\phi}S_{0}\ & C_{\phi}S_{\theta}S_{0} - S_{\phi}C_{0} & C_{\phi}C_{\theta}
\end{bmatrix}
\begin{bmatrix}
    0 \\
    0 \\
    -g
\end{bmatrix} \\ 
&=
\begin{bmatrix}
    C_{\theta}*1 & C_{\theta}*0 & - S_{\theta} \\
    S_{\phi}S_{\theta}*1 - C_{\phi}*0 & S_{\phi}S_{\theta}*0 + C_{\phi}*1 & S_{\phi}C_{\theta}\\
    C_{\phi}S_{\theta}*1 + S_{\phi}*0 & C_{\phi}S_{\theta}*0 - S_{\phi}*1 & C_{\phi}C_{\theta}
\end{bmatrix}
\begin{bmatrix}
    0 \\
    0 \\
    -g
\end{bmatrix} \\ \\
&=
\begin{bmatrix}
    C_{\theta} & 0 & -S_{\theta} \\
    S_{\theta}S_{\phi} & C_{\phi} & S_{\phi}C_{\theta}\\
    S_{\theta}C_{\phi} & -S_{\phi} & C_{\phi}C_{\theta}
\end{bmatrix}
\begin{bmatrix}
    0 \\
    0 \\
    -g
\end{bmatrix}
\end{aligned}
\end{equation}
\end{document}

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

答え2

\BA@colsep` の値を操作することができます:

    \documentclass[twocolumn]{article}
    \usepackage{blkarray}
    \usepackage{lipsum} 
    \makeatletter
    \AtBeginDocument{\BA@colsep=1.5pt}
    \makeatother

    \begin{document}

    \[
    \begin{blockarray}{*{16}{c}}
      & c_1 & c_2 & c_3 & c_4 & c_5 & c_6 & c_7 & c_8 & c_9 & c_{10} & c_{11} & c_{12} & c_{13} & c_{14} & c_{15} \\
      \begin{block}{c ccccccccccccccc }
      r_1 & | & & & & & & & & & & & & | & & \\
      r_2 & & | & & & & & & & & & & & | & & \\
      r_3 & & & | & & & & & & & & & & | & & \\
      r_4 & & & & | & & & & & & & & & | & & \\
      r_5 & & & & & | & & & & & & & & & | & \\
      r_6 & & & & & & | & & & & & & & & | & \\
      r_7 & & & & & & & | & & & & & & & | & \\
      r_8 & & & & & & & & | & & & & & & | & \\
      r_9 & & & & & & & & & | & & & & & & | \\
      r_{10} & & & & & & & & & & | & & & & & | \\
      r_{11} & & & & & & & & & & & | & & & & | \\
      r_{12} & & & & & & & & & & & & | & & & | \\
    \end{blockarray}
     \]

 \lipsum

    \end{document} 

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

答え3

multline整列がないので、smallmatrix小さいので使えます

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

\documentclass[twocolumn]{article}

\usepackage{mathtools}

\begin{document}

\noexpand X\dotfill X
\setlength\arraycolsep{3pt}
\begin{multline}
\label{eqn:Acc_rot_matrix_3}
% No, only as a last resort, and not then \resizebox{0.9\columnwidth}{!}{ $
\begin{bsmallmatrix}
    a_x \\
    a_y \\
    a_z
\end{bsmallmatrix} 
\\
{}=\begin{bsmallmatrix}
    C_{\theta}C_{0} & C_{\theta}S_{0} & -S_{\theta} \\
    S_{\phi}S_{\theta}C_{0} - C_{\phi}S_{0} & S_{\phi}S_{\theta}S_{0} + C_{\phi}C_{0} & S_{\phi}C_{\theta}\\
    C_{\phi}S_{\theta}C_{0} + S_{\phi}S_{0}\ & C_{\phi}S_{\theta}S_{0} - S_{\phi}C_{0} & C_{\phi}C_{\theta}
\end{bsmallmatrix}\!
\begin{bsmallmatrix}
    0 \\
    0 \\
    -g
\end{bsmallmatrix}
\\
{}=\begin{bsmallmatrix}
        C_{\theta}*1 & C_{\theta}*0 & - S_{\theta} \\
        S_{\phi}S_{\theta}*1 - C_{\phi}*0 & S_{\phi}S_{\theta}*0 + C_{\phi}*1 & S_{\phi}C_{\theta}\\
        C_{\phi}S_{\theta}*1 + S_{\phi}*0 & C_{\phi}S_{\theta}*0 - S_{\phi}*1 & C_{\phi}C_{\theta}
    \end{bsmallmatrix}\!
    \begin{bsmallmatrix}
        0 \\
        0 \\
        -g
    \end{bsmallmatrix}
\\
{}=    \begin{bsmallmatrix}
        C_{\theta} & 0 & -S_{\theta} \\
        S_{\theta}S_{\phi} & C_{\phi} & S_{\phi}C_{\theta}\\
        S_{\theta}C_{\phi} & -S_{\phi} & C_{\phi}C_{\theta}
    \end{bsmallmatrix}
    \begin{bsmallmatrix}
        0 \\
        0 \\
        -g
    \end{bsmallmatrix}
\end{multline}
\noexpand X\dotfill X

\end{document}

答え4

equationここでは、ネストされた/ のmultlined組み合わせを使用し、フォント サイズを 10% ずつ線形に縮小し、低レベルの数学間隔パラメータ\thinmuskip、、\medmuskipを一時的に 0 (に近い値) に設定するソリューションを示します\thickmuskip

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

\documentclass[twocolumn]{article}
\usepackage{mathtools}

\begin{document}
\hrule % draw line across width of column

\begingroup
\small
\thinmuskip=0mu    % default value: 3mu
\medmuskip=0mu     % default value: 4mu plus/minus "glue"
\thickmuskip=0.5mu % default value: 5mu plus/minus "glue"
\arraycolsep=2.5pt % default value: 5pt

\begin{equation} \label{eqn:Acc_rot_matrix_3}
\begin{multlined}[b]
\begin{bmatrix}
    a_x \\
    a_y \\
    a_z
\end{bmatrix}   \\
=
\begin{bmatrix}
    C_{\theta}C_{0} & C_{\theta}S_{0} & -S_{\theta} \\
    S_{\phi}S_{\theta}C_{0} - C_{\phi}S_{0} & S_{\phi}S_{\theta}S_{0} + C_{\phi}C_{0} & S_{\phi}C_{\theta}\\
    C_{\phi}S_{\theta}C_{0} + S_{\phi}S_{0}\ & C_{\phi}S_{\theta}S_{0} - S_{\phi}C_{0} & C_{\phi}C_{\theta}
\end{bmatrix}
\begin{bmatrix}
    0 \\
    0 \\
    -g
\end{bmatrix} \\  
=
\begin{bmatrix}
        C_{\theta}*1 & C_{\theta}*0 & - S_{\theta} \\
        S_{\phi}S_{\theta}*1 - C_{\phi}*0 & S_{\phi}S_{\theta}*0 + C_{\phi}*1 & S_{\phi}C_{\theta}\\
        C_{\phi}S_{\theta}*1 + S_{\phi}*0 & C_{\phi}S_{\theta}*0 - S_{\phi}*1 & C_{\phi}C_{\theta}
    \end{bmatrix}
    \begin{bmatrix}
        0 \\
        0 \\
        -g
    \end{bmatrix} \\
=
    \begin{bmatrix}
        C_{\theta} & 0 & -S_{\theta} \\
        S_{\theta}S_{\phi} & C_{\phi} & S_{\phi}C_{\theta}\\
        S_{\theta}C_{\phi} & -S_{\phi} & C_{\phi}C_{\theta}
    \end{bmatrix}
    \begin{bmatrix}
        0 \\
        0 \\
        -g
    \end{bmatrix}
\end{multlined}
\end{equation}
\endgroup
\hrule
\end{document}

関連情報