Long URL in bibliography section
Topic: pdfLaTex / IEEEtran style
Problem
Recently I find it really annoying having the urls in my citation exceeding the page bounds.
This is how the wrong format looks like:
As you can see, the two lines end with black blocks exceed the page bound.
Environment
Software: overleaf [online]
Compiler: pdfLaTex
Bibliography Style: IEEEtran
I’ve also got a separate .bib file to store all my references.
ps: If you are using desktop software to write latex articles, I strongly recommend you to shift to online editors like overleaf. It saves your time installing all the packages locally and the online compling speed is way faster.
Solution
Thanks to Mico’s answer on stackexchange, I finally solved this problem after some unsuccessful attempts including importing the breakcites package.
The solution is so simple as you just need to add the following line in your latex text:
\usepackage[hyphens]{url}
Here we are! Now this is it:
Looks just great!
Btw, I need to look at url hyphenation later. Chances are I’ll write another article about how it works.
Ugly alignment in bibliography section caused by long url
Topic: alignment
Same Environment as before.
Problem
Again, this is how the wrong alignment looks like:
The compiler is really struggling with indenting the url correctly, but somehow it still did it wrong.
Solution
This answer from Will Robertson introduces the magical package microtype which perfectly solved the problem. More details about microtype here.
Again, add this line to your latex text if you have the same issue:
\usepackage{microtype}
It should be like this once correctly imported the package: