You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Typst seems like a good potential choice for people in the legal community to be able to write court filings. However, some courts require that legal documents include line numbers in the left-hand column. LaTeX has lineno for this, but I don't see the ability to do it with Typst. If a developer needs some examples of courts' local rules that shows the format I'd be happy to post them.
Reacted by Lucas Jung, rktjmp, Ismaël Lajaaiti, Pedro Peixoto, zymon, Bastien Voirin, Roland Fredenhagen, Zuri Klaschka, John Michael Egana, Sébastien d'Herbais de Thun and 25 more
Line numbers are probably going to pass the set margins, right? If you set left margin to 3cm then the line number would appear somewhere in the first 3 cm from the left.
If so, then there is probably going to be the next options:
font: string | array
size: relative length
offset: rect
font is either a string or an array of fallback fonts. size is the size of the font. offset, I can't find a good example in the doc., but it can take something like:
A primitive such as line (similar to par) would be a great addition for per-line styling, which would also enable a modification of adding a number offset into the margin for each line.
split up the input by parbreaks (numbering should skip these)
for each chunk between parbreaks, layout the content and calculate its height
divide the height of the chunk by the line height to get the number of lines (should be parameterized 🙃 )
make a grid, put the original content in the right half, put the line numbers in the left half, offset everything to the left to maintain placement of the original content
(Messy) Code below
number_content works with multiple paragraphs, inline equations, figures. I haven't tested with other types of content yet. Haven't tested multiple columns, probably will not work without modification. Haven't tested headers.
the template basically does the same thing, but globally for the entire page, without considering parbreaks.
Improvements:
You could probably avoid numbering the figures (and whatever other content you want to avoid skipping numbering for) by splitting on these in addition to parbreaks.
Recently had the same requirement of numbering paragraphs, not lines, for a legal document. I settled on this solution using numbered lists for now. Maybe it can be of help to some of you?
This is the line number that I need.
Because during the review process, the editor requested the addition of line numbers, which allows reviewers to locate and ask questions using line numbers.
Reacted by Victor L., Kevin Bonham, Bing Guo, Joseph Guhlin, EM Leon, Vincent Law, lgehr, Andrew Mitchell, Evan Widloski, ⑆ Neved4 ⑈ and 1 more
In case of CVPR/ICML-like templates, I have managed to render lines (see 998f02ac/cvpr). I define a ruler as a couter and locatable content and put it in background kwarg of page. Counter allows to enumerate lines on a specific page in locate(loc => ...) context.
In case of NeurIPS/ACL-like templates, it seems that there is no way to render line numbers in pure Typst without going deeper and modifying document model. I tried to override paragraph rule in order to attach on the left or on the right line number as follows.
#showpar: it=> {
place(left+top, float: true, dx: -100pt, { /* generate line numbers here */ })
it
}
Unfortunately, it does not work since it recursively invokes par rendering routine infinitely.
Activity
gabrfarina commentedon Apr 7, 2023
+1. Also certain conferences in computer science require line numbers in submissions, including NeurIPS (https://neurips.cc/), one of the top conferences in machine learning. NeurIPS's template can be seen here.
Andrew15-5 commentedon Jul 26, 2023
Are line numbers in these type of documents only needed to review and easily refer to a specific line?
Or line numbers have more use cases than this?
Andrew15-5 commentedon Jul 26, 2023
Line numbers are probably going to pass the set margins, right? If you set left margin to
3cmthen the line number would appear somewhere in the first 3 cm from the left.If so, then there is probably going to be the next options:
fontis either astringor anarrayof fallback fonts.sizeis the size of thefont.offset, I can't find a good example in the doc., but it can take something like:If offset is
auto(default), then it, for example, hasright: 0.5cm, so that it would be usable by default.One problem is that you have to somehow include an "on/off" switch somewhere in the Typst settings.
P.S. This is just an example/markup, and I'm also still new to the Typst.
[-]Feature Request: Line Numbers (Legal Documents)[/-][+]Line Numbers[/+]jamesrswift commentedon Oct 16, 2023
A primitive such as
line(similar topar) would be a great addition for per-line styling, which would also enable a modification of adding a number offset into the margin for each line.CGMossa commentedon Oct 16, 2023
Alright, well recently we got #2341, which greatly resembles what would be needed to accomplish this.
Otherwise, yes, line-numbering everything would be helpful with paper reviews, etc.
jamesrswift commentedon Oct 16, 2023
Indeed, good catch! Something like that but not just for raw
Atreyu-94 commentedon Oct 18, 2023
I was just coming to leave an issue about this. This is very important in academic journals or even in draftsmen in the hands of reviewers.
g-simmons commentedon Oct 19, 2023
FWIW I am using this for now.
Main idea:
(Messy) Code below
number_contentworks with multiple paragraphs, inline equations, figures. I haven't tested with other types of content yet. Haven't tested multiple columns, probably will not work without modification. Haven't tested headers.Credit:
pad_intis from https://github.com/dasayan05/typst-ai-conf-templatesImprovements:
maradotwebp commentedon Oct 28, 2023
Recently had the same requirement of numbering paragraphs, not lines, for a legal document. I settled on this solution using numbered lists for now. Maybe it can be of help to some of you?
AlexShyXie commentedon Dec 24, 2023
This is the line number that I need.
Because during the review process, the editor requested the addition of line numbers, which allows reviewers to locate and ask questions using line numbers.
RafailFridman commentedon Apr 3, 2024
Are there any new solutions that will allow us to get nice line numbers?
jguhlin commentedon Apr 5, 2024
Another vote for line numbers for scientific papers. Current solution is pandoc to latex, and going from there.
If someone could give me pointers I could take a look myself too.
CGMossa commentedon Apr 5, 2024
Consideration: pages with table only should also have their content provoke a line numbering.
laurmaedje commentedon Apr 6, 2024
@RafailFridman No current news, but I wanted to take a look at this before 0.12.
daskol commentedon Apr 22, 2024
In case of CVPR/ICML-like templates, I have managed to render lines (see 998f02ac/cvpr). I define a ruler as a couter and locatable content and put it in
backgroundkwarg ofpage. Counter allows to enumerate lines on a specific page inlocate(loc => ...)context.In case of NeurIPS/ACL-like templates, it seems that there is no way to render line numbers in pure Typst without going deeper and modifying document model. I tried to override paragraph rule in order to attach on the left or on the right line number as follows.
Unfortunately, it does not work since it recursively invokes
parrendering routine infinitely.maxall41 commentedon Jul 3, 2024
Any updates on this?
jamesrswift commentedon Jul 3, 2024
There has been a good deal of discussion on the topic in the academia forge on discord these past few days
daskol commentedon Aug 29, 2024
Hurray! 🎉
rrrodzilla commentedon Aug 29, 2024
Fantastic. Thank you for the hard work on this!
jreniel commentedon Sep 11, 2024
Kudos!