0

I'm trying to print my bibliography, but "pages XXX-XXX" is making overfull boxes. I have already reviewed this answer but seqsplit as mentioned on ISBNs and other long numbers is not working, even worse, it throws the next error:

!Package etoolbox Error: Toggle 'bbx:pageranges' undefined.

This is my file

\RequirePackage{fix-cm}
\documentclass[12pt, table, letterpaper]{report}

\usepackage[english,spanish,es-tabla]{babel} \usepackage[ letterpaper, top = 18mm, left = 20mm, right= 20mm, bottom = 18mm ]{geometry} \usepackage{fontspec} \usepackage[hidelinks]{hyperref} \usepackage[ thresholdtype=words ]{csquotes} \usepackage[ backend=biber, style=ieee, url=false, hyperref=true, ]{biblatex}

\usepackage{xurl}

\setlength{\parindent}{0pt} \setlength{\parskip}{1em}

\defaultfontfeatures{Ligatures=TeX} \setmainfont{Times New Roman} \addbibresource{Bib/References.bib}

\DeclareFieldFormat{url}{% % \mkbibacro{URL}\addcolon\space \href{#1}{\nolinkurl{\thefield{urlraw}}}}

\begin{document} \pagenumbering{gobble} \nocite{*} \printbibliography[heading=bibintoc] \end{document}

References.bib

@article{palomino-resendiz_design_2018,
    title = {Design and implementation of a robotic active solar distiller based on a Fresnel concentrator and a photovoltaic system},
    volume = {166},
    issn = {0196-8904},
    url = {https://www.sciencedirect.com/science/article/pii/S0196890418304175},
    doi = {10.1016/j.enconman.2018.04.069},
    abstract = {},
    pages = {637--647},
    journaltitle = {Energy Conversion and Management},
    shortjournal = {Energy Conversion and Management},
    author = {Palomino-Resendiz, S. I. and Flores-Hernández, D. A. and Lozada-Castillo, N. and Guzmán-Vargas, L. and Luviano-Juárez, A.},
    urldate = {2022-03-18},
    date = {2018-06-15},
    langid = {english},
    keywords = {Desalination, Fresnel lens, Photovoltaic system, Robotic solar distiller, Solar energy},
}

@article{kabeel_performance_2022, title = {Performance assessment of the hemispherical solar distillers with the extended cylindrical iron fins: An experimental investigation}, volume = {61}, issn = {1110-0168}, url = {https://www.sciencedirect.com/science/article/pii/S1110016822002794}, doi = {10.1016/j.aej.2022.04.018}, shorttitle = {Performance assessment of the hemispherical solar distillers with the extended cylindrical iron fins}, pages = {11149--11157}, number = {12}, journaltitle = {Alexandria Engineering Journal}, shortjournal = {Alexandria Engineering Journal}, author = {Kabeel, Abd Elnaby and El Hadi Attia, Mohammed and Abdelgaied, Mohamed and Abdullah, A. S. and Bellila, Abdelkader and Abdel-Aziz, Moataz M.}, urldate = {2022-05-29}, date = {2022-12-01}, langid = {english}, keywords = {Extended cylindrical fins, Hemispherical solar still, Iron fins, Number, Solar energy} }

enter image description here

I'm compiling my LaTeX code like this

xelatex -synctex=1 -interaction=nonstopmode --output-directory=./build --shell-escape %.tex
makeindex -t ./build/%.glg -s ./build/%.ist -o ./build/%.gls ./build/%.glo
makeindex -t ./build/%.alg -s ./build/%.ist -o ./build/%.acr ./build/%.acn
biber --output-directory=./build %
xelatex -synctex=1 -interaction=nonstopmode --output-directory=./build --shell-escape %.tex

Edit

It seems that the problem occurs when adding csquotes package. I deleted my file line by line and the problem disappears removing csquotes package. But the problem is that I require that package too. Any idea?

  • When I compile your MWE I get no overfull boxes (LuaLaTeX: https://i.stack.imgur.com/gNj6Z.png, with XeLaTeX some spaces are subtly different, but nothing overflows into the margin either.) How do you compile your document? Did you double check that your MWE reproduces the issue? (Obviously the image shown in the post does not come from the MWE: it has way more citations). – moewe Mar 05 '23 at 05:41
  • 1
    Alright, with csquotes I get https://i.stack.imgur.com/9amrD.png, where one page range definitely runs into the margin. It's not near as bad as shown in your screenshot, but it is visible. Do keep in mind that line breaking is very context sensitive, so any solution that might work (be enough) for a particular case might not be good enough for another case. I can only base my suggestions off the problem I can reproduce. – moewe Mar 05 '23 at 06:41
  • https://tex.stackexchange.com/q/442308/35864 has a number of other hints that can help you with line breaking. – moewe Mar 05 '23 at 06:42
  • I don't know exactly what code you tried, but the seqsplit MWE from https://tex.stackexchange.com/a/466691/35864 still works for me. So if you get an error, you need to share the code you tried in an MWE. – moewe Mar 05 '23 at 06:48
  • @moewe, maybe seqsplit didn't succed cause I need to use style=ieee and they use style=chem-angew – Eduardo Jiménez Mar 05 '23 at 06:50
  • And my SS is worse because isn't [1] and [2] but [18] and [20] and that pushes another character to the right. (I think) – Eduardo Jiménez Mar 05 '23 at 06:52

1 Answers1

1

Line breaking is highly context sensitive, so any solution that might work in a particular situation might not be suitable for another situation, however similar they might be.

Based on the code shown in the question I can reproduce the following overfull box if I add \usepackage{csquotes}.

Overfull box: "págs. 637-647," protrudes into the margin (approx "47," is outside the text area).

In this case of fairly short page numbers I don't think breaking the number itself up randomly is going to give the best results. In a first step I would try to allow line breaking at the hyphen by redefining \bibrangedash. By default spanish.lbx uses a hyphen at which there cannot be a line break.

This gives us

\RequirePackage{fix-cm}
\documentclass[12pt, letterpaper]{report}
\usepackage[
  letterpaper,
  top = 18mm,
  left = 20mm,
  right= 20mm,
  bottom = 18mm,
]{geometry}
\usepackage{fontspec}
\usepackage[english,spanish,es-tabla]{babel}
\usepackage{csquotes}

\usepackage[ backend=biber, style=ieee, url=false, ]{biblatex}

\usepackage{xurl} \usepackage[hidelinks]{hyperref}

\setlength{\parindent}{0pt} \setlength{\parskip}{1em}

\defaultfontfeatures{Ligatures=TeX} \setmainfont{Times New Roman}

\DefineBibliographyExtras{spanish}{% \protected\def\bibrangedash{-}% }

\DeclareFieldFormat{url}{% % \mkbibacro{URL}\addcolon\space \href{#1}{\nolinkurl{\thefield{urlraw}}}}

\begin{filecontents}{\jobname.bib} @article{palomino-resendiz_design_2018, title = {Design and implementation of a robotic active solar distiller based on a Fresnel concentrator and a photovoltaic system}, volume = {166}, issn = {0196-8904}, url = {https://www.sciencedirect.com/science/article/pii/S0196890418304175}, doi = {10.1016/j.enconman.2018.04.069}, pages = {637--647}, journaltitle = {Energy Conversion and Management}, author = {Palomino-Resendiz, S. I. and Flores-Hernández, D. A. and Lozada-Castillo, N. and Guzmán-Vargas, L. and Luviano-Juárez, A.}, urldate = {2022-03-18}, date = {2018-06-15}, langid = {english}, } @article{kabeel_performance_2022, title = {Performance assessment of the hemispherical solar distillers with the extended cylindrical iron fins: An experimental investigation}, volume = {61}, issn = {1110-0168}, url = {https://www.sciencedirect.com/science/article/pii/S1110016822002794}, doi = {10.1016/j.aej.2022.04.018}, pages = {11149--11157}, number = {12}, journaltitle = {Alexandria Engineering Journal}, author = {Kabeel, Abd Elnaby and El Hadi Attia, Mohammed and Abdelgaied, Mohamed and Abdullah, A. S. and Bellila, Abdelkader and Abdel-Aziz, Moataz M.}, urldate = {2022-05-29}, date = {2022-12-01}, langid = {english}, } \end{filecontents} \addbibresource{\jobname.bib}

\begin{document} \pagenumbering{gobble} \nocite{*} \printbibliography[heading=bibintoc] \end{document}

Same bibliography as above. This time page ranges are broken at "-" resulting in no text protruding into the margin.

From the looks of it I'm hoping this will also work in the document shown in your screenshot (which is not the MWE).

Personally, I think the seqsplit solution is a bit radical (breaking numbers at arbitrary positions can look odd). If the problem persists, I'd probably try one of the generic solutions from How to adjust the line breaking in the bibliography?, e.g. \emergencystretch.

moewe
  • 175,683
  • Adding both solutions (yours and \emergencystretch) solved everything! – Eduardo Jiménez Mar 05 '23 at 07:22
  • 1
    @EduardoJiménez Do keep in mind, though, that the "best" value for \emergencystrecth is highly context dependent, so you may have to come back to it from time to time if there are changes to your bibliography layout (however small). The first thing I'd always try is microtype, but I think its XeLaTeX support isn't that great (you might get better results with LuaLaTeX there). – moewe Mar 05 '23 at 07:24