\citeform 取决于计数器的值

\citeform 取决于计数器的值

我继承了一种 LaTeX 样式,它区分了两种类型的参考文献(选定的自己的作品、其他作品)。前者应该以“[R1]”的形式出现,后者则以“[4]”的格式出现。

实现此目的的方法是定义不同的书目类型。如果某个条目属于第一个类别,则其计数器值将增加 1000。这确实有效。

样式文件中还有一个\citeform命令,它应该用“R”和原始计数器值(即 num-1000)替换引用键 > 1000。

由于某种原因,第二部分不起作用,引用保持其编号 1001、1002 等。

这是一个简单的例子:

\documentclass[11pt,DIV11,BCOR10mm,twoside]{scrartcl}

\input{style.sty}

\begin{document}

  Citation test \cite{P5:test}.

  Does this work? \cite{test}


  \section{References}

  \begin{projectbibliography}
    \Bibitem{P5:test}  own paper number 1
  \end{projectbibliography}


  \begin{otherbibliography}
    \Bibitem{test}  other paper number 1
  \end{otherbibliography}

\end{document}

以下是 style.sty 的内容:

\makeatletter

\newif\if@SFB
\@SFBfalse
\newbox\@SFB
\newbox\@BULLET
\newcount\my@bibcount
\newcount\my@bibcountP
\newcount\my@bibtempcount

\newenvironment{subbibliography}[2]%
     { 
       \global\setbox\@SFB=\hbox{#1}\ifdim \wd\@SFB>0pt%
       \global\@SFBtrue \else \global\@SFBfalse %%%%%%%%%%\subsubsection*{#1\@mkboth{\MakeUppercase#1}{\MakeUppercase#1}}
       \fi%
       \global\setbox\@BULLET=\hbox{#2}%
      \list{%% DEFINE HOW THE ITEM APPEARS
        %% save list position
        \my@bibtempcount=\c@enumiv%
        %% add bibcounter
        \if@SFB%
        \advance\my@bibtempcount by \my@bibcountP%
        \else%
        \advance\my@bibtempcount by \my@bibcount%
        \fi%
        %% make label
        \@biblabel{%%%%%%%%%%%%%%%%%%\unhcopy\@BULLET% for bullet in brackets
          \unhcopy\@SFB\@arabic\my@bibtempcount}}%
%      \list{\@biblabel{\unhcopy\@SFB\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{%%%%%%%%%%%%%%%%%%\unhcopy\@BULLET% for bullet in brackets
                 \unhcopy\@SFB99}}%
            \leftmargin\labelwidth%
            \advance\leftmargin\labelsep%
            \@openbib@code%
            \usecounter{enumiv}%
            \let\p@enumiv\@empty%
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy%
      \clubpenalty4000%
      \@clubpenalty \clubpenalty%
      \widowpenalty4000%
      \sfcode`\.\@m%
    }
     {\def\@noitemerr%
       {\@latex@warning{Empty `subbibliography' environment}}%
       %% save bibcounter
       \if@SFB%
       \global\advance\my@bibcountP by \c@enumiv%
       \else%
       \global\advance\my@bibcount  by \c@enumiv%
       \fi%
       \endlist}
\newenvironment{otherbibliography}{\begin{subbibliography}{}{}}{\end{subbibliography}}
\newenvironment{projectbibliography}{\begin{subbibliography}{R}{}}{\end{subbibliography}}
%%%%%% Neues token fuer bibitem
\def\Bibitem{\@ifnextchar[\@lbibitem\@Bibitem}
\def\@Bibitem#1{\count255=\the\value{\@listctr}%
                \if@SFB%
                \advance\count255 by \my@bibcountP%
                \advance\count255 by 1001%
                \else%
                \advance\count255 by \my@bibcount%
                \advance\count255 by 1%
                \fi%
                \item\if@filesw %
                \immediate\write\@auxout{\string\bibcite{#1}{\the\count255}}\fi%
                \unhcopy\@BULLET% bullet comes AFTER bibitem
                \ignorespaces%               
              }
%              
\providecommand\citeform[1]{{\def\@b@b{#1}\if ?\@b@b \@b@b \else  \count255=#1 \ifnum #1>1000\count255=#1
\loop\ifnum\count255>1000\advance\count255 by -1000
\repeat P\the\count255\else\the\count255\fi\fi}}
\makeatother

\endinput

答案1

您还必须加载包cite,但是你的style包。这样命令\citeform就会完成它的工作。否则它永远不会被调用。

相关内容