![路径、圆形框架和不必要的间隙](https://linux22.com/image/422141/%E8%B7%AF%E5%BE%84%E3%80%81%E5%9C%86%E5%BD%A2%E6%A1%86%E6%9E%B6%E5%92%8C%E4%B8%8D%E5%BF%85%E8%A6%81%E7%9A%84%E9%97%B4%E9%9A%99.png)
下面的代码生成了以下图表,其中节点框架和圆圈周围的框架之间的路径不是好的路径。有两个不必要的间隙。我该如何解决这个问题?
% Source
% * https://tex.stackexchange.com/questions/101839/how-to-draw-a-venn-diagram-in-tikz
\documentclass[a4paper, 12pt]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{positioning,fit,calc}
\begin{document}
\begin{tikzpicture}
\node(secondcircle)
[circle, text width = 3cm,
draw, ultra thick] {};
\node(firstcircle)
[circle, text width = 3cm,
left = -1cm of secondcircle,
draw = orange, ultra thick] {};
\node(box)
[fit = (firstcircle)(secondcircle),
inner sep = 1cm,
draw, ultra thick, rounded corners] {};
\node(universe) at (box.north east)
[anchor = south west, xshift = 0.25cm, yshift = 0.25cm,
draw, ultra thick, rounded corners] {$\Omega$};
\path[draw, ultra thick]
(box.north east) -- (universe.south west);
\end{tikzpicture}
\end{document}
答案1
一个非通用的可能解决方案是使用 使线的两端更长shorten
。你只需要让线在曲线内结束。red
从以下选项中删除:
\documentclass[a4paper, 12pt]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{positioning,fit,calc}
\begin{document}
\begin{tikzpicture}
\node(secondcircle)
[circle, text width = 3cm,
draw, ultra thick] {};
\node(firstcircle)
[circle, text width = 3cm,
left = -1cm of secondcircle,
draw = orange, ultra thick] {};
\node(box)
[fit = (firstcircle)(secondcircle),
inner sep = 1cm,
draw, ultra thick, rounded corners] {};
\node(universe) at (box.north east)
[anchor = south west, xshift = 0.25cm, yshift = 0.25cm,
draw, ultra thick, rounded corners] {$\Omega$};
\path[draw, red, ultra thick,shorten <=-0.1cm, shorten >=-0.1cm]
(box.north east) -- (universe.south west);
\end{tikzpicture}
\end{document}