
En uno de mis gráficos de Tikz, he creado un círculo simple lleno de rojo:
\addplot [mark=*, mark size=3, mark options={solid, fill=red}] coordinates {
(1.25, 0) };
Ahora me gustaría hacer referencia a ese círculo en el texto, así que me preguntaba si es posible crear un comando que, cuando esté alineado con el texto, reproduzca el mismo círculo.
EDITAR
La posible solución casi funciona en el título de la figura:
Respuesta1
El círculo también se puede dibujar en TikZ; plot
también acepta mark
opciones:
\documentclass{article}
\usepackage{tikz}
\newcommand*{\RedCircle}{}
\DeclareRobustCommand*{\RedCircle}{%
\tikz\path plot[
mark=*,
mark size=3,
mark options={solid, fill=red},
] coordinates {(0, 0)};%
}
\begin{document}
Circle: \RedCircle
\end{document}
Centrado vertical alrededor del eje matemático
El símbolo centrado encaja mejor entre paréntesis.
\documentclass{article}
\usepackage{tikz}
\newcommand*{\RedCircle}{}
\DeclareRobustCommand*{\RedCircle}{%
\ensuremath{\vcenter{\hbox{%
\tikz\path plot[
mark=*,
mark size=3,
mark options={solid, fill=red},
] coordinates {(0, 0)};%
}}}%
}
\begin{document}
Circle (\RedCircle)
\end{document}
Corrección del cuadro delimitador
TikZ parece olvidarse de tener en cuenta el ancho de línea de la marca para el cuadro delimitador. El siguiente código agrega un pequeño marco para compensar esto:
\documentclass{article}
\usepackage{tikz}
\newcommand*{\RedCircle}{}
\DeclareRobustCommand*{\RedCircle}{%
\ensuremath{\vcenter{\hbox{%
\setlength{\fboxsep}{.21pt}%
% 0.2pt (half line width)
% + 0.01pt to get some rounding tolerance
\setlength{\fboxrule}{0pt}%
\fbox{%
\tikz\path plot[
mark=*,
mark size=3,
mark options={solid, fill=red, draw=black},
] coordinates {(0, 0)};%
}%
}}}%
}
\begin{document}
% Show bounding box:
\setlength{\fboxsep}{0pt}
\setlength{\fboxrule}{.1pt}
(\textcolor{cyan}{\fbox{\RedCircle}})
\end{document}
Agregando el margen dentro de TikZ (tal vez, la imagen se recorta al externalizar):
\documentclass{article}
\usepackage{tikz}
\newcommand*{\RedCircle}{}
\DeclareRobustCommand*{\RedCircle}{%
\ensuremath{\vcenter{\hbox{%
\def\BoundingBoxCorrection{.55\pgflinewidth}%
% .5\pgflinewidth: half the line width, forgotten by TikZ
% .05\pgflinewidth: some tolerance for rounding errors
\tikz\path plot[
mark=*,
mark size=3,
mark options={solid, fill=red, draw=black},
] coordinates {(0, 0)}
(current bounding box.south west)
++(-\BoundingBoxCorrection, -\BoundingBoxCorrection)
(current bounding box.north east)
++(\BoundingBoxCorrection, \BoundingBoxCorrection)
;%
}}}%
}
\begin{document}
% Show bounding box:
\setlength{\fboxsep}{0pt}
\setlength{\fboxrule}{.1pt}
(\textcolor{cyan}{\fbox{\RedCircle}})
\end{document}