4

I created a newcommand like this: \newcommand{\txtDBC}[1]{\contour{white}{#1}} and I want to apply it on all text and math formula in a tikzpicture.

The first was to declare a specific font using font keyword:

\begin{tikzpicture}[font=\small]
...
\end{tikzpicture}

But my \txtDBC command need one parameter. How can I rewrite it for using it as the \small command? Maybe another solution can be used.

MWE:

\documentclass[]{standalone}

\usepackage{esvect,tikz}
\usepackage[outline]{contour}
\newcommand{\vecteur}[1]{\protect\vv{#1}}
\newcommand{\txtDBC}[1]{\contour{white}{#1}}

\begin{document}
\begin{tikzpicture}
\node[fill=blue]{\txtDBC{$\vecteur{aa}$}};
\end{tikzpicture}
\end{document}

Result: aa

Expected syntax:

...
\begin{document}
\begin{tikzpicture}[font=\txtDBC]
\node[blue]{$\vecteur{aa}$};
\end{tikzpicture}
\end{document}
Guuk
  • 1,495
  • @cfr I update my post – Guuk Feb 26 '15 at 15:04
  • For [font=\small] \small will appear in several macros, sometimes in front of \tiks@text@action, sometimes in front of \else, so adding an argument won't work. If I could find a macro that takes the text for a node as an argument (\pgftext is not it), I could replace it. – John Kormylo Feb 26 '15 at 20:05
  • Maybe I can rewrite the command and create a command that takes no argument. But I don't know how I can do this.... – Guuk Feb 27 '15 at 18:40
  • @JohnKormylo do you mean \pgfnodeparttextbox? otherwise I am afraid there is no such macro because \tikz\node{\verb|%|}; compiles. – Symbol 1 Mar 01 '15 at 17:17
  • A tip for your: http://tex.stackexchange.com/questions/88517/how-can-execute-at-begin-node-be-used-with-special-characters-like-curly-brace – Malipivo Mar 21 '15 at 14:17
  • This is my try with \pdfliteral which is not drawing contours of a box and therefore catching a content of a node is useless: https://www.overleaf.com/read/zcbnnkbgnhsz. It might help. – Malipivo Mar 21 '15 at 14:42

0 Answers0