无需添加标签即可交叉引用任何参考计数器

无需添加标签即可交叉引用任何参考计数器

答案提供了创建新引用计数器的绝佳解决方案。我还有一个想法,即无需手动输入label或输入即可引用特定点ref。这是在包中linguex为不同目的完成的。让我们看看这段代码。

\documentclass{article}
\usepackage{lipsum}
\usepackage{amsmath}
\usepackage{linguex}
\newcounter{mynumber}
\newcommand{\myno}[1]{\hfill\refstepcounter{mynumber}(\arabic{mynumber})\label{#1}}

\begin{document}
\lipsum[1]
\ex. This is one example.

\lipsum[1]
\ex. This is another example.

Example \LLast illustrates abc and \Last illustrates xyz.

\section{New section}
This is my first theorem. \myno{first}\\
This is my second theorem. \myno{}\\
By \eqref{first} it is evident that bla bla bla.\\
By \eqref{} it is evident that bla bla bla.\\
\end{document}

此代码将产生-

1

现在,由于该linguex包为我提供了类似的命令\Last\LLast我希望它们用于这些新的引用计数器。这可能吗?


这是我编写的伪代码。它看起来几乎一样,但有两个附加命令,最终应该以自动方式引用定理数字。预期输出与所附屏幕截图完全相同。

\documentclass{article}
\usepackage{lipsum}
\usepackage{amsmath}
\usepackage{linguex}
\newcounter{mynumber}
\newcommand{\myno}{\hfill\refstepcounter{mynumber}(\arabic{mynumber})}

\begin{document}
    \lipsum[1]
    \ex. This is one example.

    \lipsum[1]
    \ex. This is another example.

    Example \LLast illustrates abc and \Last illustrates xyz.

    \section{New section}
    This is my first theorem. \myno\\ % Note that I have no compulsory label argument here. It is automatically labelled.
    This is my second theorem. \myno\\
    By \NewLast it is evident that bla bla bla.\\ % Here the labels are referred.
    By \NewLLast it is evident that bla bla bla.\\
\end{document}

相关内容