178
votes
Forcing linebreaks in \url
Herbert Voß created (December 2017) the package xurl.
This package allows urls to break everywhere, can be compiled simply with pdflatex, and has the same options as url (indeed, it loads url package)...
118
votes
Multiple lines one side of equation with a Curly Bracket
Use the cases environment, like this.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
D_{it} =
\begin{cases}
1 & \text{if bank $i$ issues ABs at time $t$...
73
votes
How to force LaTeX not to break the line after a hyphen “-”?
Do not reinvent the wheel – there is a package for that
It is called the extdash package and adds multiple commands for new behaviour with dashes.
Important: load this package as the very last ...
62
votes
Accepted
What does "overfull hbox" mean? (Why is there a black mark at the end of a line?)
Quoting Phil Miller answer, for completeness:
This message means that a line of your document is too long to fit within the horizontal space on the page, and TeX couldn't find a good way to break it ...
58
votes
How to force LaTeX not to break the line after a hyphen “-”?
The amsmath package provides the \nobreakdash command to insert before the relevant dash:
\documentclass{article}
\usepackage{amsmath}
\usepackage[width=1.5cm]{geometry}
\begin{document}
A (re\...
56
votes
How can I prevent inline math formulas from overflowing into the margin?
If your formular is not too long for a line in the first place, you can use
\sloppy
in the begining of your paragraph:
The lineshape of the imaginary part of the susceptibility
(e.g. $\mathrm{\...
55
votes
Accepted
newline in multirow environment
There is several ways to do it. A very simple way is using \shortstack
\documentclass{article}
\usepackage[frenchb]{babel}
\usepackage[T1]{fontenc}
\usepackage{multirow}
\begin{document}
\begin{...
40
votes
Accepted
How to adjust the line breaking in the bibliography?
This is a general problem of automatically generated bibliographies. Some bits of the bibliography entry may turn out to be unbreakable and if they happen to occur in the wrong place, overfull or ...
38
votes
Accepted
how to maintain text justification after forcing a new line
\\ (which you should almost never use) is for leaving the line short. \linebreak (which you should almost never use) is the command to force a line and still justify the paragraph.
\linebreak has an ...
38
votes
Accepted
Typesetting curiosity: word change on one line does not affect how that line is set, but affects how the next line is set
I could not reproduce the output that you show, however by exaggerating width of her I can produce the effect,
\documentclass[12pt]{book}
\RequirePackage[adobe-utopia]{mathdesign}
\textwidth5.5in
\...
36
votes
35
votes
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?
That's just TeX alerting you that it was unable to ...
34
votes
break lines in minted code
Version 2.1 of minted has breaklines and linenos:
\documentclass[a5paper]{article}
\usepackage[T1]{fontenc}
\usepackage[]{minted}
\begin{document}
\begin{minted}[linenos,tabsize=2,breaklines]{text}
...
34
votes
newline in multirow environment
Simple with makecell, which is done for this sort of things: use the \multirowcell command (syntax even simpler than \multirow):
\documentclass{article}
\usepackage[frenchb]{babel}
\usepackage[T1]{...
33
votes
How to put a line-break in section heading?
I recently ran into a similar issue where my section title was being split across two lines, but only one or two words were ending up on the second line. I wanted to manually insert a line break so ...
32
votes
Accepted
The word "Wikipedia" does not hyphenate
It's true that by default “Wikipedia” is not hyphenated:
\documentclass{article}
\usepackage{showframe}
\begin{document}
wikipedia wikipedia wikipedia wikipedia wikipedia
wikipedia wikipedia ...
31
votes
How to create nonbreaking arbitrary length snakes for full-width justification?
Really is not a snake, but ...
\documentclass{article}
\usepackage[text={1.2in,3in}]{geometry}
\def\snake{\cleaders\hbox to .5em{\hss\ensuremath\sim\hss%
\hspace{-.3em minus -.2em}%
}\hfill$^{_\...
31
votes
How to create nonbreaking arbitrary length snakes for full-width justification?
While I couldn't get David Carlisle's answer to work, I made a simple tielable vector version of the xkcd snake:
\documentclass{article}
\usepackage[text={1.2in,3in}]{geometry}
\usepackage[none]{...
29
votes
How to add a forced line break inside a table cell
Here I use stacks to accomplish it. Several things are noteworthy:
I demonstrate \Longstack , \Longunderstack and \Centerstack, which give three different alignments.
In order not to squeeze against ...
26
votes
URLs in bibliography: LaTeX not breaking line as expected
When using biblatex, this can also be achieved with the block=ragged option, see §3.1.2.1 in http://mirrors.ibiblio.org/CTAN/macros/latex/contrib/biblatex/doc/biblatex.pdf
i.e. \usepackage[block=...
25
votes
How can I make my text never go over the right margin by always hyphenating or breaking on word-boundaries?
The accepted answer suggests \sloppy. However, as per this related answer, \sloppy can produce imperfect results, and it's often preferable to use \emergencystretch 3em instead.
Please have a look at ...
25
votes
Accepted
What is \arraybackslash doing on my table column?
As with almost everything in TeX, control sequences (macros and control words) can be redefined, and because local grouping allows for local redefinition, the definitions of macros within a particular ...
24
votes
How can I force a new line after a subsection?
Add the following code;
\hfill\\
after the \subsection{...} command. The \hfill fills the line with empty space, so that \\ can end this line without an error.
23
votes
Why does \\ not return a new line in an equation?
There is an easy way to make \\ works in equation (change line):
\begin{equation}
a = b
\end{equation}
Change it to
\begin{equation}
\begin{array}{l}
a = \\
b
\end{array}
\end{...
23
votes
Accepted
How to create nonbreaking arbitrary length snakes for full-width justification?
this is lualatex only and draws a PDF line w points wide to pad out each line, if you are feeling artistic replace w 0 l by something that draws a snake of the same length
\documentclass{article}
\...
23
votes
Typesetting curiosity: word change on one line does not affect how that line is set, but affects how the next line is set
As an addition to existing answers, the idea is as follows.
TeX classifies lines in a paragraph as
tight
decent
loose
very loose
overfull/underfull
according to their badness, which is computed by ...
22
votes
Best practices for source file line lengths?
I'll use an example from the TeXBook source
This manual is intended for people who have never used \TeX\ before, as
well as for experienced \TeX\ hackers. In other words, it's supposed to
be a ...
21
votes
Allowing line break at ',' in inline math mode?
Here is a solution that doesn't make the comma globally active:
\documentclass{article}
\newcommand{\splitatcommas}[1]{%
\begingroup
\begingroup\lccode`~=`, \lowercase{\endgroup
\edef~{\...
21
votes
Accepted
Multi-line legend entry in pgfplots
By default, TikZ nodes do not allow line breaks, but if you add the align=<left/right/center> key you can use \\. Hence, you can modify the legend style as below.
\documentclass[border=4pt]{...
21
votes
How to create nonbreaking arbitrary length snakes for full-width justification?
The snake could be improved. Also I never know how to do calculations with tikz coordinates, so I use zref instead.
Edit
Actually I think that my first example didn't work in all cases as the begin ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
line-breaking × 2807tables × 221
math-mode × 195
hyphenation × 185
spacing × 173
equations × 135
paragraphs × 125
listings × 103
urls × 97
horizontal-alignment × 87
biblatex × 86
macros × 80
formatting × 78
page-breaking × 69
align × 66
boxes × 60
sectioning × 59
tikz-pgf × 56
hyperref × 56
indentation × 55
lists × 54
amsmath × 50
line-spacing × 50
warnings × 50
bibliographies × 48