adapted reproduction

Latex 常数编号及交叉引用

Latex 小技巧

当同时撰写论文的不同部分时,是否遇到过前文的修改会引起无关常量编号的改变?

Constant宏包年久失修,且和hyperref冲突,不如试试将如下部分加入导言区吧!

\makeatletter
\newcounter{CConst}
\renewcommand{\theCConst}{\ensuremath{C_{\arabic{CConst}}}}
\newcommand{\Const}[1]{
{
\refstepcounter{CConst}
\phantomsection
\protected@edef\@currentlabel{\theCConst}%
\theCConst
\protected@write\@auxout{}{
\string\newlabel{#1}{{\theCConst}{\thepage}}
}
}
}
\newcommand{\CCref}[1]{\ref{#1}}
\makeatother

通过\Const{}或\Const{label}创建新常数,并通过\CCref{label}进行引用。