有没有办法在 linguex 中重述语言实例?

有没有办法在 linguex 中重述语言实例?

在里面格布包中,你可以用相同的数字重新陈述一个例子,\exr而不是\ex使用是否存在类似的东西语言,号称是为懒人准备的?

答案1

这里有一种方法可以做到这一点,其工作原理与相应的功能大致相同gb4e。我们定义一个\exr宏(无尾随.),该宏以标签为参数,并使用该标签的引用作为示例编号。

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

代码输出

答案2

那么重置计数器怎么样?

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

答案3

还有简单的\label-\ref系统与可选示例标签 ( \ex.[]) 相结合,\label位于点后面,并\ref放在方括号中。这里还说明了子示例。

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

在此处输入图片描述

相关内容