1

Im trying to align the elements of the matrix to the left but its not working. Any idea?

\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}
2
  • See if answers on the (similar) question can help you : tex.stackexchange.com/questions/563571/…
    – Zarko
    Sep 21, 2020 at 9:04
  • If you like an answer and it was helpful, please consider upvoting (by clicking on the arrows next to the score) and marking it as accepted answer (by clicking on the checkmark ✓).
    – user30471
    Sep 24, 2020 at 5:52

2 Answers 2

3

Are you obligated to use tikz for writing your system of equations (as matrix)? If not, you can use simple 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}

enter image description here

2

To left-align matrix elements, you can set the style for each cell by cells={anchor=west} or 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}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .