Tag Info

Hot answers tagged

65

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 ...


57

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 ...


48

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 ...


45

\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 ...


43

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 ...


43

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 ...


39

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 ...


37

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 ;-)


34

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}\\% ...


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 ...


32

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 ...


29

You can avoid the paragraph indention for specific paragraphs with the \noindent macro. If you want to disable it globally you could use \setlength{\parindent}{0pt}. However, I would not recommend changing it globally in your case, because that's effectively changes the template, even if the actual file isn't modified.


28

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} ...


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 ...


24

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

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 ...


23

You can always cheat the "there is no line here to end" error with empty \mbox{}es. For example: \paragraph{Some title stuff.}\mbox{}\\ bla bla bla For convenience you can define your own paragraph before \begin{document} \newcommand{\myparagraph}[1]{\paragraph{#1}\mbox{}\\} and just use your new command: \myparagraph{Some title stuff.} bla bla bla


23

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 ...


22

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 ...


22

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 ...


22

The easiest method is to call \usepackage{indentfirst} in your preamble. This package is included in all LaTeX distributions. The standard setting of LaTeX is to suppress indentation in the first paragraph after a sectional title, which is standard usage in American typography. Some babel language settings do similarly to indentfirst, for instance the ...


22

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 ...


22

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 ...


21

I would approach the answer to the question a bit differently (though it is essentially equiv to what David said): \par in LaTeX is equivalent to an empty line in the user document! Whatever the LaTeX gives as meaning to the "empty line" in a certain context is what \par would result to. Example given by David: in a tabular empty lines are ignored. But ...


20

\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).


20

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 ...


20

I ran your code. (By the way, your not-so-minimal example doesn't compile unless the natbib and pagenote packages are loaded as well.) At least in the example you provide, there's indeed a problem of "overstretched inter-paragraph glue", confirming @Marco's guess. I can think of three solutions to this problem: You could issue the following command in your ...


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

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 ...


19

I would use the adjustwidth environment from the changepage package: \begin{adjustwidth}{<left margin>}{right margin>} ... \end{adjustwidth} The entire contents of adjustwidth is indented from the left margin by <left margin> and from the right margin by <right margin>. Here's a minimal example: \documentclass{article} ...



Only top voted, non community-wiki answers of a minimum length are eligible