]> git.donarmstrong.com Git - don.git/blob - posts/biblatex_ajhg_style.mdwn
add slides for the talk on this work
[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 [[!format tex """
19 \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}
20 \renewbibmacro{in:}{%
21   \ifentrytype{article}{}{%
22   \printtext{\bibstring{in}\intitlepunct}}}
23 % from http://tex.stackexchange.com/questions/12806/guidelines-for-customizing-biblatex-styles
24 \\DeclareFieldFormat
25   [article,inbook,incollection,inproceedings,patent,thesis,unpublished,manual]
26   {title}{#1\isdot}
27 \\DeclareFieldFormat{journaltitle}{#1}
28 \\DeclareFieldFormat[article,periodical]{volume}{\mkbibemph{#1}}
29 \\DeclareFieldFormat{year}{(#1)}
30 \\DeclareNameAlias{default}{last-first}
31 \\DeclareFieldFormat{pages}{#1}
32 %\renewbibmacro{journal}{#1}%
33 % from http://tex.stackexchange.com/questions/6743/biblatex-changing-the-order-of-entries
34 \renewbibmacro*{journal+issuetitle}{%
35 %   \setunit*{\addspace}%
36 %   (\printfield{year})%
37 %  \usebibmacro{date}%
38   \setunit*{\addspace}%
39   \usebibmacro{journal}%
40   \setunit*{\addspace}%
41   \iffieldundef{series}
42     {}
43     {\newunit
44      \printfield{series}%
45      \setunit{\addspace}}%
46    \newunit%
47   \printfield{volume}%
48 %  \setunit{\addspace}% DELETED
49 %  \usebibmacro{issue+date}% DELETED
50 %  \setunit{\addcolon\space}% DELETED
51 %  \usebibmacro{issue}% DELETED
52   \newunit}
53 \renewbibmacro*{title}{%
54   \printfield{year}%
55   \setunit*{\addspace}%
56   \newunit
57   \ifboolexpr{
58     test {\iffieldundef{title}}
59     and
60     test {\iffieldundef{subtitle}}
61   }
62     {}
63     {\printtext[title]{%
64        \printfield[titlecase]{title}%
65        \setunit{\subtitlepunct}%
66        \printfield[titlecase]{subtitle}}%
67      \newunit}%
68   \printfield{titleaddon}}
69 \renewbibmacro*{publisher+location+date}{%
70   \setunit*{\addspace}%
71   \printtext[parens]{\printlist{location}%
72   \iflistundef{publisher}
73     {\setunit*{\addcomma\space}}
74     {\setunit*{\addcolon\space}}%
75   \printlist{publisher}%
76 %  \setunit*{\addcomma\space}%
77 %  \usebibmacro{date}%
78   }%
79   \newunit}
80 """]]
81
82 This, coupled with:
83
84 [[!format tex """
85 \newcommand{\citep}[1]{\autocite{#1}}
86 \newcommand{\citet}[1]{\citeauthor{#1}\autocite{#1}}
87 """]]
88
89 enables my standard natbib workflow of \citep and \citet to work
90 properly too. Eventually I'll move to just using \autocite everywhere,
91 but for now, that's good enough.
92
93 [[!tag latex tech biblatex]]