1

How can I format verses with a counter assigned to them?

I am working on a book that requires formatting verses (in Devanagari and Roman transliteration) in a specific way. Please see the image below for the sample format that I need to achieve:

sample format

What I need

  1. I need the numbers to be automatically assigned, through some counter.
  2. The number corresponding to the verse can be typeset either on the left side or the right side.
  3. Each verse has text and transliteration in 3 languages/scripts (see the sample text below), and the verse number should be displayed in the respective script at the end of each verse. (Each verse will be printed individually on a separate page.) As in the example image, verses belonging to one chapter need to be numbered sequentially. In a similar way, all 18 chapters of the Bhagavad Gita are to be laid out in the form of a pocket sized book.

Specs: TexLive 2020 Debian 11, XeLaTeX.

Possibilities I've thought of

  1. Place each verse in a section of its own. The counter will be that of the section number. Use titlesec package to achieve the desired formatting.

  2. Define a new counter that would increment at every subsequent instance and place the number and the verse in a tabular environment to achieve the desired formatting.

Even though these are my initial thoughts, I really don't know how to put it in the code. I can try titlesec, though. But if there is some intuitive way to achieve my needs, that would be very helpful.

Sample texts

Here are some sample texts, if anyone is interested in using them to suggest a MWE.

**TEXT 11**

ಯದಕ್ಷರಂ ವೇದವಿದೋ ವದಂತಿ

ವಿಶಂತಿ ಯದ್ಯತಯೋ ವೀತರಾಗಾ: 

ಯದಿಚ್ಛಂತೋ ಬ್ರಹ್ಮಚರ್ಯಂ ಚರಂತಿ

ತತ್ತೇ ಪದಂ ಸಂಗ್ರಹೇಣ ಪ್ರವಕ್ಷ್ಯೇ  ೧೧


यदक्षरं वेदविदो वदन्ति

विशन्ति यद्यतयो वीतरागा: ।

यदिच्छन्तो ब्रह्मचर्यं चरन्ति

तत्ते पदं सङ्ग्रहेण प्रवक्ष्ये ॥ ११ ॥

yad akṣaraṁ veda-vido vadanti

viśanti yad yatayo vīta-rāgāḥ

yad icchanto brahma-caryaṁ caranti

tat te padaṁ saṅgraheṇa pravakṣye
8
  • 2
    The verse package may be of some help. Commented Jan 8, 2022 at 18:12
  • Thank you @ShreevatsaR. For the inline images.
    – vrgovinda
    Commented Jan 10, 2022 at 2:51
  • I think the question is clear enough, not sure why it's closed. Voting to reopen... Commented Jan 11, 2022 at 13:28
  • 1
    I've rewritten the question a bit, hopefully it's clearer now and the intention hasn't changed. If I understand correctly, there are a few different parts to this question: (1) Maintaining a counter, which increases with each verse/page. (2) Typesetting that counter in the three different scripts (polyglossia can help here), (3) The actual typesetting of the verse (or rather the three verses) on each page (the verse package can help here). Is that right? Have I missed anything? Commented Jan 11, 2022 at 14:23
  • 1
    @VrajarajaGovindaDas I'm aware of srirangadigital.com — I know at least one of the main people involved, and they have made some very nice websites and books. I've also heard of river-valley.com but not encountered any of their work personally. Commented Jan 12, 2022 at 17:37

1 Answer 1

1

An extension to the verse package may help you. The package provides a \flagverse{<stuff>} macro that puts <stuff> at the start of a verse line. The following is an example of extending verse to increment a verse counter and put it at the left or right of a line of the verse.

% verseprob.tex

\documentclass{article}
\usepackage{verse}

% put something after the verse line
\newcommand{\flagverseR}[1]{%
  \hskip1.5\versewidth\rlap{#1}\hskip-1.5\versewidth}

% counter for verse number
\newcounter{vscntr}
\newcommand{\zeroverse}{\setcounter{vscntr}{0}}
\newcommand{\upverse}{\refstepcounter{vscntr}}


\usepackage{comment}
\begin{document}

\settowidth{\versewidth}{In a cavern, in a canyon}
\poemtitle{Clementine}
\zeroverse % zero the verse number
\begin{verse}[\versewidth]
  \begin{altverse} \upverse % increment the verse number
\flagverse{\thevscntr} In a cavern, in a canyon, \\ % put verse number at the left
    Excavating for a mine, \\
    Lived a miner, forty-niner, \\
    And his daugther, Clementine. \\!
  \end{altverse}

  \begin{altverse} \upverse % increment the verse number
\flagverseR{\thevscntr}   Oh my darling, Oh my darling \\ % put verse number after the line
    Oh my darling Clementine. \\
    Thou art lost and gone forever, \\
    Oh my darling Clementine. \\!
  \end{altverse}
  \end{verse}

\end{document}

At some point, but no guarantees, I might add something like this to the verse package.

1
  • yes. Give me some time. I'll revert back.
    – vrgovinda
    Commented Jan 12, 2022 at 5:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .