![如何在 latex 中标记椭圆?为什么我的椭圆的标签没有出现?](https://linux22.com/image/445924/%E5%A6%82%E4%BD%95%E5%9C%A8%20latex%20%E4%B8%AD%E6%A0%87%E8%AE%B0%E6%A4%AD%E5%9C%86%EF%BC%9F%E4%B8%BA%E4%BB%80%E4%B9%88%E6%88%91%E7%9A%84%E6%A4%AD%E5%9C%86%E7%9A%84%E6%A0%87%E7%AD%BE%E6%B2%A1%E6%9C%89%E5%87%BA%E7%8E%B0%EF%BC%9F.png)
我需要在椭圆底部标记每个椭圆。椭圆显示为红色,但标签未显示。我的代码如下图所示
\documentclass[12pt,a4paper,onecolumn]{article}
\usepackage{tikz}
\usetikzlibrary{shapes,backgrounds}% for drawing ellipse
\usepackage{caption}
\usepackage{color}
\usetikzlibrary{positioning,fit,calc}
\begin{document}
\noindent\makebox[\textwidth]{%
\tikzstyle{every node}=[circle, draw, fill=black!100,
inner sep=0pt, minimum width=5pt]%%%I need to keep this line to draw vertices in my diagram
\begin{tikzpicture}[thick,scale=0.8]%
\draw(-4.5,10)node[label={[yshift=-0.2cm, xshift=0cm]90:{$vertex 1$}}](v1){};
%3 ellipses
\draw (-9,6) ellipse (2cm and 7cm) node at (0,-5) {ELIPSE ONE};
\draw (-4.5,6) ellipse (2cm and 7cm);
\draw (0,6) ellipse (2cm and 7cm);
\end{tikzpicture}
}
{\captionof{figure}{FIGURE HOW TO LABEL ELLIPSE??}
\end{document}
最终代码:
\begin{tikzpicture}[
E/.style = {ellipse, fill=none, draw=#1,
minimum height=7cm, minimum width=2cm},
E/.default=black
]
\draw(-4.5,8)node[label={[yshift=-0.2cm, xshift=0cm]90:{$vertex 1$}}](v1){};
\node (e1) [E=red, label={[yshift=0.2cm, xshift=0cm]270:{ELLIPSE ONE}}] at (-9,6) {};
\node (e2) [E, label={[yshift=0.2cm, xshift=0cm]270:{ELLIPSE TWO}}] at (-4.5,6){};
\node (e3) [E] at (0,6) {};
\end{tikzpicture}```
答案1
\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,
shapes.geometric}
\begin{document}
\begin{tikzpicture}[
node distance = 5mm,
E/.style = {ellipse, draw=#1,
minimum height=7cm, minimum width=2cm},
E/.default=black
]
\node (e1) [E=red,
label=below: ELIPSE ONE] {};
\node (e2) [E,right=of e1,
label=below: ELIPSE TWO] {};
\node (e3) [E, right=of e2] {};
\end{tikzpicture}
\end{document}
您可能喜欢标签使用较小的字体。在这种情况下,添加到tikzpicture
选项:
every label/.append style = {font=<desired font size>}