7

I have noticed that when I have "itemize" environments defined within blocks in beamer, that they introduce more vertical spacing between the top and the bottom of the blocks, than vertical text. Since I have a slide with some text filled blocks and directly after, a slide with only "itemize" holding blocks, I would like the spacing between the itemized text and the block to be the same as for regular text.

On this question I have read about "squeeze" option, but it doesn't seem to work...

Additional info:

The problem is in the additional vertical space that is included by the "\itemize" environment. I have found this answer on how to remove vertical spacing from the itemize list, and I am using this approach. However, it is a brute force approach. What I would like to know if it is possible to have the same vertical space between the end of the itemize list and the bottom of a block, as the one set between the normal text and the bottom of the block.

MWE:

\documentclass[10pt]{beamer}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{exscale}
\usepackage{epsfig}
\usepackage{fancybox}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{overpic}

\usepackage{multimedia}

\usetheme{default}
\usecolortheme{crane}

% -- Modifications that enable the footline and set black color for the fonts 
\setbeamertemplate{footline}{%
    \begin{beamercolorbox}[wd=\paperwidth,ht=2.25ex,dp=1ex,right, rightskip=1mm, leftskip=1mm]{titlelike}
        \textcolor{black}{
            %\inserttitle\hfill\insertauthor\hfill\insertframenumber%
            Something\hfill Something Else \hfill\insertframenumber%
        }
    \end{beamercolorbox}
}

\setbeamertemplate{itemize items}[square]

\setbeamercolor{item}{fg=black}
\setbeamercolor{frametitle}{fg=black}
\setbeamercolor{block title}{fg=black}
\setbeamercolor{title}{fg=black}
\setbeamercolor{block body}{bg=white}

% END Modifications

\begin{document}


\begin{frame}
  \frametitle{text blocks}
    \begin{block}{block}
        block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   blockk
    \end{block}{block} 
    \begin{block}
        block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block
    \end{block}
    \begin{block}{block}
        block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block
    \end{block}
\end{frame}

\begin{frame}
  \frametitle{itemize blocks}
    \begin{block}{item}
        \begin{itemize}
            \item item 
            \item item 
            \item item
        \end{itemize}
    \end{block}
    \begin{block}{item}
        \begin{itemize}
            \item item 
            \item item 
            \item item
        \end{itemize}
    \end{block}
    \begin{block}{item}
        \begin{itemize}
            \item item 
            \item item 
            \item item
        \end{itemize}
    \end{block}


\end{frame}

\end{document}
4
  • Well i fear i don't understand your problem. I never cam across such an issue. Could you please add an MWE to illustrate your question?
    – bloodworks
    Commented Jan 16, 2013 at 14:17
  • @bloodworks I'm "underwater" right now... I'll upload an MWE as soon as I can
    – tmaric
    Commented Jan 16, 2013 at 14:22
  • @bloodworks I've added the MWE, now you can see how the block panels shift, and notice how text blocks are densly packed vertically, and the large vertical space between blocks with the itemize lists..
    – tmaric
    Commented Jan 16, 2013 at 15:24
  • 1
    You should adjus the list parameters, including \topsep in way similar to tex.stackexchange.com/q/87249/15925 Commented Jan 16, 2013 at 15:29

2 Answers 2

13

There are two things going on in this situation. For those who know about LaTeX's list parameters, there is a \topsep being added before the itemize list. The other is that this item is starting in vertical mode, so a \partopsep is also being added.

We thus need to do two things in this situation: (1) set \topsep to zero for the list, via a redefinition \@listi, and (2) clear \partopsep.

The best way to do this is to add this to block begin template. Here is an example, based on the essentials of your code.

\documentclass[10pt]{beamer}
\usepackage{lmodern}
\usepackage[T1]{fontenc}

\usetheme{default}
\usecolortheme{crane}

\setbeamertemplate{itemize items}[square]

\setbeamercolor{item}{fg=black}
\setbeamercolor{frametitle}{fg=black}
\setbeamercolor{block title}{fg=black}
\setbeamercolor{title}{fg=black}
\setbeamercolor{block body}{bg=white}

\makeatletter
\addtobeamertemplate{block begin}{
\def\@listi{\leftmargin\leftmargini
              \topsep    0pt
              \parsep    0pt
              \itemsep   3pt plus 2pt minus 3pt}
\partopsep 0pt
}
\makeatother

\begin{document}


\begin{frame}
  \frametitle{text vs. item blocks}
  \begin{columns}[t]
    \begin{column}{0.42\textwidth}
      \begin{block}{text block}
        block block block block block\vadjust{\hrule}
        block block block block block 
        block block block block block 
        block block block block block 
      \end{block}
    \end{column}
    \begin{column}{0.48\textwidth}
      \begin{block}{item block}
        \begin{itemize}
        \item item\vadjust{\hrule}
        \item item
        \item item
        \end{itemize}
      \end{block}
    \end{column}
  \end{columns}
\end{frame}

\end{document}

Sample output

I have placed the blocks side-by-side and added the \vadjust{\hrule} for illustration purposes. The values for \@listi are based on beamers defaults which are

\def\@listi{\leftmargin\leftmargini
            \topsep 3\p@ \@plus2\p@ \@minus2.5\p@
            \parsep 0\p@
            \itemsep3\p@ \@plus2\p@ \@minus3\p@}

\partopsep has default value

2.0pt plus 1.0pt minus 1.0pt

If you want the individual lines to match up, then you should also put \itemsep equal to 0pt in the above code.

Beaware that if the titles of the two blocks have different heights/depths then theh body will move accordingly and you will loose your alignment again. You can cover yourself a little by adding an appropriate strut to your block titles.

Note that the above code also kills \topsep for subsquent uses of itemize within the same block. If this is a problem, you might try to just adjust \partopsep to cancel out \topsep and ensure that your subsequent lists in the block do not start in vertical mode.

2
  • I like it too, the onliest problem remaining is that you will have some messed up spacing between two itemize environments in the same block. It will be less that the itemsep which looks queer to me. And for the descender problem in the titleline a vphantom would serve too.
    – bloodworks
    Commented Jan 17, 2013 at 10:55
  • A good point. It turns out my analysis was incorrect the first time, I have now rewritten my solution that no negative values are used and mentioned a possible work around for the situation you describe. Commented Jan 17, 2013 at 11:54
7

Howdy i'm not quite sure if this is actually an answer but it somehow solves the problem. My comment about the MWE came up, cause i never use the default theme. I figured out, that using \setbeamertemplate{blocks}[rounded] in the preamble just makes the separation towards the block border consistent. I also figured out that those rounded blocks are somehow drawn differently. But this won't do here since it wasn't asked for different blocks. So in my desperation i simply did the following:

\documentclass[10pt]{beamer}

\usetheme{default}
\usecolortheme{crane}


\setbeamertemplate{block begin}%{default}
{
  \par\vskip\medskipamount%
    \begin{beamercolorbox}[colsep*=.75ex]{block title}
    \usebeamerfont*{block title}\insertblocktitle%
  \end{beamercolorbox}%
  {\parskip0pt\par}%
  \ifbeamercolorempty[bg]{block title}
  {}
  {\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}%
  \usebeamerfont{block body}%
  \begin{beamercolorbox}[colsep*=.75ex,vmode, sep=.5mm]{block body}%
    \ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}\begin{minipage}{\textwidth}%
}
\setbeamertemplate{block end}%{default}  
{\end{minipage}\end{beamercolorbox}\vskip\smallskipamount}


\begin{document}


\begin{frame}
  \frametitle{text blocks}
  \begin{columns}
        \column[t]{.5\textwidth}
    \begin{block}{block}
        block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   block   blockk
    \end{block}
    \column[t]{.5\textwidth}
        \begin{block}{iteml}
        \begin{itemize}
            \item item 
            \item item 
            \item item
        \end{itemize}
    \end{block}
  \end{columns}

\end{frame}


\end{document}

I added a minipage to the original definition so that the content of the block is in the very. Seems to work so far but mayhaps some beamer professionals could bring in some light here.

enter image description here

You must log in to answer this question.

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