## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ Numbered Examples in Linguistics Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
Kotoschow
Posts: 28
Joined: Mon Apr 09, 2012 3:13 pm

### Numbered Examples in Linguistics

Hi,

I'm having trouble with referring to numbered examples in the gb4e package. When I refer to a labeled example, instead of example number I get '??'. It happened even when I copy-pasted the example from LaTeX/Linguistics:

\begin{exe}         \ex\label{ex1} Godzilla destroyed the city.         \ex\label{ex2} Godzilla roared.\end{exe}Sentence (\ref{ex1}) contains two arguments, but (\ref{ex2}) contains only one.
Last edited by localghost on Wed Feb 13, 2013 5:46 pm, edited 1 time in total.
Reason: Longer passages of source code are tagged as code block, not as in-line code.

Tags:

svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am
First: A MWE is necessary for us to help.

I don't know the package but have you compiled it two times? First the label needs to be written to the AUX file and secondly the \ref needs to catch' the label.
Last edited by svend_tveskaeg on Thu Feb 14, 2013 12:44 am, edited 1 time in total.
In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)

Kotoschow
Posts: 28
Joined: Mon Apr 09, 2012 3:13 pm
How do you do that? I don't see in reference to my numbered examples in the AUX. And I don't really know what i means to have \ref catch the label, other than what I showed in my example. Currently my AUX looks like this, if it helps:

\relax \citation{fos}\citation{ot}\@writefile{toc}{\contentsline {section}{\numberline {1}Introduction}{1}}\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}The language}{2}}\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.1.1}Consonants}{2}}\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.1.2}Vowels}{2}}\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.1.3}Syllable inventory}{2}}\citation{fos}\citation{fos}\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.1.4}Generalizations}{3}}\@writefile{toc}{\contentsline {subsection}{\numberline {1.2}The phenomenon}{4}}\citation{kager}\citation{kager}\@writefile{toc}{\contentsline {subsection}{\numberline {1.3}Theoretical background}{5}}\@writefile{toc}{\contentsline {section}{\numberline {2}Analysis}{6}}\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Distribution of vowel clusters}{6}}\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Derivation of vowel clusters}{7}}\@writefile{toc}{\contentsline {subsection}{\numberline {2.3}Word juncture}{11}}\@writefile{toc}{\contentsline {subsection}{\numberline {2.4}Word medial vowel clusters}{13}}\bibstyle{agsm}\bibdata{refs}
Last edited by localghost on Wed Feb 13, 2013 11:30 pm, edited 1 time in total.
Reason: Longer passages of source code are tagged as code block, not as in-line code.

svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am
All you have to try first is to compile two times in a row. Have you done that?

As I said, a MWE is necessary for us to help.
Last edited by svend_tveskaeg on Thu Feb 14, 2013 12:41 am, edited 1 time in total.
In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)

cgnieder
Site Moderator
Posts: 1993
Joined: Sat Apr 16, 2011 7:27 pm
Svend is right. For example this minimal working example:

\documentclass{article} \usepackage{gb4e} \begin{document}     \begin{exe}         \ex\label{ex1} Godzilla destroyed the city.         \ex\label{ex2} Godzilla roared.\end{exe}Sentence (\ref{ex1}) contains two arguments, but (\ref{ex2}) contains only one. \end{document}

gives the following aux file:

\relax \newlabel{ex1}{{1}{1}}\newlabel{ex2}{{2}{1}}`

and gives after two compilations this output:

label.png (7.59 KiB) Viewed 5789 times

Regards
site moderator & package author

Kotoschow
Posts: 28
Joined: Mon Apr 09, 2012 3:13 pm
Yeah, it worked. I encountered this double-compilation thingie also in bibtex, should have thought about it. Isn't there any solution to this?

I think we can mark this as solved. Thanks!

cgnieder
Site Moderator
Posts: 1993
Joined: Sat Apr 16, 2011 7:27 pm
Kotoschow wrote:I encountered this double-compilation thingie also in bibtex, should have thought about it. Isn't there any solution to this?

Well, there are some tools that can take care of double compilation and similar stuff, e.g. latexmk or arara.

In my opinion double compilation is the solution. When I creat a document I usually have compiled it so often before it is ready that the double-compilation for references doesn't really matter.

Regards
site moderator & package author