# How to label sets in Venn diagram using venndiagram package

How do I have the labels (A and B) outside the circles? I would like a solution that uses the venndiagram package.

Code:

\documentclass{article}
\usepackage{venndiagram}
\begin{document}
\fillOnlyA
\end{venndiagram2sets}
\end{document}


Solution 1.:

(Modified after the comment of @CarLaTeX)

\documentclass{article}
\usepackage{venndiagram}
\begin{document}
\fillOnlyA
\setpostvennhook
{
\draw (labelA) node[above=2pt] {A};
\draw (labelB) node[above=2pt] {B};
}
\end{venndiagram2sets}
\end{document}


Solution 2.:

You could use tikzlibrary calc, and with its help, it's easy to put the labels on certain coordinates.

(I used @Jake's answer for TikZ: Node at same x-coordinate as another node, but specified y-coordinate?)

\documentclass{article}
\usepackage{tikz}
\usepackage{venndiagram}
\usetikzlibrary{calc}
\begin{document}
\fillOnlyA
\setpostvennhook
{
\path let \p1 = (labelA) in node at (\x1,3.2) {A};
\path let \p2 = (labelB) in node at (\x2,0.2) {B};
}
\end{venndiagram2sets}
\end{document}


• Thanks for both solutions. This is just what I was looking for! Jan 13, 2018 at 15:59
• In solution 1 you could put above=2pt to shift the node a bit up, without usingcalc. Jan 13, 2018 at 20:56
• You do not need calc for the second scenario: \path node at (labelA|-0,3.2) {A}; \path node at (labelB|-0,0.2) {B};
– user121799
May 7, 2019 at 23:53