]> git.donarmstrong.com Git - don.git/blob - posts/biblatex_gi_style.mdwn
creating tag page tags/cluster
[don.git] / posts / biblatex_gi_style.mdwn
1 [[!meta title="Biblatex format for Genes & Immunity"]]
2
3 Here's a biblatex format for
4 [Genes & Immunity](http://www.nature.com/gene/index.html) (a
5 [Nature](http://www.nature.com) imprint) which I needed recently:
6
7 The following code in the preamble does almost all of the hard lifting:
8
9 [[!format tex """
10 \usepackage[backend=biber,hyperref=true,doi=true,url=false,isbn=false,maxbibnames=6,minbibnames=6,sorting=none,firstinits=true,terseinits=true,autocite=inline,style=numeric-comp]{biblatex}
11 \renewbibmacro{in:}{%
12   \ifentrytype{article}{}{%
13   \printtext{\bibstring{in}\intitlepunct}}}
14 % from http://tex.stackexchange.com/questions/12806/guidelines-for-customizing-biblatex-styles
15 \\DeclareCiteCommand{\parencite}[\mkbibbrackets]
16   {\usebibmacro{cite:init}%
17    \usebibmacro{prenote}}
18   {\usebibmacro{citeindex}%
19    \usebibmacro{cite:comp}}
20   {}
21   {\usebibmacro{cite:dump}%
22    \usebibmacro{postnote}}
23 \\DeclareMultiCiteCommand{\parencites}[\mkbibbrackets]{\parencite}{\multicitedelim}
24 \\DeclareFieldFormat
25   [article,inbook,incollection,inproceedings,patent,thesis,unpublished,manual]
26   {title}{#1\isdot}
27 \\DeclareFieldFormat{journaltitle}{\mkbibemph{#1}}
28 \\DeclareFieldFormat[article,periodical]{volume}{\mkbibbold{#1}\addcolon}
29 \\DeclareFieldFormat{year}{#1}
30 \\DeclareNameAlias{default}{last-first}
31 \\DeclareFieldFormat{pages}{#1}
32 % from http://tex.stackexchange.com/questions/17583/biblatex-remove-commas-between-last-and-first-names-in-bibliography
33 % remove commas between authors and first inits
34 \renewcommand*{\revsdnamepunct}{}
35 % from http://tex.stackexchange.com/questions/40798/how-do-i-get-et-al-to-appear-in-italics-when-using-textcite-or-citeauthor-w
36 % make et al. /et al./
37 \renewbibmacro*{name:andothers}{% Based on name:andothers from biblatex.def
38   \ifboolexpr{
39     test {\ifnumequal{\value{listcount}}{\value{liststop}}}
40     and
41     test \ifmorenames
42   }
43     {\ifnumgreater{\value{liststop}}{1}
44        {\finalandcomma}
45        {}%
46      \andothersdelim\bibstring[\emph]{andothers}}
47     {}}
48 % \renewbibmacro{journal}{#1}%
49 % from http://tex.stackexchange.com/questions/6743/biblatex-changing-the-order-of-entries
50 \renewbibmacro*{journal+issuetitle}{%
51   \setunit*{\addspace}%
52   \usebibmacro{journal}%
53   \setunit*{\addspace}%
54   \printfield{year}%
55   \setunit*{\addspace}%
56   \iffieldundef{series}
57     {}
58     {\newunit
59      \printfield{series}%
60      \setunit{\addspace}}%
61   \newunit{\addsemicolon\space}%
62   \printfield{volume}%
63   \setunit*{\addspace}%
64   \newunit
65 }
66 \renewbibmacro*{title}{%
67   \newunit
68   \ifboolexpr{
69     test {\iffieldundef{title}}
70     and
71     test {\iffieldundef{subtitle}}
72   }
73     {}
74     {\printtext[title]{%
75        \printfield[titlecase]{title}%
76        \setunit{\subtitlepunct}%
77        \printfield[titlecase]{subtitle}}%
78      \newunit}%
79   \printfield{titleaddon}}
80 \renewbibmacro*{publisher+location+date}{%
81   \setunit*{\addspace}%
82   \printtext[parens]{\printlist{location}%
83   \iflistundef{publisher}
84     {\setunit*{\addcomma\space}}
85     {\setunit*{\addcolon\space}}%
86   \printlist{publisher}%
87   }%
88   \newunit}
89 """]]
90
91 [[!tag latex tech biblatex]]