# Beamer: tikz picture in right column is moved if I place text in left column inside a block

As the title says I have problems keeping the tikz picture in my right column at the same position.

Here a MWE so you can see for yourself.

\documentclass[xcolor=x11names,compress]{beamer}

\usepackage{graphicx}
\usepackage{tikz}

\setbeamercolor{block title}{use=structure,fg=white,bg=DeepSkyBlue4}
\setbeamercolor{block body}{use=structure,fg=black,bg=DeepSkyBlue4!10!white}

\begin{document}

\subsection*{Test 1}
\begin{frame}{Frame 1}
\begin{columns}[onlytextwidth]
\begin{column}{.4\textwidth}
Test: A really long line of text for a presentation\\
\end{column}
\begin{column}{.6\textwidth}
\centering
\begin{tikzpicture}
\draw[->,very thick,cap=rect] (3.8,1.2)--(4.8,1.2);
\node at (4.85,0.95) {$x$};
\draw[->,very thick, cap=rect] (3.8,1.2)--(3.8,2.2);
\node at (4.05, 2.1) {$y$};
\draw[very thick] (3.8,1.2) circle (0.1);
\draw[very thick] (3.8,1.2) circle (0.02);
\node at (3.65, 0.95) {$z$};

\draw[opacity=0.15] (1.5,-2.59861) circle (0.7cm);

\draw[opacity=0.15] (0.0,0) circle (0.7cm);

\end{tikzpicture}
\end{column}
\end{columns}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection*{Test 2}
\begin{frame}{Frame 2}
\begin{columns}[onlytextwidth]
\begin{column}{.4\textwidth}
\begin{block}{Test}
Make a test with some more text
\end{block}
\end{column}
\begin{column}{.6\textwidth}
\centering
\begin{tikzpicture}
\draw[->,very thick,cap=rect] (3.8,1.2)--(4.8,1.2);
\node at (4.85,0.95) {$x$};
\draw[->,very thick, cap=rect] (3.8,1.2)--(3.8,2.2);
\node at (4.05, 2.1) {$y$};
\draw[very thick] (3.8,1.2) circle (0.1);
\draw[very thick] (3.8,1.2) circle (0.02);
\node at (3.65, 0.95) {$z$};

\draw[opacity=0.15] (1.5,-2.59861) circle (0.7cm);

\draw[opacity=0.15] (0.0,0) circle (0.7cm);

\end{tikzpicture}
\end{column}
\end{columns}

\end{frame}

\end{document}


I would need a solution where I keep the two frames, so \only etc. is not an option.

block has some inner separation that somehow deosn't get restricted inside the width. Use

\end{column}
\hfill
\begin{column}{.55\textwidth}


\documentclass[xcolor=x11names,compress]{beamer}

\usepackage{graphicx}
\usepackage{tikz}

\setbeamercolor{block title}{use=structure,fg=white,bg=DeepSkyBlue4}
\setbeamercolor{block body}{use=structure,fg=black,bg=DeepSkyBlue4!10!white}

\begin{document}

\subsection*{Test 1}
\begin{frame}{Frame 1}
\begin{columns}[onlytextwidth]
\begin{column}{.4\textwidth}
Test: A really long line of text for a presentation\\
\end{column}\hfill
\begin{column}{.55\textwidth}
\centering
\begin{tikzpicture}
\draw[->,very thick,cap=rect] (3.8,1.2)--(4.8,1.2);
\node at (4.85,0.95) {$x$};
\draw[->,very thick, cap=rect] (3.8,1.2)--(3.8,2.2);
\node at (4.05, 2.1) {$y$};
\draw[very thick] (3.8,1.2) circle (0.1);
\draw[very thick] (3.8,1.2) circle (0.02);
\node at (3.65, 0.95) {$z$};

\draw[opacity=0.15] (1.5,-2.59861) circle (0.7cm);

\draw[opacity=0.15] (0.0,0) circle (0.7cm);

\end{tikzpicture}
\end{column}
\end{columns}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection*{Test 2}
\begin{frame}{Frame 2}
\begin{columns}[onlytextwidth]
\begin{column}{.4\textwidth}
\begin{block}{Test}
Make a test with some more text
\end{block}
\end{column}\hfill
\begin{column}{.55\textwidth}
\centering
\begin{tikzpicture}
\draw[->,very thick,cap=rect] (3.8,1.2)--(4.8,1.2);
\node at (4.85,0.95) {$x$};
\draw[->,very thick, cap=rect] (3.8,1.2)--(3.8,2.2);
\node at (4.05, 2.1) {$y$};
\draw[very thick] (3.8,1.2) circle (0.1);
\draw[very thick] (3.8,1.2) circle (0.02);
\node at (3.65, 0.95) {$z$};

\draw[opacity=0.15] (1.5,-2.59861) circle (0.7cm);

\draw[opacity=0.15] (0.0,0) circle (0.7cm);

\end{tikzpicture}
\end{column}
\end{columns}

\end{frame}

\end{document}


Inspired by @cfr's solution here -- https://tex.stackexchange.com/a/217885/34618, With some modifications to the block template seems to do the trick.

Code

\documentclass[xcolor=x11names,compress]
{beamer}

\usepackage{graphicx}
\usepackage{tikz}
%

\setbeamertemplate{block begin}{
\vskip\baselineskip
\begin{beamercolorbox}[wd=\textwidth, ht=0.5cm, dp=0.2cm, leftskip=0.2cm]{block title}%
\usebeamerfont*{block title}%
{\rule[-0.4ex]{0mm}{2ex}\insertblocktitle}%
\end{beamercolorbox}%
{\nointerlineskip\vskip-0.5pt}%
\usebeamerfont{block body}%
\begin{beamercolorbox}[wd=\textwidth, leftskip=0.2cm,dp=0.2cm]{block body}%
\vskip-.75ex\vspace*{0.2cm}%
}
\setbeamertemplate{block end}{
\end{beamercolorbox}
\vspace*{.25cm}
}

\setbeamercolor{block title}{use=structure,fg=white,bg=DeepSkyBlue4}
\setbeamercolor{block body}{use=structure,fg=black,bg=DeepSkyBlue4!10!white}

\begin{document}

\subsection*{Test 1}
\begin{frame}{Frame 1}
\begin{columns}[onlytextwidth]
\begin{column}{.4\textwidth}
Test: A really long line of text for a presentation\\
\end{column}
\begin{column}{.6\textwidth}
\centering
\begin{tikzpicture}
\draw[->,very thick,cap=rect] (3.8,1.2)--(4.8,1.2);
\node at (4.85,0.95) {$x$};
\draw[->,very thick, cap=rect] (3.8,1.2)--(3.8,2.2);
\node at (4.05, 2.1) {$y$};
\draw[very thick] (3.8,1.2) circle (0.1);
\draw[very thick] (3.8,1.2) circle (0.02);
\node at (3.65, 0.95) {$z$};
\draw[opacity=0.15] (1.5,-2.59861) circle (0.7cm);

\draw[opacity=0.15] (0.0,0) circle (0.7cm);

\end{tikzpicture}
\end{column}
\end{columns}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection*{Test 2}
\begin{frame}{Frame 2}
\begin{columns}[onlytextwidth]
\begin{column}{.4\textwidth}
\begin{block}{Test}
Make a test with some more text
\end{block}
\end{column}
\begin{column}{.6\textwidth}
\centering
\begin{tikzpicture}
\draw[->,very thick,cap=rect] (3.8,1.2)--(4.8,1.2);
\node at (4.85,0.95) {$x$};
\draw[->,very thick, cap=rect] (3.8,1.2)--(3.8,2.2);
\node at (4.05, 2.1) {$y$};
\draw[very thick] (3.8,1.2) circle (0.1);
\draw[very thick] (3.8,1.2) circle (0.02);
\node at (3.65, 0.95) {$z$};
\draw[opacity=0.15] (1.5,-2.59861) circle (0.7cm);

\draw[opacity=0.15] (0.0,0) circle (0.7cm);

• On the second concern, this is my take. Use of minipage as showh what follows, which goes inside block environment. This is a long very text. \setlength\abovedisplayskip{0pt} \begin{minipage}{3cm} \begin{align} &x+y=z \\ &x*y=zz \end{align} \\ \end{minipage} – Jesse Jan 8 '15 at 12:13