Cell Citation Style with groff

For anyone who wants to use the Cell Citation Style for your academic writing with groff: I have figured it out and you can save some time. This blog post should also be an informative starting point for making other citations styles with groff. I highly recommend the refer manpage.

Groff uses GNU refer as a preprocessor for bibliograhic processing. You can write a codeblock that will be interpreted by refer by starting with .R1 and ending with .R2. Here you can specify what labels in the text and the actual citation in the <i>References</i> section should look like.

The bibliography database should also use refer format. For more information check out the refer manpage. Here is an example:

  %K brueser2021
  %A Christian Brüser
  %A Jan Keller-Findeisen
  %A Stefan Jakobs
  %D 2021
  %T The TFAM-to-mtDNA ratio defines inner-cellular nucleoid populations with distinct activity levels
  %J Cell Reports
  %N 37

The groff code using ms macros should look like this:

  .R1
  database reference.bib
  abbreviate %A
  reverse %A
  accumulate
  move-punctuation
  .R2

  .TL
  Example: Implementing the Cell Citation Style with groff
  .AU
  Béla Goertz
  .NH
  Results
  .PP
  A population of inactivated mtDNA is maintained by condensation through the DNA-bindin g protein TFAM.
  .[
  brueser2021
  .]

To compile the code I used the following command:

  refer cell-citation.ms | groff -ms -Tpdf -Kutf8 > cell-citation.pdf

Alternatively you can also invoke refer with the -R option when running groff but I will take any opportunity for piping stdout to stdin because it's so much fun and it makes it more visible what the preprocessors are doing.