1

I want to write an equation on top of a tikzpicture within an adjustbox, but I'm getting this (I just wrote one equation):

enter image description here

the MWE follows:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{setspace}
\usepackage{outlines}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{adjustbox}
\usepackage{blindtext}
\usepackage[margin=0.8in]{geometry}
\usepackage{tikz}
  \def\firstcircle{(90:1.75cm) circle (2.5cm)}
  \def\secondcircle{(210:1.75cm) circle (2.5cm)}
  \def\thirdcircle{(330:1.75cm) circle (2.5cm)}

\begin{document}

\begin{minipage}{\linewidth}\begin{outline}\1[$\blacktriangleright$]\emph{\textbf{aTitle}}:
\1[] \blindtext:

\begin{adjustbox}{width=5cm}
$ A \cup (B\cap C) = (A\cup B) \cap (A\cup C) $

 \begin{tikzpicture}
    \begin{scope}
        \clip \secondcircle;
        \thirdcircle;
    \end{scope}
    \begin{scope}
        \clip \firstcircle;
        \thirdcircle;
    \end{scope}
        \draw \firstcircle node[text=black,above] {$A$};
        \draw \secondcircle node [text=black,below left] {$B$};
        \draw \thirdcircle node [text=black,below right] {$C$};
\end{tikzpicture}
\end{adjustbox}
\begin{adjustbox}{width=5cm}
 \begin{tikzpicture}
    \begin{scope}
        \clip \secondcircle;
        \thirdcircle;
    \end{scope}
    \begin{scope}
        \clip \firstcircle;
        \thirdcircle;
    \end{scope}
        \draw \firstcircle node[text=black,above] {$A$};
        \draw \secondcircle node [text=black,below left] {$B$};
        \draw \thirdcircle node [text=black,below right] {$C$};
\end{tikzpicture}
\end{adjustbox}
\begin{adjustbox}{width=5cm}
 \begin{tikzpicture}
    \begin{scope}
        \clip \secondcircle;
        \thirdcircle;
    \end{scope}
    \begin{scope}
        \clip \firstcircle;
        \thirdcircle;
    \end{scope}
        \draw \firstcircle node[text=black,above] {$A$};
        \draw \secondcircle node [text=black,below left] {$B$};
        \draw \thirdcircle node [text=black,below right] {$C$};
\end{tikzpicture}
\end{adjustbox}
\end{outline}\end{minipage}

\end{document}
1

You can place the equation below the first A circle, for example, as follows:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{setspace}
\usepackage{outlines}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{adjustbox}
\usepackage{blindtext}
\usepackage[margin=0.8in]{geometry}
\usepackage{tikz}
\usetikzlibrary{positioning}
  \def\firstcircle{(90:1.75cm) circle (2.5cm)}
  \def\secondcircle{(210:1.75cm) circle (2.5cm)}
  \def\thirdcircle{(330:1.75cm) circle (2.5cm)}

\begin{document}

\begin{minipage}{\linewidth}
\begin{outline}\1[$\blacktriangleright$]\emph{\textbf{a Title}}:
\1[] \blindtext:
%
\begin{center}
\begin{adjustbox}{width=5cm}
 \begin{tikzpicture}
    \begin{scope}
        \clip \secondcircle;
        \thirdcircle;
    \end{scope}
    \begin{scope}
        \clip \firstcircle;
        \thirdcircle;
    \end{scope}
        \draw \firstcircle node(A)[text=black,above] {$A$};
        \draw \secondcircle node [text=black,below left] {$B$};
        \draw \thirdcircle node [text=black,below right] {$C$};
   \node [below=of A] {$ A \cup (B\cap C) = (A\cup B) \cap (A\cup C) $};
\end{tikzpicture}
\end{adjustbox}
\begin{adjustbox}{width=5cm}
 \begin{tikzpicture}
    \begin{scope}
        \clip \secondcircle;
        \thirdcircle;
    \end{scope}
    \begin{scope}
        \clip \firstcircle;
        \thirdcircle;
    \end{scope}
        \draw \firstcircle node[text=black,above] {$A$};
        \draw \secondcircle node [text=black,below left] {$B$};
        \draw \thirdcircle node [text=black,below right] {$C$};
\end{tikzpicture}
\end{adjustbox}
\begin{adjustbox}{width=5cm}
 \begin{tikzpicture}
    \begin{scope}
        \clip \secondcircle;
        \thirdcircle;
    \end{scope}
    \begin{scope}
        \clip \firstcircle;
        \thirdcircle;
    \end{scope}
        \draw \firstcircle node[text=black,above] {$A$};
        \draw \secondcircle node [text=black,below left] {$B$};
        \draw \thirdcircle node [text=black,below right] {$C$};
 \end{tikzpicture}
\end{adjustbox}
\end{center}
\end{outline}
\end{minipage}

\end{document}

enter image description here

  • Ok. I hadn't thought of looking into doing it within tikz, and I didn't know it was so expressive. Cool. Thanks – cladelpino May 30 '17 at 23:39
  • For anyone looking, note: \usetikzlibrary{positioning} – cladelpino May 30 '17 at 23:44
  • And what about positioning it relative to the circle ? I'm finding it hard to do – cladelpino May 31 '17 at 0:08
  • Easiest is to specify the dimension in below=<dimension> of A also above, left, right or a combination of these, below right, below left, above right, etc... – AboAmmar May 31 '17 at 0:37
1

Simple solution:

\begin{adjustbox}{width=5cm}
 \begin{tikzpicture}
        \node at (90:3) {$ A \cup (B\cap C) = (A\cup B) \cap (A\cup C) $};
        \node[draw,circle,minimum size=3cm,inner sep=0pt] (c1) at (90:1) {};
        \node at (110:2) {$A$};
        \node[draw,circle,minimum size=3cm,inner sep=0pt] (c2) at (210:1) {};
        \node at (210:2) {$B$};
        \node[draw,circle,minimum size=3cm,inner sep=0pt] (c3) at (330:1) {};
        \node at (330:2) {$C$};
\end{tikzpicture}
\end{adjustbox}
  • Inspired by @AboAmmar to dig deeper in tikz – cladelpino May 31 '17 at 2:23
  • Also \node[above] (current bounding box.north) {...}; – John Kormylo May 31 '17 at 3:33
  • ah... I didn't see that syntax in the manual. thks – cladelpino May 31 '17 at 3:51
  • see tex.stackexchange.com/questions/372229/…, maybe can help. And don't resize images and equations, better is scale tikz images or even better redraw it to desired size. – Zarko May 31 '17 at 5:00
  • you mean using subfloats or minipages as in the example provided ? Why is that better than adjustbox ? thanks! – cladelpino May 31 '17 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.