2

I'm having trouble formatting the references. I have to prepare whole text using font 11 and single line spacing. Also I want to save space in references by removing new line when next bibitem is printed. Also I want the reference numbers to be in bold. I have achieved both of these, but the font in references is somehow compressed relative to the rest of the text.

If possible, I'd like also to change the format of references:

  • order: authors, year, title, journal, journal information
  • remove extra space in [ 1], so that it looks like [1]
  • transform each entry into a link to an url with given article

I couldn't find a documentation which explains how to manually format references. I don't have to stick to biblatex, so if my requirements can be achieved using natbib or cite packages, then that's fine for me. For compilation I'm using overleaf with default settings.

Edit: the comment by @daleif solved most problems and I've crossed them out. The code and image are updated.

Here's my current version:

enter image description here

\documentclass[11pt]{article}
\usepackage{lipsum}
\usepackage[doi=false,isbn=false,url=false,eprint=false]{biblatex}
\addbibresource{bibinfo.bib}
\defbibenvironment{bibliography}
  {\noindent}
  {\unspace}
  {\textbf{\printtext[labelnumberwidth]{%
    \printfield{labelprefix}%
     \printfield{labelnumber}}}%
   \addspace}
\renewbibmacro*{finentry}{\finentry\addspace}

\begin{document}

\lipsum[1-1]

See also \cite{duquennoy91} and \cite{dwek95}. Also \cite{duquennoy91,dwek95,feroz08}.

\printbibliography[heading=none]

\end{document}
@ARTICLE{duquennoy91,
   author = {{Duquennoy}, A. and {Mayor}, M.},
    title = "{Multiplicity among solar-type stars in the solar neighbourhood. II - Distribution of the orbital elements in an unbiased sample}",
  journal = {\it A\&A},
 keywords = {Binary Stars, Dwarf Stars, G Stars, Solar Neighborhood, Stellar Orbits, Brown Dwarf Stars, Orbital Elements, Peculiar Stars, Radial Velocity, Stellar Evolution, Variable Stars},
     year = 1991,
    month = aug,
   volume = 248,
    pages = {485-524},
   adsurl = {http://adsabs.harvard.edu/abs/1991A%26A...248..485D},
  adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

@ARTICLE{dwek95,
   author = {{Dwek}, E. and {Arendt}, R.~G. and {Hauser}, M.~G. and {Kelsall}, T. and 
    {Lisse}, C.~M. and {Moseley}, S.~H. and {Silverberg}, R.~F. and 
    {Sodroski}, T.~J. and {Weiland}, J.~L.},
    title = "{Morphology, near-infrared luminosity, and mass of the Galactic bulge from COBE DIRBE observations}",
  journal = {\it ApJ},
 keywords = {COSMIC BACKGROUND EXPLORER SATELLITE, GALACTIC BULGE, GALACTIC MASS, IMAGE PROCESSING, LUMINOSITY, MORPHOLOGY, NEAR INFRARED RADIATION, ASTRONOMICAL MODELS, GALACTIC STRUCTURE, MAPPING, STAR DISTRIBUTION, STELLAR EVOLUTION},
     year = 1995,
    month = jun,
   volume = 445,
    pages = {716-730},
      doi = {10.1086/175734},
   adsurl = {http://adsabs.harvard.edu/abs/1995ApJ...445..716D},
  adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

@ARTICLE{feroz08,
   author = {{Feroz}, F. and {Hobson}, M.~P.},
    title = "{Multimodal nested sampling: an efficient and robust alternative to Markov Chain Monte Carlo methods for astronomical data analyses}",
  journal = {\it MNRAS},
archivePrefix = "arXiv",
   eprint = {0704.3704},
 keywords = {methods: data analysis, methods: statistical},
     year = 2008,
    month = feb,
   volume = 384,
    pages = {449-463},
      doi = {10.1111/j.1365-2966.2007.12353.x},
   adsurl = {http://adsabs.harvard.edu/abs/2008MNRAS.384..449F},
  adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
4
  • 1
    Do you want to add an URL link to each entry or do you want to tranform each entries into links (without printing the URL)?
    – Tom Solid
    Commented Dec 1, 2020 at 9:27
  • Transform each entry into link. I'll correct the post, thanks.
    – rpoleski
    Commented Dec 1, 2020 at 9:32
  • Sporadic spaces: (1) why is there a space before \textbf, additionally, all lines in that definition should be ended with a % to avoid sporadic spaces. Additionally, formating such as \it (depreciated since 1993) has no place in the bib data, should should be a part of the styling.
    – daleif
    Commented Dec 3, 2020 at 11:47
  • Thanks @daleif. You helped me solve the font issue and spaces - I've updated the question. I've move \it there to make the code minimal.
    – rpoleski
    Commented Dec 3, 2020 at 13:45

1 Answer 1

1
+100

As a first note, the documentation explaining all the necessary macros is in biblatex.pdf. Open ist using texdoc biblatex. That said, here's my suggestions:

The General Format

You seem to be writing a document in the field of physics, so I would take the phys style as a starting point. This changes a couple of things about the appearance, all improvements in my view. If you don't like this style, most of the rest of this answer can be easily adapted to work with biblatex defaults.

In order to get the numbers in brackets and the sorting you desire, use the options biblabel=brackets, sorting=nyt. The former is a biblatex-phys option, the latter a general biblatex option.

Formatting has no place in the bib file (and \it has no place in LaTeX). You can easily change it in the preamble, though. To get an italic journal title, use

\DeclareFieldFormat{journaltitle}{\itshape #1}

If you don't like the bold volume numbers used for articles by default, use

\DeclareFieldFormat[article]{volume}{#1}

For inspiration on how to define these things, have a look at phys.bbx.

Making Entries Links

First of all, in order to get hyperlinks you will need to load hyperref. If you do that, biblatex-phys already makes the journal and issue information a link as long as you provide a doi or url. Your first bib entry had neither, so I copied the URL from the non-standard adsurl field into the url field.

You can add the following code to also make article titles links.

\renewbibmacro*{title}{%
  \ifboolexpr{
    test {\iffieldundef{title}}
    and
    test {\iffieldundef{subtitle}}
  }
    {}
    {%
      \printtext[doi/url-link]{%
        \printtext[title]{%
          \printfield[titlecase]{title}%
          \setunit{\subtitlepunct}%
          \printfield[titlecase]{subtitle}%
        }%
      }%
      \newunit
    }%
  \printfield{titleaddon}%
}

One could easily extend this to the whole entry, but I prefer having the author names not be links.

Additional Notes

If present, biblatex automatically loads the file biblatex.cfg, so you can put any configuration code changing the bibliography there, which is what I did below. This unclutters your preamble a bit and also makes it easier to use the same configuration in several documents.

Not that the fields journal, year and month are BibTeX fields and it is preferable to use journaltitle and date with biblatex. As with all the rest, you can find more information in the biblatex documentation.


\begin{filecontents}[nosearch, overwrite]{bibinfo.bib}
@article{duquennoy91,
   author = {{Duquennoy}, A. and {Mayor}, M.},
    title = "{Multiplicity among solar-type stars in the solar neighbourhood. II - Distribution of the orbital elements in an unbiased sample}",
  journal = {A\&A},
 keywords = {Binary Stars, Dwarf Stars, G Stars, Solar Neighborhood, Stellar Orbits, Brown Dwarf Stars, Orbital Elements, Peculiar Stars, Radial Velocity, Stellar Evolution, Variable Stars},
     year = 1991,
    month = aug,
   volume = 248,
    pages = {485-524},
      url = {http://adsabs.harvard.edu/abs/1991A%26A...248..485D},
   adsurl = {http://adsabs.harvard.edu/abs/1991A%26A...248..485D},
  adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

@article{dwek95,
   author = {{Dwek}, E. and {Arendt}, R.~G. and {Hauser}, M.~G. and {Kelsall}, T. and 
    {Lisse}, C.~M. and {Moseley}, S.~H. and {Silverberg}, R.~F. and 
    {Sodroski}, T.~J. and {Weiland}, J.~L.},
    title = "{Morphology, near-infrared luminosity, and mass of the Galactic bulge from COBE DIRBE observations}",
  journal = {ApJ},
 keywords = {COSMIC BACKGROUND EXPLORER SATELLITE, GALACTIC BULGE, GALACTIC MASS, IMAGE PROCESSING, LUMINOSITY, MORPHOLOGY, NEAR INFRARED RADIATION, ASTRONOMICAL MODELS, GALACTIC STRUCTURE, MAPPING, STAR DISTRIBUTION, STELLAR EVOLUTION},
     year = 1995,
    month = jun,
   volume = 445,
    pages = {716-730},
      doi = {10.1086/175734},
   adsurl = {http://adsabs.harvard.edu/abs/1995ApJ...445..716D},
  adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

@article{feroz08,
   author = {{Feroz}, F. and {Hobson}, M.~P.},
    title = "{Multimodal nested sampling: an efficient and robust alternative to Markov Chain Monte Carlo methods for astronomical data analyses}",
  journal = {MNRAS},
archivePrefix = "arXiv",
   eprint = {0704.3704},
 keywords = {methods: data analysis, methods: statistical},
     year = 2008,
    month = feb,
   volume = 384,
    pages = {449-463},
      doi = {10.1111/j.1365-2966.2007.12353.x},
   adsurl = {http://adsabs.harvard.edu/abs/2008MNRAS.384..449F},
  adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
\end{filecontents}

\begin{filecontents}[nosearch, overwrite]{biblatex.cfg}
\ExecuteBibliographyOptions{
  biblabel=brackets,
  sorting=nyt,
}

\DeclareFieldFormat{journaltitle}{\itshape #1}

\defbibenvironment{bibliography}
  {\noindent}
  {\unspace}
  {\textbf{\printtext[labelnumberwidth]{%
    \printfield{labelprefix}%
     \printfield{labelnumber}}}%
   \addspace}
\renewbibmacro*{finentry}{\finentry\addspace}

\renewbibmacro*{title}{%
  \ifboolexpr{
    test {\iffieldundef{title}}
    and
    test {\iffieldundef{subtitle}}
  }
    {}
    {%
      \printtext[doi/url-link]{%
        \printtext[title]{%
          \printfield[titlecase]{title}%
          \setunit{\subtitlepunct}%
          \printfield[titlecase]{subtitle}%
        }%
      }%
      \newunit
    }%
  \printfield{titleaddon}%
}
\end{filecontents}

\documentclass[11pt]{article}

\usepackage{lipsum}

\usepackage[style=phys]{biblatex}
\usepackage{hyperref}

\addbibresource{bibinfo.bib}

\begin{document}

\lipsum[1-1]

See also \cite{duquennoy91} and \cite{dwek95}. Also \cite{duquennoy91,dwek95,feroz08}.

\printbibliography[heading=none]

\end{document}

MWE output

4
  • 2
    Italics for journal titles really isn't default? I think it is worth pointing out that switching to Biblatex field names is only advisable if you don't need backwards compatibility, which lots of people do.
    – cfr
    Commented Dec 4, 2020 at 5:30
  • Is there a way to limit number of authors displayed? I've added maxcitenames = 2 in \ExecuteBibliographyOptions{}, but nothing changed.
    – rpoleski
    Commented Dec 4, 2020 at 23:05
  • 1
    @rpoleski Use maxnames. maxcitenames is only for in-text citations (which doesn't apply here as you use a numeric style).
    – schtandard
    Commented Dec 5, 2020 at 11:11
  • @schtandard Thanks!
    – rpoleski
    Commented Dec 5, 2020 at 14:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .