1

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.

\documentclass[10pt]{article}
\usepackage{fontspec}
\usepackage{verbatim}
\usepackage{xltxtra,fontspec,xunicode}
\defaultfontfeatures{Scale=MatchLowercase}
\setromanfont{Linux Libertine}% Better Diacritics
\setsansfont{DejaVu Sans}%
\setmonofont{DejaVu Sans Mono}%
\title{Your Title}
\author{Your Name}
\date{}

\begin{document}

\maketitle

\include{myfile}
\end{document}

This is a snippet of what I am trying to add

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

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.

1
  • 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. Commented Jan 21, 2011 at 19:35

3 Answers 3

3

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

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

Together with your preamble it gives:

alt text

1
  • Thanks Stefan. This works. Thanks to everyone who offered constructive suggestions.
    – jayr
    Commented Jan 22, 2011 at 21:02
0

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

3
  • It does not work. Note when I used tname in my example it was a number 1.2.3.
    – jayr
    Commented Jan 21, 2011 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
    Commented Jan 21, 2011 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
    Commented Jan 22, 2011 at 15:20
0
\documentclass[10pt]{book}    
\begin{document} % End of preamble and beginning of text.
    \chapter{}
    \newcounter{chapterNo}
    \newcounter{verseNo}
    \setcounter{chapterNo}{1}
    \setcounter{verseNo}{1}

\begin{verse}
    Kabira So dhan sanchiye jo aage to hoye\\
    Seesh chadhavat kaath ki Jaat na d ekha koye.
\arabic{chapterNo}.\arabic{verseNo}\\

\stepcounter{verseNo}
    Kaal kare so Aaj kar, aaj kare so ab
    Pal me parlay hoyegi bahuri karega kab.
\arabic{chapterNo}.\arabic{verseNo}\\

\end {verse}

\end{document}

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.

0

You must log in to answer this question.

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