区间的并集与交集

区间的并集与交集

我想使用 tikz 或 pstricks 制作下面的图片。我知道如何使用 pstricks 绘制间隔,但不幸的是我无法像图片中那样绘制交点和并点在此处输入图片描述 在此处输入图片描述

答案1

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{arrows.meta,decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}
 \draw[stealth-stealth] (-6,0) node[below]{$-\infty$} -- (6,0) node[below]{$\infty$};
 \draw foreach \X in {-4,-3,...,4} {(\X,.1) -- (\X,-.1) node[below=0.2em]{$\X$}};
 \draw[very thick,red] (0,0.06) -- (4,0.06);
 \draw[very thick,red,{Bracket[width=1.2em]}-{Bracket[width=1.2em]}] (0,0) -- (4,0) node[pos=3/4,above]{$J$};
 \draw[very thick,blue,{Bracket[reversed,width=1.2em]}-{Bracket[width=1.2em]}] (-3.05,0) -- (2,0) node[pos=1/5,above]{$I$};
 \draw[decorate,decoration=brace] (-3,0.5) -- (4,0.5) node[midway,above=0.1em]{$I\cup J$};
\end{tikzpicture}
\begin{tikzpicture}
 \draw[stealth-stealth] (-6,0) node[below]{$-\infty$} -- (6,0) node[below]{$\infty$};
 \draw foreach \X in {-4,-3,...,4} {(\X,.1) -- (\X,-.1) node[below=0.2em]{$\X$}};
 \draw[very thick,red] (0,0.06) -- (4,0.06);
 \draw[very thick,red,{Bracket[width=1.2em]}-{Bracket[width=1.2em]}] (0,0) -- (4,0) node[pos=3/4,above]{$J$};
 \draw[very thick,blue,{Bracket[reversed,width=1.2em]}-{Bracket[width=1.2em]}] (-3.05,0) -- (2,0) node[pos=1/5,above]{$I$};
 \draw[decorate,decoration=brace] (0,0.5) -- (2,0.5) node[midway,above=0.1em]{$I\cap J$};
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容