打印示例,其编号与上一个示例相同,但在 linguex 中有新的子编号

打印示例,其编号与上一个示例相同,但在 linguex 中有新的子编号

如何使用获取以下输出linguex

(2) a. James sang to himself
    b. James didn't sing to himself.

"Lorem ipsum dolor sit amet, consectetur adipiscing elit.

(2) c. James would not sing to himself

我想写一个与文本前具有相同编号但使用新的子编号方案的示例。

答案1

这基本上是有没有办法在 linguex 中重述语言实例?但恢复子标签编号增加了复杂性。除了手动提供子标签外,没有其他简单的方法可以做到这一点,如下例所示:

\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.[c.] A repeated subexample.
\b.[d.] Another subexample.

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

\ex. Another one.

\end{document}

代码输出

相关内容