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

ShreevatsaR
  • 45,428
  • 10
  • 117
  • 149
vrgovinda
  • 330
  • 2
    The verse package may be of some help. – Peter Wilson Jan 08 '22 at 18:12
  • Thank you @ShreevatsaR. For the inline images. – vrgovinda Jan 10 '22 at 02:51
  • I think the question is clear enough, not sure why it's closed. Voting to reopen... – ShreevatsaR Jan 11 '22 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? – ShreevatsaR Jan 11 '22 at 14:23
  • @ShreevatsaR: Oh yes. The question is quite clear now. – vrgovinda Jan 12 '22 at 05:37
  • @Shreevatsa: [off-topic] assuming you are from India, or at least, of Indian origin, can you share details of people whom I can approach to outsource typesetting and book layout? I live in Chennai, Tamil Nadu, India. Simply because this is taking too much time. And I know just the basics having used LaTeX. Of course, there are people who can neatly do the job using InDesign. But I am keen on LaTeX due to many of its advantages (FOSS, text based, and I want to learn it too!). I have many books in the pipeline. Hence the request. – vrgovinda Jan 12 '22 at 16:25
  • 1
    @VrajarajaGovindaDas I'm aware of https://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 http://www.river-valley.com/ but not encountered any of their work personally. – ShreevatsaR Jan 12 '22 at 17:37
  • @ShreevatsaR Oh! That's very kind of you. I'll check out. Thank you very much sir. Hare Krishna! – vrgovinda Jan 12 '22 at 23:34

1 Answers1

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.

Peter Wilson
  • 28,066