Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{article}
- usepackage[style=authoryear]{biblatex}
- DeclareSourcemap{maps[datatype = bibtex]{map{
- %% 1. Find year in brackets and sort them as if they were without brackets
- step[fieldsource = year,
- match = regexp{A[(.+)]z}, final]
- step[fieldset = sortyear, fieldvalue = {$1}]
- %% 2. Abbreviate an entry such as Adam J[ohn] Smith to Smith, Adam J.
- step[fieldsource = author,
- match = regexp{[[^]]+]},
- replace = .]
- %% 3. Change US postal codes such as 'MA' to 'StateMA'
- step[fieldsource = location,
- match = regexp{,s*(MA|CA|NY)},
- replace = regexp{,~\State{$1}}]
- }}}
- % then change 'StateMA' etc. to AP style abbreviations 'Mass.' etc.
- defState#1{csname State#1endcsname}
- defStateMA{Mass.}
- defStateCA{Calif.}
- defStateNY{N.Y.}
- begin{filecontents}{jobname.bib}
- @ARTICLE{western1889,
- AUTHOR = "Aug[ust] Western",
- TITLE = "Kurze darstellung des norwegischen lautsystems",
- JOURNALTITLE = "Phonetische Studien",
- YEAR = "1889",
- PAGES = "259--282",
- VOLUME = "2"}
- @BOOK{lehiste1970,
- AUTHOR = "Ilse Lehiste",
- TITLE = "Suprasegmentals",
- YEAR = "1970",
- LOCATION = "Cambridge, MA",
- PUBLISHER = "The M.I.T. Press"}
- @BOOK{hoff1946,
- AUTHOR = "Ingeborg Hoff",
- TITLE = "Skjetvem{aa}let",
- YEAR = "1946",
- LOCATION = "Oslo",
- NUMBER = "1",
- PUBLISHER = "Jacob Dybwad",
- SERIES = "Skrifter utgitt av Det Norske Videnskaps-Akademi i Oslo. II. Historisk-filosofisk klasse. 1946"}
- @INCOLLECTION{hoff1968,
- AUTHOR = "Ingeborg Hoff",
- BOOKTITLE = "Aurskog og Blaker",
- EDITOR = "[Eyvind Lillevold]",
- TITLE = "M{aa}let i Aurskog og Blaker",
- YEAR = "[1968]",
- LOCATION = "[Aurskog og Blaker]",
- PAGES = "685--752",
- PUBLISHER = "Bygdeboknemnda for Aurskog og Blaker",
- VOLUME = "3"}
- end{filecontents}
- addbibresource{jobname.bib}
- begin{document}
- nocite{*}
- printbibliography
- end{document}
- documentclass{article}
- usepackage[style=authoryear]{biblatex}
- DeclareSourcemap{
- maps[datatype = bibtex]{
- map{%% 1. Find year in brackets and sort them as if they were without brackets
- step[fieldsource = year,
- match = regexp{A[(.+)]z}, final]
- step[fieldset = sortyear, fieldvalue = {$1}]
- }
- map{%% 2. Abbreviate an entry such as Adam J[ohn] Smith to Smith, Adam J.
- step[fieldsource = author,
- match = regexp{[[^]]+]},
- replace = .]
- }
- map{%% 3. Change US postal codes such as 'MA' to 'StateMA'
- step[fieldsource = location,
- match = regexp{,s*(MA|CA|NY)},
- replace = regexp{,~\State{$1}}]
- }
- }
- }
- % then change 'StateMA' etc. to AP style abbreviations 'Mass.' etc.
- newcommand{State}[1]{csname State#1endcsname}
- newcommand{StateMA}{Mass.}
- newcommand{StateCA}{Calif.}
- newcommand{StateNY}{N.Y.}
- begin{filecontents}{jobname.bib}
- @ARTICLE{western1889,
- AUTHOR = "Aug[ust] Western",
- TITLE = "Kurze darstellung des norwegischen lautsystems",
- JOURNALTITLE = "Phonetische Studien",
- YEAR = "1889",
- PAGES = "259--282",
- VOLUME = "2"}
- @BOOK{lehiste1970,
- AUTHOR = "Ilse Lehiste",
- TITLE = "Suprasegmentals",
- YEAR = "1970",
- LOCATION = "Cambridge, MA",
- PUBLISHER = "The M.I.T. Press"}
- @BOOK{hoff1946,
- AUTHOR = "Ingeborg Hoff",
- TITLE = "Skjetvem{aa}let",
- YEAR = "1946",
- LOCATION = "Oslo",
- NUMBER = "1",
- PUBLISHER = "Jacob Dybwad",
- SERIES = "Skrifter utgitt av Det Norske Videnskaps-Akademi i Oslo. II. Historisk-filosofisk klasse. 1946"}
- @INCOLLECTION{hoff1968,
- AUTHOR = "Ingeborg Hoff",
- BOOKTITLE = "Aurskog og Blaker",
- EDITOR = "[Eyvind Lillevold]",
- TITLE = "M{aa}let i Aurskog og Blaker",
- YEAR = "[1968]",
- LOCATION = "[Aurskog og Blaker]",
- PAGES = "685--752",
- PUBLISHER = "Bygdeboknemnda for Aurskog og Blaker",
- VOLUME = "3"}
- end{filecontents}
- addbibresource{jobname.bib}
- begin{document}
- nocite{*}
- printbibliography
- end{document}
Add Comment
Please, Sign In to add comment