Giter Club home page Giter Club logo

spath3's Introduction

spath3 TikZ library

This is a library for manipulating TikZ's soft paths. When TikZ reads a path construction, it first constructs a soft path before converting it into an actual path in the output document. A soft path contains the information needed to build the path in a TeX macro, whence it can be manipulated before it is baked.

This library provides ways of modifying these paths before they are baked.

It also provides some sub-packages which make use of this facility:

  1. knots for drawing knot diagrams, sorting out the crossings at intersections
  2. calligraphy which turns a path into one that might be drawn by a calligraphic pen
  3. spath3 which is a user-level interface to the core functionality

Installation

These libraries are on CTAN and are included in TeXLive and MikTeX. You should obtain them from one of those sources. If you know that you need the most up to date version from here, then download the file spath3_code.dtx and run tex spath3_code.dtx to generate the files.

Documentation

The simplest way to get the documentation is via texdoc or from CTAN. To generate it from source, run pdflatex on one of the _doc.tex files or on spath3.tex.

spath3's People

Contributors

loopspace avatar mbertucci47 avatar

Stargazers

Utensil avatar  avatar Lîm Tsú-thuàn avatar Zachary Talis avatar  avatar Florian Sihler avatar Apoorv Potnis avatar Santhosh Thottingal avatar Yiqi Xu avatar Desiment avatar  avatar  avatar Panteleimon Korolev avatar TJ Hitchman avatar EmD avatar Pantelis Koukousoulas avatar

Watchers

 avatar  avatar Apoorv Potnis avatar  avatar  avatar

spath3's Issues

Dimension too large error

I'm current using knots package v2.4 on texlive 2023. We compiling the following code

        \begin{tikzpicture}
		\begin{knot}[
			%draft mode=crossings,
			clip width=3,
		]
			\strand (0,0)  --(2,2);
			\strand (0.5,0)  --(2.5,2);
		\end{knot}
	\end{tikzpicture}

the compiler(pdflatex) reports a "Dimension too large." error.
However there's no error if we change (2.5,2) to (2.50001,2).

Another bug in the new version

The command `strand' below used to work, but not anymore:

\usetikzlibrary{positioning, decorations, arrows.meta, calc,shapes, math}
\begin{tikzpicture}
 \draw[decoration={markings, mark=at position 0.2 with {\draw[black, fill=black] circle[radius=2pt];}},postaction={decorate}] (0,0) -- (1,1);
% This used to work, but not anymore:
\begin{knot}
\strand[decoration={markings, mark=at position 0.2 with {\draw[black, fill=black] circle[radius=2pt];}},postaction={decorate}] (0,0) -- (1,1);
   \end{knot}
\end{tikzpicture}

! LaTeX3 Error: Inconsistent local/global assignment

Hello, using this example:

\documentclass{article}
\RequirePackage[enable-debug]{expl3}
\ExplSyntaxOn
\debug_on:n { check-declarations , deprecation }
\ExplSyntaxOff
\usepackage{tikz}
\usetikzlibrary{knots}
\begin{document}
\begin{tikzpicture}
\begin{knot}[
  draft mode=strands
]
\strand[red,thick] (0,0) .. controls +(1,0) and +(-1,0) .. (2,1) .. controls +(1,0) and +(-1,0) .. (4,0);
\strand[blue,thick] (0,1) .. controls +(1,0) and +(-1,0) .. (2,0) .. controls +(1,0) and +(-1,0) .. (4,1);
\end{knot}
\end{tikzpicture}
\end{document}

You get

! LaTeX3 Error: Inconsistent local/global assignment

For immediate help type H <return>.
 ...                                              
                                                  
l.38 ...th_moveto_tl {\pgfsyssoftpath@movetotoken}

( I'm using TeXLive 2019 updated)
Saludos

Check for closed paths with intersection routines (spath3 & knot)

There are a few issues pertaining to working with intersections and closed curves.

  1. In the spath3 routines, when splitting a closed curve at an intersection point then the result should be a single open curve. However, this will interact weirdly with when splitting at multiple points so it's not just as simple as cycling round the segments and applying a spot weld. The cycling will have to be done after all the splittings so it will be necessary to remember where the closed path joined up to.
  2. In the knots package then ignore endpoint intersections=true doesn't ignore the intersection between the last point and first point.

Useful to have code to use just a component of a soft path.

In answering a few TeX-SX questions I'm using a wrapper around \clist_item:Nn to get a component of a soft path. I think it's fine to require the use of get components of to split the soft path into its components (if using multiple components - as is often the case - then splitting them once saves time) but then making it easy to use a particular item of that list would be helpful. Not sure whether this should be via keys or that the wrapper I'm using is the way to go.

Issue with calligraphy and the updated spath3

I hope that I am not barking at the wrong tree, but it appears to me that the new spath3 library breaks the calligraphy library. Minimal non-working example:

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{calligraphy}
\begin{document}
\begin{tikzpicture}
\end{tikzpicture}
\end{document}

On my just updated TeXLive2020 installation I get (with pdflatex)

! Undefined control sequence.
l.697 \spath_components_to_seq:NV
                                  \l__cal_tmpa_seq \l__cal_tmpa_tl

P.S. The update library is really great! Thank you so much!

Feature request: knots "mesh gray style"

Hi, looking for a package for something else I came across this nice figure.
Captura de pantalla -2021-03-08 20-46-33
which is part of the documentation for the fiziko package that uses metapost for drawings.

You could get such an output in spath3?

I think it would be a nice feature.
Regards

Lines intersection in a flowchart (feature request)

I found 2 "solutions" for what I need:

But then I (don't remember how) discovered spath3 and knots packages. I can see from the documentation that with them, I can cut one line in place of an intersection to prevent the physical intersection itself. But I was hoping that I can change the way the intersection is redrawn to make one line an arc and leave the other one untouched, or apply the same "cutting" effect (but at the arc intersection).

The given examples are manual work, unlike the knots package, and therefore not desirable.

Incomplete key name `[at] end path construction` in doc

In doc spath3.pdf, key at end path construction marked inside {verbatim} environment is typeset without the beginning at.

spath3/spath3.tex

Lines 144 to 146 in 2b32dde

\begin{verbatim}
at end path construction={code}
\end{verbatim}

image

It's a surprising gift from l3doc, as l3doc loads fancyvrb and sets

\fvset{gobble=2}
\cs_gset_eq:NN \verbatim \Verbatim
\cs_gset_eq:NN \endverbatim \endVerbatim

spath3.tex can either indent all {verbatim} lines by 2 (extra) spaces or reset gobbling option by \fvset{gobble=0}.

4 intersections with 4 lines in a flowchart + 1 redundant arc/intersection (bug)

With my setup:
#23 (comment)
I can do simple stuff like this:
arc, arc
arc, rarc

But I failed to do the petty "pattern" (it probably has a name): each of 4 lines go over only 1 of the other lines:
4 arcs + 1 redundant

But somehow a new 5th arc (red number 1) is introduced when I "requested" only 4.

source code
\documentclass{article}
\usepackage{tikz}
\usepackage{spath3}
\usetikzlibrary{positioning,arrows.meta,knots}

\tikzset{
  bridging path/.initial=intersection arc,
  bridging rpath/.initial=intersection reverse arc,
  bridging span/.initial=8pt,
  bridging gap/.initial=4pt,
  bridge/.style 2 args={
    spath/split at intersections with={#1}{#2},
    spath/insert gaps after
      components={#1}{\pgfkeysvalueof{/tikz/bridging span}},
    spath/join components upright
      with={#1}{\pgfkeysvalueof{/tikz/bridging path}},
    spath/split at intersections with={#2}{#1},
    spath/insert gaps after
      components={#2}{\pgfkeysvalueof{/tikz/bridging gap}},
  },
  rbridge/.style 2 args={
    spath/split at intersections with={#1}{#2},
    spath/insert gaps after
      components={#1}{\pgfkeysvalueof{/tikz/bridging span}},
    spath/join components upright
      with={#1}{\pgfkeysvalueof{/tikz/bridging rpath}},
    spath/split at intersections with={#2}{#1},
    spath/insert gaps after
      components={#2}{\pgfkeysvalueof{/tikz/bridging gap}},
  },
}

\AtBeginDocument{%
  \tikz[overlay] { \path[spath/save global=intersection arc] (0,0) arc[
    radius=1cm, start angle=180, delta angle=-180]; }%
  \tikz[overlay] { \path[spath/save global=intersection reverse arc] (0,0) arc[
    radius=1cm, start angle=-180, delta angle=180]; }%
}

\begin{document}
\fontsize{14}{14}

\def\offset{8pt}
\begin{tikzpicture}[
    node distance=4cm,
    arrow/.style={-Triangle, line width=1pt},
  ]

  \node (c) {};
  \node[draw,above=of c] (above) {above};
  \node[draw,left=of c] (left) {left};
  \node[draw,below=of c] (below) {below};
  \node[draw,right=of c] (right) {right};

  \path[spath/save=abovebelow]
    ([xshift=-\offset]above.south) --
    ([xshift=-\offset]below.north)
    node[start, above, rotate=90] {above--below};
  \path[spath/save=belowabove]
    ([xshift=\offset]below.north) --
    ([xshift=\offset]above.south)
    node[start, below, rotate=90] {below--above};

  \path[spath/save=leftright]
    ([yshift=-\offset] left.east) --
    ([yshift=-\offset] right.west)
    node[start, below] {left--right};
  \path[spath/save=rightleft]
    ([yshift=\offset] right.west) --
    ([yshift=\offset] left.east)
    node[start, above] {right--left};

  \tikzset{
    bridging span/.initial=8pt,
    bridging gap/.initial=4pt,
    bridge={abovebelow}{rightleft},
    bridge={leftright}{abovebelow},
    bridge={belowabove}{leftright},
    bridge={rightleft}{belowabove},
    % bridge={abovebelow}{rightleft},
    % bridge={abovebelow}{leftright},
    % rbridge={belowabove}{rightleft},
    % rbridge={belowabove}{leftright},
  }

  \draw[arrow, spath/use=abovebelow];
  \draw[arrow, spath/use=belowabove];
  \draw[arrow, spath/use=leftright];
  \draw[arrow, spath/use=rightleft];

\end{tikzpicture}

\end{document}

Document celtic-style knots

Although there's the celtic package for genuine celtic knots, for more general celtic-style knots then this package is probably the best option. Styling them to render without artefacts is a little tricky so should be documented.

gap insert incorrect shape

I try to insert the gap by split at in with develop vesion spath3 2.6 and encounter some problems:

  1. path with cycle will connect to the original path start point
  2. path with rectangle will rotate
    Screenshot_2022-07-16_22-09-54

In addtion, I could not generate spath3.pdf with command pdflatex spath3_code.dtx with error:

! Package doc Error: Checksum not passed (9067<>10133).
\documentclass{article}
%\url{https://tex.stackexchange.com/q/639719/86}
\usepackage{tikz}
\usetikzlibrary{ spath3 } % spath3  2.6 

\begin{document}
% Method 1: Splice into gaps
\begin{tikzpicture}[
  original path/.style={
    ultra thick,
    red,
    spath/save=#1
  }
]

\draw[spath/save=triangle,black,yshift=1cm] (0,0) -- ++(1,1) --(120:1) --cycle;
\path[original path=line] (0,0) -- (3,0);
\tikzset{
  spath/split at={line}{0.8},
  spath/split at={line}{0.6/.8*1/2},
  spath/split at={line}{0.4/.6*1/3},
  spath/split at={line}{0.2/.4*1/4},
	spath/insert gaps after components={line}{10pt},
  spath/join components with={line}{triangle},
}
\draw[spath/use=line,blue];

	
\path[original path=line2] (0,-1) -- (3,-1);
\draw[spath/save=rect,yshift=-3cm] (0,0) rectangle (1,1);
\tikzset{
  spath/split at={line2}{0.8},
  spath/split at={line2}{0.6/.8*1/2},
  spath/split at={line2}{0.4/.6*1/3},
  spath/split at={line2}{0.2/.4*1/4},
	spath/insert gaps after components={line2}{10pt},
  spath/join components with={line2}{rect},
}
\draw[spath/use=line2,red];

\end{tikzpicture}
\end{document}

ignore endpoint intersections = false creates a bounding box

Consider the following document:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{knots}
\begin{document}
\setlength\fboxsep{0pt}
\setlength\fboxrule{.2pt}
\newcommand*\KNOT[2]{%
  \fbox{%
    \begin{tikzpicture}
      \begin{knot}[consider self intersections = true,#1]
        \strand[line width=0.6pt, looseness=1.4,#2]
          (0,0) to [out=0,in=0] (0.2,0.2) to [out=180,in=180] (.4,0);
      \end{knot}
    \end{tikzpicture}%
  }\par}

\KNOT{}{}
\KNOT{ignore endpoint intersections = false}{}
\KNOT{ignore endpoint intersections = true}{}
\bigskip

\KNOT{}{overlay}
\KNOT{ignore endpoint intersections = false}{overlay}
\KNOT{ignore endpoint intersections = true}{overlay}
\end{document}

When ignore endpoint intersections = false, the picture gets it bounding box adjusted so that it fits a 24pt × 24pt rectangle around, I guess, the strand's path's center:
grafik

When adding overlay to the strand, the \fbox disappears in the other cases because the TikZ picture has no size anymore but in the problematic case the rectangle is still there:
grafik

spath3 and nodes

Hi, in a complex figure, I would like to save the path of a node (its border). Can I do this using spath3?

I found an example on stackoverflow that does not work any more (https://tex.stackexchange.com/questions/428270/tikz-convert-a-fit-node-into-a-path-for-clipping-filling). The documentation does not contain any example.

I have tried:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{spath3}
\begin{document}
\begin{tikzpicture}
  \node[draw,inner ysep=3mm,spath/save=box] (0,0) {Text};
  \draw [blue,spath/transform={box}{shift={(0.2,0.2)}},spath/use=box];
\end{tikzpicture}
\end{document}

It compiles fine but there is a warning about an empty path and I do not get any blue rectangle...

As the following example works as intended as I have tried to combine it with save path macro of tikz that works for saving node border.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{spath3}
\begin{document}
\begin{tikzpicture}
  \draw[spath/save=box] (0,0) rectangle (1,1);
  \draw [blue,spath/transform={box}{shift={(2,0)}},spath/use=box];
  \draw [green,spath/translate={box}{0cm}{2cm},spath/use=box];
  \draw [magenta] (2,2) [spath/use={box,move}] ;
\end{tikzpicture}
\end{document}

I ended up with (to test various use)

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{spath3}
\begin{document}
\fbox{
\begin{tikzpicture}
  \node[save path=\pathBox,draw,inner ysep=3mm] (t) at (0,0) {Text};
  \draw [red,use path=\pathBox,spath/save=box];
  \draw [blue,spath/transform={box}{shift={(2,0)}},spath/use=box];
  \draw [green,spath/translate={box}{0cm}{2cm},spath/use=box];
  \draw [magenta] ([xshift=1cm,yshift=1cm]t) [spath/use={box,move}] ;
\end{tikzpicture}
}
\end{document}

where the transformation are weird (they are not only translation, there is some scaling going on) and the bounding box is buggy too.

Bridging code introduces spurious space at document start

Consider the preamble suggested by the manual of v2.4, page 20:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections,spath3}
\tikzset{
  bridging path/.initial=arc,
  bridging span/.initial=8pt,
  bridging gap/.initial=4pt,
  bridge/.style 2 args={
    spath/split at intersections with={#1}{#2},
    spath/insert gaps after components={#1}{\pgfkeysvalueof{/tikz/bridging span}},
    spath/join components upright with={#1}{\pgfkeysvalueof{/tikz/bridging path}},
    spath/split at intersections with={#2}{#1},
    spath/insert gaps after components={#2}{\pgfkeysvalueof{/tikz/bridging gap}},
  }
}
% \AtBeginDocument{
%   \tikz[overlay] \path[spath/save=arc] (0,0) arc[radius=1cm, start angle=180, delta angle=-180];
% }
\begin{document}
First line
\end{document}

When uncommenting the three lines \AtBeginDocument{…}, we get spurious space at the start of the document. (This may seem small, but in a larger example involving svmono and tons of other packages – which I unfortunately cannot cite – this issue magnifies such that I even get one spurious page at the start of the document.) This is a bug and should not happen. Here is the screenshot of diffpdf (the compilation result for the commented version is on the left, for the uncommented version on the right):
diffpdf_screenshot
I would be happy if this issue finds attention. Thanks in advance.

Calligraphy for closed paths

Is it normal that I can't use calligraphy on closed paths ?

For example \calligraphy (0,0) arc(0:360:1); is ok but \calligraphy (0,0) arc(0:360:1) -- cycle; or \calligraphy (0,0) circle(1); throws \l__spath_tmpc_tl=\pgfsyssoftpath@closepathtoken . <recently read> }.

Transparent Background at knots

Hello

This package have been a tremendous help with line crossings. But a problem I found was, when you want transparent backgrounds, unfortunately you can see the white (or another color) lines, where the crossings are. Of course I can always change the background color for the knots, so it matches the current background color.

But if you export the picture, and want to use it everywhere, you have to export a picture for each background color, which can be time consuming.

So if a possible solution to this problem exists, it would be nice.

Best Regards
Mads

And again thank you for a great usepackage!

Path that is saved to aux file is not set global and empty.

Consider the following document.

\documentclass[border=5pt, tikz]{standalone}
\usetikzlibrary{spath3}
\begin{document}
\begin{tikzpicture}
  \fill[left color=blue, right color=green] (0,0) rectangle (2,1);
  \draw[spath/use=box];
  \draw (0,0) -- (2,1);
  \path[spath/save=box] (0.5, 0) rectangle (1.5, 1);
  \tikzset{spath/save to aux=box}
\end{tikzpicture}
\end{document}

This will save the following to the aux file (line formatted, of course).

\ExplSyntaxOn
\tl_clear_new:N \tikz@intersect@path@name@box
\tl_set:Nn \tikz@intersect@path@name@box {
  \pgfsyssoftpath@movetotoken {14.22636pt}{0.0pt}
  \pgfsyssoftpath@movetotoken {14.22636pt}{0.0pt}
  \pgfsyssoftpath@linetotoken {14.22636pt}{28.45274pt}
  \pgfsyssoftpath@linetotoken {42.67911pt}{28.45274pt}
  \pgfsyssoftpath@linetotoken {42.67911pt}{0.0pt}
  \pgfsyssoftpath@closepathtoken {14.22636pt}{0.0pt}
  \pgfsyssoftpath@movetotoken {42.67911pt}{28.45274pt}
}
\ExplSyntaxOff 

However, the log file will contain

Package spath3 Warning: Soft path box is empty on line 11

even after the second compilation.

And indeed, \tikz@intersect@path@name@box is empty (not undefined because \tl_clear_new:N makes sure the tl exists globally).

With the following patch to \spath_save_to_aux:Nn where everything is done globally, it works as I expected it to. (The first patch is maybe not even necessary because even \tl_clear_new:N makes sure the tl exists globally but this is too deep into L3 territory for me …)

\documentclass[border=5pt, tikz]{standalone}
\usetikzlibrary{spath3}
\usepackage{etoolbox}
\ExplSyntaxOn
\patchcmd \spath_save_to_aux:Nn { \tl_clear_new:N }{ \tl_gclear_new:N }{}{} % L1682
\patchcmd \spath_save_to_aux:Nn { \tl_set:Nn      }{ \tl_gset:Nn      }{}{} % L1683
\ExplSyntaxOff
\begin{document}
\begin{tikzpicture}
  \fill[left color=blue, right color=green] (0,0) rectangle (2,1);
  \draw[spath/use=box];
  \draw (0,0) -- (2,1);
  \path[spath/save=box] (0.5, 0) rectangle (1.5, 1);
  \tikzset{spath/save to aux=box}
\end{tikzpicture}
\end{document}

For reference:

spath3/spath3_code.dtx

Lines 1676 to 1690 in bb6dc50

\cs_new_protected_nopar:Npn \spath_save_to_aux:Nn #1#2 {
\tl_if_empty:nF {#2}
{
\tl_clear:N \l_@@_tmpa_tl
\tl_put_right:Nn \l_@@_tmpa_tl {
\ExplSyntaxOn
\tl_clear_new:N #1
\tl_set:Nn #1 {#2}
\ExplSyntaxOff
}
\protected@write\@auxout{}{
\tl_to_str:N \l_@@_tmpa_tl
}
}
}


I don't know much about the aux file but it looks like LaTeX usually \gdefs stuff there which makes me think global definition is needed and it works the way I did it in this answer on TeX.SE before I realized, spath3 has save to aux.

The new version of knots bug

I updated MacTex(LiveTex) from 2019 to 2021 including the knots package, and the following started giving me an error:

    \begin{tikzpicture}[scale=0.5] %scale plays a role in this error.
    \begin{knot}[clip width=5, clip radius=15pt, consider self intersections, end tolerance=3pt]
       \strand (2,0)
          to[out=left, in=right] 
             (1.4,0)
          to[out=left, in=down] (0.6,0.4)
          to[out=up, in=left] (1,.8)
          to[out=right, in=up]  (1.4,0.4)
          to[out=down, in=right]  (0.6,0);   %removing this line resolves the problem.   
    \end{knot}

tikz line that connects nodes is shorter when using `\strand` (knots tikz library) instead of `\draw`

I've minimized my usage as much as I could, so here is MWE:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{knots,arrows.meta}
\def\samecode{
  \node[draw] (a) at (0,0) {a};
  \node[draw] (b) at (1,0) {b};
  \draw[arrow, red] (a.east) -- (b.west);
}
\begin{document}
\begin{tikzpicture}[arrow/.style={->}]
  \samecode
  \begin{knot}
    % Strand shortened the line by ~0.4pt
    \strand[arrow] (a.east) -- ([xshift=0.4pt] b.west);
  \end{knot}
\end{tikzpicture}

\begin{tikzpicture}[arrow/.style={-Triangle}]
  \samecode
  \begin{knot}
    % Strand shortened the line by ~3.48pt
    \strand[arrow] (a.east) -- ([xshift=3.48pt] b.west);
  \end{knot}
\end{tikzpicture}
\end{document}

Output (red arrow lines are under the white ones):
image

`spath/transform={current}{...}` doesn't work in `postaction`

But it works in preaction.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{spath3}

\begin{document}
Pre-action
\begin{tikzpicture}[line width=1pt]
  \path[draw=red, draw opacity=.5]
       [preaction ={draw=blue,
                    spath/transform={current}{xshift=10pt}}]
    (0,0) rectangle (1,.8);
\end{tikzpicture}

Post-action
\begin{tikzpicture}[line width=1pt]
  \path[draw=red, draw opacity=.5]
       [postaction={draw=blue,
                    spath/transform={current}{xshift=10pt}}]
    (0,0) rectangle (1,.8);
\end{tikzpicture}
\end{document}

image

spath/transform xscale with scope xshift

Hi, I would like to shift the whole scope containing saved path with scale. The xshift value is directly applied to the xscale factor, inside the scope environment which is not expected.

How to do it?

In the following example, how to place the red rectangle in the cyan one

\documentclass[a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{spath3}
\pagestyle{empty}

\begin{document}
\begin{tikzpicture}
	\draw [help lines] (-2,-2) grid (2,2);
	\begin{scope}[xshift=1cm]  
	\fill[spath/save=cc](0.5,0) rectangle (1,.5);
  \fill[spath/transform={cc}{xscale=-1},spath/use={cc},red];
	\end{scope}
	\fill[cyan](0,0) rectangle (0.5,.5);
\end{tikzpicture}	
\end{document}

image

Spath3 used in `preaction` polutes the main action

I was trying with spath3 to achieve a shadow-like effect with bounding box auto updated. Then I found that if a preaction contains both line width change and spath/transform, the new line width was also applied to the main action, causing a wrong final bounding box.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shadows, spath3}

\tikzset{every picture/.append style={
  execute at end picture={
    \draw[dashed] (current bounding box.north east) rectangle
                  (current bounding box.south west);
  }
}}

\parindent=0pt

\begin{document}
Expected \\
\begin{tikzpicture}[line width=1pt]
  \path[draw=blue!50, line width=10pt]
    (0.3,0.3) rectangle +(1,.8);
  \path[draw=red]
    (0,0) rectangle +(1,.8);
\end{tikzpicture}

Using \verb|preaction={transform canvas={...}}| \\[.4cm]
\begin{tikzpicture}[line width=1pt]
  \path[draw=red]
       [preaction={draw=blue!50, line width=10pt,
                   transform canvas={shift={(.3,.3)}}}]
    (0,0) rectangle (1,.8);
\end{tikzpicture}

Using \verb|preaction={spath/transform={current}{...}}| \\
\begin{tikzpicture}[line width=1pt]
  \path[draw=red]
       [preaction={draw=blue!50, line width=10pt,
                   spath/transform={current}{shift={(.3,.3)}}}]
    (0,0) rectangle (1,.8);
\end{tikzpicture}
\end{document}

image

Can `every strand/.style` be added to `tikzpicture` environment?

I want to modify example from #22 (comment) like this (just as a silly example):

\begin{tikzpicture}[
    arrow/.style={-Triangle},
    every strand/.style={only when rendering/.style={arrow}},
  ]
  \samecode
  \begin{knot}
    \strand (a.east) -- (b.west);
  \end{knot}
\end{tikzpicture}

But instead of

image

I get

image

There are probably more valid examples of using every strand/.style but it is a useful "command", right? Can it be added?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.