Place two tikzpictures next to eachother LaTeX

Viewed 8627

I have two tikzpitctures in LaTeX that I was hoping to place side-by-side. Does anybody know a solid way of accomplishing this? If not, is there another approach to creating side-by-side Venn Diagrams?

Code:

% %%%%%%%%%%%%%%%%%%%
\section*{Question 1}
% %%%%%%%%%%%%%%%%%%%
{\bfseries Determine the relationship between $P = (A-B)-C$ and $Q = (A-C)-(B-C)$}

{\bfseries Answer: $P = Q$}

% %%%%%%%%%%%%%%%%%%%
\subsection*{Justification 1: Venn Diagram}
% %%%%%%%%%%%%%%%%%%%
\def\firstcircle{ (0.0, 0.0) circle (1.5)}
\def\secondcircle{(2.0, 0.0) circle (1.5)}
\def\thirdcircle{ (1.0,-1.5) circle (1.5)}
\def\rectangle{ (-1.5,-3.0) rectangle (3.5,1.0) }
\colorlet{circle edge}{black}
\colorlet{circle area}{blue!30}

\tikzset{filled/.style={fill=circle area, draw=circle edge, thick},
    outline/.style={draw=circle edge, thick}}

\begin{tikzpicture}
    \begin{scope}
        \fill[filled]  \firstcircle;
        \fill[white]  \secondcircle;
        \fill[white] \thirdcircle;
    \end{scope}
    \draw[outline] \firstcircle  node[left]  {$A$};
    \draw[outline] \secondcircle node[right] {$B$};
    \draw[outline] \thirdcircle  node[below] {$C$};
    \node[anchor=south] at (current bounding box.north) 
      {$P = (A - B) - C$};
\end{tikzpicture}

\begin{tikzpicture}
    \begin{scope}
        \fill[filled]  \firstcircle;
        \fill[white]  \secondcircle;
        \fill[white] \thirdcircle;
    \end{scope}
    \draw[outline] \firstcircle  node[left]  {$A$};
    \draw[outline] \secondcircle node[right] {$B$};
    \draw[outline] \thirdcircle  node[below] {$C$};
    \node[anchor=south] at (current bounding box.north) 
      {$Q = (A - C) - (B - C)$};
\end{tikzpicture}
\pagebreak

Result: a

2 Answers

You force the two images to be in separate lines by leaving an empty line between the two pictures. For latex an empty line marks the start of a new paragraph.

\documentclass{article}

\usepackage{tikz}

\begin{document}

% %%%%%%%%%%%%%%%%%%%
\section*{Question 1}
% %%%%%%%%%%%%%%%%%%%
{\bfseries Determine the relationship between $P = (A-B)-C$ and $Q = (A-C)-(B-C)$}

{\bfseries Answer: $P = Q$}

% %%%%%%%%%%%%%%%%%%%
\subsection*{Justification 1: Venn Diagram}
% %%%%%%%%%%%%%%%%%%%
\def\firstcircle{ (0.0, 0.0) circle (1.5)}
\def\secondcircle{(2.0, 0.0) circle (1.5)}
\def\thirdcircle{ (1.0,-1.5) circle (1.5)}
\def\rectangle{ (-1.5,-3.0) rectangle (3.5,1.0) }
\colorlet{circle edge}{black}
\colorlet{circle area}{blue!30}

\tikzset{filled/.style={fill=circle area, draw=circle edge, thick},
    outline/.style={draw=circle edge, thick}}

\begin{tikzpicture}
    \begin{scope}
        \fill[filled]  \firstcircle;
        \fill[white]  \secondcircle;
        \fill[white] \thirdcircle;
    \end{scope}
    \draw[outline] \firstcircle  node[left]  {$A$};
    \draw[outline] \secondcircle node[right] {$B$};
    \draw[outline] \thirdcircle  node[below] {$C$};
    \node[anchor=south] at (current bounding box.north) 
      {$P = (A - B) - C$};
\end{tikzpicture}
%
\begin{tikzpicture}
    \begin{scope}
        \fill[filled]  \firstcircle;
        \fill[white]  \secondcircle;
        \fill[white] \thirdcircle;
    \end{scope}
    \draw[outline] \firstcircle  node[left]  {$A$};
    \draw[outline] \secondcircle node[right] {$B$};
    \draw[outline] \thirdcircle  node[below] {$C$};
    \node[anchor=south] at (current bounding box.north) 
      {$Q = (A - C) - (B - C)$};
\end{tikzpicture}
\pagebreak

\end{document}

enter image description here

You can always draw a huge Grid, I have this exact problem... and I draw a grid, Especially if your scheme is a progression where most things stay the same..but a few things change for each new image... like a cartoon... you will just have the alter the coordinates when you copy the new picture..

It’s very easy to space everything and tailor it to your aesthetic...

You can even use different step sizes on the grid.

Once you’ve drawn the total scheme, change the grid lines to white and it doesn’t show in the rendered pdf..

Hope that helps

Related