Graphics, Figures & TablesNumbered Examples in Linguistics

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

Numbered Examples in Linguistics

Post by Kotoschow »

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:

Code: Select all

\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.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Numbered Examples in Linguistics

Post by svend_tveskaeg »

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

Numbered Examples in Linguistics

Post by Kotoschow »

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:

Code: Select all

\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.
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Re: Numbered Examples in Linguistics

Post by svend_tveskaeg »

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)
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Numbered Examples in Linguistics

Post by cgnieder »

Svend is right. For example this Infominimal working example:

Code: Select all

\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:

Code: Select all

\relax 
\newlabel{ex1}{{1}{1}}
\newlabel{ex2}{{2}{1}}
and gives after two compilations this output:
label.png
label.png (7.59 KiB) Viewed 9181 times
Regards
site moderator & package author
Kotoschow
Posts: 28
Joined: Mon Apr 09, 2012 3:13 pm

Re: Numbered Examples in Linguistics

Post by Kotoschow »

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!
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Numbered Examples in Linguistics

Post by cgnieder »

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
Post Reply