![Fehlausrichtung mit gerahmtem Paket und Säule](https://rvso.com/image/286356/Fehlausrichtung%20mit%20gerahmtem%20Paket%20und%20S%C3%A4ule.png)
Ich versuche die schattierte Umgebung wie folgt zu nutzen:
\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}
Ich erhalte die folgende Ausgabe (obwohl seltsamerweise kein „Overfull hbox“-Fehler auftritt):
Ohne die schattierte Umgebung um das erste "foo" bekomme ich
Muss ich auf die schattige Umgebung verzichten oder mache ich etwas anderes falsch?
Antwort1
Die Verwendung minipage
von s anstelle der columns
Umgebung löst das Problem. Ich würde vorschlagen, dass Sie verwendenmdframed
odertcolorbox
anstelle von framed
; die früheren Pakete sind vielseitiger und leichter anpassbar:
\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}