Row Numbering for every n-th multiple
Nice question! Unfortunately my editor is struggling with the Greek characters, so I hope you do not mind me using ASCII characters in the example. Of course, the code does work in your use case, too. You can use \numexpr
to define a mod
function by exploiting that it rounds fractions.
\documentclass[letterpaper,12pt]{article}
\usepackage{array}
\newcounter{rowcount}
\setcounter{rowcount}{0}
\begin{document}
\begin{tabular}{@{\stepcounter{rowcount}%
\ifnum\the\numexpr\value{rowcount}-5*(\value{rowcount}/5)=0\relax
\number\value{rowcount}%
\fi
\hspace*{\tabcolsep}
}lc}
& A \\
& B \\
& C \\
& D \\
& E \\
& F \\
& G \\
& H \\
& I \\
& J \\
& K \\
& L \\
& M \\
& N \\
& O \\
& P \\
& Q \\
& R \\
& S \\
& T \\
& U \\
& V \\
& W \\
& X \\
& Y \\
& Z \\
\end{tabular}
\end{document}
One can of course use a macro and condense it but I wanted to keep the trick explicit. It is also obvious (I hope;-) how to generalize this to other integers, i.e. not 5. You can define this to be a new column type.
\documentclass[letterpaper,12pt]{article}
\usepackage{array}
\newcounter{rowcount}
\setcounter{rowcount}{0}
\newcolumntype{N}[1]{@{\stepcounter{rowcount}%
\ifnum\the\numexpr\value{rowcount}-#1*(\value{rowcount}/#1)=0\relax
\number\value{rowcount}%
\fi
\hspace*{\tabcolsep}
}l}
\begin{document}
\begin{tabular}{N{4}c}
& A \\
& B \\
& C \\
& D \\
& E \\
& F \\
& G \\
& H \\
& I \\
& J \\
& K \\
& L \\
& M \\
& N \\
& O \\
& P \\
& Q \\
& R \\
& S \\
& T \\
& U \\
& V \\
& W \\
& X \\
& Y \\
& Z \\
\end{tabular}
\end{document}
Your idea is good. I defined a \countrows
command that has as optional argument the interval of the numbering. Omitting it will number all lines.
I decided to set the numbers in the margin, with smaller type size, but this can be modified by changing the definition.
\documentclass[letterpaper,12pt]{article}
\usepackage{polyglossia}
\usepackage{fontspec}
\usepackage{array}
\setmainfont{Libertinus Serif}
\setmainlanguage[variant=us]{english}
\setotherlanguage[variant=ancient]{greek}
\ExplSyntaxOn
\int_new:N \g_robxxviii_rowcount_int
\NewDocumentCommand{\countrows}{O{1}}
{
\int_gincr:N \g_robxxviii_rowcount_int
\int_compare:nT { \int_mod:nn { \g_robxxviii_rowcount_int } { #1 } = 0 }
{
\makebox[0pt][r]
{
\footnotesize
\int_to_arabic:n { \g_robxxviii_rowcount_int }\hspace{\tabcolsep}
}
}
}
\NewDocumentCommand{\resetcountrows}{}
{
\int_gzero:N \g_robxxviii_rowcount_int
}
\ExplSyntaxOff
\begin{document}
\section*{Fragment I.1: Psalm 17:26b-(LXX)}
\begin{greek}
\noindent\resetcountrows
\begin{tabular}{
@{\countrows[5]}
ccccc
>{\bfseries}r
@{}
}
ουεμ & καί μ(ετ)α & πρὸς & καὶ μ(ετ)α & καὶ μ(ετ)α\\
γαβρ & ἀν̣δρὸ̣ς̣ & ἀνδρὸ̣ς̣ & ἀνδρὸς & ἀνδρὸς\\
θαμιμ & τ(ε̣λ̣)ει̣ου̣ & ἀκέ̣ραιον & ἀθώιου & ἀμωμου\\
θεμαμ̣μ̣α̣μ̣ & τ(ελ)(ε̣ι̣)ωθήσι̣ & ἀκέραια π̣ρά̣ζεις & ἀθώος ἔσηι & ἄμωμος (ἔσ)ηι\\
ουεμ & καὶ μ(ετ)α & πρὸς & καὶ μ(ετ)α & μ(ετ)α & 27\\
ναβαρ \\
ουεμ & καί μ(ετ)α & πρὸς & καὶ μ(ετ)α & καὶ μ(ετ)α\\
γαβρ & ἀν̣δρὸ̣ς̣ & ἀνδρὸ̣ς̣ & ἀνδρὸς & ἀνδρὸς\\
θαμιμ & τ(ε̣λ̣)ει̣ου̣ & ἀκέ̣ραιον & ἀθώιου & ἀμωμου\\
θεμαμ̣μ̣α̣μ̣ & τ(ελ)(ε̣ι̣)ωθήσι̣ & ἀκέραια π̣ρά̣ζεις & ἀθώος ἔσηι & ἄμωμος (ἔσ)ηι\\
ουεμ & καὶ μ(ετ)α & πρὸς & καὶ μ(ετ)α & μ(ετ)α & 27\\
ναβαρ \\
ουεμ & καί μ(ετ)α & πρὸς & καὶ μ(ετ)α & καὶ μ(ετ)α\\
γαβρ & ἀν̣δρὸ̣ς̣ & ἀνδρὸ̣ς̣ & ἀνδρὸς & ἀνδρὸς\\
θαμιμ & τ(ε̣λ̣)ει̣ου̣ & ἀκέ̣ραιον & ἀθώιου & ἀμωμου\\
θεμαμ̣μ̣α̣μ̣ & τ(ελ)(ε̣ι̣)ωθήσι̣ & ἀκέραια π̣ρά̣ζεις & ἀθώος ἔσηι & ἄμωμος (ἔσ)ηι\\
ουεμ & καὶ μ(ετ)α & πρὸς & καὶ μ(ετ)α & μ(ετ)α & 27\\
ναβαρ \\
ουεμ & καί μ(ετ)α & πρὸς & καὶ μ(ετ)α & καὶ μ(ετ)α\\
γαβρ & ἀν̣δρὸ̣ς̣ & ἀνδρὸ̣ς̣ & ἀνδρὸς & ἀνδρὸς\\
θαμιμ & τ(ε̣λ̣)ει̣ου̣ & ἀκέ̣ραιον & ἀθώιου & ἀμωμου\\
θεμαμ̣μ̣α̣μ̣ & τ(ελ)(ε̣ι̣)ωθήσι̣ & ἀκέραια π̣ρά̣ζεις & ἀθώος ἔσηι & ἄμωμος (ἔσ)ηι\\
ουεμ & καὶ μ(ετ)α & πρὸς & καὶ μ(ετ)α & μ(ετ)α & 27\\
ναβαρ \\
\end{tabular}
\end{greek}
\end{document}