![如何去掉图片中的部分轮廓?](https://linux22.com/image/334451/%E5%A6%82%E4%BD%95%E5%8E%BB%E6%8E%89%E5%9B%BE%E7%89%87%E4%B8%AD%E7%9A%84%E9%83%A8%E5%88%86%E8%BD%AE%E5%BB%93%EF%BC%9F.png)
\documentclass[addpoints,12pt]{exam}
\usepackage[latin1]{inputenc}
\usepackage[portuguese,brazil]{babel}
\usepackage{mathptmx}
\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage[a4paper,bottom=2cm]{geometry}
\usepackage{multicol}
\usepackage{textcomp}
\usepackage{tikz}
\begin{center}
\begin{tikzpicture}
\draw (0,0) circle [radius=1];
\draw (0.5,0.5) circle [radius=1];
\draw (0.5,-0.5) circle [radius=1];
\draw (-0.5,0.5) circle [radius=1];
\draw (-0.5,-0.5) circle [radius=1];
\end{tikzpicture}
\end{center}
\end{document}
答案1
也可以通过裁剪来解决这个问题。这样可以避免圆圈的背景被白色填充。
通过使用 将圆与整个绘图区域组合,可以从剪切路径中排除圆的区域even odd rule
。圆区域被覆盖两次,因此被排除(均匀)。需要对与要绘制的圆重叠的每个圆重复此操作。
示例文件:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[radius=1, even odd rule]
\path
% Define center points of the circles
( .5, .5) coordinate (Z)
( .5, -.5) coordinate (V)
(-.5, -.5) coordinate (W)
(-.5, .5) coordinate (Y)
( 0, 0) coordinate (X)
% Simulated drawing of the circles to get the bounding box
\foreach \M in {V, ..., Z} {(\M) circle[]}
% The bounding box needs to be increased by half of the line width.
% Also a small amount is additionally added to avoid cutting
% the curves because of rounding issues.
(current bounding box.south west) ++(-.5\pgflinewidth, -.5\pgflinewidth)
++(-.1pt, -1.pt)
(current bounding box.north east) ++(.5\pgflinewidth, .5\pgflinewidth)
++(.1pt, .1pt)
% Shorter names
(current bounding box.south west) coordinate (ll)
(current bounding box.north east) coordinate (ur)
;
% Circle Z
\begin{scope}
\foreach \M in {V, X, Y} {% W is already covered by V, X, Y
\clip (ll) rectangle (ur) (\M) circle[];
}
\draw (Z) circle[];
\end{scope}
% Circle V
\begin{scope}
\foreach \M in {W, X} {% Y is covered
\clip (ll) rectangle (ur) (\M) circle[];
}
\draw (V) circle[];
\end{scope}
% Circle W
\begin{scope}
\foreach \M in {X, Y} {%
\clip (ll) rectangle (ur) (\M) circle[];
}
\draw (W) circle[];
\end{scope}
% Circle Y
\begin{scope}
\clip (ll) rectangle (ur) (X) circle[];
\draw (Y) circle[];
\end{scope}
% Circle X
\draw (X) circle[];
% Annotations
\node at ( 0, 0) {$X$};
\node at ( .9, .9) {$Z$};
\node at (-.9, .9) {$Y$};
\node at (-.9,-.9) {$W$};
\node at ( .9,-.9) {$V$};
\end{tikzpicture}
\end{document}
答案2
使用选项fill=white
,您可以在之前绘制的线条上方绘制填充的白色圆盘。请注意圆盘的顺序发生了变化,以及代码已清理。
\documentclass[]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[fill=white] (0.5,0.5) circle [radius=1];
\draw[fill=white] (0.5,-0.5) circle [radius=1];
\draw[fill=white] (-0.5,-0.5) circle [radius=1];
\draw[fill=white] (-0.5,0.5) circle [radius=1];
\draw[fill=white] (0,0) circle [radius=1];
\node at (0,0) {X};
\node at (0.875,0.875) {Z};
\node at (-0.875,0.875) {Y};
\node at (-0.875,-0.875) {W};
\node at (0.875,-0.875) {V};
\end{tikzpicture}
\end{document}