When I use the \cite
command for my citations, often LaTeX will overflow the margins for my lines, and the text looks pretty bad. How can I make LaTeX push long citations to the next line automatically?
-
Here's a reference to the same question in 2004, but I don't get the answer tug.org/pipermail/tugindia/2004-September/002975.html– NoliSep 5, 2010 at 23:01
-
The email to the Tugindia mailing list links to the TeX FAQ, but this yielded the error message, "This site can’t be reached. Check if there is a typo in www.tex.ac.uk. DNS_PROBE_FINISHED_NXDOMAIN."– Brian SchackAug 22, 2023 at 1:08
6 Answers
Without a minimal example (i.e., code that will show the problematic behaviour), one can only speculate. However, I've stumbled over this problem in the past, and it may (!) help if you add the following to your preamble:
\usepackage{breakcites}
See the breakcites
page at CTAN for details. If it doesn't help, you'll have to provide a minimal example that (above all) shows your document class and your bibliography style.
-
5
-
2
-
-
The "general solution" for overfull boxes in paragraph mode runs as follows:
Rewrite your text. Seriously. In some cases, this can be the only way to achieve "perfect" typesetting.
Enable the microtype package. Surprisingly enough, this package reduces many occurrences of overfull lines.
Wrap the paragraph with
\begin{sloppypar}...\end{sloppypar}
. This relaxes LaTeX's rules for how much interword space is acceptable; you'll get less "grey" paragraph, but at least it will stay within its margins.Finally, if this happens a lot, you can enable
\sloppy
for the entire document. With this mode in effect, well-typeset paragraphs will (almost almost always) remain just as well typeset, but "bad" paragraphs such as you're talking about will behave as if they were wrapped withsloppypar
. I tend not to recommend this route as it can make you lazier about good typesetting—but depending on your document this is not necessarily a bad thing.
-
2+1 for microtype, -1 for sloppypar and \sloppy (for me, this is only the last resort).– 0x6d64Aug 25, 2011 at 7:10
-
1What do you suggest besides microtype+rewriting? I suppose playing with other paragraph settings might get you what you want, but I doubt it would be any better than sloppypar. Note that sloppypar on an already good paragraph will not reduce its quality. Aug 25, 2011 at 8:06
-
-
-
In order to split citation you must add both these packages, otherwise the citation will not properly split.
\usepackage[breaklinks=true]{hyperref}
\usepackage{breakcites}
-
1Welcome to TeX.SE. How does your answer differ materially from the one posted by @lockstep? Note that the original posting made no reference to the
hyperref
package being loaded; it may thus not be a good recommendation to suggest including\usepackage[breaklinks=true]{hyperref}
.– MicoJan 5, 2014 at 16:22 -
2Although @Mico is right in his comment, this actually solved my problem. +1!– astabadaApr 15, 2014 at 10:37
Just use following command on your LaTeX file
\usepackage{cite}
if you are using LaTeX2e
-
2You mean "Just use the
cite
package.". Also everyone should use LaTeX2e. LaTeX2 is outdated since ages and LaTeX3 isn't around yet. Apr 27, 2011 at 11:24
If you are using hyperref, it may help to put breaklinks=true
in the options, e.g.
\usepackage[breaklinks=true]{hyperref}
.
I found this suggested here: [http://www.latex-community.org/forum/viewtopic.php?f=47&t=5455]
-
4If the driver does not support
breaklinks
, then the link area will be messed up.breaklinks
is already enabled by default for drivers that support this feature. Sep 10, 2013 at 16:38
I don't mean for this to be an answer, though it worked in my case and that is why I'm putting it here - in the odd chance it is helpful to someone else. I tried all these suggestions and I suppose I could have drastically reworded the paragraph but it was best as it was. It had two citations like this: \cite{citation1,citation2}
and the second one (though order didn't appear to matter) always ran off into the margin in the bibliography. I finally wound up just putting \penalty-10000
inside the JabRef bib source file where I wanted the break - disappointing way of solving it for sure! Feel free to remove this if people do not think it is helpful.