[Tex/LaTex] Manually breaking a URL (in the bibliography) to avoid overfull hbox

bibliographiesurl

Following suggestions here: Manually breaking a long URL (in the bibliography) and here: How can I break a long URL in bibliography I am trying to insert a break in a .bib file URL that is giving an overfull hbox warning.

This is the code used to create the bibliography:

\documentclass[11pt,twoside]{report}

\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{url}
%\usepackage{hyperref}
\usepackage{siunitx}
\usepackage[backend=biber,style=apa,natbib=true,maxbibnames=7,maxcitenames=3,dashed=false,uniquename=false]{biblatex}

\setcounter{biburllcpenalty}{7000}
\setcounter{biburlucpenalty}{7000}
\setcounter{biburlnumpenalty}{7000}

\addbibresource{bibliography.bib}
\AtBeginDocument{\renewcommand{\bibname}{References}}

\begin{document}
\nocite{*}

\printbibliography

\end{document}

\usepackage{hyperref} is commented out because, when included, the error:

! Paragraph ended before \Hy@setref@link was complete.

occurs.

The entry that gives the warning in the .bib file:

@manual{Ormo15,
  title        = {OrmoComp® and OrmoClear®FX},
  organization = {micro resist technology GmbH},
  address      = {Köpenicker Straße 325, 12555 Berlin, Germany},
  note         = {OrmoComp® and OrmoClear®FX datasheet},
  year = {2015},
  URL = {www.microresist.de/sites/default/files/download/PI_OrmoComp_OrmoClearFX_2015_0.pdf}
}

This is the output:

Screenshot of bibliography entry

Trying to tell LaTeX that it is a URL (before telling it where to insert the break) I try:

@manual{Ormo15,
  title        = {OrmoComp® and OrmoClear®FX},
  organization = {micro resist technology GmbH},
  address      = {Köpenicker Straße 325, 12555 Berlin, Germany},
  note         = {OrmoComp® and OrmoClear®FX datasheet},
  year = {2015},
  URL = {\\\url{www.microresist.de/sites/default/files/download/PI_OrmoComp_OrmoClearFX_2015_0.pdf}}
}

But this gives the URL as:

Retrieved from %5C%5C%5Curl%7Bwww.microresist.de/sites/default/files/
download/PI OrmoComp OrmoClearFX 2015 0.pdf%7D

Can anyone tell me what am I doing wrong here please?

Best Answer

Your question is not very clear, you did not show us the code you use to create your bibliography.

To give you a start let us check the following MWE. It uses package filecontents to have tex code and bib file together in one compiling MWE. To get printed url I used package natbib and bibliography style plainnat. Please see that I also used package hyperref to get better breakable urls ...

The following MWE

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Book{Goossens,
  author    = {Goossens, Michel and Mittelbach, Frank and 
               Samarin, Alexander},
  title     = {The LaTeX Companion},
  edition   = {1},
  publisher = {Addison-Wesley},
  location  = {Reading, Mass.},
  year      = {1994},
}
@Book{adams,
  title     = {The Restaurant at the End of the Universe},
  author    = {Douglas Adams},
  series    = {The Hitchhiker's Guide to the Galaxy},
  publisher = {Pan Macmillan},
  year      = {1980},
}
@article{einstein,
  author  = {Albert Einstein},
  title   = {{Zur Elektrodynamik bewegter K{\"o}rper}. ({German}) 
             [{On} the electrodynamics of moving bodies]},
  journal = {Annalen der Physik},
  volume  = {322},
  number  = {10},
  pages   = {891--921},
  year    = {1905},
  DOI     = {http://dx.doi.org/10.1002/andp.19053221004},
}
@manual{Ormo15,
  title        = {OrmoComp® and OrmoClear®FX},
  organization = {micro resist technology GmbH},
  address      = {Köpenicker Straße 325, 12555 Berlin, Germany},
  note         = {OrmoComp® and OrmoClear®FX datasheet},
  year = {2015},
  URL = {www.microresist.de/sites/default/files/download/PI_OrmoComp_OrmoClearFX_2015_0.pdf}
}
\end{filecontents*}


\documentclass[10pt,a4paper]{article}

\usepackage{showframe}  %       to visualise the typing area and margins
\usepackage[numbers]{natbib}
\usepackage{hyperref}

\begin{document}

This is text with \cite{Goossens} and \cite{adams}.

\nocite{*} % to test all bib entrys
\bibliographystyle{plainnat} % unsrt 
\bibliography{\jobname} %      to use bib file created with filecontents

\end{document}

gives you the result:

enter image description here

Please copy my MWE and run it on your computer. Same result? Good. If not report the differences.

If you want a answer for your circumstances, please show us in your question with an MWE (copy mine and change it to show your used packages and bib style) your current situation ...

Update:

With an current MiKTeX 2.9, version pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6630 64-bit) running the following MWE (please see that I changed the order of calling packages, in your case hyperref should be called last!)

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@manual{Ormo15,
  title        = {OrmoComp® and OrmoClear®FX},
  organization = {micro resist technology GmbH},
  address      = {Köpenicker Straße 325, 12555 Berlin, Germany},
  note         = {OrmoComp® and OrmoClear®FX datasheet},
  year = {2015},
  URL = {www.microresist.de/sites/default/files/download/PI_OrmoComp_OrmoClearFX_2015_0.pdf}
}
\end{filecontents*}


\listfiles % <==========================================================
\documentclass[11pt,twoside]{report}

\usepackage[utf8]{inputenc}
\usepackage{geometry}

\usepackage{siunitx}
\usepackage[%
  backend=biber,
  style=apa,
  natbib=true,
  maxbibnames=7,
  maxcitenames=3,
  dashed=false,
  uniquename=false
]{biblatex}
\addbibresource{\jobname.bib}

\usepackage{url}
\usepackage{hyperref} % <===============================================

\setcounter{biburllcpenalty}{7000}
\setcounter{biburlucpenalty}{7000}
\setcounter{biburlnumpenalty}{7000}

\AtBeginDocument{\renewcommand{\bibname}{References}}


\begin{document}
\nocite{*}

\printbibliography

\end{document}

I get the following resulting page which is different to that you show us:

resulting bibliography

I marked the differences with red arrows. Can it be that you are using another font and did not call it in your given MWE? Or do you use wider margins not given in the MWE? It also could be that one or more of your used packages is outdated. I added command \listfiles to my MWE. It results in the following list of used packages and version numbers:

 *File List*
filecontents.sty    2011/10/08 v1.3 Create an external file from within a LaTeX document
  report.cls    2014/09/29 v1.4h Standard LaTeX document class
  size11.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
inputenc.sty    2015/03/17 v1.2c Input encoding file
    utf8.def    2017/01/28 v1.1t UTF-8 support for inputenc
   t1enc.dfu    2017/01/28 v1.1t UTF-8 support for inputenc
  ot1enc.dfu    2017/01/28 v1.1t UTF-8 support for inputenc
  omsenc.dfu    2017/01/28 v1.1t UTF-8 support for inputenc
geometry.sty    2010/09/12 v5.6 Page Geometry
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
   ifpdf.sty    2017/03/15 v3.2 Provides the ifpdf switch
  ifvtex.sty    2016/05/16 v1.6 Detect VTeX and its facilities (HO)
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
geometry.cfg
 siunitx.sty    2017/11/26 v2.7k A comprehensive (SI) units package
   expl3.sty    2018/03/05 L3 programming layer (loader) 
expl3-code.tex    2018/03/05 L3 programming layer 
l3pdfmode.def    2017/03/18 v L3 Experimental driver: PDF mode
  xparse.sty    2018/02/21 L3 Experimental document command parser
 amstext.sty    2000/06/29 v2.01 AMS text
  amsgen.sty    1999/11/30 v2.0 generic functions
   array.sty    2016/10/06 v2.4d Tabular extension package (FMi)
l3keys2e.sty    2018/02/21 LaTeX2e option processing using LaTeX3 keys
translator.sty    2018/01/04 v1.12 Easy translation of strings in LaTeX
biblatex.sty    2018/03/04 v3.11 programmable bibliographies (PK/MW)
pdftexcmds.sty    2018/01/21 v0.26 Utility functions of pdfTeX for LuaTeX (HO)
infwarerr.sty    2016/05/16 v1.4 Providing info/warning/error messages (HO)
ifluatex.sty    2016/05/16 v1.4 Provides the ifluatex switch (HO)
 ltxcmds.sty    2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
etoolbox.sty    2018/02/11 v2.5e e-TeX tools for LaTeX (JAW)
kvoptions.sty    2016/05/16 v3.12 Key value format for package options (HO)
kvsetkeys.sty    2016/05/16 v1.17 Key value parser (HO)
etexcmds.sty    2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
  logreq.sty    2010/08/04 v1.0 xml request logger
  logreq.def    2010/08/04 v1.0 logreq spec v1.0
  ifthen.sty    2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
     url.sty    2013/09/16  ver 3.4  Verb mode for urls, etc.
 xstring.sty    2013/10/13  v1.7c  String manipulations (C Tellechea)
  blx-dm.def    2018/03/04 v3.11 biblatex localization (PK/MW)
     apa.dbx    2018/03/05 v7.6 APA biblatex style data model
blx-compat.def    2018/03/04 v3.11 biblatex compatibility (PK/MW)
biblatex.def    2018/03/04 v3.11 biblatex compatibility (PK/MW)
blx-natbib.def    2018/03/04 v3.11 biblatex compatibility (PK/MW)
standard.bbx    2018/03/04 v3.11 biblatex bibliography style (PK/MW)
     apa.bbx    2018/03/05 v7.6 APA biblatex references style
     apa.cbx    2018/03/05 v7.6 APA biblatex citation style
biblatex.cfg    
hyperref.sty    2018/02/06 v6.86b Hypertext links for LaTeX
hobsub-hyperref.sty    2016/05/16 v1.14 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty    2016/05/16 v1.14 Bundle oberdiek, subset generic (HO)
  hobsub.sty    2016/05/16 v1.14 Construct package bundles (HO)
 intcalc.sty    2016/05/16 v1.2 Expandable calculations with integers (HO)
kvdefinekeys.sty    2016/05/16 v1.4 Define keys (HO)
pdfescape.sty    2016/05/16 v1.14 Implements pdfTeX's escape features (HO)
bigintcalc.sty    2016/05/16 v1.4 Expandable calculations on big integers (HO)
  bitset.sty    2016/05/16 v1.2 Handle bit-vector datatype (HO)
uniquecounter.sty    2016/05/16 v1.3 Provide unlimited unique counter (HO)
letltxmacro.sty    2016/05/16 v1.5 Let assignment for LaTeX macros (HO)
 hopatch.sty    2016/05/16 v1.3 Wrapper for package hooks (HO)
xcolor-patch.sty    2016/05/16 xcolor patch
atveryend.sty    2016/05/16 v1.9 Hooks at the very end of document (HO)
atbegshi.sty    2016/06/09 v1.18 At begin shipout hook (HO)
refcount.sty    2016/05/16 v3.5 Data extraction from label references (HO)
 hycolor.sty    2016/05/16 v1.8 Color options for hyperref/bookmark (HO)
 auxhook.sty    2016/05/16 v1.4 Hooks for auxiliary files (HO)
  pd1enc.def    2018/02/06 v6.86b Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg    2002/06/06 v1.2 hyperref configuration of TeXLive
 hpdftex.def    2018/02/06 v6.86b Hyperref driver for pdfTeX
rerunfilecheck.sty    2016/05/16 v1.8 Rerun checks for auxiliary files (HO)
 english.lbx    2018/03/04 v3.11 biblatex localization (PK/MW)
american.lbx    2018/03/04 v3.11 biblatex localization (PK/MW)
american-apa.lbx    2018/03/05 v7.6 APA biblatex localisation
english-apa.lbx    2018/03/05 v7.6 APA biblatex localisation
  ts1enc.dfu    2017/01/28 v1.1t UTF-8 support for inputenc
translator-basic-dictionary-English.dict    
siunitx-abbreviations.cfg    2017/11/26 v2.7k siunitx: Abbreviated units
  422795.bbl
 nameref.sty    2016/05/21 v2.44 Cross-referencing by name of section
gettitlestring.sty    2016/05/16 v1.5 Cleanup title references (HO)
  422795.out
  422795.out
  omscmr.fd    2014/09/29 v2.5h Standard LaTeX font definitions
 ***********

Please run my MWE on your computer and compare your resulting list at the end of the log file with mine. Differences? Which one?

As it stands now I can not reproduce your issue ...

Related Question