Line numbering behavior and page layout

First of all, a big thank you to the Typst devs for enabling line numbering of paragraphs.

While playing around with it, I noticed that the line numbering seemed to refer to the page and not to the paragraphs. Let me explain with an example. If you use the following code:

#set page(columns: 2)
#set par.line(numbering: "1")

= Introduction

#lorem(500)

Line numbering works as expected.

But with the following code:

#set par.line(numbering: "1")
#let body = [
  = Introduction

  #lorem(500)
]
#show: columns(2, body)

The line numbering is only active for the first column of the page.

Is this a bug or the intended behavior?

This somewhat prevents the use of single columns (e.g. for title and abstract) and double columns (the body) on the same page, because #set page() implies a page break, which is perfectly understandable.

Do you have any advice on how to combine single and double columns on the same page with line numbering?

I am sure it is possible, given the Youtube video posted by @reknih to announce Typst v0.12 :smiley:

The usage of show: columns(2, ...) is discouraged now with 0.12 and probably the root cause of the issue. To combine single column and double column on the same page, you would enable two-column layout in your initial set page rule with set page(columns: 2) and then use the new scope argument of place to place the title or abstract in a single column fashion by setting it to "parent", see: Page setup guide – Typst Documentation.

#set page(columns: 2, height: 10cm, width: 12cm)
#set par(justify: true)
#set par.line(numbering: "1")

#place(
  top + center,
  float: true,
  scope: "parent",
  text(1.4em, weight: "bold")[
    Impacts of Odobenidae
  ],
)

== About seals in the wild
#lorem(80)

image

5 Likes

@xkevio Thank you ! It is the answer I was lookgin for.

Hi @maucejo, I have moved your question to the Questions category, please make sure to check the category when creating a topic :slight_smile: that also means that you can select an answer. If you feel the response you got has sufficiently answered your question, be sure to give it a checkmark. This will help others find the solution in the future. Thanks!

1 Like