Neural Sketch

Mark Path

Annotating paths with precision and clarity using Neural Sketch.

Overview

\nskMarkPath enables precise placement of annotations along paths defined by other commands, such as \nskConnect. It provides a robust yet intuitive interface for marking intermediate points along any drawn path, ideal for labeling distances, weights, points of interest, or other notable markers in your diagrams.


Basic Usage

The core syntax of \nskMarkPath is:

\nskMarkPath[<options>]{<path id or definition>}{<content>}
  • <options>: Configuration parameters such as positioning (at), skipping steps (skip-first, skip-last), or defining intervals (step).
  • <path id or definition>: The reference path identifier or explicit path definition.
  • <content>: Arbitrary TikZ commands (e.g., nodes, drawings, labels) executed at each specified position.

Annotating Specific Positions

Precisely place markers using fractional path positions (at):

\nskMarkPath[
  at=.25,
]{<path-id>}{
  \node[above=.5] {$w_0$};
  \draw[black, thick] (0,0) -- (0,.5);
}

The position at accepts a fractional value (e.g., 0.25 means 25% of the way along the path).

Fractional ValuePosition on Path
.0Start of path
.5Middle of path
1.0End of path

Complete Example

Illustrating markers placed at multiple intervals along connections:

\nskContainer[
  id=ab,
  border-type=dashed,
  fill=nskSecondaryAccent!20,
  border-color=nskSecondaryAccent,
]{
  \nskBlock[type=circle, id=ablock, text-center=A, importance=1.2]
  \nskBlock[type=rectangle, id=bblock, last-pos={right=3cm}, text-center=B]
  \nskConnect[id=acn, from=ablock.east, to=bblock.west]
 
  \nskMarkPath[at=.25]{acn}{
    \node[above=.5cm] {$w_0$};
    \draw[black, thick] (0,0) -- (0,.5);
  }
 
  \nskMarkPath[at=.5]{acn}{
    \node[above=.5cm] {$w_1$};
    \draw[black, thick] (0,0) -- (0,.5);
  }
 
  \nskMarkPath[at=.75]{acn}{
    \node[above=.5cm] {$w_n$};
    \draw[black, thick] (0,0) -- (0,.5);
  }
}
Multiple path annotations at intervals

Advanced Path Routing

Custom Path Definitions

Beyond marking paths defined by IDs (e.g., from \nskConnect), you can directly specify custom paths. This gives maximum flexibility for complex routing scenarios:

\nskMarkPath[at=.5]{(0,0) -- (3,1) -- (4,4)}{
  \node[above=.5cm, rotate=45] {Midway};
  \draw[black, thick] (0,0) -- (0,.5);
}

\nskMarkPath also seamlessly integrates with complex paths involving bends and custom routes:

\nskContainer[border-type=dashed, fill=nskSecondaryAccent!20]{
  \nskBlock[id=ab, type=rectangle, width=1cm, height=1cm, text-center=A]
  \nskBlock[id=bb, type=rectangle, width=1cm, height=1cm, text-center=B, last-pos={right=3cm}]
  \nskBlock[id=op, type=rounded rectangle, width=2cm, text-center=node, fill=nskSecondaryAccent,
            pos={below right=1cm and .8cm of ab}]
  \nskConnect[from=ab.south, to=op.west, bend-type=single, bend-direction=up]
 
  \nskConnect[id=cn2, from=bb.south, to=op.east, route={to[in=0, out=-115]}]
 
  \nskMarkPath[at=.5]{cn2}{
    \node[below right=.5cm] {Text};
    \draw[black, thick] (0,0) -- (0,.5);
  }
}
Annotations on complex routed paths

Tip

Combine \nskMarkPath with anchors and markers to create informative visual annotations. Markers can include labels, connectors, and custom drawn indicators, greatly enhancing clarity in complex diagrams.


Interval-based Marking

Use evenly spaced markers along an arbitrary path by specifying intervals:

\nskContainer[border-type=dashed, padding=3mm]{
  \nskBlock[id=ba, width=8cm, height=1cm]
  \nskMarkPath[
    path-width=8cm,
    skip-first=true,
    skip-last=true,
    step=10mm
  ]{(ba.south west) -- (ba.south east)}{
    \draw[black] (0,0) -- (0,1cm);
  }
}
Interval-based path annotations

Explanation of Interval Marking Options

  • step: Defines the interval at which markers are placed along the path.
  • skip-first, skip-last: Allows skipping markers at endpoints for cleaner aesthetics.

Best Practices

  • Consistency: Use consistent styles (line thickness, marker positions) across diagrams to enhance readability.
  • Clarity: Ensure annotations do not clutter the diagram. Balance between informative content and visual cleanliness.

Reference

PropTypeDefault
at?token list{}
color?token listc__nsk_principal
end?number1
path-width?dimension0pt
skip-first?booleanfalse
skip-last?booleanfalse
start?number0
step?dimension10mm

Key Takeaway

\nskMarkPath empowers you to annotate paths precisely, clearly communicating detailed information without sacrificing visual appeal.

On this page