![如何弯曲文本以使其遵循维恩图的曲线](https://linux22.com/image/391901/%E5%A6%82%E4%BD%95%E5%BC%AF%E6%9B%B2%E6%96%87%E6%9C%AC%E4%BB%A5%E4%BD%BF%E5%85%B6%E9%81%B5%E5%BE%AA%E7%BB%B4%E6%81%A9%E5%9B%BE%E7%9A%84%E6%9B%B2%E7%BA%BF.png)
我需要让“A 类”、“B 类”、“C 类”沿着紧邻它们的圆的曲线行进:
\documentclass{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{tikzpicture}[scale=0.85]
\foreach \X [count=\Y starting from 2] in {\textit{A},\textit{B},\textit{C}}
{\draw (-\Y,-\Y/2) circle ({1.5*\Y} and \Y);
\node at (1-2*\Y,-1.1*\Y) {$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ classes \X}; }
\draw ([xshift=-0.5cm,yshift=-0.5cm]current bounding box.south west)
rectangle ([xshift=0.5cm,yshift=0.5cm]current bounding box.north east);
\node[anchor=south] at (current bounding box.north) {\textbf{Three classes}};
\end{tikzpicture}
\end{document}
答案1
像这样吗?
\documentclass{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{tikzpicture}[scale=0.85]
\foreach \X [count=\Y starting from 2] in
{A,B,C}
{\draw (-\Y,-\Y/2) circle ({1.5*\Y} and \Y);
\path[decoration={text along path,
text={classes |\itshape|\X},text align=center,raise=0.2em},decorate] (-\Y,-\Y/2) +(-1.5*\Y,0) arc(180:360:{1.5*\Y} and \Y);
}
\draw ([xshift=-0.5cm,yshift=-0.5cm]current bounding box.south west)
rectangle ([xshift=0.5cm,yshift=0.5cm]current bounding box.north east);
\node[anchor=south] at (current bounding box.north) {\textbf{Three classes}};
\end{tikzpicture}
\end{document}`