다음과 같이 음영처리된 환경을 사용하려고 합니다.
\documentclass[11pt]{beamer}
\usepackage{xcolor}
\usepackage{framed}
\definecolor{shadecolor}{rgb}{1,0.8,0.3}
\begin{document}
\begin{frame}
\begin{columns}[t, totalwidth=\linewidth]
\begin{column}{0.5\linewidth}
\begin{shaded}
Foo
\end{shaded}
\end{column}
\begin{column}{0.5\linewidth}
Foo
\end{column}
\end{columns}
\end{frame}
\end{document}
다음과 같은 출력이 표시됩니다(이상하게도 Overfull hbox 오류는 없습니다).
첫 번째 "foo" 주위에 음영 처리된 환경이 없으면 다음과 같은 결과를 얻습니다.
그늘진 환경을 포기해야 하는 걸까요, 아니면 뭔가 다른 일을 잘못하고 있는 걸까요?
답변1
minipage
환경 대신 s를 사용하면 columns
문제가 해결됩니다. 나는 당신이 사용하는 것이 좋습니다mdframed
또는tcolorbox
대신에 framed
; 이전 패키지는 더 다양하고 쉽게 사용자 정의할 수 있습니다.
\documentclass[11pt]{beamer}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{tcolorbox}
\usepackage{framed}
\definecolor{shadecolor}{rgb}{1,0.8,0.3}
% for mdframed
\newmdenv[
hidealllines=true,
backgroundcolor=shadecolor,
userdefinedwidth=.6\linewidth
]{mybox}
% for tcolorbox
\newtcolorbox{mytbox}[1][]{
colback=shadecolor,
colframe=shadecolor,
arc=0pt,
outer arc=0pt,
#1
}
\begin{document}
\begin{frame}
With \texttt{framed} package:
\begin{minipage}{0.5\linewidth}
\begin{shaded}
Foo
\end{shaded}
\end{minipage}%
\begin{minipage}{0.5\linewidth}
Foo
\end{minipage}\vfill
With \texttt{mdframed} package:
\begin{minipage}{0.5\linewidth}
\begin{mybox}[userdefinedwidth=.95\linewidth]
Foo
\end{mybox}
\end{minipage}%
\begin{minipage}{0.5\linewidth}
Foo
\end{minipage}\vfill
With \texttt{tcolorbox} package:
\begin{minipage}{0.5\linewidth}
\begin{mytbox}[width=.95\linewidth]
Foo
\end{mytbox}
\end{minipage}%
\begin{minipage}{0.5\linewidth}
Foo
\end{minipage}
\end{frame}
\end{document}