I cannot get \label{tname} \ref{tname} to generate any number.

I am new to xetex - used latex some 15 yrs back while at school. Any pointers?

My goal is to tag verse in \begin{verse} ... \end{verse} block.

\setromanfont{Linux Libertine}% Better Diacritics
\setsansfont{DejaVu Sans}%
\setmonofont{DejaVu Sans Mono}%
\title{Your Title}
\author{Your Name}




This is a snippet of what I am trying to add

sukha-duḥkhe same kṛtvā lābhālābhau jayājayau \\
tato yuddhāya yujyasva naivaḿ pāpam avāpsyasi \\

In the verse \ref{2.38} ...

I tried using \nameref. Interestingly nameref gives me the label name verbatim. However at the point the label is defined, there is no numbering.

I want verses to be explicitly numbered, ie I number them or tag them.

  • 4
    Wait, you are trying to tag verse in a \begin{verse}...\end{verse} block? As far as I know (at least in LaTeX) the verse blocks have no attached counters. You probably need to define a new environment for that. – Willie Wong Jan 21 '11 at 19:35

You could create a theorem environment for numbered verses. This way you could number arbitrary environments. Here, for example:

sukha-duḥkhe same kṛtvā lābhālābhau jayājayau \\
tato yuddhāya yujyasva naivaḿ pāpam avāpsyasi \\
In the verse \ref{2.38} ...

Together with your preamble it gives:

alt text

| improve this answer | |
  • Thanks Stefan. This works. Thanks to everyone who offered constructive suggestions. – jayr Jan 22 '11 at 21:02

try \label{1.1.1} and \nameref{1.1.1} Also \lable{name} and \nameref{name} should work as well.

| improve this answer | |
  • It does not work. Note when I used tname in my example it was a number 1.2.3. – jayr Jan 21 '11 at 18:50
  • 1
    in your example you say "\include{myfile}" it would be helpful if you can post an example where you used these tags. you include file could be big but you can post a small section of code that you are using to create what you desire. – Aku Jan 21 '11 at 18:57
  • Aku, Thanks. From your example below, I see you set these counters. I'll give this a shot. I am trying to do old fashioned label and ref. I cannot get the combo to work, even outside the verse block. I will provide the actual sample in a followup to your post. – jayr Jan 22 '11 at 15:20
\begin{document} % End of preamble and beginning of text.

    Kabira So dhan sanchiye jo aage to hoye\\
    Seesh chadhavat kaath ki Jaat na d ekha koye.

    Kaal kare so Aaj kar, aaj kare so ab
    Pal me parlay hoyegi bahuri karega kab.

\end {verse}


I am not sure from your message what you are trying to do, but if you are trying to number verses automatically here is something that you can give a try.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.