0

The following is a MWE

\documentclass[xcolor=dvipsnames]{beamer} \usepackage{pgf,tikz} \usetikzlibrary{arrows} \begin{document} \begin{frame} \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=0.695cm,y=0.685cm] \clip(-1.72,-5.46) rectangle (21.28,5.38); \draw (3.54,1.5) ellipse (2.02cm and 2cm); \draw (8.24,1.82) ellipse (2.11cm and 2.08cm); \end{tikzpicture} \begin{itemize} \item $B_\alpha$ \end{itemize} \end{frame} \end{document}

On compiling the above tex, we see that there is a huge gap between the tikzpicture and the text. How to reduce this gap? enter image description here I am not so familiar with tikzpicture. Any help and suggestions?

Sayan
  • 199
  • 1
    Are you sure you need that \clip? That seems to cause the huge gap. – TeXnician Mar 16 '17 at 05:31
  • 1
    The y-coordinate of your clip is too small. If you use \draw instead of \clip you can see the clip. Tune it and then turn it into \clip again. Of course you can just leave out the clip and center the tikzpicture. –  Mar 16 '17 at 05:31
  • 1
    You don't need \clip. Once a tikzpicture is finished, its bounding box is adjusted to fit all used coordinates, visible or not. Sometimes we need to adjust the bounding box, but not in this particular case. – Ignasi Mar 16 '17 at 08:10

1 Answers1

2

To put the comments above into an answer the code would look like this.

\documentclass[xcolor=dvipsnames]{beamer}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\begin{document}
\begin{frame}
    \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=0.695cm,y=0.685cm]
%    \clip(-1.72,-5.46) rectangle (21.28,5.38);
    \draw  (3.54,1.5) ellipse (2.02cm and 2cm);
    \draw  (8.24,1.82) ellipse (2.11cm and 2.08cm);
    \end{tikzpicture}
    \begin{itemize}
\item   $B_\alpha$
    \end{itemize}
\end{frame}
\end{document}

If you try to center the picture horizontally (just an idea of mine) with the clipping it would be better to use something like this:

\documentclass[xcolor=dvipsnames]{beamer}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\begin{document}
\begin{frame}
\begin{center}
    \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=0.695cm,y=0.685cm]
%    \clip(-1.72,-5.46) rectangle (21.28,5.38);
    \draw  (3.54,1.5) ellipse (2.02cm and 2cm);
    \draw  (8.24,1.82) ellipse (2.11cm and 2.08cm);
    \end{tikzpicture}
\end{center}

    \begin{itemize}
\item   $B_\alpha$
    \end{itemize}
\end{frame}
\end{document}
Jürgen
  • 2,160