[Tex/LaTex] Citing patents using biblatex

biblatex

I'm trying to use biblatex to cite patents. I don't need a formal bibliography; I just want inline citations.

Given:

@Patent{edison793,
 author = {Edison, Thomas},
 number = {266793},
}
@Patent{edison580,
 author = {Edison, Thomas},
 number = {297580},
}

I'd like to be able to cite in three ways:

  1. Edison teaches…
  2. This is anticipated by the teaching of Edison (266,793)
  3. Edison '793 can be distinguished from Edison '580…

I'm at a loss as to how to actually accomplish citation in the formats I'd like using biblatex. How should I start? Do I have to create an entire custom style? (Again, I don't need the formal bibliography displayed, I just want these three ways of being able to cite).

Best Answer

This problem can be simplified by putting restrictions on the data found in the number field and using existing citation commands.

Here I've assumed that patent numbers contain at least three consecutive digits. The numbers can have an alphabetic prefix or suffix, possibly with a dash separator. New field formats are defined to add a thousands separator in patent numbers. This is done via some hacks based on the numprint package. The three citation variants you're wanting can be achieved on the basis of any standard author-year citation style.

\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}

enter image description here

With the compact author-year citation styles, citations lists are sorted according to the scheme specified by the sorting option. Compact lists can look awkward with a mix of patents and other entry types. See the list by Sorace et al. above, for example.

To avoid this we can incorporate number into sorting with biber as the backend and \DeclareSortingScheme. Since other entry types might use number, we can configure biber to copy patent numbers to an empty field, say, 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>

Just save this as biber.conf in the same folder as the above document. In the document preamble we can modify the nyt scheme to include 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}
  }
}

By default a minimum value is used as a fallback for usera. So under this scheme non-patent entries appear first in a compact citation list.

Loading biblatex with

\usepackage[backend=biber,style=authoryear-comp,sorting=nyt,%
            uniquename=init,uniquelist=false]{biblatex}

now gives the following output.

enter image description here