如何在表格中创建此图像/tikz 图片?

如何在表格中创建此图像/tikz 图片?

在此处输入图片描述

最大的问题是最左边的最后两行

答案1

比桑迪的答案稍微冗长一些,但可能具有更少的硬连线维度并且更接近原始答案:

\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,fit}

% Borrowed from: https://tex.stackexchange.com/a/152098/36145
\newcommand\addvmargin{%
  \node[fit=(current bounding box),inner ysep=3pt,inner xsep=0pt] {};
}
% Borrowed from: https://tex.stackexchange.com/a/208616/36145
\xdef\baselinedim{\number\dimexpr\baselineskip\relax sp}
\newcommand\addbase{%
  \node (base) {\phantom{1}};
}

\begin{document}
\tikzset{every picture/.style={baseline=(base.base),very thick,x=\baselinedim,y=\baselinedim}}
\begin{tabular}{c|c|c}
  & \# cut points & \# non-cut points \\ \hline
  closed interval & $\infty$ & 2 \\ \hline
  open interval & $\infty$ & 0 \\ \hline
  half-open interval & $\infty$ & 1 \\ \hline
  circle \quad
\begin{tikzpicture}
  \draw[radius=0.5] circle;
  \addvmargin\addbase
\end{tikzpicture}
  & 0 & $\infty$ \\ \hline
\begin{tikzpicture}
  \draw[radius=0.5] circle ++(1, 0) circle;
  \addvmargin\addbase
\end{tikzpicture}
  & 1 & $\infty$ \\ \hline
\begin{tikzpicture}
  \draw[radius=0.5] circle ++(1, 0) circle ++(1, 0) circle;
  \addvmargin\addbase
\end{tikzpicture}
  & 2 & $\infty$ \\ \hline
\begin{tikzpicture}
  \draw[radius=0.5] circle ++(0.5, 0) -- ++(1, 0) ++(0.5, 0) circle;
  \addvmargin\addbase
\end{tikzpicture}
  & $\infty$ & $\infty$ \\ \hline
\begin{tikzpicture}[very thick,-{Circle[length=2.5pt]}]
  \draw (0, 0) -- +(0:1);
  \draw (0, 0) -- +(130:1);
  \draw (0, 0) -- +(-130:1);
  \addvmargin\addbase
\end{tikzpicture}
  & $\infty$ & 3
\end{tabular}
\end{document}

结果

答案2

你可以制作一张包含以下内容的表格tikzpictures

在此处输入图片描述

我制作了一个宏来绘制几个圆圈\circs[3]。半径由 全局控制\myrad,当前设置为1ex

以下是代码:

\documentclass{article}

\usepackage{tikz}

\newcommand{\myrad}{1ex}
\newcommand{\circs}[1][1]{\tikz[baseline=-.7ex]{\foreach \n in {1,...,#1}{\draw[thick](2*\myrad*\n,0) circle[radius=\myrad];}}}

\begin{document}

\begin{tabular}{c|c|c}
half-open interval & $\infty$ & 1\\
circle\quad\circs & 0 & $\infty$\\
\circs[2] & 1 & $\infty$\\
\circs[3] & 2 & $\infty$\\
\tikz[baseline=-.7ex]{\draw[thick](0,0)circle[radius=\myrad](\myrad,0)--(3*\myrad,0)(4*\myrad,0)circle[radius=\myrad];} & $\infty$ & $\infty$\\
\tikz[baseline=-.7ex]{\draw[thick, line cap=round](0:2*\myrad)--(0,0)--(120:2*\myrad)(0,0)--(240:2*\myrad);} & $\infty$ & 3
\end{tabular}

\end{document}

相关内容