Tikz における行列要素の配置

Tikz における行列要素の配置

行列の要素を左に揃えようとしていますが、うまくいきません。何かアイデアはありますか?

\documentclass{beamer}
\usepackage{xcolor}
\definecolor{lava}{rgb}{0.81, 0.06, 0.13}
\definecolor{myblue}{rgb}{0.0, 0.30, 0.60}
\usepackage{tikz}
\usetikzlibrary{matrix}  


\begin{document}



\begin{frame}{xxxxx}
\underline{\textbf{Example}}
\begin{itemize}
\item[$\rightarrow$] Let's consider two systems of linear equations that correspond to the same coefficient matrix $\mathbf{A}$
\end{itemize}




\begin{tikzpicture}[>=stealth,thick,baseline]
   \tikzstyle{column 8}=[myblue]
    \matrix [matrix of math nodes,column/.style={anchor=base west},ampersand replacement=\&](A){ 
    3 x_1  \&+ 5x_2    \& -4x_3   \& = \&7\\
    - 3 x_1 \& -2x_2  \& +4x_3   \& = \&  -1\\
      6  x_1 \& +x_2   \& -8x_3    \& =\&   -4\\
   };
   \end{tikzpicture}


\end{frame}

\end{document}

答え1

tikz方程式系を(行列として)記述するために を使用する義務がありますか? そうでない場合は、単純な を使用できますarray

\documentclass[table]{beamer}
\definecolor{lava}{rgb}{0.81, 0.06, 0.13}
\definecolor{myblue}{rgb}{0.0, 0.30, 0.60}

\begin{document}
\begin{frame}{xxxxx}
\underline{\textbf{Example}}
\begin{itemize}
\item[$\rightarrow$] Let's consider two systems of linear equations that correspond to the same coefficient matrix $\mathbf{A}$
\end{itemize}

\[\setlength\arraycolsep{1pt}
\begin{array}{rrr >{\color{myblue}}r}
  3 x_1 + & 5x_2 - & 4x_3 = &   7\\
- 3 x_1 - & 2x_2 + & 4x_3 = &  -1\\
  6 x_1 + &  x_2 - & 8x_3 = &  -4\\
\end{array}
\]
\end{frame}
\end{document}

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

答え2

行列要素を左揃えにするには、各セルのスタイルをcells={anchor=west}次のように設定します。nodes={anchor=west}

\documentclass{beamer}
\usepackage{xcolor}
\definecolor{lava}{rgb}{0.81, 0.06, 0.13}
\definecolor{myblue}{rgb}{0.0, 0.30, 0.60}
\usepackage{tikz}
\usetikzlibrary{matrix}  


\begin{document}



\begin{frame}{xxxxx}
\underline{\textbf{Example}}
\begin{itemize}
    \item[$\rightarrow$] Let's consider two systems of linear equations that correspond to the same coefficient matrix $\mathbf{A}$
\end{itemize}



\centering
\begin{tikzpicture}[>=stealth,thick,baseline]
    \tikzstyle{column 8}=[myblue]
    \matrix [matrix of math nodes,ampersand replacement=\&,cells={anchor=west}](A){ 
        3 x_1  \&+ 5x_2    \& -4x_3   \& = \&7\\
        - 3 x_1 \& -2x_2  \& +4x_3   \& = \&  -1\\
          6  x_1 \& +x_2   \& -8x_3    \& =\&   -4\\
    };
\end{tikzpicture}


\end{frame}

\end{document}

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

関連情報