1. Long URL in bibliography section
    1. Problem
    2. Environment
    3. Solution
  2. Ugly alignment in bibliography section caused by long url
    1. Problem
    2. Solution

Long URL in bibliography section

Topic: pdfLaTex / IEEEtran style


Recently I find it really annoying having the urls in my citation exceeding the page bounds.

This is how the wrong format looks like:

Wrong Format

As you can see, the two lines end with black blocks exceed the page bound.


	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.


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:


Here we are! Now this is it:

Correct Format

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.


Again, this is how the wrong alignment looks like:

Wrong Alignment

The compiler is really struggling with indenting the url correctly, but somehow it still did it wrong.


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:


It should be like this once correctly imported the package:

Correct Alignment