
私は長い間、ビーマーと列に関するこの問題に直面してきましたが、なぜ 2 つの列が揃っていないのでしょうか?
\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{columns}[T,onlytextwidth]
\begin{column}{.5\textwidth}
\begin{center}
\begin{tikzpicture}[>=stealth,thick,baseline]
\tikzstyle{column 8}=[myblue]
\matrix [matrix of math nodes,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{center}
\end{column}
\begin{column}{.5\textwidth}
\begin{tikzpicture}[>=stealth,thick,baseline]
\tikzstyle{column 5}=[myblue]
\matrix [matrix of math nodes,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{column}
\end{columns}
\end{frame}
\end{document}
答え1
center
最初の列の -environmentを削除しました。これで 2 つの列が完全に揃いました。
\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{columns}[T,onlytextwidth]
\begin{column}{.5\textwidth}
\begin{tikzpicture}[>=stealth,thick,baseline]
\tikzstyle{column 8}=[myblue]
\matrix [matrix of math nodes,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{column}
\begin{column}{.5\textwidth}
\begin{tikzpicture}[>=stealth,thick,baseline]
\tikzstyle{column 5}=[myblue]
\matrix [matrix of math nodes,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{column}
\end{columns}
\end{frame}
\end{document}
答え2
- 両方の列に
\begin{center}
...を挿入するか、以下の MWE で行われているようにコマンド\end{center}
に置き換える必要があります。\centering
- オフトピック:
- 両方のマトリックスに
tikz
共通のオプションをマージできます\tikzset
beamer
xtabular
再度ロードする必要がないようにロードする- MWEでは、以下の行列要素間のスペースも縮小されています(
inner xsep=1pt
)
- 両方のマトリックスに
\documentclass{beamer}
\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{columns}[T,onlytextwidth]
\tikzset{M/.style={ >=stealth,thick,baseline,
matrix of math nodes,
inner xsep=1pt,
column 8/.append style =myblue,
ampersand replacement=\&}
}
\begin{column}{.49\textwidth}
\centering
\begin{tikzpicture}[]
\matrix (A) [M]
{
\& 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{column}
\begin{column}{.49\textwidth}
\centering
\begin{tikzpicture}
\matrix (B) [M]
{
\& 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{column}
\end{columns}
\end{frame}
\end{document}
追記:
マトリックス コードは次のように簡略化できます。
\documentclass{beamer}
\usepackage{fontspec}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{frame}[fragile]
\frametitle{Writing matrices in \texttt{beamer} }
\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{columns}[T,onlytextwidth]
\tikzset{M/.style = {>=stealth,thick,baseline,
matrix of math nodes,
nodes={inner xsep=1pt, anchor=east},
column 4/.append style=blue,
}
}
\begin{column}{.49\textwidth}
\centering
\begin{tikzpicture}
\matrix (A) [M]
{
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{column}
\begin{column}{.49\textwidth}
\centering
\begin{tikzpicture}
\centering
\matrix (B) [M]
{
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{column}
\end{columns}
\end{frame}
\end{document}
XeLaTeX でコンパイルすると、次の結果が得られます。