| 1 |
|
| 2 |
\_codedecl \lualineno {Line numbering <0.1, 2026-02-12>} |
| 3 |
|
| 4 |
\_directlua{require('lualineno')} |
| 5 |
\addto\_resetattrs{\lualineno{unset}} |
| 6 |
|
| 7 |
\_endcode |
| 8 |
|
| 9 |
\sec Loading `lualineno` |
| 10 |
To load the package you can use |
| 11 |
|
| 12 |
\begitems \style d |
| 13 |
* {\LaTeX} `\usepackage{lualineno}` |
| 14 |
|
| 15 |
* {\OpTeX} `\load[lualineno]` |
| 16 |
|
| 17 |
* {Plain} `\directlua{require('lualineno')}` |
| 18 |
\enditems |
| 19 |
|
| 20 |
\sec User Interface |
| 21 |
There is only one macro, `\lualineno`, which takes a single argument consisting of |
| 22 |
a list of `key=val` pairs which are separated by spaces (or end on lines). |
| 23 |
The possible keys are |
| 24 |
|
| 25 |
\begitems \style d |
| 26 |
* {define} Takes a list of `key=val` pairs in itself, and is used to define a new `lineno` type. |
| 27 |
see \ref[define]{line~@} for more details. |
| 28 |
|
| 29 |
* {defaults} Takes a list of `key=val` pairs in itself, and is used to set the default values of a newly defined `lineno` type. |
| 30 |
see \ref[defaults]{line~@} for more details. |
| 31 |
|
| 32 |
* {set} Takes a name of a defined `lineno`. Set this `lineno` as the active one. |
| 33 |
|
| 34 |
* {unset} Does not accept a value. Disables line numbers. |
| 35 |
|
| 36 |
* {label} Takes a list of tokens inside braces, e.g. `{label}`, these tokens will be fed into `\label` at a later stage. Should be used |
| 37 |
after a glyph (but it does not have to be right after it). |
| 38 |
|
| 39 |
* {anchor} Does not accept a value. When used after a vertical box, line numbers for lines inside that box |
| 40 |
will be positioned at the box boundaries. |
| 41 |
|
| 42 |
* {processbox} Takes an integer corresponding to a box. When using this key, numbers will be added to lines in this box. |
| 43 |
This is mainly useful for plain users who will need to use this in the output routine, but might be useful |
| 44 |
if someone wants to number lines in a strange order. |
| 45 |
\enditems |
| 46 |
|
| 47 |
Note that a line is numbered according to the attribute of the last node in it, so it is possible |
| 48 |
to change `lineno` type in the middle of the line. |
| 49 |
|
| 50 |
\secc Defining a Lineno |
| 51 |
When defining a lineno the following keys are available\lualineno{label={define}} |
| 52 |
|
| 53 |
\begitems \style d |
| 54 |
* {name} Accepts a string that will be used as the name for the `set` key. This key is mandatory. If the same name is used a second time, |
| 55 |
the parameters of the existing type will be modified. |
| 56 |
|
| 57 |
* {column} Takes an integer. Each `lineno` type can have different parameters in different columns, each definition only modifies |
| 58 |
the parameters for one column. The default is `1`. |
| 59 |
|
| 60 |
* {toks} Takes a list of tokens inside braces. These tokens will be executed each time before line numbers are added to a line. |
| 61 |
The tokens do not have to be fully expandable, but they should not create any nodes. The default is empty. |
| 62 |
|
| 63 |
* {left} Takes a list of tokens inside braces. These tokens will be fed into an `\hbox` which will be added to the left side of a line. |
| 64 |
The default is empty. |
| 65 |
|
| 66 |
* {right} Takes a list of tokens inside braces. These tokens will be fed into an `\hbox` which will be added to the right side of a line. |
| 67 |
The default is empty. |
| 68 |
|
| 69 |
* {line} Takes two boolean keys, `number` and `recurse`. If `number` is true then hlists of subtype `line` will be numbered, default is `true`. |
| 70 |
If `recurse` is true hlists of subtype `line` will be searched recursively to check if they have lines inside of them |
| 71 |
(for example minipage inside of a line), default is true. |
| 72 |
|
| 73 |
* {box} The same as `line` but for hlists of subtype `box`. |
| 74 |
|
| 75 |
* {alignment} The same as `line` but for hlists of subtype `alignment`. |
| 76 |
|
| 77 |
* {equation} The same as `line` but for hlists of subtype `equation`. |
| 78 |
|
| 79 |
* {displayalignment} The same as `line` but for hlists of subtype `alignment` which are created inside a display equation. |
| 80 |
|
| 81 |
* {offset} A boolean key. If set to false, offsets will be ignored, and line numbers will be added right before or after the lines. |
| 82 |
The default is `true`. |
| 83 |
\enditems |
| 84 |
|
| 85 |
If a key is not specified when defining a lineno, the default value will be used\lualineno{label={defaults}}. |
| 86 |
The default values can be changed using the `defaults` key, which accepts the same keys as `define` do, except for `name`. |
| 87 |
|
| 88 |
\secc Notes For Plain Users |
| 89 |
|
| 90 |
Plain users need to process the page box before it is shipped out. |
| 91 |
A simple example is |
| 92 |
\begtt |
| 93 |
\catcode`\@=11 |
| 94 |
\def\plainoutput{% |
| 95 |
\setbox0\vbox{\makeheadline\pagebody\makefootline}% |
| 96 |
\lualineno{processbox=0}% |
| 97 |
\shipout\box0 |
| 98 |
\advancepageno |
| 99 |
\ifnum\outputpenalty>-\@MM\else \dosupereject\fi |
| 100 |
} |
| 101 |
\catcode`\@=12 |
| 102 |
\endtt |
| 103 |
|
| 104 |
If `luatexbase` is not used, you will probably want to reallocate |
| 105 |
the attributes used by `lualineno`. You can do this with the keys |
| 106 |
`typeattr`, `colattr` and `markattr`, which each accept an integer |
| 107 |
(the attribute number). Note that in this case, all alignments will |
| 108 |
be treated as regular (even those inside display equations), and the |
| 109 |
`lualineno` callbacks will not be defined. |
| 110 |
|
| 111 |
\sec Examples |
| 112 |
\everytt{\typoscale[700/700]\hisyntax{tex}} |
| 113 |
|
| 114 |
\secc Number Lines Across the Document |
| 115 |
|
| 116 |
Since `pre_shipout_filter` is called inside the output routine, |
| 117 |
it is running inside a group, which means you should use global |
| 118 |
counters. \LaTeX/ already does that by default, in \OpTeX/ |
| 119 |
we need to use the `\global` prefix. |
| 120 |
|
| 121 |
\begEX |
| 122 |
\newcounter{lineno} |
| 123 |
\lualineno |
| 124 |
{ |
| 125 |
define = |
| 126 |
{ |
| 127 |
name = default |
| 128 |
toks = {\stepcounter{lineno}} |
| 129 |
left = {\tiny\thelineno |
| 130 |
\kern.8em} |
| 131 |
} |
| 132 |
set = default |
| 133 |
} |
| 134 |
\midEX |
| 135 |
\newcount\lineno |
| 136 |
\lualineno |
| 137 |
{ |
| 138 |
define = |
| 139 |
{ |
| 140 |
name = default |
| 141 |
toks = {\global\advance\lineno by 1} |
| 142 |
left = {\thefontsize[5] |
| 143 |
\the\lineno\kern.8em} |
| 144 |
} |
| 145 |
set = default |
| 146 |
} |
| 147 |
\endEX |
| 148 |
|
| 149 |
\secc Number Lines Per Page |
| 150 |
Since `pre_shipout_filter` is called inside the output routine, |
| 151 |
it is running inside a group, which means you should use local |
| 152 |
counters. \OpTeX/ already does that by default, in \LaTeX/ |
| 153 |
we need to reset the counter per page. |
| 154 |
|
| 155 |
\begEX |
| 156 |
\newcounter{lineno} |
| 157 |
\counterwithin{lineno}{page} |
| 158 |
\lualineno |
| 159 |
{ |
| 160 |
define = |
| 161 |
{ |
| 162 |
name = default |
| 163 |
toks = {\stepcounter{lineno}} |
| 164 |
left = {\tiny\thelineno |
| 165 |
\kern.8em} |
| 166 |
} |
| 167 |
set = default |
| 168 |
} |
| 169 |
\midEX |
| 170 |
\newcount\lineno |
| 171 |
\lualineno |
| 172 |
{ |
| 173 |
define = |
| 174 |
{ |
| 175 |
name = default |
| 176 |
toks = {\advance\lineno by 1} |
| 177 |
left = {\thefontsize[5] |
| 178 |
\the\lineno\kern.8em} |
| 179 |
} |
| 180 |
set = default |
| 181 |
} |
| 182 |
\endEX |
| 183 |
|
| 184 |
\secc Number Two Column Layout |
| 185 |
|
| 186 |
In this example, we add numbers to the right of lines in the first |
| 187 |
column and to the left in the second column. |
| 188 |
|
| 189 |
\begEX |
| 190 |
\newcounter{lineno} |
| 191 |
\lualineno |
| 192 |
{ |
| 193 |
define = |
| 194 |
{ |
| 195 |
name = default |
| 196 |
toks = {\stepcounter{lineno}} |
| 197 |
left = {\tiny\thelineno |
| 198 |
\kern.8em} |
| 199 |
} |
| 200 |
define = |
| 201 |
{ |
| 202 |
name = default |
| 203 |
column = 2 |
| 204 |
toks = {\stepcounter{lineno}} |
| 205 |
right = {\kern.8em\tiny |
| 206 |
\thelineno} |
| 207 |
} |
| 208 |
|
| 209 |
set = default |
| 210 |
} |
| 211 |
\midEX |
| 212 |
\newcount\lineno |
| 213 |
\lualineno |
| 214 |
{ |
| 215 |
define = |
| 216 |
{ |
| 217 |
name = default |
| 218 |
toks = {\global\advance\lineno by 1} |
| 219 |
left = {\thefontsize[5]% |
| 220 |
\the\lineno\kern.8em} |
| 221 |
} |
| 222 |
define = |
| 223 |
{ |
| 224 |
name = default |
| 225 |
column = 2 |
| 226 |
toks = {\global\advance\lineno by 1} |
| 227 |
right = {\kern.8em\thefontsize[5]% |
| 228 |
\the\lineno} |
| 229 |
} |
| 230 |
|
| 231 |
set = default |
| 232 |
} |
| 233 |
\endEX |
| 234 |
|
| 235 |
\secc Modulo |
| 236 |
If for example you want to print only every third line |
| 237 |
after the first, you can use something like |
| 238 |
|
| 239 |
\begEX |
| 240 |
\newcounter{lineno} |
| 241 |
\lualineno |
| 242 |
{ |
| 243 |
define = |
| 244 |
{ |
| 245 |
name = default |
| 246 |
toks = {\stepcounter{lineno}} |
| 247 |
left = {\ifnum\value{lineno}= |
| 248 |
\numexpr(\thelineno-1)/3*3+1\relax |
| 249 |
\tiny\thelineno\kern.8em\fi} |
| 250 |
} |
| 251 |
set = default |
| 252 |
} |
| 253 |
\midEX |
| 254 |
\newcount\lineno |
| 255 |
\lualineno |
| 256 |
{ |
| 257 |
define = |
| 258 |
{ |
| 259 |
name = default |
| 260 |
toks = {\global\advance\lineno by 1} |
| 261 |
left = {\ifnum\lineno= |
| 262 |
\numexpr(\lineno-1)/3*3+1\relax |
| 263 |
\thefontsize[5] |
| 264 |
\the\lineno\kern.8em\fi} |
| 265 |
} |
| 266 |
set = default |
| 267 |
} |
| 268 |
\endEX |
| 269 |
|
| 270 |
\secc Reference a Line |
| 271 |
|
| 272 |
You will need to create a label target, with `\refstepcounter` |
| 273 |
or `\wlabel`. Note that `\refstepcounter` cannot be inside the number box |
| 274 |
because the `\label` will be executed at an outer group. |
| 275 |
|
| 276 |
\begEX |
| 277 |
\newcounter{lineno} |
| 278 |
\lualineno |
| 279 |
{ |
| 280 |
define = |
| 281 |
{ |
| 282 |
name = default |
| 283 |
toks = {\refstepcounter{lineno}} |
| 284 |
left = {\tiny |
| 285 |
\thelineno |
| 286 |
\kern.8em} |
| 287 |
} |
| 288 |
set = default |
| 289 |
} |
| 290 |
\midEX |
| 291 |
\newcount\lineno |
| 292 |
\lualineno |
| 293 |
{ |
| 294 |
define = |
| 295 |
{ |
| 296 |
name = default |
| 297 |
toks = {\global\advance\lineno by 1} |
| 298 |
left = {\thefontsize[5]% |
| 299 |
\wlabel{\the\lineno}% |
| 300 |
\the\lineno\kern.8em} |
| 301 |
} |
| 302 |
} |
| 303 |
\endEX |
| 304 |
|
| 305 |
now `\lualineno{label={foo}}` will create a label named `foo` that can be referenced later. |
| 306 |
|
| 307 |
\secc Link to a Line |
| 308 |
|
| 309 |
When hyperref is loaded, `\refstepcounter` creates |
| 310 |
a node (a pdf destination), so we need to disable the |
| 311 |
node creation temporarily and use `\MakeLinkTarget` inside the box. |
| 312 |
There might be a better way though. |
| 313 |
|
| 314 |
In \OpTeX/ it is the same as with normal line reference, |
| 315 |
but we also put a destination node with `\dest`. |
| 316 |
|
| 317 |
\begEX |
| 318 |
\newcounter{lineno} |
| 319 |
\lualineno |
| 320 |
{ |
| 321 |
define = |
| 322 |
{ |
| 323 |
name = default |
| 324 |
toks = {\AssignSocketPlug |
| 325 |
{refstepcounter/target}{noop}% |
| 326 |
\refstepcounter{lineno}% |
| 327 |
\AssignSocketPlug |
| 328 |
{refstepcounter/target}{hyperref}} |
| 329 |
left = {\MakeLinkTarget{lineno}% |
| 330 |
\tiny\thelineno\kern.8em} |
| 331 |
} |
| 332 |
set = default |
| 333 |
} |
| 334 |
\midEX |
| 335 |
\newcount\lineno |
| 336 |
\lualineno |
| 337 |
{ |
| 338 |
define = |
| 339 |
{ |
| 340 |
name = default |
| 341 |
toks = {\global\advance\lineno by 1} |
| 342 |
left = {\thefontsize[5]% |
| 343 |
\wlabel{\the\lineno}% |
| 344 |
\dest[line:\the\lineno]% |
| 345 |
\the\lineno\kern.8em} |
| 346 |
} |
| 347 |
} |
| 348 |
\endEX |
| 349 |
|
| 350 |
\secc Ignore Line Numbers When Copying Text |
| 351 |
|
| 352 |
You can put the line number inside an empty |
| 353 |
ActualText span, although not all pdf readers |
| 354 |
support that. |
| 355 |
\begEX |
| 356 |
\newcounter{lineno} |
| 357 |
\lualineno |
| 358 |
{ |
| 359 |
define = |
| 360 |
{ |
| 361 |
name = default |
| 362 |
toks = {\stepcounter{lineno}} |
| 363 |
left = {\pdfextension literal page |
| 364 |
{/Span<</ActualText<>>>BDC}% |
| 365 |
\tiny\thelineno |
| 366 |
\pdfextension literal page{EMC}% |
| 367 |
\kern.8em} |
| 368 |
} |
| 369 |
set = default |
| 370 |
} |
| 371 |
\midEX |
| 372 |
\newcount\lineno |
| 373 |
\lualineno |
| 374 |
{ |
| 375 |
define = |
| 376 |
{ |
| 377 |
name = default |
| 378 |
toks = {\global\advance\lineno by 1} |
| 379 |
left = {\thefontsize[5]% |
| 380 |
\pdfliteral page |
| 381 |
{/Span<</ActualText<>>>BDC}% |
| 382 |
\the\lineno |
| 383 |
\pdfliteral page{EMC}\kern.8em} |
| 384 |
} |
| 385 |
set = default |
| 386 |
} |
| 387 |
\endEX |
| 388 |
|
| 389 |
\secc The `offset` and `anchor` Keys |
| 390 |
The following example demonstrates what they do |
| 391 |
\begtt |
| 392 |
\newcount\lineno |
| 393 |
\lualineno |
| 394 |
{ |
| 395 |
defaults = |
| 396 |
{ |
| 397 |
toks = {\advance\lineno by 1} |
| 398 |
left = {\the\lineno\kern.8em} |
| 399 |
right = {\kern.8em\the\lineno} |
| 400 |
} |
| 401 |
define = {name = offset} |
| 402 |
define = {name = nooffset offset = false} |
| 403 |
set = offset |
| 404 |
} |
| 405 |
|
| 406 |
\def\tmp{\noindent\hfil |
| 407 |
\frame{\vbox{ |
| 408 |
\hbox{Text}\hbox{Spanning}\hbox{Multiple}\hbox{Lines}\hbox to 5cm{} |
| 409 |
\vskip-\baselineskip}}} |
| 410 |
\tmp |
| 411 |
\medskip |
| 412 |
\tmp\lualineno{anchor} |
| 413 |
\medskip |
| 414 |
\lualineno{set=nooffset} |
| 415 |
\tmp |
| 416 |
\endtt |
| 417 |
|
| 418 |
\medskip |
| 419 |
|
| 420 |
\begingroup |
| 421 |
\newcount\linecount |
| 422 |
\lualineno |
| 423 |
{ |
| 424 |
defaults = |
| 425 |
{ |
| 426 |
toks = {\advance\linecount by 1} |
| 427 |
left = {\the\linecount\kern.8em} |
| 428 |
right = {\kern.8em\the\linecount} |
| 429 |
} |
| 430 |
define = {name = offset} |
| 431 |
define = {name = nooffset offset = false} |
| 432 |
set = offset |
| 433 |
} |
| 434 |
\def\tmp{\noindent\hfil |
| 435 |
\frame{\vbox{ |
| 436 |
\hbox{Text}\hbox{Spanning}\hbox{Multiple}\hbox{Lines}\hbox to 5cm{} |
| 437 |
\vskip-\baselineskip}}} |
| 438 |
\tmp |
| 439 |
\medskip |
| 440 |
\tmp\lualineno{anchor} |
| 441 |
\medskip |
| 442 |
\lualineno{set=nooffset} |
| 443 |
\tmp |
| 444 |
\endgroup |
| 445 |
|
| 446 |
\sec Callbacks |
| 447 |
|
| 448 |
There are three callbacks defined by `lualineno` |
| 449 |
|
| 450 |
\begitems \style O |
| 451 |
* `lualineno.pre_numbering`: A simple callback that is called before numbers are added to a line. |
| 452 |
This is where the tokens from the `toks` keyword are executed, and labels |
| 453 |
are created if \OpTeX/ is used. |
| 454 |
* `lualineno.numbering`: An exclusive callback that invokes the function that adds the numbers to lines. |
| 455 |
You can replace the function if you want to modify things. |
| 456 |
* `lualineno.post_numbering`: A simple callback that is called before numbers are added to a line. |
| 457 |
This is where labels are created if \LaTeX/ is used. |
| 458 |
\enditems |
| 459 |
|
| 460 |
None of the callbacks need a return value, and take as arguments the following (in order) |
| 461 |
\begitems \style O |
| 462 |
* `line`: The line node where numbers will be added. |
| 463 |
* `line_type`: A table of the parameters of the type of the `lineno` (see the implementation for details) |
| 464 |
* `offset`: The calculated horizontal offset of the line from the box margin. |
| 465 |
* `width`: The width of the page or column (or anchored box) containing the line. |
| 466 |
* `dir`: The direction of the vertical list containing the line. |
| 467 |
\enditems |
| 468 |
|
| 469 |
\_doc |
| 470 |
|
| 471 |
%%%%%%%%%%%%%%%%%%%%%%%%% example blocks |
| 472 |
|
| 473 |
\def\begEX{\_wipeepar\begingroup\_setverb |
| 474 |
\adef{ }{\_dsp}\adef\^^I{\t}% |
| 475 |
\def\t{\hskip \dimexpr\tabspaces em/2\relax}% |
| 476 |
\endlinechar=`^^J |
| 477 |
\startEX} |
| 478 |
|
| 479 |
\expanded{\def\noexpand\startEX#1\csstring\\midEX^^J#2\csstring\\endEX^^J{% |
| 480 |
\medskip |
| 481 |
\setbox0\vtop attr 4 = 1{\hsize=0.45\hsize |
| 482 |
\unexpanded{{\Blue\LaTeX} |
| 483 |
\begingroup\bracedparam\begtti{}#1}% |
| 484 |
\csstring\\endtt^^J}% |
| 485 |
\setbox1\vtop attr 4 = 2{\hsize=0.45\hsize |
| 486 |
\unexpanded{{\Green\OpTeX} |
| 487 |
\begingroup\bracedparam\begtti{}#2}% |
| 488 |
\csstring\\endtt^^J}% |
| 489 |
\noindent\hfil\noexpand\inoval{\vbox{\vskip10pt |
| 490 |
\line{\box0\hss\vtop to \dimexpr\dp1-\ht1{\Red\leaders\vrule width 1bp\vfil}\hss\box1}}}\medskip\endgroup}} |
| 491 |
|
| 492 |
%%%%%%%%%%%%%%%%%%%%%%%%% lists |
| 493 |
|
| 494 |
\_itemskipamount = 3.5pt plus 1pt |
| 495 |
\sdef{_item:d}{\aftergroup\dword} |
| 496 |
\def\dword#1#2{{\bf#2 }\ignorespaces} |
| 497 |
|
| 498 |
%%%%%%%%%%%%%%%%%%%%%%%%% |
| 499 |
|
| 500 |
\load[lualineno] |
| 501 |
\margins/1 a4 (1,1,1,1)in |
| 502 |
\newcount\lineno |
| 503 |
\lualineno |
| 504 |
{ |
| 505 |
define = |
| 506 |
{ |
| 507 |
name = default |
| 508 |
toks = {\global\advance\lineno by 1} |
| 509 |
left = {\_ewref\Xline{{\_the\lineno}}% |
| 510 |
\thefontsize[5]\wlabel{\the\lineno}% |
| 511 |
\_def\_destheight{20pt}\_dest[line:\_the\lineno]% |
| 512 |
\pdfliteral page{/Span<</ActualText<>>>BDC}% |
| 513 |
\the\lineno\pdfliteral page{EMC}\kern2em} |
| 514 |
} |
| 515 |
define = |
| 516 |
{ |
| 517 |
name = default |
| 518 |
column = 2 |
| 519 |
toks = {\global\advance\lineno by 1} |
| 520 |
right = {\_ewref\Xline{{\_the\lineno}}% |
| 521 |
\thefontsize[5]\kern2em\wlabel{\the\lineno}% |
| 522 |
\_def\_destheight{20pt}\_dest[line:\_the\lineno]% |
| 523 |
\pdfliteral page{/Span<</ActualText<>>>BDC}% |
| 524 |
\the\lineno\pdfliteral page{EMC}} |
| 525 |
} |
| 526 |
define = |
| 527 |
{ |
| 528 |
name = skip |
| 529 |
toks = {\global\advance\lineno by 1} |
| 530 |
left = {} |
| 531 |
} |
| 532 |
set = default |
| 533 |
} |
| 534 |
|
| 535 |
\load[doc] |
| 536 |
\colordef\EXbg{.2\Red} |
| 537 |
\ovalparams={\fcolor=\EXbg |
| 538 |
\roundness=6pt |
| 539 |
\shadow=N |
| 540 |
\lwidth=1bp |
| 541 |
\hhkern=-\roundness |
| 542 |
} |
| 543 |
|
| 544 |
\_openref |
| 545 |
\_immediate\_write\_reffile{% |
| 546 |
\def\noexpand\Xline\string#1{\def\noexpand\currline{{}{\string#1}}}% |
| 547 |
\_def\noexpand\_XtocA\string#1{\noexpand\_addto\noexpand\_toclist{{\string#1}}% |
| 548 |
\unexpanded{\_ea\_addto\_ea\_toclist\_ea{\currline}}}% |
| 549 |
} |
| 550 |
\suppresslongerror=1 |
| 551 |
\replmacro \_tocline {} {} {"pg:\#6", "line:\#7"} {} |
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
\insertoutline{Lua-Lineno} |
| 556 |
\tit Numbering lines in \LuaTeX/ |
| 557 |
\hfill Version: 0.1, 2026-02-12 \par |
| 558 |
\centerline{\it Udi Fogiel, 2026} |
| 559 |
|
| 560 |
The `lualineno` module provides flexible line numbering |
| 561 |
for \LuaTeX-based formats (Lua\LaTeX, \OpTeX, and Plain \LuaTeX). |
| 562 |
|
| 563 |
\insertoutline{Contents}\outlines 0 |
| 564 |
\notoc\nonum\sec Table of contents\hfill \typosize[8/]\bf line |
| 565 |
\maketoc |
| 566 |
\printdoctail lualineno.opm |
| 567 |
|
| 568 |
\sec Implementation |
| 569 |
|
| 570 |
\secc Lua module |
| 571 |
|
| 572 |
{\everytt={\typosize[8/10]\lualineno{set=skip}\_let\_printverbline=\_printcodeline \_hfuzz=1em \medskip} |
| 573 |
\commentchars-- \def\docfile{lualineno.lua} \ttline=-1 |
| 574 |
\_def\_printcomments{\_medskip |
| 575 |
{\_catcodetable0 \_typosize[10/12]\lualineno{set=default}\_everypar={}\_scantextokens\_ea{\_vcomments}\par}% |
| 576 |
\_bigskip |
| 577 |
\_ifx\_normalprintfilename\_undefined\_else \_let\_printfilename=\_normalprintfilename \_fi |
| 578 |
} |
| 579 |
|
| 580 |
\verbinput \hisyntax{lua} (3-) lualineno.lua |
| 581 |
} |
| 582 |
|
| 583 |
\secc \OpTeX/ package |
| 584 |
The \OpTeX/ package does not contain much. It is mainly here |
| 585 |
for the documentation, or |
| 586 |
in case someone prefers to type `\load[lualineno]` instead of |
| 587 |
`\directlua{require('lualineno')}`. |
| 588 |
|
| 589 |
\bgroup \lualineno{set=skip} |
| 590 |
\printdoc lualineno.opm % prints \_doc...\_cod parts + code before \_endcode |
| 591 |
\egroup |
| 592 |
|
| 593 |
\everytt{\typoscale[800/800]\lualineno{set=skip}} |
| 594 |
\secc \LaTeX/ package |
| 595 |
The \LaTeX/ package mostly contains patches to |
| 596 |
other packages to mark the column boxes. |
| 597 |
|
| 598 |
\verbinput \commentchars\%\% \vitt{lualineno.sty} \hisyntax{tex} (1-) lualineno.sty |
| 599 |
|
| 600 |
\bye |
| 601 |
\_cod |
| 602 |
|
| 603 |
\endinput |