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.

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}
share|improve this question

1 Answer 1

up vote 2 down vote accepted

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

share|improve this answer
    
Many thanks for your help! You TeX giants (10k+) really amaze me! –  user1146332 Mar 21 at 20:55

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.