TransWikia.com

Height filling minipages in Beamer

TeX - LaTeX Asked by BConic on September 26, 2021

I am trying to accurately center things in my Beamer frames with animations. For that purpose, I would like to use minipages with fixed height, which should be automatically inferred so that I do not have to guess for each frame what is the correct height to specify. I tried to do the following, but it does not work:

documentclass{beamer}

usetheme{Ilmenau}
useoutertheme{smoothbars}
usecolortheme{seahorse}

begin{document}

begin{frame}
    begin{minipage}{1linewidth}
        List
        begin{itemize}
            item<1-> Point 1
            item<2-> Point 2
        end{itemize}
    end{minipage}
    only<1>{
        begin{minipage}[c][fill]{1textwidth}
            centering
            centered text
        end{minipage}}
    only<2>{
        begin{minipage}[c][fill]{1textwidth}
            centering
            color{green}{rule{4cm}{3cm}}
        end{minipage}}
end{frame}

end{document}

Why is this not working and is there another way to do this?

One Answer

When you specify the size of a box the natural size of a length is used (which is 0pt in the case of fill).

I think you want something like

documentclass{beamer}

usetheme{Ilmenau}
useoutertheme{smoothbars}
usecolortheme{seahorse}

begin{document}

begin{frame}
    begin{minipage}{1linewidth}
        List
        begin{itemize}
            item<1-> Point 1
            item<2-> Point 2
        end{itemize}
    end{minipage}
    only<1>{vspace*{fill}par
        begin{minipage}[c][.7textheight][c]{1textwidth}
            centering
            centered text
        end{minipage}
        parvspace*{fill}}
    only<2>{vspace*{fill}par
        begin{minipage}[c][.7textheight][c]{1textwidth}
            centering
            color{green}{rule{4cm}{3cm}}
        end{minipage}
        parvspace*{fill}}
end{frame}

end{document}

Correct answer by David Carlisle on September 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP