# Custom bibliography style in ShareLaTeX

I want to use a particular bibliography style in ShareLaTeX but I don't think it's standard. As a result, I need a way to customise it. If it can't be done in ShareLaTeX (although this is really what I need), a solution in standard LaTeX is also appreciated.

I'm currently using biblatex, but I don't really care what it is so long as it gets the desired result.

I would like referencing to look like this in the text1, 3-5

And for the referencing in the bibliography to look like it does below, namely I'd like the numbers in square brackets on the left and the title left out of the citation.

It's very hard to promise that this is quite right, because there are many distinctive features of your preferred style (quite apart from those you draw attention to) which I may not have picked up, and you don't give us sample data to work from. So you will need to check a sample of typical types of literature (e.g., usually, at least a book, an article, a paper in a collection, and in each case with and without DOI and URL information) an may need to refine. Your example also shows some colouring, but it's not clear whether that matters to you.

All that being said, I think the nature style gets you very close, and it's best to start from that and then modify it. It's a style available in TeXlive, so I am assuming it is on Sharelatex, which I don't use.

The modifications are then easy:

• To get superscript citations, compressed and sorted (as your example is), simply use \autocite (or \supercite), which is standard \autocite command for the nature style.

• To lose the titles of journal articles, pass biblatex the option articletitle=false.

• To substitute labels in brackets for the default in nature which is a label with a dot, add \Declarefieldformat{labelnumberwidth}{\mkbibbrackets{#1}} in your preamble.

With those three changes, and using some samples from the default example .bib file, I get the following, which seems pretty close to what you have specified.

EDITED TO ADD (As an object lesson in why these things require precision, having got this I realised a problem: nature uses last-first names, whereas your examples use first-last. To achieve that, we need to make one further modification to the name format, shown in the code below.)

I haven't tested it on Sharelatex can't see any reason why it should't work in any reasonably standard TeX setup.

Full source (amended in light of comment below) for that:

\documentclass{article}
\usepackage[style=nature,articletitle=false]{biblatex}
\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}}
\DeclareNameAlias{default}{given-family}
\begin{document}

A citation\autocite{bertram,springer,cotton}

\printbibliography
\end{document}

• Instead of your \DeclareNameFormat{default} I'd just use \DeclareNameAlias{default}{given-family} together with the firstinits=true option (if necessary with nature - maybe some of it is the default, haven't checked). I try to avoid changing the name format as long as possible. – moewe Apr 23 '17 at 10:19
• Sorry. Quite right. I wasn't thinking straight! I'll change the code. – Paul Stanley Apr 23 '17 at 10:31
• I can't thank you enough for this, it's a tremendous help. I apologise for the lack of necessary information. I have DOI and URL information for almost every entry (eg doi={10.1063/1.4899057}, url={doi.org/10.1063/1.4899057} in .bib file), where the URL is the URL form of the DOI. Is there a way to make those with URLs become hyperlinks, without writing the DOI or URL itself? That's what the blue is in the above example, although I'd prefer it if mine weren't coloured. – Ben Jones Apr 23 '17 at 14:31
• Just load hyperref after biblatex and links will be clickable: colorisation is a matter for hyperref (consult its documentation). I also think you should \renewcommand{\newunitpunct}{\addcomma\space} because that seems to be more consistent with the style you have. – Paul Stanley Apr 23 '17 at 14:51
• Ah, didn't realise you had to load it after! Is there a way to do it without having the URL physically in the bibliographies though? As in, the journal, issue and article number become the link? Similar to reference 2,5,6,7 etc in the example – Ben Jones Apr 23 '17 at 16:00