Hot answers tagged paragraphs
45
Adding
\usepackage{parskip}
to the preamble of your document (the part between \documentclass{...} and \begin{document} will set the paragraphs to have no indentation and a bit of space between them.
Note that this isn't a complete solution, because there may be elements in your document that you don't want this format to apply to (footnotes, for ...
45
After reading lockstep's and Lev's answers, here is my own take. It seems to me that there's 4 main factors that make a river bad:
Its orientation: The straighter, the worse;
Its width: the larger, the worse;
The constancy of its width: the more constant, the worse;
The length: the longer, the worse.
From this, I guess I could try to improve the ...
39
I think to do it properly, you really need to take into account the shapes of the glyphs. Some glyphs, such as .,-' are very light. Others, such as ATVWvwLkbhdpq"lean" to the left or the right. I don't think the two rivers in this example could be spotted without taking into account glyph shapes:
EDIT: To respond to Raphink's comment, here is the same ...
38
\par is a Tex primitive and is the same as a blank line (except in special environments such as verbatim where the usual rules don't apply). It ends horizontal mode, causes TeX to break the horizontal text into lines placed on the current vertical list, and exercises the page breaker which may possibly cause the next page to be shipped out.
\\ is different ...
34
There are exactly 7 places in the TeX program where TeX executes the paragraph builder internally, i.e. turning a horizontal list (if there is one under construction) into a paragraph. This happens not by inserting a \par token into the input stream but by executing the procedure end_graf implemented in module §1096 in the TeX program.
This procedure does ...
33
In addition to Werner's excellent answer I'd like to make some remarks.
The indent after a section title (section is used here in a very broad sense, that is, anything with a title) is a question both of personal taste and of typographic tradition.
Tschichold, for example, states that the first indent should be suppressed only after a centered title and ...
32
You can inhibit page breaks in the middle of paragraphs by saying in you preamble
\widowpenalties 1 10000
\raggedbottom
Without \raggedbottom (that the article class does automatically) the pages would be awful.
The primitive \widowpenalties is an extension to the original TeX program, present in e-TeX based engines (pdftex, xetex and luatex). It ...
31
This is perhaps very subjective.
The default for LaTeX is to have no indent after sectional headings, like \chapter and \section. The choice should be based on consistency. Do you want a paragraph indent after a sectional heading?
Yes: Add \usepackage{indentfirst} to your document preamble. The minimalist indentfirst package sets the boolean ...
29
I have added a first version of an algorithm to detect rivers using Lua to the impnattypo package on github. To use it, simply use the rivers option:
\usepackage[draft,rivers]{impnattypo}
Here is an example result:
Beware that there might still be some bugs ;-)
25
The he-she package now does everything you need. (I have added a package option as the result of this question.) Let's first see how you would do this without automating (and why this is probably preferable.)
Partial automation
The he-she package implements two different sets of macros for pronouns: one set (\heshe, \himher, and \hisher) outputs a pronoun ...
23
It is correct behaviour and the reason is that you don't need to show with an indent that a paragraph starts here as everyone knows that after a section title a new paragraph starts.
You can change this with indentfirst package.
23
Here’s my attempt, using Xfig. I have simplified the shape a bit, to make it work better for shorter paragraphs.
\def\coatpar#1{\shapepar{\coatshape}#1\par}
\def\coatshape{%
{25.1761}%
{0.176056}b{0.176056}\\%
{0.176056}t{0.176056}{50}\\%
{1.05634}t{0.176056}{0.880282}st{1.05634}{49.1197}\\%
{2.28873}t{0.176056}{0.352113}t{2.46479}{47.7113}\\%
...
23
Here's a list of other possible solutions
A solution that admits page breaks using mdframed:
\documentclass{article}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{lipsum}
\begin{document}
\lipsum[4]
\begin{mdframed}[hidealllines=true,backgroundcolor=blue!20]
\lipsum[2]
\end{mdframed}
\lipsum[4]
\end{document}
The environments provided by the ...
22
Since you did not say which document class or bibliography packages you're using I will give you a general answer.
A bibliography like this uses a numbered list. The paralist package provides such in-paragraph lists: you could use the inparaenum environment of paralist to get numbered items within a paragraph without linebreaks.
For instance, with article ...
22
I suggest to assign a "badness" value to rivers according to the following definition/formula:
A river occurs whenever two or more successive text lines feature white space that overlaps horizontally. (It seems that Raphink's detection algorithm adheres to this definition.)
The "badness" of a river may be calculated as
(overlap / word space ) * (no. of ...
21
In addition to what Joseph said, No, it is not good style. If you want paragraphs without leading indentation, use the parskip package.
You are better off in LaTeX marking up what things mean and letting the engine decide how they ought to look. So, in general, when you are tempted to stick in some fine-grained layout command, you ought have a second ...
20
According to The TeXbook, the rule for end-of-lines is as follows
If TeX sees an end-of-line character (category 5), it throws away
any other information that might remain on the current line. Then if
TeX is in state N (new line), the end-of-line character is
converted to the control sequence token \par (end of
paragraph); if TeX is in state M ...
19
\newline does not start a new paragraph, it just forces a new line. So the result is very different: use two blank lines (or \par) for a paragraph, and \newline (or \\) when you want a new line. The later is rare but of course does happen (particularly in titles and so forth).
19
To expand a little on the answers already given: It is not merely a question of adding a new sort of penalty and having TeX magically optimize for the new penalty. The problem is that TeX's paragraph optimization algorithm utilizes the special structure of the problem given it: The problem is rephrased as a shortest path algorithm in a graph (whose nodes are ...
18
You could use the adjustwidth environment from changepage package- a MWE follows. Note that adjustwidth environment deals with page breaks.
The adjustwidth environment takes 2 arguments: the first is the indent from the left margin, and the second is the indent from the right margin. See the documentation for more details.
\documentclass{report}
...
17
At the end of each paragraph, TeX usually adds infinitely stretchable glue, since the usual setting of \parfillskip is equivalent to
\setlength{\parfillskip}{0pt plus 1fill}
One way might be to set
\setlength{\parfillskip}{0pt plus\dimexpr\textwidth-2\parindent}
but this would work only for normal paragraphs. In lists one should reset the \parfillskip ...
17
You asked for a LuaTeX solution and you get one:
\documentclass{article}
\usepackage{luatexbase,luacode}
\begin{luacode}
last_line_twice_parindent = function (head)
while head do
local _w,_h,_d = node.dimensions(head)
if head.id == 10 and head.subtype ~= 15 and (_w < 2 * tex.parindent) then
-- we are at a glue and have less then ...
17
Disclaimer: I am standing on the shoulders of giants (Werner and egreg), and probably interfering in their conversation...
Bringhurst, in The Elements of Typographic Style, v2.3, pp39-40, dedicates over a page to this, with the usual insights one has come to expect.
But he, like Tschichold and the Imprimerie Nationale, tends to be a bit prescriptive. The ...
17
David did beat me by a couple of minutes, but this version here does indentation as requested and is not producing overfull lines (within reason):
\documentclass{article}
\makeatletter
% this defines myverbatim environment. to change name replace "myverbatim" in all places below (strctly speaing it is only necessary in some but ... :-)
...
16
For our purposes, \begin{#1} is roughly
\begingroup \@endpefalse \csname #1\endcsname
and \end{#1} is roughly
\csname end#1\endcsname\expandafter \endgroup \if@endpe \@doendpe \fi
Since \expandafter expands \if@endpe before the group ends, the value of the switch that is used is the one within the environment. If the \csname #1\endcsname part of a ...
16
If the routines are to be integrated with TeX or a TeX-like system optimization should preferably be done at the paragraph level to enable faster execution.
Consider the text below given by Bishop in his post.
The characteristics of the 'rivers' is an advancing front. If the x,y positions of the endings of words is known a line (not necessarily straight ...
16
\newcommand{\lettrinerule}[1]{%
\settoheight{\dimen0}{\scshape #1}%
\noindent
\vbox to \dimen0{\hrule width 5em\vfill\hrule}\kern.5em
\textsc{#1}}
The \noindent is probably unnecessary. Adjust to suit. You can modify the thickness of the rule by saying heigth <dimen> after each \hrule command.
A more LaTeX way would be
...
16
The conversion of two consecutive newlines to a \par token comes from TeX's parser and so all formats of TeX (plain, LaTeX, ConTeXt) observe it too.
Note that \par gobbles all whitespace until the next non-whitespace token, so three or more consecutive newlines have the same effect as two: one new paragraph. So if you want to have three blank lines ...
15
Neither an empty line nor a \par token indicate the beginning of a new paragraph; they end an active paragraph and switch to unrestricted vertical mode (if the processor has been in unrestricted horizontal mode so far). To begin a new paragraph, either \indent, \noindent or a horizontal command has to be used—i.e., a command that forces TeX to switch to ...
15
I doubt this is practical, but just in case... but the problem is a lot easier (conceptually, not computationally), and closer to what the eye does, if detection is performed on the page image - in pixel space, not character space. Then it would "just" require blurring the image a little, and then searching for long lines that are somewhat vertical and are ...
Only top voted, non community-wiki answers of a minimum length are eligible

