
我試圖將矩陣的元素向左對齊,但它不起作用。任何想法?
\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}