2

I would like to place a mark on a highly complex path:

enter image description here

The mark should be at exactly 0.1 from beginning:

I try:

\documentclass[border=1cm]{standalone}

\usepackage{tikz}
\usetikzlibrary{decorations.markings}

\begin{document}
\begin{tikzpicture}

\coordinate (A) at (0,0);
\coordinate (B) at (1, 3);
\coordinate (C) at (2, -1);
\coordinate (D) at (3, 0.5);

\draw plot [smooth] coordinates { (A) (B) (C) (D) };
\path [
   postaction={decorate},
     decoration={
       markings,
       mark = at position {0.1\dimexpr\pgfdecoratedpathlength\relax} with {fill = red circle (0.5cm)}
  }
] plot [smooth] coordinates { (A) (B) (C) (D) };

\end{tikzpicture}
\end{document}

When I compile I get an error:

! Dimension too large.
<to be read again> 
                   \relax 

What is wrong?

1

If you just say 0.1, this is understood as 10% of the decorated path length. Also, \pgfdecoratedpathlength is not a length, just a macro. And you need to add normal TikZ commands like \draw, not just pgf keys.

\documentclass[border=1cm]{standalone}

\usepackage{tikz}
\usetikzlibrary{decorations.markings}

\begin{document}
\begin{tikzpicture}

\coordinate (A) at (0,0);
\coordinate (B) at (1, 3);
\coordinate (C) at (2, -1);
\coordinate (D) at (3, 0.5);

\draw plot [smooth] coordinates { (A) (B) (C) (D) };
\path [
   postaction={decorate},
     decoration={
       markings,
       mark = at position 0.1 with {\fill[red] circle[radius=0.5cm];}
  }
] plot [smooth] coordinates { (A) (B) (C) (D) };

\end{tikzpicture}
\end{document}

enter image description here

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.