How to add horizontal line in between text lines

Hello, I’m trying to write a document which I will print out and cut each line of text into its own strip. For that I would like to add short lines at the beginning and end of the page in between each line to make it easy to line up to a paper cutter and cut it straight.

I’ve tried a few things and gotten it to work with underlines to have a thin line all the way across:

#set text(size: 2em, spacing: 1em)
#set par(leading: 1em, justify: true)
#show text: it => {
  underline(it, extent: 20pt, offset: 0.5em, stroke: 0.1pt)
}

words
and
more
different
words
and
more
and
more
exampie
words

However, I haven’t gotten far when trying to only have them at the start and end of each line. I thought par.line could be used, but that isn’t doing anything in the show rule I tried:

#set text(size: 2em, spacing: 1em)
#set par(leading: 1em, justify: true)
#show par.line: it => {
  it
  line(length: 100%)
}

words
and
more
different
words
and
more
and
more
exampie
words

I appreciate any help :)

Without knowing more about your specific use-case, I’m not sure if this even helps you. It uses tiling, line, and stroke options.
An example, even if it’s hand-drawn, would be great.

It’s possible to add lines to the entire page like this:

Code
#set text(20pt) //Adjust to your desired text size

#let stroke = (paint: gray, thickness: .1mm, dash: "loosely-dashed")
#let size = 20pt * 1.3
#set page(
  paper: "a6",
  fill: tiling(
    size: (10cm, size),
    line(
      stroke: stroke,
      length: 100%
    )
  )
)

words
and
more
different
words
and
more
and
more
exampie
words

This was modified from the graph paper snippet.

1 Like

Thank you for the help, especially with the tiling, I was able to get what I wanted with that as the starting point:

#let text-size = 0.4cm
#set text(top-edge: 0.2cm, bottom-edge: -0.2cm)
#let par-leading = 0.3cm
#set text(size: text-size, spacing: 10pt)
#set par(leading: par-leading, justify: true)
#let stroke = (paint: gray, thickness: .1mm, dash: "loosely-dashed")
#let size = 0.7cm
#set page(
  margin: (top: 2.38cm),
  fill: tiling(
    size: (18cm, size),
    line(
      stroke: stroke,
      length: 15%
    )
  )
)


words
and
more
different
words
and
more
and
more
example
words
words
and
more
different
words
and
more
and
more
example
words
words
and
more
different
words
and
more
and
more
example
words

There are lots of hard-coded values to line everything up, which I’m sure could be improved, but this is good enough for my use case.