I'm attempting to condense 4 tikzpictures into a smaller space in my document. The solution I have is as follows:
\documentclass{article}
\usepackage[paperwidth=6in, paperheight=4in]{geometry}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage{multicol}
\begin{document}
Examples
\begin{multicols}{2}
\begin{tikzpicture}[xscale=.5, yscale=.5]
\draw [<->,thick] (0,5) |- (5,0);
\draw [thick] (4,1) --(4,4) node [right] {$A$ is not open in $\mathbb{R}^{2}$.};
\draw [thick, dashed] (4,1) -- (1,1) -- (1,4) -- (4,4);
\draw [fill] (4,1) circle [radius=0.1];
\draw [fill] (4,4) circle [radius=0.1];
\node at (2.5,2.5) {$A$};
\end{tikzpicture}
\begin{tikzpicture}[xscale=.5, yscale=.5]
\draw [<->,thick] (0,5) |- (5,0);
\draw [thick, dashed] (1,1) to [out=90, in=280] (1,4) to [out=30, in=150] (2,3.5) to [out=30, in=200] (4,4) to [out=40, in=90] (5,3) to [out=270, in=90] node [right] {$A$ is open.} (4,1) to [out=180, in=30] (1,1);
\node at (2.5,2.5) {$A$};
\end{tikzpicture}
\begin{tikzpicture}[xscale=.5, yscale=.5]
\draw [<->,thick] (0,5) |- (5,0);
\draw [fill] (4,1) circle [radius=0.1];
\draw [fill] (2,1) circle [radius=0.1];
\draw [fill] (3,5) circle [radius=0.1];
\draw [fill] (1,3) circle [radius=0.1];
\node at (5,3) {$A$ is not open.};
\end{tikzpicture}
$\newline$
\begin{tikzpicture}[xscale=.5, yscale=.5]
\draw [<->,thick] (0,2) |- (5,0);
\draw [ultra thick] (1,0) --(3,0) node [above] {$A$};
\node at (7,-1) {$A$ is not open in $\mathbb{R}^{2}$ but open in $\mathbb{R}$.};
\draw [fill=white] (1,0) circle [radius=0.1];
\draw [fill=white] (3,0) circle [radius=0.1];
\end{tikzpicture}
\end{multicols}
\end{document}
This produces:
The solution involves creating columns and placing the tikzpictures within the columns and forcing them to separate with a \newline.
But this is, in my opinion, an ugly solution. I'd like to be able to place the 4 tikzpictures in a 2×2 grid, each tikzpicture horizontally and vertically centered within it's cell plus turning each node that currently acts as a label (e.g. "A is open.") into a caption for that tikzpicture.
I tried to do this before by placing each tikzpicture within a minipage, but then this can't be captioned (something about float and absolute figures?), also I tried putting \figures of minipages of tikzpictures which, obviously, didn't work and became messy quickly.
Is there a simple solution to this?
Best Answer
While
tabularx
works, it's a bit overkill in this case.Note the
%
after the first\end{minipage}
in each row, to avoid a spurious space. Thecenter
environment is just to remove indentations and to give some room after "Examples".Use a different vertical space command instead of
\medskip
, if you prefer.The
\label
commands are useless, as you don't number the captions. In any case, the strings should be different from each other.