My .bib
file is using US postal codes as abbreviations for US states (CA and MA for California and Massachusetts). For a paper I'm writing, these need to be changed to abbreviations such as Calif.
and Mass.
(cf. Wikipedia).
I'd prefer not to change my .bib
file, but instead include a command in my preamble that says "When the entry LOCATION
in the .bib
file has strings such as , CA
, , MA
, etc., then substitute these with , Calif.
, , Mass.
, etc.". (I've added a comma plus space before the strings to be absolutely certain that it doesn't catch any two-letter strings that aren't US states - not that I know right now what that would be, but just in case).
MWE:
\documentclass{article}
\usepackage[style=authoryear]{biblatex}
\begin{filecontents}{\jobname.bib}
@BOOK{lehiste1970,
AUTHOR = "Ilse Lehiste",
TITLE = "Suprasegmentals",
YEAR = "1970",
LOCATION = "Cambridge, MA",
PUBLISHER = "The M.I.T. Press"}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{lehiste1970}
\printbibliography
\end{document}
This should read
Lehiste, Ilse (1970). Suprasegmentals. Cambridge, Mass.: The M.I.T. Press.
.tex
file that I can simply comment out whenever I don't need it. All my otherbiblatex
tweaks are in my preamble too - delving into.bst
files seems a bit too complicated for me.@STRING{ak.us = "Alaska"}
in one versus@STRING{ak.us = "AK"}
in the other, and then you just include the desired one as the first bib file in your list. The only extra effort is in composing yourLOCATION
fields in your bib file asLOCATION = "Fairbanks, " # ak.us,
.tex
preamble that searches for a specific string in a specific entry in the.bib
file and then replaces that string with another string, I'd prefer to go with such an approach (which in the end seems like an easier solution).