4

In the gb4e package you can restate an example with the same number using \exr instead of \ex Does something like this exist for linguex, which claims to be for lazy people?

3 Answers 3

4

Here's a way to do this which works roughly in the same way as the corresponding gb4e functionality. We define an \exr macro (no trailing .) which takes a label as its argument and uses the reference to that label as the example number.

\documentclass{article}
\usepackage{linguex}
\makeatletter
\newif\if@repeated\@repeatedfalse
\newcounter{savedExNo}
\renewcommand{\NormalEx}{\ifExWarning 
     \PackageWarning{linguex}{Check example numbering (screwed up?), 
     check number of empty lines at end of examples.  
     Detected}\fi\ExWarningtrue
     \if@repeated
        \Exformat[\ref{\tmp@ref}]
        \setcounter{ExNo}{\value{savedExNo}}
        \global\@repeatedfalse
     \else
     \if@noftnote\refstepcounter{ExNo}%
        \Exformat[\ExLBr\Exarabic{ExNo}\ExRBr]%
     \else
         \refstepcounter{FnExNo}\Exformat[\FnExLBr\Exroman{FnExNo}\FnExRBr]%
     \fi
     \fi}
\newcommand{\exr}[1]{%
\@repeatedtrue
\setcounter{savedExNo}{\value{ExNo}}
\def\tmp@ref{#1}
\ex.}

\makeatother
\begin{document}
\ex. This is an example.

\ex. This example will be repeated.\label{r1}

\ex.  \label{r2}
\a. An subexample.
\b. Another subexample.

\ex. Another example.

\exr{r1} This is the first repeated example.

\exr{r2}
\a. A repeated subexample.
\b. Another subexample.

\ex. Another example showing that the numbering continues correctly.

\ex. Another one.

\end{document}

output of code

1

What about reset the counter?

\documentclass{article}
\usepackage{linguex}
\def\exr{\setcounter{ExNo}{0}\ex}
\begin{document} 
\ex.  Some text\par 
\ex.  Some text\par 
\exr. Some text\par 
\ex.  Some text\par 
\end{document}
1
  • This doesn't actually do what the corresponding \exr command does in gb4e. That command takes a label as its argument and uses the number of the \ref to that label as the example number.
    – Alan Munn
    Sep 24, 2016 at 18:49
1

There's also the simple \label-\ref system combined with the optional example label (\ex.[]). \label right after the dot, and \ref in square brackets. Here also illustrated for sub-examples.

\documentclass{article}
\usepackage{linguex}
\begin{document} 
\ex.  Some text

\ex.  Some text

\ex.\label{ex:aa}  Some text (example number to be remembered: \ref{ex:aa})

\ex.  Some text
\a. sub-ex
\b.\label{ex:cc} sub-ex (a sub-example number to be remembered: \ref{ex:cc})

\ex.  Some text

\ex.[\ref{ex:aa}]  Some text (repeated example number: \ref{ex:aa})

\ex.  Some text

\ex.[\ref{ex:cc}]  Some text (with the remembered sub-example number: \ref{ex:cc})

\end{document}

enter image description here

You must log in to answer this question.

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