기둥이 비머에 정렬되지 않았습니다.

기둥이 비머에 정렬되지 않았습니다.

나는 오랫동안 비머와 기둥에서 이 문제에 직면해 왔습니다. 왜 두 기둥이 정렬되지 않습니까?

\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}두 열 모두에 ...를 삽입 하거나 아래 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로 컴파일하면 다음과 같은 결과가 나옵니다.

여기에 이미지 설명을 입력하세요

관련 정보