{line-breaking} is about how (La)TeX breaks paragraphs into lines and how those breaks can be influenced.

learn more… | top users | synonyms (1)

208
votes
17answers
129k views

How to add a forced line break inside a table cell

I have some text in a table and I want to add a forced line break. I want to insert a forced line break without having to specify the column width, i.e. something like the following: ...
152
votes
5answers
5k views

How to define the badness of a river?

I've written an algorithm to try and detect rivers in paragraphs and it actually detects quite a lot when I run it. Some of them are clearly false positives, but there are others that are indeed ...
69
votes
9answers
25k views

Forcing linebreaks in \url

I wish to typeset some relatively long URLs in a piece of text, and when I use \url{..}, the resulting text does not respect the margin boundaries that govern the main text body, instead going all the ...
64
votes
1answer
26k views

What is the difference between \newline and \\?

As far as I know, \\ and \newline both insert a new line. But they do not have an identical expansion and tracing shows they do not execute the same commands, so what is their difference?
63
votes
2answers
21k views

What does “overfull hbox” mean?

I often see output from TeX with the warning overfull hbox, badness 10000. What does this message mean?
62
votes
5answers
31k views

Description list - How to put the definition on a new line?

I have the following LaTeX code: \documentclass{article} \begin{document} \begin{description} \item[foo] bar \item[baz] bang \end{description} \end{document} and it produces the following PDF: ...
62
votes
5answers
4k views

Avoiding “rivers” in successive lines of type

This question led to a new feature in a package: impnattypo The following quote is from James Felici, The Complete Manual of Typography (2003), p. 161: Rivers occur when word spaces stack ...
61
votes
3answers
25k views

What are underfull hboxes and vboxes and how can I get rid of them?

Often, TeX outputs underfull hbox and vbox warnings when running and in the generated log file. What are these and how can I get rid of them?
57
votes
4answers
94k views

How can I split an equation over two lines

I am having the following equation: \begin{equation} Q(\lambda,\hat{\lambda}) = -\frac{1}{2} P(O \mid \lambda ) \sum_s \sum_m \sum_t \gamma_m^{(s)} (t) \left( n \log(2 \pi ) + \log \left| C_m^{(s)} ...
54
votes
4answers
100k views

How to break a long equation?

I have a long equation but long enough to occupy two lines. I want to break it to improve readability. How can I break it? \begin{equation} F = \{F_{x} \in F_{c} : (|S| > |C|) \cap (minPixels ...
53
votes
2answers
9k views

When to use \par and when \\

What is the difference between \par and \\ and when should I use \par instead of \\?
51
votes
1answer
6k views

Manual/automatic line breaks and text alignment in TikZ nodes

How can I insert a line break in a TikZ node? Simply putting \\ where I want the break doesn't work (see MWE). Is there a way to make lines break automatically at some specified width? And can I ...
46
votes
3answers
14k views

Allowing line break at ',' in inline math mode?

In the inline math mode ($...$), if the formula is too long, LaTeX will try to break it on operators, e.g. very long text followed by a very long equation like $a+b+c+d+e+f+g+h+i+j+k+l$ etc may be ...
44
votes
3answers
1k views

Why no vertical-mode Knuth-Plass?

I have only basic knowledge of the TeX internals, so I hope what I am saying here is not complete nonsense. If I understand correctly, in TeX, horizontal positioning / line breaking is done using a ...
41
votes
1answer
5k views

Breaking equations with breqn

I am new to using the breqn package. It looks good, but I get an odd behaviour when an equation can almost fit in the page but not quite: the alignment gets completely wrong. Is there a way to fix ...
40
votes
5answers
10k views

When should I use non-breaking space?

DEK gained a reputation of painting red the draft dissertations of his students, taking particular note of incidents when they omitted a non-breaking space that should have been included. I have this ...
40
votes
5answers
40k views

How to break a line in a table [duplicate]

Possible Duplicate: How to add a forced line break inside a table cell In a table I would like to have a line break in the text inside a cell. Is there an easy way to do so, or do I have to ...
39
votes
6answers
13k views

Prevent LaTeX to break an inline math equation

I hope this question was not asked before. At least I haven't found it. I have an inline math equation and LaTeX is breaking it into two parts. In this case I'd prefer to have the whole and short ...
37
votes
6answers
12k views

How can I write multiple lines in a subscript?

Is there a way to force a line break inside a math mode text? My example: \[ \underbrace{....}_\text{Some long text that should be multiline} \] Trying \text{Some long text that\\ should be ...
35
votes
5answers
3k views

one-letter word at the end of line

This question led to a new feature in a package: impnattypo I come from Poland and I'm writing some text in my native language. One of our typography standards is that we do not leave ...
32
votes
7answers
7k views

Allow line break, but without inserting a dash

I have a sentence that contains a number of long dataset names. I would like to allow LaTeX to break these names at certain positions that I would like to specify somehow just like I can use \- to ...
32
votes
4answers
3k views

How to prevent linebreaks after hyphen if word starts with hyphen?

(Remark: Maybe this is a typically German problem, I'm not sure in which other languages that might be relevant) Sometimes there are words which start with a hyphen, as they are connected with a word ...
31
votes
2answers
7k views

Why does underlined text not get wrapped once it hits the end of a line ?

Sometimes I want to underline some text, and it extends past the end of a line. Why does \underline{} not automatically wrap my text for me ? Also, how can I underline text so that it will still ...
30
votes
2answers
4k views

What is the difference between \nobreak and \nolinebreak?

What is the difference between \nobreak and \nolinebreak? I noticed that a lot of solutions in TeX.SE use the former, but I thought the latter is LaTeX while the former is plain TeX. And LaTeX macros ...
30
votes
2answers
1k views

TeX assistance in writing hidden acrostics

Here's a fun challenge. Try to come up with (and code) techniques through which (La)TeX can help authors to incorporate acrostics in their writing. The definition from Wikipedia: An acrostic is a ...
29
votes
2answers
737 views

Ensure minimal length of last line

This question led to a new feature in a package: impnattypo One rule in French typography is that the last line of a paragraph should not be shorter than the double of the indentation of the ...
29
votes
2answers
30k views

Error message: There's no line here to end

In a letter-class document that had no previous errors I am suddenly getting the error message: "There's no line here to end" \opening{text} I've used this file many times and today it starts ...
29
votes
2answers
1k views

How to visualize the underfull box in final output PDF files

I am finalizing a document. There are a few underfull vbox I just cannot figure out where they are. Sometimes it is easy to figure out which page is underfull vbox from the log file, but sometimes it ...
27
votes
3answers
13k views

How to get long \texttt sections to break

I often format path names with \texttt which can be very long. Usually Tex will not break this text. The line will just create a hbox overflow. It looks like this: ................ ...C:\documents ...
26
votes
1answer
493 views

Why does TeX prefer an overfull box to hyphenating here?

Here is a short file which produces an overfull hbox: \documentclass[12pt]{report} \usepackage[left=1.5in,right=1in,paperwidth=8.5in,paperheight=11in]{geometry} \begin{document} \trivlist ...
24
votes
3answers
11k views

Prevent hyphenation and use line break in block of text

I have a custom block of text on my title page which can be longer than a single line. By default LaTeX is hyphenating a word at the end of a line, but I want it to break on to the next line. How do ...
24
votes
4answers
9k views

Prevent line breaking in inline math, but allow flexible spacing

How can I easily tell Latex to prevent line-breaks inside a part of an inline formula, without affecting inter-word spacing? Writing something like $ab(c+d)$ in Latex is bad: Latex might put a line ...
23
votes
4answers
589 views

unexpected interaction between \raggedright and \parshape

While answering Random start of line, I came upon a strange interaction between \raggedright and \parshape. If a ragged-right paragraph ends in a short line, this line will be "the most ragged". ...
23
votes
2answers
8k views

Line breaking of URLs in bibliographies

I have a problem with the line break of an URL. The URL can´t break correct and extends into the border. I´ve tried some things. Amongst others I loaded the package breakurl, but without any success. ...
23
votes
1answer
8k views

How to typeset a “small” non-breaking space

I can use ~ to produce a non-breaking space. But it is too large for me, and I would like a non-breaking space of the size of \, for example. Is it possible ?
23
votes
2answers
529 views

What is “\\” called?

I’ve seen it take arguments, and apparently there’s a starred version, but I can’t find any documentation because it is ungooglable!
22
votes
2answers
5k views

Why should I put a ~ before \ref or \cite?

My question is in the title of this post, but extends to other referencing commands like \eqref, \citep, \citet (and the like) as well.
22
votes
2answers
771 views

Repetition of a word on two lines

This question led to a new feature in a package: impnattypo There have been questions about rivers asked in the past. I'm wondering about words that are repeated in the same place on two ...
22
votes
4answers
12k views

Verbatim environment that can break too long lines?

I want to generate a PDF of user-submitted text using LaTeX. To handle crazy user input, I first thought about using the verbatim package, but of course it doesn't break up too long lines. Is there ...
22
votes
1answer
305 views

Does \\ in the last line of an array have any effect?

Consider the following example: \begin{array}{l} line 1 \\ line 2 \\ \end{array} Is the \\ in the last line completely optional or are there circumstances under which it has any effect?
22
votes
3answers
951 views

How to avoid a linebreak before a comma?

I just had a problem with a linebreak after a word ending with a hyphen which was followed by a comma. This example shows the problem: (The example is constructed, but this just occurred to me in a ...
21
votes
5answers
5k views

How do I make LaTeX push long citations to a new line?

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 ...
21
votes
1answer
5k views

Underfull \hbox in bibliography

I am getting lots of "Underfull \hbox" warnings that point to the *.bbl file. It looks like these messages appear only when URLs are very long, like in the below example: @techreport{nistguidesec, ...
20
votes
2answers
3k views

Reduce bibliography to one line

Quick question, hopefully with a quick answer. I'm writing a paper where I'm limited by length (2 pages) and I need references, but it doesn't have to look nice. I'd like LaTeX to compress my ...
20
votes
3answers
2k views

When can I safely add an empty line?

I really like spacing my LaTeX to stay organized, but I'm always scared that adding a space will affect the output when all I really wanted to do was separate the "code" a bit. So most of the time I ...
20
votes
1answer
293 views

How to I force a word to move to the end of the line?

How do I force my document to pull selected words to the end of each line (and to hyphenate them as well, if needed)? I have an old document. I know the page size and I think I've found the ...
19
votes
3answers
1k views

LaTeX word wrapping poorly

LaTeX is not word wrapping this anything close to sanely: \documentclass{article} \usepackage{graphicx} \usepackage{wrapfig} \usepackage{geometry} \usepackage{lipsum} \geometry{margin=1in} ...
19
votes
5answers
1k views

Wrapping long lines that contain no spaces

I need to format extremely long strings of text. I would like to be able to specify their width, and have them wrap, with or without some special symbol to indicate that the line is wrapped. The ...
19
votes
2answers
3k views

How can I prevent LaTeX from breaking inline formulas globally?

I am using the acmsmall template and my inline formulas are being broken at equal signs and arrows; how can I prevent them from being typeset like that globally (i.e. without having to put tildes ...
19
votes
1answer
2k views

Difference between \\ and \tabularnewline

What is the difference between \\ and \tabularnewline? Is it same as the difference between \\ and newline? Is \tabularnewline preferred over \\ when creating tables?