0

In my references a strange vertical misalignment appeard in the writing of each name, for example: enter image description here

And I really don't know why this happen...

MWE (.cls file)

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{solutionclass}[2023/03/03 My Custom LaTeX Class for exercise solutions]

\LoadClass[a4paper, twoside, 11pt]{book}

\RequirePackage[portuguese, english]{babel} 
\RequirePackage[utf8]{inputenc} 
\RequirePackage[T1]{fontenc} 
\RequirePackage[backend    = biber, 
            style      = ext-authoryear-comp,
            sorting    = nyvt, 
            backref    = false,
            articlein  = false,
            uniquename = true,
            doi        = true, 
            dashed     = false]{biblatex}
\addbibresource{bib.bib}
\DeclareFieldFormat[article,periodical]{volume}{\mkbibbold{#1}}

\AtEndDocument{%
    \clearpage
    \pagestyle{fancy}
    \markboth{\textsc{References}}{\textsc{References}}
    \printbibliography[heading=bibintoc, title=References]
} 

MWE (.bib file)

@book{Choquet-BruhatGR,
    title = {General Relativity and the Einstein Equations},
    author = {Choquet-Bruhat, Yvonne},
    date = {2009},
    volume = {I},
    publisher = {Oxford University Press},
    location = {Oxford}
}

@book{Choquet-BruhatGR2,
    title = {Introduction to general relativity, black holes, and cosmology},
    author = {Choquet-Bruhat, Yvonne},
    date = {2015},
    volume = {I},
    publisher = {Oxford University Press},
    location = {Oxford}
}
3
  • 1
    If use delete title content in .bib, you will know why. The space between chars is glue.
    – Clara
    Mar 12 at 10:40
  • Ah, I see, but is there any way to keep the alignment even with the title??
    – Jimeens
    Mar 12 at 10:46
  • But that will cause uneven right edge.
    – Clara
    Mar 12 at 11:15

1 Answer 1

1

Assuming standard settings, your bibliography is typeset as justified text - just like normal text in the rest of your document. This means that TeX tries to make all lines meet up evenly on the right margin. This is as opposed to left aligned text, where text does not meet up evenly on the right margin and has a more "ragged" look.

Justification is mainly achieved by slightly enlarging or compressing the width of spaces in a line. That's exactly the effect you show in the screenshot. Because the text that is typeset in these lines is different and has different natural width, TeX has to compress/enlarge the spaces to compensate for the different width and make the line ends meet up nicely.

\documentclass[a4paper, 11pt, british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=authoryear, dashed=false]{biblatex}

\begin{filecontents}{\jobname.bib}
@book{Choquet-BruhatGR,
  title     = {General Relativity and the {Einstein} Equations},
  author    = {Choquet-Bruhat, Yvonne},
  date      = {2009},
  volume    = {I},
  publisher = {Oxford University Press},
  location  = {Oxford},
}
@book{Choquet-BruhatGR2,
  title     = {Introduction to General Relativity, Black Holes, and Cosmology},
  author    = {Choquet-Bruhat, Yvonne},
  date      = {2015},
  volume    = {I},
  publisher = {Oxford University Press},
  location  = {Oxford},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem \autocite{sigfridsson,Choquet-BruhatGR,Choquet-BruhatGR2}

\printbibliography
\end{document}

Justified bibliography

You can get the same spaces if you give up justification. But of course then you no longer have even right edges. This may actually not be too bad in a bibliography, where most entries are not that long anyway.

\documentclass[a4paper, 11pt, british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage{ragged2e}
\usepackage[backend=biber, style=authoryear, dashed=false]{biblatex}

\begin{filecontents}{\jobname.bib}
@book{Choquet-BruhatGR,
  title     = {General Relativity and the {Einstein} Equations},
  author    = {Choquet-Bruhat, Yvonne},
  date      = {2009},
  volume    = {I},
  publisher = {Oxford University Press},
  location  = {Oxford},
}
@book{Choquet-BruhatGR2,
  title     = {Introduction to General Relativity, Black Holes, and Cosmology},
  author    = {Choquet-Bruhat, Yvonne},
  date      = {2015},
  volume    = {I},
  publisher = {Oxford University Press},
  location  = {Oxford},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem \autocite{sigfridsson,Choquet-BruhatGR,Choquet-BruhatGR2}

\begingroup
\RaggedRight
\printbibliography
\endgroup
\end{document}

Raggedright bibliography

You must log in to answer this question.

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