3
\documentclass{beamer}
\usepackage{lipsum}
\setbeamercolor{postit}{fg=black,bg=yellow}

\begin{document}
\begin{frame}
\begin{itemize}
\item some words
% possibly an empty line here    
\begin{beamercolorbox}[rounded=true]{postit}
\lipsum[1-1]
\end{beamercolorbox}
\item some words
\end{itemize}
\end{frame}
\end{document}

I'd like the box to be horizontally aligned with the items, both on the left and right, and not to occupy the full page width. I could do it with two colums (0.075 and 0.97), but that would be pretty ad hoc and not perfect, in the fact that the box would extend too much on the right. In the same fashion, if I put an extra line between \item some words and \begin, it gets correctly aligned on the right (no overfull hbox 22pt on the right), but too wide on left.

Any ideas?

1
  • 1
    Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem.
    – jub0bs
    Feb 24, 2014 at 11:46

1 Answer 1

5

You can set the width to \linewidth using wd=\linewidth:

\documentclass{beamer}
\usepackage{lipsum}
\setbeamercolor{postit}{fg=black,bg=yellow}

\begin{document}
\begin{frame}
\begin{itemize}
\item some words
% possibly an empty line here    
\begin{beamercolorbox}[rounded=true,wd=\linewidth]{postit}
\lipsum[1-1]
\end{beamercolorbox}
\item some words
\end{itemize}
\end{frame}
\end{document}

enter image description here

2
  • Thanks, that's precisely what I couldn't remember; I was tampering with .9\textwidth and similar, but this is better
    – jj_p
    Feb 24, 2014 at 15:11
  • For some reason this doesn't work when I remove the "some words". If I wanted all text in that item within such a box how could I achieve that?
    – mab
    Apr 21, 2021 at 15:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .