I'm working in a tabular environment. I am a writing a set of 20+ rows in the environment. At first, I was going to number each row (automatically). But then it occurred to me that I could just number every fifth row: 5, 10, 15, 20... and so forth.
What is the simplest way to do this?
Here is my source code:
\documentclass[letterpaper,12pt]{article}
\usepackage{array}
\newcounter{rowcount}
\setcounter{rowcount}{0}
\usepackage{polyglossia}
\usepackage{fontspec}
\setmainlanguage[variant=us]{english}
\setotherlanguage{hebrew}
\setotherlanguage[variant=ancient]{greek}
\newfontfamily\greekfont[Script=Greek, Scale=MatchUppercase, Ligatures=TeX]{SBL BibLit}
\newfontfamily\hebrewfont[Script=Hebrew,Contextuals=Alternate,Ligatures=Required]{SBL BibLit}
\begin{document}
\section*{Fragment I.1: Psalm 17:26b-(LXX)}
\begin{greek}
\begin{tabular}{@{\stepcounter{rowcount}\therowcount\hspace*{\tabcolsep}}ccccccr}
& ουεμ & καί μ(ετ)α & πρὸς & καὶ μ(ετ)α & καὶ μ(ετ)α\\
& γαβρ & ἀ\d{ν}δρ\d{ὸ}\d{ς} & ἀνδρ\d{ὸ}\d{ς} & ἀνδρὸς & ἀνδρὸς\\
& θαμιμ & τ(\d{ε}\d{λ})ε\d{ι}ο\d{υ} & ἀκ\d{έ}ραιον & ἀθώιου & ἀμωμου\\
& θεμα\d{μ}\d{μ}\d{α}\d{μ} & τ(ελ)(\d{ε}\d{ι})ωθήσ\d{ι} & ἀκέραια \d{π}ρ\d{ά}ζεις & ἀθώος ἔσηι & ἄμωμος (ἔσ)ηι\\
& ουεμ & καὶ μ(ετ)α & πρὸς & καὶ μ(ετ)α & μ(ετ)α & 27\\ %how do I make this last column bold? Current commands (textbf and bfseries) do not seem to work...
& ναβαρ
\end{tabular}
\end{greek}
\end{document}
At the end of the day, I could always just manually input on a separate column \therowcount. I guess I'm just being curious.


forloop? If I would have to write the answer (thinking on most programming languages) I would useforfor sure, where the stop is the the number of rows, lol. Is that possible? Thank you! – manooooh Mar 10 '20 at 21:03\numexpr. So this answer is simple, fast, easy to modify and understand, and does not suffer from incompatibilities or other threats. – Mar 10 '20 at 21:39rowcountis divisible by 5,\ifnum\the\numexpr\value{rowcount}-5*(\value{rowcount}/5)yields 0. What happens ifrowcountis not divisible by 5? We need to know that\the\numexprrounds the result. So5*(\value{rowcount}/5)yields0,0,5,5,5forrowcount=1,2,3,4,5, and thus the whole term yields 0 only ifrowcountis divisible by 5. – Apr 12 '20 at 14:52x-5*round(x/5)wherex=rowcount. See this comment by ShreevatsaR for some more of these tricks. – Apr 12 '20 at 16:29*is just a multiplication sign. And7gets mapped to7-5*round(7/5)=7-5*1=2. You can play with\documentclass{article} \newcounter{rowcount} \begin{document} \loop \stepcounter{rowcount}% \number\value{rowcount}:\the\numexpr\value{rowcount}-5*(\value{rowcount}/5)\relax :\the\numexpr5*(\value{rowcount}/5)\relax\par \ifnum\value{rowcount}<30 \repeat \end{document}or similar codes to see things more explicitly. – Apr 12 '20 at 17:13