假设我们写一份调查问卷。我们需要统计已审阅的论文数量。最简单的方法是创建一个计数器,例如,在每个 处refsRev
添加。1
\cite
我创建了 newcommand \rcite
,它包装\cite
并添加1
到refsRevS
计数器。但是,如果有更通用的决定就更好了。
解决问题的一个可能方法是在 bib-entries 中创建一个特殊字段(一个字段note
用于其他目的)。然后,如果 bib-entries 中存在此字段(或者我们可以检查条目内的值),则计算引用,例如在 内citenum
。
我尝试过另一种可能的解决问题的方法:创造一个特殊的环境。然而
citenum
,它工作正常,但biblatex
坏了biber
- 我不知道如何在环境开始和环境结束时保存当前引用的数量(没有重复)
作为 MWE,我们可以使用给定的 MWE这里 经过一些修改。也许,可以使用某种方式assoccnt
包,因为它是通过埃格尔用于计数章节在这里
这是我的 MWE:
MyBook.tex
:
\documentclass[a5paper,10pt,twoside,openany,article]{memoir}
\usepackage[backend=biber,bibencoding=utf8,sorting=none,]{biblatex}[2014/06/25]
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@misc{A01,
author = {Author, A.},
year = {2001},
title = {Alpha}
}
@misc{B02,
author = {Buthor, B.},
year = {2002},
title = {Betta}
}
@misc{C03,
author = {Cuthor, C.},
year = {2003},
title = {Charlie}
}
@misc{D04,
author = {Duthor, D.},
year = {2004},
title = {Delta}
}
@misc{E05,
author = {Euthor, D.},
year = {2005},
title = {Eelta}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\usepackage{etoolbox}
\usepackage{totcount,assoccnt}
% http://texblog.org/2012/04/16/counting-the-total-number-of/
\newtotcounter{citenum} %total counter for references %broken
\def\oldcite{}
\let\oldcite=\bibcite
\def\bibcite{\stepcounter{citenum}\oldcite}
% attempt to create an environment
\newcounter{refsRev} %counter for total citings in environment countRefs
\newcounter{atBeginOfCountRefs} % save a current number of citings at the begining of env
\newcounter{atEndOfCountRefs} % save a current number of citings at the end of env
\newenvironment{countRefs}{
% 1) save number of references at the begining and at the end of environment
% 2) calculate the differense between them
% 3) add to refsRev the current values of counters
%\addtocounter{refsRev}{\numexpr\value{atBeginOfCountRefs}-\value{atEndOfCountRefs}\relax}
}
% new cite-like command, seems to be safe, i.e. with the same properities as \cite[]{}
\newcounter{refsRevS}
\newcommand{\rcite}[2][]{\cite[#1]{#2}\addtocounter{refsRevS}{1}}
\begin{document}
Here we need to mention that there are \therefsRev $\:$ references in some parts of text, which are wrapped by our environment countRefs.
This document contains \total{citenum} references (possibly with multiple citations). %broken
\section{First}
Some text \autocite{A01}.
\begin{countRefs}
Here we begin review papers.
Some text \autocite{B02} = \rcite{B02}
Some text \autocite{B02}. % this value should be deleted
\section{Second}
Some text \autocite{C03}.
Some text \autocite{D04}.
Here we temporary stop review papers.
\end{countRefs}
Some text \autocite{A01}.
The current number of refsRev papers is ... % 3 papers
\section{Third}
\begin{countRefs}
Continuation of papers review.
Some text \cite[p.2~]{E05} = \rcite[p.2~]{E05}
Some text \autocite{D04}.
End of papers review.
\end{countRefs}
The current number of refsRev papers is ... % 4 papers
The current number of refsRevS papers is \therefsRevS.
\end{document}
问题是如何获得上述两个决定中的一个来计算调查文件的数量?
未指定译文:\rcite
如果有机会通过引用添加到用于环境的计数器中,即混合这两种方法, 那就太好了。