According to the v2.10 manual, section 30.6, each letter of the text is typeset in its own \hbox
. I take this to mean that TikZ parses the text = {...}
token-by-token, so if you wrote Plan m\'eridien
, it would take \'
to be its own character; since it is just an accent command, that causes an error. Writing Plan m{\'e}ridien
works.
Edit: As Altermundus says, the braces cause the accented letter {\'e}
to be treated as a single token, which is very often the case in TeX.
First Version
Here is a possible solution via a markings
decoration (the gray clouds are on a line and the orange clouds are on a circle):
\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{decorations.markings,shapes,calc}
\tikzset{
random clouds/.style={
decoration={markings,mark=between positions 0 and 1 step 5mm with {
\pgfmathsetmacro\myh{5mm+ rnd*1cm}
\pgfmathsetmacro\myw{\myh + 5mm + rnd*1cm}
\node[shape=cloud, cloud puffs={10+int(5*rnd)}, fill=#1, opacity=0.4,
minimum width=\myw,minimum height=\myh]
at (rand * 1cm,rand * 1cm) {};
}},
},
}
\begin{document}
\begin{tikzpicture}
\path[decorate,random clouds=gray]
(0,0) -- (10,10);
\path[decorate,random clouds=red]
(5,5) circle (3cm);
\end{tikzpicture}
\end{document}
Second Version (with fade out fading)
\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{decorations.markings,shapes,calc}
\tikzset{
random clouds/.style={
decoration={markings,mark=between positions 0 and 1 step 5mm with {
\pgfmathsetmacro\myh{15mm + rnd*1cm}
\pgfmathsetmacro\myw{\myh + 5mm + rnd*1cm}
\pgfkeysgetvalue{/pgf/decoration/mark info/distance from start}{\currdist}
\pgfmathsetmacro\myop{1-\currdist/\pgfdecoratedpathlength}
\node[shape=cloud, cloud puffs={10+int(5*rnd)}, fill=#1, opacity=\myop,
minimum width=\myw,minimum height=\myh]
at (rand * 1cm,rand * 1cm) {};
}},
},
}
\begin{document}
\begin{tikzpicture}
\path[decorate,random clouds=orange]
(0,0) -- (10,10);
\end{tikzpicture}
\end{document}
Third Version (with keys to control size and color)
In this version, clouds sizes are not random.
\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{decorations.markings,shapes,calc}
\makeatletter
\tikzset{
random clouds/.is family,
random clouds,
color/.store in=\randomclouds@c,
start width/.store in=\randomclouds@startw,
start height/.store in=\randomclouds@starth,
end width/.store in=\randomclouds@endw,
end height/.store in=\randomclouds@endh,
color=gray,
start width=22mm,start height=12mm,
end width=14mm,end height=8mm
}
\tikzset{
random clouds decoration/.style={
decoration={markings,mark=between positions 0 and 1 step 5mm with {
\tikzset{random clouds,#1}
\pgfkeysgetvalue{/pgf/decoration/mark info/distance from start}{\currdist}
\pgfmathsetmacro\myop{1-\currdist/\pgfdecoratedpathlength}
\pgfmathsetmacro\myw{\randomclouds@endw+\myop*(\randomclouds@startw-\randomclouds@endw)}
\pgfmathsetmacro\myh{\randomclouds@endh+\myop*(\randomclouds@starth-\randomclouds@endh)}
\node[shape=cloud, cloud puffs={10+int(5*rnd)},fill=\randomclouds@c, opacity=\myop,
minimum width=\myw,minimum height=\myh]
at (rand * 1cm,rand * 1cm) {};
}},
},
}
\makeatother
\pgfmathsetseed{\pdfuniformdeviate 1000000}
\begin{document}
\begin{tikzpicture}
\path[decorate,random clouds decoration]
(0,0) -- (10,10);
\path[decorate,random clouds decoration={
color=orange,
start width=12mm,end width=5mm,
start height=22mm,end height=10mm,
}]
(5,0) -- (15,10);
\end{tikzpicture}
\end{document}
Best Answer
See section 50.7 “Text Decorations” of the TikZ/PGF manual, where it is explained that the default
text format delimiters
are pipes (|
). There are also some examples in this section that nicely show how to style text along path.In your case, you can use
text={|\tiny|\p}
, like in the following example: