1

I can manage to get line numbers in roman (as it is explain in the documentation) but what I want is to be able to have the lines numbered on both sides of the text, left and right, but I would like to have it arabic in the left and roman in the right. Is there anyway to do that?

I'm using document class book.

Werner
  • 603,163
Bpi
  • 188
  • 6

2 Answers2

3

Example

Not a true answer because a total hack, so therefore just a placeholder because there must be a more elegant solution.

Define the left number command (say) to print both the left and right numbers.

Make a copy of lineno.sty, call it lineno2.sty and put it where TeX can find it (in the current project folder, say).

After line 1523 (% . . . here are the hooks:) add:

\def\LineNumberL{\arabic{linenumber}}%
\def\LineNumberR{\roman{linenumber}}%

Change the next line, defining \makeLineNumberLeft so that it combines both Left and Right definitions together (more or less), that is, change it from

\def\makeLineNumberLeft{% 
  \hss\linenumberfont\LineNumber\hskip\linenumbersep}

to

\def\makeLineNumberLeft{% 
  \makebox[-2em]{\linenumberfont\LineNumberL}\makebox[3em]{}%left side
\linenumberfont\hskip\columnwidth
  \hb@xt@\linenumberwidth{\hss\LineNumberR}\hss%right side
  }%

In the main TeX file, \usepackage{lineno2}.

MWE

\documentclass{article}
\usepackage{lineno2}
\usepackage{lipsum}
\begin{document}
\linenumbers
\lipsum[1-15]
\end{document}
Cicada
  • 10,129
  • That really works, wow, it was more complicated that I thought. I'm working hard in understanding more and more the inner codes that produce these nice documents. Thank you for your answer!! – Bpi Nov 07 '20 at 20:06
0

Following https://tex.stackexchange.com/a/199593, add this to your preamble:

\makeatletter
\def\makeLineNumberLeft{%
  \linenumberfont\llap{\hb@xt@\linenumberwidth{\arabic{linenumber}\hss}\hskip\linenumbersep}% left line number
  \hskip\columnwidth% skip over column of text
  \rlap{\hskip\linenumbersep\hb@xt@\linenumberwidth{\hss\roman{linenumber}}}\hss}% right line number
\leftlinenumbers% Re-issue [left] option
\makeatother
rmolina
  • 183