2

enter image description here

I have some problems with the bibliography of my thesis and Jabref. I don't understand why some URL or DOI go out the borders... Can you help me?

\documentclass{article}
\usepackage[backend=bibtex,style=phys,biblabel=brackets,natbib=true,sorting=none,url=true,hyperref=auto]{biblatex}

\addbibresource{tesi.bib}

\usepackage[autostyle=true]{csquotes}

\begin{document}

\setcounter{biburlnumpenalty}{8000}

\printbibliography[heading=bibintoc]

\end{document}
  • 1
    This has nothing to do with poor old JabRef… Simply, LaTeX, by default, cannot hyphenate url's anywhere. You have to customise the rules for hyphenating url's. Other possibility, asking for urls to start a new line. – Bernard Jul 23 '17 at 14:23
  • Thanks for the answer... How can I do that? And why some links cannot hyphenate and others do? – Sebastiano Jul 23 '17 at 14:28
  • 3
    Could you post a full compilable code+ the problematic bibliography items? – Bernard Jul 23 '17 at 15:09
  • 1
    Can you please add a minimal working example with bibliography (MWEB) so we can reproduce your problem? – samcarter_is_at_topanswers.xyz Jul 23 '17 at 15:09
  • 2
    @Sebastiano Thanks for the code. Can you please complete it with the bib entries that don't work? – samcarter_is_at_topanswers.xyz Jul 23 '17 at 19:18
3

Because we have no bib entrys you use I simply used the example bib file biblatex-examples.bib. The bib entrys kastenholz,sigfridsson,ctan,markey have dois and urls included to test the code.

To get a better layout add the three following lines to your code:

\setcounter{biburlnumpenalty}{8000} % <=================================
\setcounter{biburlucpenalty}{8000}  % <=================================
\setcounter{biburllcpenalty}{8000}  % <=================================

You can change the number 8000 as you need (1 to 10000).

With the following MWE I have no problems with the margins and dois or urls:

\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Article{Hsi_JACS_1975, 
  author = {Edward Hsi and Robert G. Bryant}, 
  title = {Nuclear magnetic resonance relaxation in frozen lysozyme solutions}, 
  journal = {J. Am. Chem. Soc.}, 
  year = {1975}, 
  volume = {97}, 
  number = {11}, 
  pages = {3220--3221}, 
  doi = {10.1021/ja00844a051}, 
  eprint = {dx.doi.org/10.1021/ja00844a051}, 
  url = {dx.doi.org/10.1021/ja00844a051}, 
}
@Article{Brovchenko_ChemPhysChem_2008, 
  author = {Ivan Brovchenko and Alla Oleinikova}, 
  title = {Multiple Phases of Liquid Water}, 
  journal = {Chem\-PhysChem}, 
  year = {2008}, 
  volume = {9}, 
  number = {18}, 
  pages = {2660--2675}, 
  issn = {1439-7641}, 
  doi = {10.1002/cphc.200800639}, 
  keywords = {percolation, phase diagrams, phase transitions, 
      supercritical fluids, thermodynamics}, 
  publisher = {WILEY-VCH Verlag}, 
  url = {dx.doi.org/10.1002/cphc.200800639}, 
}
\end{filecontents}


\documentclass{article}
\usepackage[%
  backend=bibtex,
  style=phys,
  biblabel=brackets,
  natbib=true,
  sorting=none,
  url=true,
  hyperref=auto
]{biblatex}
\usepackage[autostyle=true]{csquotes}

\addbibresource{biblatex-examples.bib}
\addbibresource{\jobname.bib}

\setcounter{biburlnumpenalty}{8000} % <=================================
\setcounter{biburlucpenalty}{8000}  % <=================================
\setcounter{biburllcpenalty}{8000}  % <=================================


\begin{document}

Test \cite{kastenholz,sigfridsson,ctan,markey} 
test \cite{Hsi_JACS_1975,Brovchenko_ChemPhysChem_2008} test

\printbibliography[heading=bibintoc]

\end{document}

with the resulting page:

bibliography

Please try this MWE with your own bib entrys. If you still have problems please add theese bib entrys to your question. Then we can test them on our computers ...

  • Here the word "lysozyme" goes out the margins! – Sebastiano Aug 14 '17 at 7:41
  • @Article{Brovchenko_ChemPhysChem_2008, author = {Ivan Brovchenko and Alla Oleinikova}, title = {Multiple Phases of Liquid Water}, journal = {ChemPhysChem}, year = {2008}, volume = {9}, number = {18}, pages = {2660--2675}, issn = {1439-7641}, doi = {10.1002/cphc.200800639}, keywords = {percolation, phase diagrams, phase transitions, supercritical fluids, thermodynamics}, publisher = {WILEY-VCH Verlag}, url = {dx.doi.org/10.1002/cphc.200800639}, } – Sebastiano Aug 14 '17 at 7:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.