# Bibliographic entries: URL strings too long

I want to cite and format the bibliographic references according to APA style. So I tried:

    \documentclass[12pt,a4paper,twoside]{article}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{apacite}
\begin{document}
\title{blabla}
\author{blabla}
\date{\today}
\maketitle
\cite{delistraty_2014}

\bibliographystyle{apacite}
\bibliography{ref.bib}
\end{document}


But the output of the reference list seems weird

So what can I do to solve it out?

• Welcome to TeX.SE. You need to load the url package and/or the hyperref package in order to enable line breaks in long URL strings. – Mico Feb 26 '18 at 8:56

## 1 Answer

To typeset long URL strings, it's a good idea to load the url package and/or the hyperref package. That way, LaTeX is much more likely to "find" permissible line break opportunities.

\RequirePackage{filecontents}
\begin{filecontents}{ref.bib}
@misc{delistraty_2014,
author = "Cody C. Delistraty",
title  = "The Beauty-Happiness Connection",
year   = 2014,
month  = "Aug.",
howpublished = "Atlantic Media Co.",
url    = "https://www.theatlantic.com/health/archive/2014/08/the-beautyhappiness-connection/375678/",
}
\end{filecontents}

\documentclass[12pt,a4paper,twoside]{article}
\usepackage{apacite}
\bibliographystyle{apacite}
\usepackage[hyphens,spaces,obeyspaces]{url}

\begin{document}
\cite{delistraty_2014}
\bibliography{ref}
\end{document}

• If you want the URL string to use the main text font instead of a monospaced font, just issue the directive \urlstyle{same} after loading the url package. – Mico Feb 26 '18 at 9:27
• Yes, it works. Thanks very much! Another problem is what if I want the url in the reference to be a hyperlink? What should I do, instead of "\cite{xxxxx}"? – user155860 Feb 26 '18 at 15:36
• @user155860 - If you want to enable hyperlinking of URL strings, you must load the hyperref package. – Mico Feb 26 '18 at 15:43
• However, if I use "hyperref" package, I can't use \cite{xxx} command. So what should I do? – user155860 Mar 4 '18 at 8:57
• Yes,hyperref going after url solves the problem. Thank you! – user155860 Mar 5 '18 at 9:16