2

I asked myself for the sake of interest: Is there possibly a possibility to add a mark=<...> to a \coordinate?

\documentclass[margin=3cm]{standalone}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}
\coordinate[label={[mark=*, text=red,left]:A}] (A) at (0,2);
\end{tikzpicture}

\end{document}

Note: The method

\foreach \P in {....} \draw[fill=white] (\P) circle (1.5pt);

is clear.

  • 1
    \coordinate[label={[text=red,left]:\pgfuseplotmark{*}A}] (A) at (0,2);? Or \coordinate[label={[text=red,left]:A},label={[anchor=center,blue]:\pgfuseplotmark{*}}] (A) at (0,2);? Please make your question clearer. – Schrödinger's cat Aug 21 '19 at 20:31
  • @Schrödinger'scat Ah, second methode could work. – cis Aug 21 '19 at 20:36
  • 2
    Well, if course you can define a style like \begin{tikzpicture}[cmark/.style={label={[anchor=center]:\pgfuseplotmark{#1}}}] \coordinate[cmark=*,label={[text=red,left]:A}] (A) at (0,2); \end{tikzpicture}. – Schrödinger's cat Aug 21 '19 at 21:01
  • Nice! The question should be rephrased “Is it possible to mimic MetaPost's dotlablel macro with TikZ?”. ;-) – frougon Aug 21 '19 at 21:11
  • 1
    @frougon The question is how much sense this makes as opposed to just using a node (like node[circle,fill,inner sep=1.5pt]). The latter has all the node anchors, i.e. if you connect it with an arrow, it looks good, but the plot mark stuff doesn't. – Schrödinger's cat Aug 21 '19 at 21:21
4

For what it is worth. This adds a plot mark and respects mark options.

\documentclass[margin=3cm]{standalone}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}[cmark/.style={append after command={plot[only marks,mark=#1] coordinates {(\tikzlastnode)}}}]
\coordinate[label={[text=red,left]:A},cmark={*,mark options={fill=white}}] 
(A) at (0,2);
\path (2,2) node[circle,inner sep=1.5pt,draw,label={[text=red,left]:B}] (B){} ;
\draw[stealth-stealth] (A) to[out=90,in=90] (B);
\end{tikzpicture}
\end{document}

enter image description here

Note, however, that I do not see any advantage compared to option B in which a node is used. Rather, I see a disadvantage since, if you connect either of them with an arrow, only the node knows the boundary, as illustrated. (Of course, in the node case you can connect to the center, too, by using B.center instead of B in the arc path.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.