7

Problem:

I wish to remove the intersecting line for circle A (left).

Minimal Working Example (MWE):

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{backgrounds,positioning}
\usepackage{venndiagram}
\usepackage{float}
\usepackage{showframe}

\begin{document}

\begin{figure}[H]
    \centering
    \begin{minipage}[t]{0.45\textwidth}
        \begin{venndiagram2sets}[radius=1.3cm,labelA=,labelB=]
            \fillOnlyA
            \setpostvennhook
            {
                \draw (labelA) node[below=6ex] {A\textbackslash B};
                \draw (labelB) node[below=6ex] {B};
            }
        \end{venndiagram2sets}
        \caption{$\mathbf{A}$\textbackslash$\mathbf{B}$}
        \label{fig:venncup}
    \end{minipage}
\end{figure}

\end{document}

Current output:

enter image description here

Desired output:

To remove the right line for the left circle - alternatively fill circle B (right) with white color to cover the line.

enter image description here

5
  • Hi. Are you open in "just tikz" solutioons? I think you will find much easier an answer and it will be simple
    – koleygr
    Jul 14 '19 at 14:48
  • 1
    @koleygr Yes I am
    – kexxcream
    Jul 14 '19 at 14:48
  • Perhaps you could add a white arc to circle A?
    – Bernard
    Jul 14 '19 at 15:02
  • @Bernard How would I do that using the venndiagram package?
    – kexxcream
    Jul 14 '19 at 15:03
  • You'd probably have to insert some pure TikZ code.
    – Bernard
    Jul 14 '19 at 15:19
10

The venndiagram package is very well written and hence easy to customize. I added a style interior B (and also interior A) that can be used as follows:

\fill[white,interior B];

This fills the right circle white. One could add several other similar styles, if needed.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{backgrounds,positioning}
\usepackage{venndiagram}
\usepackage{float}
\usepackage{showframe}
\makeatletter
\tikzset{interior A/.style={insert path={
 (\@venn@Ax,\@venn@Ay) circle[radius=\@venn@radius-\pgflinewidth/2]}},
 interior B/.style={insert path={
 (\@venn@Bx,\@venn@By) circle[radius=\@venn@radius-\pgflinewidth/2]}}}
\makeatother
\begin{document}

\begin{figure}[H]
    \centering
    \begin{minipage}[t]{0.45\textwidth}
        \begin{venndiagram2sets}[radius=1.3cm,labelA=,labelB=]
            \fillOnlyA
            \setpostvennhook
            {
                \fill[white,interior B];
                \draw (labelA) node[below=6ex] {A\textbackslash B};
                \draw (labelB) node[below=6ex] {B};
            }
        \end{venndiagram2sets}
        \caption{$\mathbf{A}$\textbackslash$\mathbf{B}$}
        \label{fig:venncup}
    \end{minipage}
\end{figure}

\end{document}

enter image description here

1
  • in my opinion, customizing the "venndiagram" package is boring! at least "plain" TikZ is much easier to customizing
    – Black Mild
    Jul 15 '19 at 16:25
8

A solution with "plain tikz":

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{backgrounds,positioning}
\usepackage{float}
\usepackage{showframe}

\begin{document}

\begin{figure}[H]
    \centering
    \begin{minipage}[t]{0.45\textwidth}
        \begin{tikzpicture}[scale=0.6]
                \draw (-4,-3)rectangle (6,3);
                \fill[gray,draw=black] (0,0)  circle (2cm); 
                \node at (0,0){A\textbackslash B};
                \fill[white,draw=black] (3cm,0) circle  (2cm);
                \node at (3cm,0) {B};
        \end{tikzpicture}
        \caption{$\mathbf{A}$\textbackslash$\mathbf{B}$}
        \label{fig:venncup}
    \end{minipage}
\end{figure}

\end{document}

enter image description here

2
  • 1
    a bit simpler \begin{tikzpicture} \draw[fill=gray!50] (0,0) circle(1) node{$A{\setminus}B$}; \draw[fill=white] (1.5,0) circle(1) node{$B$}; \end{tikzpicture}
    – Black Mild
    Jul 15 '19 at 16:19
  • @BlackMild Yes ... it is ... You just lost the rectangle. use the latex open quote of your keyboard to place (inline) code in your comments and answers like: test (inside "LaTeX opening quotes")
    – koleygr
    Jul 15 '19 at 20:30

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.