In Inkscape, it's possible to set a pattern along a path. There are four options for the pattern copies:

  • Single
  • Single, stretched
  • Repeated
  • Repeated, stretched

I wish to use the repeated option, but want the pattern to continue right to the end of the path, ending on a fractional pattern when necessary. Is there a way to do this in Inkscape?

In my case, I'm trying to draw a railway line using a pattern given in the left top of the figure, together with the red path shown in the rest of the figure. Gaps occur between lines when there's less than full pattern width distance - I want to avoid these gaps.

enter image description here

  • Can't you use "Repeated, stretched"? See example. That would avoid the problem of a partial pattern, and a gap at the end.
    – Billy Kerr
    Aug 11, 2020 at 12:43

3 Answers 3


I guess you cannot accept "repeated & stretched" because the pattern isn't exactly the same everywhere with it.

Here's one suggestion - absolutely nothing elegant, but possible.

Have 2 copies of the path. Insert to one a tail so that you get full repeated patterns when you apply Pattern along path. Insert a mask which hides the tail. It can be a solid white version of the right length path.

Masking: Have the white version on top, select both and apply Object > Mask > Set.

You must be disciplined. Use layers or groups to keep the multiple copies in order.

About dashes:

There's already written an answer of using dashed lines to get the railway pattern. A variation of that idea is to have a white or light-colored dashed line on top and a solid black copy of the same line below. The solid line should have a little wider stroke. An example:

enter image description here

  • What about using 'Extensions > Modify Path > Convert to Dashes' ? or may be dashed strokes from Path effects?
    – izri_zimba
    Aug 11, 2020 at 13:01
  • 2
    I'm sure the questioner wants more complex result than dashes, maybe for something totally different than for railways. But if the problem really was the classic railway map symbol he maybe could use multiple strokes or 2 layered versions - one for the edges and one for the black sections. Try to write a coherent answer about it. At least I will upvote it.
    – user82991
    Aug 11, 2020 at 13:12
  • Sorry I am beginner, I am not sure if that's was answer, I was just suggesting that to see if it does make sense or not.
    – izri_zimba
    Aug 11, 2020 at 13:16
  • Or maybe just playing with the spacing option of the path effect?
    – izri_zimba
    Aug 11, 2020 at 13:25

While not directly answering the question on fractional repeating patterns, there is a possible solution to the railway problem.

Inspired by a comment made by @user287001, the railway gaps could be solved by creating duplicate paths. One path can be set to have a dashed pattern, and the other can be converted in two parallel lines using 'stroke to path' with a stroke but no fill. This replicates the railway effect sought while avoiding any gaps in the paths.



I think you could simply solve that by playing with the following two parameters of the Path effect: Spacing and Tangential offset:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.