In the x-post, the best practice of this requirement is documented in the manual.
TL;DR
dash expand off
is all what I need.
Makes theoff
part of a dash pattern expandable such that it can stretch. This only works when there is a singleon
and a singleoff
field and requires thedecorations
library. Right now this option has to be specified on the path where it is supposed to take effect after the dash pattern option because thedash pattern
has to be known at the point where it is applied.
Code & Result Comparsion:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{ext.shapes.superellipse}
\begin{document}
\begin{tikzpicture} [
densely dashed,
% dash expand off,
every node/.append style={
draw=blue,
fill=yellow,
thick,
inner sep=2pt,
font=\LARGE,
},
]
\node [circle] {1};
\node [ellipse] at (1,0) {2};
\node [ext_superellipse,font=\tiny] at (2.25,0) {233333};
\end{tikzpicture}
\begin{tikzpicture} [
densely dashed,
dash expand off,
every node/.append style={
draw=violet,
fill=magenta,
thick,
inner sep=2pt,
font=\LARGE,
},
]
\node [circle] {1};
\node [ellipse] at (1,0) {2};
\node [ext_superellipse,font=\tiny] at (2.25,0) {233333};
\end{tikzpicture}
\end{document}
This can handle all the case by stretch the "off" part at the end, regardless of the node
's content or the shape. IMHO, it's the best practice of this case.
问 在对node的圆周使用dashed装饰时,前后的「虚线」重合如何处理?