]> git.donarmstrong.com Git - don.git/blob - posts/biblatex_ajhg_style.mdwn
creating tag page tags/latex
[don.git] / posts / biblatex_ajhg_style.mdwn
1 [[!meta title="Biblatex format for AJHG"]]
2
3 I'm working on a paper on the genetic basis of lupus, which I'm
4 submitting to the
5 [American Journal of Human Genetics](http://www.cell.com/AJHG/), and
6 since I've recently switched to the wonderful
7 [biblatex](http://www.ctan.org/pkg/biblatex) and
8 [biber](http://biblatex-biber.sourceforge.net/) from the standard
9 bibtex, I've had to figure out how to customize the bibliography and
10 citation format to fit the
11 [standards of the journal](http://images.cell.com/images/EdImages/ajhg/AJHG_Information_for_Authors.pdf).
12 Luckily, there are lots of good examples on
13 [TeX's stackexchange](http://tex.stackechange.com), which enabled me
14 to figure out how to do all of this.
15
16 The following code in the preamble does almost all of the hard lifting:
17
18      \usepackage[backend=biber,hyperref=true,doi=false,url=false,isbn=false,maxbibnames=10,minbibnames=10,sorting=none,firstinits=true,autocite=superscript,style=numeric-comp]{biblatex}
19      \renewbibmacro{in:}{%
20        \ifentrytype{article}{}{%
21        \printtext{\bibstring{in}\intitlepunct}}}
22      % from http://tex.stackexchange.com/questions/12806/guidelines-for-customizing-biblatex-styles
23      \DeclareFieldFormat
24        [article,inbook,incollection,inproceedings,patent,thesis,unpublished,manual]
25        {title}{#1\isdot}
26      \DeclareFieldFormat{journaltitle}{#1}
27      \DeclareFieldFormat[article,periodical]{volume}{\mkbibemph{#1}}
28      \DeclareFieldFormat{year}{(#1)}
29      \DeclareNameAlias{default}{last-first}
30      \DeclareFieldFormat{pages}{#1}
31      %\renewbibmacro{journal}{#1}%
32      % from http://tex.stackexchange.com/questions/6743/biblatex-changing-the-order-of-entries
33      \renewbibmacro*{journal+issuetitle}{%
34      %   \setunit*{\addspace}%
35      %   (\printfield{year})%
36      %  \usebibmacro{date}%
37        \setunit*{\addspace}%
38        \usebibmacro{journal}%
39        \setunit*{\addspace}%
40        \iffieldundef{series}
41          {}
42          {\newunit
43           \printfield{series}%
44           \setunit{\addspace}}%
45         \newunit%
46        \printfield{volume}%
47      %  \setunit{\addspace}% DELETED
48      %  \usebibmacro{issue+date}% DELETED
49      %  \setunit{\addcolon\space}% DELETED
50      %  \usebibmacro{issue}% DELETED
51        \newunit}
52      \renewbibmacro*{title}{%
53        \printfield{year}%
54        \setunit*{\addspace}%
55        \newunit
56        \ifboolexpr{
57          test {\iffieldundef{title}}
58          and
59          test {\iffieldundef{subtitle}}
60        }
61          {}
62          {\printtext[title]{%
63             \printfield[titlecase]{title}%
64             \setunit{\subtitlepunct}%
65             \printfield[titlecase]{subtitle}}%
66           \newunit}%
67        \printfield{titleaddon}}
68      \renewbibmacro*{publisher+location+date}{%
69        \setunit*{\addspace}%
70        \printtext[parens]{\printlist{location}%
71        \iflistundef{publisher}
72          {\setunit*{\addcomma\space}}
73          {\setunit*{\addcolon\space}}%
74        \printlist{publisher}%
75      %  \setunit*{\addcomma\space}%
76      %  \usebibmacro{date}%
77        }%
78        \newunit}
79
80 This, coupled with:
81
82      \newcommand{\citep}[1]{\autocite{#1}}
83      \newcommand{\citet}[1]{\citeauthor{#1}\autocite{#1}}
84
85 enables my standard natbib workflow of \citep and \citet to work
86 properly too. Eventually I'll move to just using \autocite everywhere,
87 but for now, that's good enough.
88
89 [[!tag latex tech biblatex]]