Skip to content

Instantly share code, notes, and snippets.

@ManuelTS
Last active February 29, 2020 09:52
Show Gist options
  • Save ManuelTS/12f5c5c8c0eebdea6f305f53c4fcf7d6 to your computer and use it in GitHub Desktop.
Save ManuelTS/12f5c5c8c0eebdea6f305f53c4fcf7d6 to your computer and use it in GitHub Desktop.
It was hard to find a simple and short description to change the default BibTeX citation fields. So, here an example of a change from \bibliographystyle{unsrt} @Article one.

Change BibTeX Original BST Files

It was hard to find a simple and short description to change the used citation fields of the standard BibTeX .bst files, which are used by the command \bibliographystyle{}.

All found resources with online search engines were an overhead. Hence:

  1. Locate your .bst files on your system
sudo find $directory -type f -name "*.bst"
  1. Open the path from the biblography style .bst file you want with your favorite editor, e.g. nano
sudo nano ./usr/share/texlive/texmf-dist/bibtex/bst/base/unsrt.bst
  1. Within the file, see how other styles format their output and adapt the styles to your wishes
  2. Example, in \bibliographystyle{unsrt} I changed the function for article:
FUNCTION {article}
{ output.bibitem
  format.authors "author" output.check
  new.block
  format.title "title" output.check
  new.block
  crossref missing$
    { journal emphasize "journal" output.check
      format.vol.num.pages output
      format.date "year" output.check
    }
    { format.article.crossref output.nonnull
      format.pages output
    }
  if$
  new.block
  note output
  fin.entry
}

to

FUNCTION {article}
{ output.bibitem
  format.authors "author" output.check
  new.block
  format.title "title" output.check
  new.block
  crossref missing$
    { journal emphasize "journal" output.check
      format.vol.num.pages output
      new.block
      publisher output
      format.date "year" output.check
    }
    { format.article.crossref output.nonnull
      format.pages output
    }
  if$
  new.block
  note output
  fin.entry
}

To change the citation output from

Henry H. Wilmer, Lauren E. Sherman, and Jason M. Chein. Smartphones and
Cognition: A Review of Research Exploring the Links between Mobile Technology
Habits and Cognitive Functioning. Frontiers in Psychology, 8(3):605 – 621. October 2018.

to this, where the publisher is included

Henry H. Wilmer, Lauren E. Sherman, and Jason M. Chein. Smartphones and
Cognition: A Review of Research Exploring the Links between Mobile Technology
Habits and Cognitive Functioning. Frontiers in Psychology, 8(3):605 – 621. Frontiers,
October 2018.

I hope this helped you to have a simple solution for a simple problem. Have a nice day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment