# Url break issue

I had a bibliography item with url that breaks in two line. The break is fine but the box is too wide on the right which there is empty space in the box.

Here is my code

\documentclass[12pt]{article}
\special{papersize=8.5in,11in}

% Packages Section
%=================
\usepackage{amssymb}            % Complex numbers
\usepackage{bbding}             % Symbols
\usepackage{bm}                 % Bold Math
\usepackage{enumerate}
\usepackage{gensymb}
\usepackage{fancyhdr}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{float}
\usepackage[justification=centering]{caption}
\usepackage[hyphens]{url}
\usepackage{listings}
\usepackage{mathtools}
\usepackage[pdftex]{graphicx}
\usepackage{setspace}
\usepackage{subcaption}
\usepackage{textcomp}
\usepackage[usenames, dvipsnames, pdftex]{xcolor}
\usepackage[utf8]{inputenc}     % Support for french language
\usepackage{wordlike}
\usepackage{txfonts}
\usepackage{pgfplots}

% Set up Section
%===============

% Page configuration
\pagestyle{fancy}
\fancyhf{}
\lfoot{}
\cfoot{}
\rfoot{\thepage}

% Setup subsection format
\renewcommand\thesubsubsection{\arabic{section}.\arabic{subsection}}

% Setup enumeration
\renewcommand{\labelenumi}{\alph{enumi})}

% Paragraph configuration
\setlength{\parindent}{0pt}
\setlength{\parskip}{\baselineskip}

% Listing configuration
\definecolor{light-gray}{gray}{0.75}

\newcommand{\me}[1]{\mathrm{\emph{e}}^{#1}}
\newcommand{\jcplx}[0]{\mathrm{\emph{j}}}

% Setup listings
\lstset {
language=Matlab,
frame=single,
backgroundcolor=\color{light-gray},
breaklines=true,
basicstyle=\tiny\ttfamily,
keywordstyle=\bfseries\color{blue!40!black},
identifierstyle=\color{blue},
stringstyle=\color{red},
showstringspaces=false,
captionpos=t
}

% Text Section
%=============
\begin{document}
\begin{thebibliography}{9}
\bibitem{svm}
Analytics Vidhya : Understanding Support Vector Machine algorithm
from examples (along with examples),
\\\url{https://www.analyticsvidhya.com/blog/2017/09/understaing-support-vector-machine-example-code/}
\end{thebibliography}
\end{document}


Which gives the following:

Is that any way how to make the box stop write just after the url text?

• In my opinion that box looks horrendous. I always use \usepackage[hidelinks]{hyperref} to make it disappear, or \usepackage[colorlinks]{hyperref} to paint the text instead. – Phelype Oleinik Feb 5 '18 at 0:42
• Off-topic: The bib entry example you've provided is seriously incomplete, as it's missing information about both the author (Sunil Ray) and the publication date (last updated Sept. 2017). The "author" of this piece is definitely not an entity called "Analytics Vidhya". – Mico Feb 5 '18 at 5:34
• If you use wordlike for emulating poor typesetting, you shouldn’t worry about that break. 😉 – egreg Feb 5 '18 at 8:06

Your code has a lot of errors I corrected in the following MWE. Important is for exampe the order of calls of packages. In your case that means hyperref should be called last.

I deleted all packages not needed for your problem, but left packages with wrong options to correct them. Please read my comments carefully, marked with <=====.

Your font package txfonts should not be used any more. See for the reasons the infos on ctan. Use \usepackage{newtxtext,newtxmath} instead of \usepackage{txfonts} (Mentioned in a comment of @Mico).

The way the box is ending is hardcoded in hyperref. IMHO it is better to use option colorlinks for hyperref, now the complete text of the link is colored. With for example option urlcolor=blue you can define the used color for url links ...

I would not use \\ to get the url string to a new line. To get a better-looking bibliography, I would use package ragged2e with command \RaggedRight.

With the complete MWE

\documentclass[12pt]{article}
%\special{papersize=8.5in,11in} % <========================= changed to:
\usepackage[total={8.5in,11in},centering,margin=1in]{geometry}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}     % Support for french language
\usepackage[french]{babel}

%\usepackage{txfonts}  % 'txfonts' is deprecated; use newtxtext and newtxmath
\usepackage{newtxtext,newtxmath}

\usepackage{ragged2e} % <====================== for command \RaggedRight
%\setlength{\parindent}{0pt}
%\setlength{\parskip}{\baselineskip}

\usepackage{fancyhdr}
% Page configuration
\pagestyle{fancy}
\fancyhf{}
\rfoot{\thepage}

\usepackage{listings}

\usepackage{graphicx} % <================================ pdftex deleted
\usepackage[usenames, dvipsnames]{xcolor} % <============ pdftex deleted

\usepackage[hyphens]{url}
\usepackage[%
urlcolor=blue,
]{hyperref} % <=============== 'pdftex' and 'breaklinks' options deleted

% Text Section
%=============

\begin{document}

{% start bibliography group
\RaggedRight
\begin{thebibliography}{9}
\bibitem{svm}
Analytics Vidhya: Understanding Support Vector Machine algorithm
from examples (along with examples),
%   \\ % <==============================================================
\url{https://www.analyticsvidhya.com/blog/2017/09/understaing-support-vector-machine-example-code/}
\end{thebibliography}
} % end bibliography group
\end{document}


results in the following pdf:

• +1. One more document aspect you could point out as being deprecated is the use of the txfonts package. Better to load the newtxtext and newtxmath packages. – Mico Feb 5 '18 at 5:25
• @Mico Thanks, I added your comment to my question ... – Mensch Feb 5 '18 at 5:52