1

I'm using BibDesk on Mac to manage my bibliography, and I use the phjcp bibstyle (to have small caps & unsorted refs).

The thing is : I have very long titles and url to display, and the problems begin : the text of the entry is justified, and not flush to left (as it should be). You can see the difference on the picture between [1] and [2]. I only have that for long citations, and it's kind of awful. MWE result

Moreover, I tried to isolate the problem by making one long citation, the[4], and it didn't apprear !

Can you help me ? Here is my biblio.bibfile :

%% This BibTeX bibliography file was created using BibDesk.

@comment{x-kbibtex-personnameformatting=<%l><, %f>}
@book{pbkdf,
    Author = {{Wikip{\'e}dia}},
    Date-Added = {2015-09-24 12:03:46 +0000},
    Date-Modified = {2015-09-25 08:25:58 +0000},
    Lastchecked = {Octobre},
    Publisher = {\url{https://en.wikipedia.org/wiki/small_titls}},
    Title = {Small Title},
    Year = {consult{\'e} en octobre 2015}}

@book{secuhash,
    Author = {Gilbert,Henri and Handschuh, Helena},
    Date-Added = {2015-09-24 09:27:15 +0000},
    Date-Modified = {2015-09-24 09:33:47 +0000},
    Pages = {175--193},
    Publisher = {Springer-Verlag},
    Series = {Lecture Notes in Computer Science},
    Title = {Security analysis of SHA-256 and sisters},
    Volume = {3006},
    Year = {2003}}

@book{test,
    Author = {Wikipedia, Jack, and Wikipedia, John},
    Date-Added = {2015-09-24 06:47:35 +0000},
    Date-Modified = {2015-09-25 08:29:03 +0000},
    Publisher = {\url{super/long/url/with/a/lot/of/weird/things/in/it}},
    Series = {SP 800-38D},
    Title = {Very long title because it is a name of a very specific article (with abbreviations) and many otherthings that make it take more than one line},
    Year = {2019, visited online on March 21, 2045}}

@book{justify,
    Author = {McGrew, David and Viega,John},
    Date-Added = {2015-09-23 15:29:41 +0000},
    Date-Modified = {2015-09-24 08:21:29 +0000},
    Month = {Mai},
    Publisher = {\url{https://globaljournals.org/GJCST_Volume13/4-A-Study-of-Encryption-Algorithms.pdf}},
    Title = {The Security and Performance of the Galois/Counter Mode (GCM) of Operation},
    Year = {2005, consult{\'e} en octobre 2015}}

I use a book entry for these kind of articles because they are ony online, and I want this formatting (I tried create a new bibstyle, but it didn't work).

Info : I use the url package, and the geometry package :

\usepackage[top=2cm,bottom=2.5cm,left=2.5cm,right=2.5cm]{geometry}

5
  • Do you have \usepackage{url} added?
    – user11232
    Commented Sep 25, 2015 at 8:53
  • It seems to be problem with url. See answer tex.stackexchange.com/questions/3033/forcing-linebreaks-in-url.
    – Zarko
    Commented Sep 25, 2015 at 8:57
  • In the .tex file yes. With the hyphens options.
    – 3isenHeim
    Commented Sep 25, 2015 at 8:57
  • I can't reproduce the issue; with just \usepackage{url} in the preamble, the URL is split at the slash before GJCST. However, the line width seems different from yours, so you should add also information about the formatting parameters.
    – egreg
    Commented Sep 25, 2015 at 9:16
  • I added info. But the problem is rather at the title display. That produces big spaces...
    – 3isenHeim
    Commented Sep 25, 2015 at 9:34

1 Answer 1

2

Because we do not know the document class you uses I used my standard bibliography test code to try to recreate your problem.

The code is:

% http://tex.stackexchange.com/questions/269438/text-alignment-in-bibliography
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Book{Goossens,
  author    = {Goossens, Michel and Mittelbach, Frank and 
               Samarin, Alexander},
  title     = {The LaTeX Companion},
  edition   = {1},
  publisher = {Addison-Wesley},
  location  = {Reading, Mass.},
  year      = {1994},
}
@Book{adams,
  title     = {The Restaurant at the End of the Universe},
  author    = {Douglas Adams},
  series    = {The Hitchhiker's Guide to the Galaxy},
  publisher = {Pan Macmillan},
  year      = {1980},
}
@comment{x-kbibtex-personnameformatting=<%l><, %f>}
@book{pbkdf,
    Author = {{Wikip{\'e}dia}},
    Date-Added = {2015-09-24 12:03:46 +0000},
    Date-Modified = {2015-09-25 08:25:58 +0000},
    Lastchecked = {Octobre},
    Publisher = {\url{https://en.wikipedia.org/wiki/small_titls}},
    Title = {Small Title},
    Year = {consult{\'e} en octobre 2015},
}
@book{secuhash,
    Author = {Gilbert,Henri and Handschuh, Helena},
    Date-Added = {2015-09-24 09:27:15 +0000},
    Date-Modified = {2015-09-24 09:33:47 +0000},
    Pages = {175--193},
    Publisher = {Springer-Verlag},
    Series = {Lecture Notes in Computer Science},
    Title = {Security analysis of SHA-256 and sisters},
    Volume = {3006},
    Year = {2003},
}
@book{test,
  Author = {Wikipedia, Jack and Wikipedia, John},
  Date-Added = {2015-09-24 06:47:35 +0000},
  Date-Modified = {2015-09-25 08:29:03 +0000},
  Publisher = {\url{super/long/url/with/a/lot/of/weird/things/in/it}},
  Series = {SP 800-38D},
  Title = {Very long title because it is a name of a very specific article (with abbreviations) and many otherthings that make it take more than one line},
  Year = {2019, visited online on March 21, 2045},
}
@book{justify,
  Author = {McGrew, David and Viega,John},
  Date-Added = {2015-09-23 15:29:41 +0000},
  Date-Modified = {2015-09-24 08:21:29 +0000},
  Month = {Mai},
  Publisher = {\url{https://globaljournals.org/GJCST_Volume13/4-A-Study-of-Encryption-Algorithms.pdf}},
  Title = {The Security and Performance of the Galois/Counter Mode (GCM) of Operation},
  Year = {2005, consult{\'e} en octobre 2015},
}
\end{filecontents*}


\documentclass[10pt,a4paper]{article}

\usepackage[top=2cm,bottom=2.5cm,left=2.5cm,right=2.5cm]{geometry}
%\usepackage{microtype}
\usepackage[%
  newcommands     % \RaggedRight=\raggedright etc. 
 ,newparameters   % use default settings of ragged2e
]{ragged2e}
\usepackage{showframe}  % to visualise the typing area and margins
%\PassOptionsToPackage{hyphens}{url}
\usepackage{hyperref}

\begin{document}

This is text with \cite{Goossens} and \cite{adams}.

\nocite{*} % to test all bib entrys
\bibliographystyle{phjcp}% unsrt
%{\raggedright  % group to end left justification after bib
\bibliography{\jobname}
%}              % ends group for left justified bibliography

\end{document}

In line 64 I added your geometry definition, I used class article and have prepared the MWE to write later the bibliography with \raggedright (only left justifing of the bibliography).

Result:

enter image description here

Now uncomment line 65 containing \usepackage{microtype}. And compile 3 times. Result:

enter image description here

That shows that microtype should be added to your document.

If that would not work for you, see please line 71. Uncomment it and the url is no problem any longer.

At last a hint: uncomment lines 80 and 82 to get a only left justified bibliography. Then you will have no big spaces in your bibliography. I think that is better for a bibliography.

The problem in your code was the missing hyphenation of the given url. That caused LaTeX to add big spaces. Where could it do that? There were you already had blanks, the title ...

With all lines uncomment you get the following result (The lines are comming from package showframe to visualize the typing area):

enter image description here

3
  • I'm using the report class. As I run your example, I get the same as you. But my original file gives me always the same thing...
    – 3isenHeim
    Commented Sep 28, 2015 at 11:53
  • I couldn't have the same output as you in my original document, but the breakurl package did the thing, along with the breaklinks option in hyperref. But i don't understand the result of the [6] (i.sstatic.net/mUFnR.png). Why does it break after `Volume13/ ? There is still space...
    – 3isenHeim
    Commented Sep 29, 2015 at 10:17
  • 1
    Because the next to break the line is the dot of .pdf. The complete other text is too long.
    – Mensch
    Commented Sep 29, 2015 at 15:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .