我正在尝试使用biblatex
它来引用专利。我不需要正式的参考书目;我只想要内联引用。
鉴于:
@Patent{edison793,
author = {Edison, Thomas},
number = {266793},
}
@Patent{edison580,
author = {Edison, Thomas},
number = {297580},
}
我希望能够通过三种方式引用:
- 爱迪生教……
- 爱迪生的教学预见到了这一点(266,793)
- 爱迪生 '793 与爱迪生 '580 有区别……
我不知道如何以我想要的格式完成引用biblatex
。我应该如何开始?我必须创建整个自定义样式吗?(再次强调,我不需要显示正式的参考书目,我只想要这三种引用方式)。
答案1
通过对现场发现的数据进行限制number
并使用现有的引用命令可以简化这个问题。
这里我假设专利号至少包含三个连续的数字。这些数字可以有一个字母前缀或后缀,可能带有破折号分隔符。定义了新的字段格式以在专利号中添加千位分隔符。这是通过一些基于numprint 包。您想要的三种引用变体可以根据任何标准作者年份引用样式实现。
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear-comp,sorting=nyt]{biblatex}
\usepackage[colorlinks]{hyperref}
\usepackage{numprint}
% Just for demonstration
\ExecuteBibliographyOptions{maxnames=1,firstinits}
\makeatletter
% Have \numprint ignore characters in prefix/suffix
\renewcommand*\nprt@ignorelist{-ABCDEFGHIJKLMNOPQRSTUVWXYZ}%
% Patch \numprint to output ignored prefix
\pretocmd{\nprt@testcharacter}
{\nprt@IfCharInString{#1}{\nprt@ignorelist}
{\csxappto{cbx@ignored}{#1}}
{\csuse{cbx@ignored}%
\global\csundef{cbx@ignored}}}
{}{}
% Define "hair" space, breakable with high penalty
\newrobustcmd*{\addhphairspace}{%
\unspace\blx@postpunct
\penalty\value{highnamepenalty}%
\hskip0.0416667em\relax\blx@imc@resetpunctfont}
% Add thousands separator
\newrobustcmd*{\mkbibnumsep}[1]{%
\npthousandsep{\addcomma\addhphairspace}%
\numprint{#1}\csuse{cbx@ignored}%
\global\csundef{cbx@ignored}}
% Modify \numprint to abbreviate numbers by last three digits
\newrobustcmd*{\mkbibnumshort}{%
\let\nprt@printone\cbx@printone%
\let\nprt@printtwo\cbx@printtwo%
\let\nprt@printthree\cbx@printthree}
\def\cbx@printthree#1#2#3#4\@empty{%
\def\nprt@tmp{#4}%
\ifx\nprt@tmp\@empty'#1#2#3%
\else\cbx@printthree#4\@empty\@empty\@empty\fi}
\def\cbx@printtwo#1#2#3\@empty{%
\def\nprt@tmp{#3}%
\ifx\nprt@tmp\@empty
\else\nprt@printthree#3\@empty\@empty\@empty\fi}
\def\cbx@printone#1#2\@empty{%
\def\nprt@tmp{#2}%
\ifx\nprt@tmp\@empty
\else\nprt@printthree#2\@empty\@empty\@empty\fi}
% Use patent number instead of labelyear
\AtEveryCitekey{%
\ifentrytype{patent}
{\savefield{number}{\cbx@number}%
\restorefield{labelyear}{\cbx@number}%
\clearfield{extrayear}%
\let\compcitedelim\multicitedelim}
{}}
\makeatother
\DeclareFieldFormat[patent]{number}{\mkbibnumsep{#1}}
\DeclareFieldFormat[patent]{labelyear}{\mkbibnumsep{#1}}
\newrobustcmd*{\patcite}{\AtNextCite{\mkbibnumshort}\cite}
\begin{filecontents}{\jobname.bib}
@patent{edison,
title = {Electric distribution system},
author = {Edison, Thomas A.},
number = {266793},
type = {patentus},
date = {1882-10-31}}
@patent{sorace:cal,
author = {Sorace, Ronald E. and Reinhardt, Victor S. and Chan, Clinton},
title = {Phase array calibration orthogonal phase sequence},
number = {5861843},
type = {patentus},
date = {1999-01-19}}
@article{sorace:sol,
author = {Sorace, Ronald E. and Lee, E. and Baldauf, J. and Heffernan, P.},
title = {Analysis of solar degradation to {TDRS} {S-band} phased array antenna},
volume = {34},
doi = {10.1109/7.705900},
number = {3},
month = jul,
year = {1998},
pages = {947--954}}
@patent{laufenberg:dev,
author = {Laufenberg, Xaver and Eynius, Dominique and Suelzle, Helmut and Usbeck, Stephan and Spaeth, Matthias and Neuser-Hoffmann, Miriam and Myrzik, Christian and Schmid, Manfred and Nietfeld, Franz and Thiel, Alex ander and Braun and Harald and Ebner, Norbert},
title = {Electrical device and operating method},
number = {8022677},
type = {patentus},
date = {2011-09-20}}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
\citeauthor{almendro} showed that...
Filler text \parencite{almendro}.
\textcite{sorace,sorace:cal,sorace:sol} and \textcite{edison} showed that...
Filler text \parencite{laufenberg,kowalik,laufenberg:dev}.
\patcite{edison}, \patcite{almendro} and \patcite{kowalik} showed that...
\subsection*{Patents}
\printbibliography[heading=none,type=patent]
\subsection*{Other references}
\printbibliography[heading=none,nottype=patent]
\end{document}
使用紧凑的作者-年份引文样式,引文列表将根据选项指定的方案进行排序sorting
。如果混合了专利和其他条目类型,紧凑列表看起来会很别扭。例如,请参阅上文 Sorace 等人的列表。
为了避免这种情况,我们可以将number
biber 作为后端并入排序中\DeclareSortingScheme
。由于其他条目类型可能会使用number
,我们可以配置 biber 将专利号复制到空字段,例如usera
。
<?xml version="1.0" encoding="UTF-8"?>
<config>
<sourcemap>
<maps datatype="bibtex">
<map>
<per_type>PATENT</per_type>
<map_step map_field_source="NUMBER" map_final="1"/>
<map_step map_field_set="USERA" map_origfieldval="1"/>
</map>
</maps>
</sourcemap>
</config>
只需将其保存为biber.conf
与上述文档相同的文件夹即可。在文档序言中,我们可以修改该nyt
方案以包括usera
。
\DeclareSortingScheme{nyt}{
\sort{
\field{presort}
}
\sort[final]{
\field{sortkey}
}
\sort{
\name{sortname}
\name{author}
\name{editor}
\name{translator}
\field{sorttitle}
\field{title}
}
\sort{
\field{usera}
}
\sort{
\field{sortyear}
\field{year}
}
\sort{
\field{sorttitle}
\field{title}
}
\sort{
\field[padside=left,padwidth=4,padchar=0]{volume}
\literal{0000}
}
}
默认情况下,使用最小值作为 的后备usera
。因此,在此方案下,非专利条目首先出现在紧凑的引用列表中。
使用以下方法加载 biblatex
\usepackage[backend=biber,style=authoryear-comp,sorting=nyt,%
uniquename=init,uniquelist=false]{biblatex}
现在给出以下输出。