3

This question already has an answer here:

When compiling a document console returns:

Overfull \hbox (10.57799pt too wide) in paragraph at lines 40--43
\OT1/cmtt/m/n/12 informacion-[]para-[]ciudadanos / el-[]chagas-[]en-[]el-[]pais
-[]y-[]america-[]latina$\OT1/cmr/m/n/12 ]. Pro-
[]

MWE

\documentclass[12pt,twoside]{report}

\usepackage[headheight=18pt,a4paper,width=150mm, top=25mm, bottom=25mm, bindingoffset=6mm]{geometry}

\usepackage[utf8]{inputenc}

\usepackage{fancyhdr}
\pagestyle{fancy}

\setlength\parskip{1em plus 10pt} 
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\usepackage{url}

\begin{document}
bla bla bla bla and 
 \url{http://www.msal.gob.ar/chagas/index.php/informacion-para-ciudadanos/el-chagas-en-el-pais-y-america-latina}. Programa Nacional de Chagas del Ministerio de la Nación. 
    \end{document}

What can I do to solve the warning?

marked as duplicate by CarLaTeX, siracusa, CampanIgnis, Raaja, Johannes_B May 30 at 6:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

Add option hyphens to package url to allow breaks at explicit hyphens in URLs:

\usepackage[hyphens]{url}

With more breakpoints, it is easier for TeX to break paragraphs into lines without overfull \hboxes.

1

Using xurl package instead of url (see here):

\documentclass[12pt,twoside]{report}

\usepackage[headheight=18pt,a4paper,width=150mm, top=25mm, bottom=25mm, bindingoffset=6mm]{geometry}

\usepackage[utf8]{inputenc}

\usepackage{fancyhdr}
\pagestyle{fancy}

\setlength\parskip{1em plus 10pt} 
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\usepackage{xurl}

\begin{document}
bla bla bla bla and 
 \url{http://www.msal.gob.ar/chagas/index.php/informacion-para-ciudadanos/el-chagas-en-el-pais-y-america-latina}. Programa Nacional de Chagas del Ministerio de la Nación. 
\end{document}

enter image description here

0

This actually worked for me.

It creates a box with limited width around the URL, so you can make it fit within the \textwidth of your document.

\documentclass{article}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}%able to do the same and even more

\begin{document}
   \fbox{
   \parbox{4cm}{
   \url{http://theoval.cmp.uea.ac.uk/~nlct/latex/minexample/index.html}
}}
\end{document}

The box is displayed with a black border by default.

If you want to remove the border, just add the following line before \begin{document}

\setlength{\fboxrule}{0.0pt}

Credits to this page

NOTE @PhelypeOleinik contribution in the comments. Thanks! To remove the border you can just comment out the \fbox. Also, note that this method won't work if the url contains a #.

  • 1
    To remove the border just comment out the \fbox. This will only avoid the warning, it will not improve the output... – Phelype Oleinik May 29 at 21:17
  • I tried this with a long URL that was larger than the \textwidth. It managed to print the URL in two lines instead of one large line, avoiding the overfull warning and changing the output. Improved or not depends on you, for me the output I got is acceptable. – Salias May 30 at 12:20
  • Fine by me. However note that it won't work if the url contains a #. – Phelype Oleinik May 30 at 12:57
  • Thanks @PhelypeOleinik for your comments. I have added a note at the end of the question with your contribution to the solution. – Salias May 31 at 13:15

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