Skip to content

Line Numbers

Nils Reiter edited this page Mar 2, 2019 · 4 revisions

v1.8.0

The program supports two kinds of line numbers, both can be displayed left to the text (but only one at a time). To switch between them, there is a new entry in the view menu.

View menu for selecting line number style

Calculated line numbers

Calculated line numbers are in line with what you find in plain text editors. A line is sequence of characters terminated by a newline character. Lines are enumerated starting with 1, and every line number is shown. In some cases, these line numbers are unintuitive, because the text view also supports soft wrap: Lines that are longer than one fits into the window are wrapped, so that they appear as multiple lines on the screen. Technically, they still are a single line. If the line numbering would take into account soft wrapping, the line numbers would depend on the window width and would not be stable anymore.

Calculated line numbers

Given line numbers

In some cases, the files that we want to work with already have a line numbering system (e.g., poems taken from editions). For this case, the tool can also display line numbers that are given in the files (hence the name). If at least a single line number is defined in the file, the option becomes available to show given line numbers.

In v1.8.0, line numbers can be imported via TEI/XML files. To include a line number, the file needs to include (at least one) <l>-element with a n-attribute specified. If the value of the attribute is convertible into an integer (i.e., a number without decimals), it is interpreted as a line number and shown next to the line.

As an example, consider the simple TEI file shown below:

<xml version="1.0" encoding="UTF-8">
<TEI xmlns="http://www.tei-c.org/ns/1.0">
  <teiHeader></teiHeader>
  <text>
    <body>
      <l>Nû grîfe wider, dâ ich'z liez.</l>
      <l>Tristan dô der ze stade gestiez</l>
      <l>âne ros und âne sper,</l>
      <l>nû kâmen tûsent rotte her</l>
      <l n="7235">gedrungen mit ir gruoze</l>
      <l>ze orse und ze vuoze.</l>
      <l>si enpfiengen in vrôlîche.</l>
      <l>künec unde künicrîche</l>
      <l>dien gelebeten nie sô lieben tac,</l>
      <l n="7240">des man in wol getrûwen mac.</l>
      <l>wan in was ûf erstanden</l>
      <l>grôz êre ûz sînen handen.</l>
      <l>ir aller laster unde ir leit</l>
      <l>daz haete er eine hin geleit.</l>
    </body>
  </text>
</TEI>

This file will be rendered as shown below, with the line numbers to the left of the text.

Pre-defined line numbers

Clone this wiki locally