두 열의 블록 정렬에 문제가 있습니까?

두 열의 블록 정렬에 문제가 있습니까?

비머 프레임의 다음 코드를 고려하십시오.

\begin{frame}{Test}
\begin{block}{Single column}
\justifying
This is a block.
\end{block}
\begin{columns}[onlytextwidth]
\begin{column}{0.45\textwidth}
\begin{exampleblock}{Left}
\justifying
This is the first column.
\end{exampleblock}
\end{column}
\begin{column}[right]{0.45\textwidth}
\begin{exampleblock}{Right}
\justifying
This is the second column.
\end{exampleblock}
\end{column}
\end{columns}
\end{frame}

다음과 같은 결과가 생성됩니다. 삽화

문제는 오른쪽 블록이 전체 텍스트 너비에 맞게 오른쪽 정렬되지 않는다는 것입니다.

올바르게 정렬하는 방법은 무엇입니까?

편집하다:

다음 패키지를 로드합니다.

\usepackage{marvosym} %
\usepackage{ragged2e} % define justifying
\usepackage{hyperref} %
\usepackage{transparent} %

답변1

@barbarabeeton이 주석에서 관찰한 것처럼 왼쪽 환경, 즉 디센더가 있는 문자를 포함하지 않는 단어가 포함된 환경에 \strut-- will do too --와 같은 것을 삽입해야 하는 것으로 나타났습니다. -- 반면에 그렇습니다.\mathstrutexampleblockLeftRight

LaTeX 커널에서는 \strut너비가 0이므로 높이 0.7\baselineskip와 깊이가 있는 보이지 않는 수직 규칙으로 정의됩니다 0.3\baselineskip. 따라서 전체 높이는 와 같습니다 \baselineskip. 대조적으로, a \mathstrut의 전체 높이는 )캐릭터의 전체 키입니다. 따라서 A는 \struta보다 약간 더 큽니다 \mathstrut. 어느 쪽이든, 둘 다 \strut왼쪽 \mathstrut블록에 충분한 깊이를 제공합니다.

일반적으로 스트럿을 제공해야 할 수도 있습니다.둘 다왼쪽 및 오른쪽 예제 블록 환경, 특히 한 블록에 오름차순은 있지만 하강자는 없는 단어(예: left, black)가 있고 다른 블록에 하강자는 있지만 오름차순이 없는 단어(예: green, uvwxyz)가 포함된 경우 특히 그렇습니다.

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

\documentclass{beamer}
\usetheme{Madrid}
\usepackage{marvosym} %
\usepackage{ragged2e} % define justifying
\usepackage{transparent} %
\usepackage{hyperref} %
\begin{document}
\begin{frame}{Test}
\begin{block}{Single column}
\justifying
This is a block.
\end{block}
\begin{columns}[onlytextwidth]
\begin{column}{0.45\textwidth}
\begin{exampleblock}{Left\strut}
\justifying
This is the first column.
\end{exampleblock}
\end{column}
\begin{column}{0.45\textwidth}
\begin{exampleblock}{Right}
\justifying
This is the second column.
\end{exampleblock}
\end{column}
\end{columns}
\end{frame}
\end{document} 

답변2

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

\documentclass{beamer}
\usetheme{Boadilla}

\newsavebox{\squaredblocktext}
\setbeamertemplate{block begin}{
    \par\vskip\medskipamount%
    \makebox[\dimexpr\textwidth-1.5ex\relax][l]{%
        \begin{beamercolorbox}[colsep*=.75ex]{block title}
            \usebeamerfont*{block title}\insertblocktitle%
        \end{beamercolorbox}}%
        \begin{lrbox}{\squaredblocktext}%
            \begin{minipage}[t]{\textwidth}%
                \ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}

\setbeamertemplate{block end}{
            \end{minipage}%
        \end{lrbox}%
        {\parskip0pt\par}%
        \ifbeamercolorempty[bg]{block title}{}
        {\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}%
        \usebeamerfont{block body}%
        \makebox[\dimexpr\textwidth-1.5ex\relax][l]{%
        \begin{beamercolorbox}[colsep*=.75ex,vmode]{block body}%
            \usebox{\squaredblocktext}
        \end{beamercolorbox}%
    }\vskip\smallskipamount%
}

\setbeamertemplate{block example begin}{
    \par\vskip\medskipamount%
    \makebox[\dimexpr\textwidth-1.5ex\relax][l]{%
        \begin{beamercolorbox}[colsep*=.75ex]{block title example}
            \usebeamerfont*{block titleexample}\insertblocktitle%
        \end{beamercolorbox}}%
        \begin{lrbox}{\squaredblocktext}%
            \begin{minipage}[t]{\textwidth}%
                \ifbeamercolorempty[bg]{block body example}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
            }

\setbeamertemplate{block example end}{
            \end{minipage}%
        \end{lrbox}%
        {\parskip0pt\par}%
        \ifbeamercolorempty[bg]{block title example}{}
        {\ifbeamercolorempty[bg]{block body example}{}{\nointerlineskip\vskip-0.5pt}}%
        \usebeamerfont{block body example}%
        \makebox[\dimexpr\textwidth-1.5ex\relax][l]{%
            \begin{beamercolorbox}[colsep*=.75ex,vmode]{block body example}%
                \usebox{\squaredblocktext}
            \end{beamercolorbox}%
        }\vskip\smallskipamount%
}

\begin{document}
    \begin{frame}{Test}
        \begin{block}{Single column}
            This is a block.
        \end{block}
        \begin{columns}[onlytextwidth]
            \begin{column}{0.45\textwidth}
                \begin{exampleblock}{Left}
                    This is the first column.
                \end{exampleblock}
            \end{column}
            \begin{column}{0.45\textwidth}
                \begin{exampleblock}{Right}
                    This is the second column.
                \end{exampleblock}
            \end{column}
        \end{columns}
    \end{frame}
\end{document}

관련 정보