2

This question already has an answer here:

How put halo around text using the contour package as suggested in this answer in many nodes by defining a style?

MWE:

\documentclass[tikz]{standalone}

\usepackage[outline]{contour} %halo around text
%https://tex.stackexchange.com/questions/18472/tikz-halo-around-text
\contourlength{1.2pt}

\usetikzlibrary{patterns}

\begin{document}

    \begin{tikzpicture}[halo text node/.style={circle, draw, pattern=north east lines}]

    \node [halo text node] {\contour{white}A};

    \end{tikzpicture}

\end{document}

Result:

MWE result

What I want is to include an option for the tikzpicture in a form similar to halo text node/.style{...,text=\contour{white}} instead of using \contour{white}{...} inside every node.

marked as duplicate by user121799 Feb 27 at 20:54

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

This do not answer your question (because I don't know how to apply \contour to the node content) but gives you an alternative approach to define contour text style that takes the node content as parameter.

\documentclass[tikz]{standalone}
\usetikzlibrary{patterns}
\usepackage[outline]{contour}
\contourlength{1.2pt}
\tikzset{
  contour text/.style={node contents={\contour{white}{#1}}},
  halo text node/.style={circle, draw, pattern=north east lines}
}
\begin{document}
  \tikz\node[halo text node, contour text=ABC];
\end{document}

enter image description here

Notes:

  • This do not work with XeLaTeX for me.
  • Another possibility is to not use contour package but pdfrender, or to redefine the action of contour in pure TikZ (move the text multiple times around with different color before to print it).

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