3

The appended code yield the following slide.

enter image description here

Although the code of the four rectangular nodes equals each other the vertical separation between the text and the first item within the rectangle is smaller in Testbox 1 than in the other boxes. After spending a lot of time to isolate the mistake my tired eyes need finally some help.


\documentclass[
    handout
]{beamer}
\usepackage{tikz}

\tikzset{
   X/.style={rounded corners=5pt, line width=0.75pt, 
             rectangle,text width=4.5cm, align=left, 
             minimum height=3cm,draw},
   T/.style={font=\small,text width=4.5cm,anchor=north west}
}

\newcommand\XBox[1]{%
   \node[X, 
         append after command={
            node[T] at (\tikzlastnode.north west) {%
               #1
            }
         }
   ] {}; 
}

\begin{document}

\begin{frame}{Test slide}
   \begin{center}
      \begin{tikzpicture}

         \matrix[column sep=0.5cm, row sep=0.5cm, ampersand replacement=\&]{%
            \uncover<2->{%
               \XBox{%
                  Testbox 1
                  \begin{itemize}
                     \item Test 1
                  \end{itemize}
               }
            }
            \& 
            \uncover<3->{%
               \XBox{%
                  Testbox 2
                  \begin{itemize}
                     \item Test 2
                  \end{itemize}
               }
            }
            \\
            \uncover<5->{%
               \XBox{%
                  Testbox 4
                  \begin{itemize}
                     \item Test 4
                  \end{itemize}
               }
            }
            \& 
            \uncover<4->{%
               \XBox{%
                  Testbox 3
                  \begin{itemize}
                     \item Test 3
                  \end{itemize}
               }
            }
            \\
         };
      \end{tikzpicture}
   \end{center}
\end{frame}

\end{document}
2

In case of doubt, use \leavevmode :)

\documentclass[
    handout
]{beamer}
\usepackage{tikz}

\tikzset{
   X/.style={rounded corners=5pt, line width=0.75pt, 
             rectangle,text width=4.5cm, align=left, 
             minimum height=3cm,draw},
   T/.style={font=\small,text width=4.5cm,anchor=north west}
}

\newcommand\XBox[1]{%
   \node[X, 
         append after command={
            node[T] at (\tikzlastnode.north west) {%
               #1%
            }%
         }%
   ] {}; 
}

\begin{document}

\begin{frame}{Test slide}
   \begin{center}\leavevmode
      \begin{tikzpicture}

         \matrix[column sep=0.5cm, row sep=0.5cm, ampersand replacement=\&]{%
            \uncover<2->{%
               \XBox{%
                  Testbox 1%
                  \begin{itemize}
                     \item Test 1
                  \end{itemize}
               }
            }
            \& 
            \uncover<3->{%
               \XBox{%
                  Testbox 2
                  \begin{itemize}
                     \item Test 2
                  \end{itemize}
               }
            }
            \\
            \uncover<5->{%
               \XBox{%
                  Testbox 4
                  \begin{itemize}
                     \item Test 4
                  \end{itemize}
               }
            }
            \& 
            \uncover<4->{%
               \XBox{%
                  Testbox 3
                  \begin{itemize}
                     \item Test 3
                  \end{itemize}
               }
            }
            \\
         };
      \end{tikzpicture}
   \end{center}
\end{frame}

\end{document}

enter image description here

  • Many thanks for your help! You TeX giants (10k+) really amaze me! – user1146332 Mar 21 '14 at 20:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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