Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
\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?

share|improve this question
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. –  Jubobs Feb 24 at 11:46

1 Answer 1

up vote 4 down vote accepted

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

share|improve this answer
    
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 at 15:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.