{line-breaking} is about how (La)TeX breaks paragraphs into lines and how those breaks can be influenced.
115
votes
14answers
67k 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. Something like this:
\begin{tabular}{|c|c|c|}
...
110
votes
5answers
3k 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 ...
54
votes
5answers
3k 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 ...
52
votes
2answers
11k views
What does “overfull hbox” mean?
I often see output from TeX with the warning overfull hbox, badness 10000. What does this message mean?
47
votes
8answers
13k 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 ...
40
votes
6answers
21k 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:
...
39
votes
2answers
9k 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 ...
39
votes
3answers
13k 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?
38
votes
3answers
721 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 ...
37
votes
1answer
3k 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 ...
36
votes
1answer
8k 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?
34
votes
5answers
23k 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 ...
34
votes
2answers
1k views
When to use \par and when \\
What is the difference between \par and \\ and when should I use \par instead of \\?
33
votes
4answers
2k 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 ...
33
votes
4answers
35k 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)} ...
32
votes
4answers
34k 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 ...
29
votes
4answers
2k 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 ...
27
votes
4answers
5k 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 ...
24
votes
2answers
869 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 ...
24
votes
2answers
518 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 ...
24
votes
2answers
562 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 ...
23
votes
6answers
6k 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 ...
23
votes
4answers
322 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
1answer
4k 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 ...
22
votes
5answers
4k 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 ...
22
votes
2answers
661 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
2answers
496 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
1answer
292 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?
21
votes
3answers
8k 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 ...
21
votes
4answers
6k 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 ...
19
votes
2answers
6k 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 ...
18
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}
...
18
votes
2answers
2k 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.
18
votes
2answers
2k 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 ...
18
votes
2answers
2k 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 ...
18
votes
2answers
4k 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. ...
18
votes
3answers
604 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 ...
18
votes
1answer
186 views
Check if at begin of a line
For a list of bullet-separated items, I want the separator to be swallowed if it is the first or last element of the line. That is, I want something like
\renewcommand{\and}{%
\ifnolinebreak% ...
17
votes
5answers
3k 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 ...
17
votes
2answers
265 views
Could TeX typeset note text between two lines of the body?
How to typsetting the note text like
There is body blahblah blahblah I need a note here and then blah blah
The note about word
blahblah blahblah ...
17
votes
4answers
5k 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 ...
17
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 ...
16
votes
3answers
1k views
Can I have the \overfullrule rule colored in pdfLaTeX?
I know that I can use \overfullrule=5pt to get overfull lines marked with a black marker. I am using pdfLaTeX. Is there a way I can get this marker or something similar in magenta instead?
16
votes
3answers
4k views
Quote environment with reference at the end right
I want to define a quote environment such that after the quote on the right occurs the author with page number. My solution is yet the redefinition of the quote environment
\usepackage{amsthm} % ...
16
votes
1answer
421 views
Best choice between using \\ or leaving space after each paragraph to end the paragraph
Here is the thing, I have always used a blank space between paragraphs in order to tell latex that there is a new paragraph. But there is someone I work with very often that keeps using \\ to break a ...
16
votes
2answers
470 views
What is the right way to use of non-breakable space before math expressions?
I have seen LaTeX code that
puts a ~ between every math expression and the text preceding it,
does not use ~ in this manner at all, and
uses a ~ in this way if and only if the math expression ...
16
votes
3answers
852 views
Changing the style of the first *typeset* line of a paragraph
I've been playing around with dropcaps in LaTeX (with the yfonts and lettrine packages), and one typographical effect you often see after dropcaps is having the entire first line of the paragraph ...
16
votes
1answer
760 views
Knuth's line breaking algorithm
I'm trying to understand the basics of Knuth's line breaking algorithm. At the beginning of Chapter 12: Glue of his TeXbook, there is a figure like the one below.
My question is: where did those ...
16
votes
1answer
462 views
Is it still worthwhile to let TeX try line-breaking without hyphenation?
Here's TeX's line-breaking approach (as I understand it) in a nutshell:
If \pretolerance is positive, try to break a paragraph into lines without inserting discretionary hyphens and without ...
16
votes
1answer
3k 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,
...
