
Я уже давно сталкиваюсь с этой проблемой с проектором и колоннами. Почему две колонны не выровнены?
\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 в первом столбце. Теперь два столбца идеально выровнены.
\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}
...\end{center}
или лучше заменить их\centering
командой, как это сделано в MWE ниже. - Не по теме:
- вы можете объединить
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 дает следующий результат: