Menu

#487 curveto decoration and raise option

v1.0 (example)
open
nobody
None
5
2018-05-31
2018-05-31
Symbol 1
No

It is reported here
https://tex.stackexchange.com/questions/434176/decoration-with-raise-option-on-a-cycle-path-engenders-bad-result/
that decoration={curveto,raise=-10pt} does not work well.

The problem seems to be that in the definition

\pgfdeclaredecoration{curveto}{initial}{
  \state{initial}[width=\pgfdecoratedinputsegmentlength/100]
  {
    \pgfpathlineto{\pgfpointorigin}
  }
  \state{final}{\pgfpathlineto{\pgfpointdecoratedpathlast}}
}

it starts with a lineto while the last moveto is the unraised origin;
besides \pgfpointdecoratedpathlast does not seems to be the correct point.

In that SX post I proposed an answer that is equivalent to

\pgfdeclaredecoration{curveto}{safeinit}{
  \state{safeinit}[next state=iterate,width=1pt]
  {
    \pgfpathmoveto{\pgfpointorigin}
  }
  \state{iterate}[width=\pgfdecoratedinputsegmentlength/100]
  {
    \pgfpathlineto{\pgfpointorigin}
  }
  \state{final}{\pgfpathclose}
}

but obviously \pgfpathclose does not work for paths that are not closed.

Discussion

Monday.com Logo