Tag Info

Hot answers tagged

36

this was addressed by Knuth in a q&a session in st. petersburg, florida, published in tugboat: - TUG'95: Questions and Answers with Prof. Donald E. Knuth, pp.18 (bottom of column 2) - 20; the session was republished in Digital Typography, with the relevant question starting on p.594. the page-breaking problem was also the subject of Michael Plass' ...


27

LaTeX is set up to avoid this if possible but sometimes there just isn't a good alternative. You can suppress widow lines entirely with \widowpenalty=10000 but you'll want to have \raggedbottom enabled. Avoiding widow words isn't as directly straightforward. You cannot automatically suppress them but you can specify that you want a final line of at least ...


23

It was proved by Plass, that the page breaking problem can be NP-complete. Computers were about 10^4 times slower than nowadays, so it was a problem.


19

You can now use the nowidow package to make this task easier: \usepackage[all]{nowidow}


18

Your assumption isn't quite correct, TeX doesn't simply use a greedy algorithm to fill pages. Each page break is chosen in such a way that at this point it is optimal. In order to achieve this, TeX actually typesets more material than would fit on the page and then chooses the break with the smallest badness. For example, if there's some vertical space that ...


17

As Brent points out, you cannot always do this. The best you can do is to tell TeX that it's infinitely bad for these to appear: \widowpenalty10000 \clubpenalty10000 One thing to keep in mind is that when presented with multiple infinitely bad options, TeX just picks one of them so you can still get widows or orphans.


15

The Memoir manual, in section 3.5 "Sloppybottom" discusses this in some detail, which I won't reproduce here. Be prepared even to re-word in the most intractable cases. Update: I think the specific commands like \enlargethispage and \sloppybottom are exclusively for the memoir package, but here's a snippet extracted from the aforementioned that you may ...


15

Yes, this is possible if you are prepared to accept a certain level of false positives. Basically for both cases special penalties are used by TeX and those can be recognized in the output routine. So my code below sets the value for \widowpenalty to 151 and \clubpenalty (orphans) to 152 (the LaTeX default is 150). The we use the following code: ...


14

In a book like the one you are writing that primarily deals with textual information, the TeX engine has to balance two conflicting constraints. Achieving a flushbottom layout Avoiding widows and orphans If the baselineskip is set at a fixed size - which is the norm - the page can only contain so many multiples of this, say 30 lines of text. Depending ...


12

I fear the answer is that with 2e's \marginpar this is the expected behavior. The reason for this is that LaTeX2e implements marginal notes by calling the output routine after the current line. Then in the OR it will look at the current status of the page and attach the marginal accordingly, i.e., on the left or right. It then returns the constructed ...


12

TeX assigns a badness to each line. Widows and orphans are bad and TeX tries to avoid them whenever possible. However, if avoiding the widow or orphan causes something else to be even more bad, TeX will insert the widow or orphan. You can tell TeX that these are infinitely bad by using \widowpenalty=10000 \clubpenalty=10000 TeX still might insert these ...


11

The geometry package has nothing to do with widows and orphans. In your example a widow is created because of the display. Some remedy can be applied, but only when the text of your document is in final form. For example, adding a line to an "almost full" long paragraph may avoid an orphan or a widow Some long paragraph that ends almost flush ...


11

The displayed equation is not counted as part of the paragraph in the context of widows and orphans. You can forbid a page break after the displayed equation by setting \postdisplaypenalty=10000


10

With the version 2.02 you need the following modification. I can think about a new implementation step to reduce the overlapping. \makeatletter \def\tcb@split@lower@box{% \vfuzz=\maxdimen\vbadness=10000% \setbox\tcb@lowerbox=\vsplit\tcb@totallowerbox to\tcb@split@dim% \setbox\tcb@lowerbox=\vbox{\unvbox\tcb@lowerbox}% ...


10

Define for example \interfootnotelinepenalty=100 or try 10000· Macro \footnote uses the given \interfootnotelinepenalty if a pagebreak is necessary in your footnote.


9

Using \leaders you can define a rule that will "disappear" at the beginning of a page: \documentclass{article} \usepackage[paperheight=7cm,textwidth=18cm]{geometry}% just for the example \newcommand\Myrule{% \par\leaders\vrule width \textwidth\vskip0.4pt\par\nobreak } \begin{document} \vspace*{3.64cm} % Adjust as necessary ...


9

This is not exactly what you are calling for, but since you wanted any other relevant typographic quality indicator I believe is useful, let me mention two packages: Patrik Gundlach's lua-check-hyphen, which lets you review all hyphenations actually used in a document, and Raphaël Pin­son's impnattypo, which implements quite a few rules of French ...


9

\@nobreaktrue is the correct way to do this. The reason it works is that the quote environment eventually does something like \everypar{% \if@nobreak \@nobreakfalse \clubpenalty=10000 \else \clubpenalty=150 \fi } so your \clubpenalty is being overridden. To answer your other questions, \@nobreaktrue expands to ...


8

I would say it is a bug. It also already reported (but neither analyzed nor solved): http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=latex/4065 Rougly I would say that the problem is that in a list (quote is list) the \item doesn't start a paragraph and so the everypar trickery of the list and the section clash.


8

Based on the answer to this question, here is an attempt. The same caveats apply, that is you will probably get some false positives. \documentclass[draft]{article} \usepackage{ifdraft} \usepackage{xcolor} \usepackage{marginnote} \clubpenalty=153 \widowpenalty=152 % check if the output penalty was due to orphan or widow or both \ifdraft{ ...


8

I am the author of tcolorbox and I have just uploaded version 2.22 to CTAN. This new version removed (some/most) of the addressed problems. "There are unwanted blank pages" I found the cause of the problem and (hopefully) eliminated it. Since the breaking of the upper part / lower part features of tcolorbox is sometimes a little bit tricky, I may have ...


8

The widow line is formed in your paragraph text before the signature code really starts so you need to prevent them at that level (I just set widowpenalty to be infinite here) The signature code was making overfull box warnings so I modified it a bit, unrelated to the question. \documentclass{memoir} \usepackage{lipsum} % signature % ~~~~~~~~~ % ...


7

For a one-off final editing correction rather than changing the setting of all such citations you could use \mbox{\cite{foo,bar}} But I doubt there is enough flexibility in the shown line to find good line and page break in that case. It might be better (if re-wording isn't an option) to allow the line to break there but use ...


7

It seems you set \widowpenalty=10000 in your class, and this penalty also applies to dblfnotes footnotes. Resetting the penalty to its LaTeX default value of 150 corrects the "problematic" column break. You could also use the etoolbox package to patch the \footnote command and reset widowpenalty only for footnotes. \documentclass[ twocolfnotes, ...


7

As TH wrote, your situation would pick up a \widowpenalty due to being a single line of a paragraph on a new page. It is also penalized as a page break after a hyphenation by \brokenpenalty and by \finalhyphendemerits for being a hyphenated second-to-last line of the paragraph. If any or all of these are set to sufficiently large values, then your bad break ...


7

I can't see any problems with setting \postdisplaypenalty globally—if you encounter any problems, they are probably signs of a package bug. The default values are probably fine for Knuth; but these settings are implemented as parameters because you should customize them.


6

During the manual final adjustments of the manuscript, I often (as a copy editor) use \looseness=1 to make TeX try to increase the number of lines in some paragraph by 1, so that I avoid widows, orphans and underfull pages. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus vitae mi dui. Aliquam erat volutpat. Vestibulum nec vehicula nisi. ...


6

I think bigfoot has (undocumented) \footnotewidowpenalty and \footnoteclubpenalty values.


6

I found that this hack seems to work, at least if the problematic environment is based on list: \makeatletter \g@addto@macro\endtrivlist{\aftergroup\@restoreclubpenalty} \def\@restoreclubpenalty{\clubpenalty\@clubpenalty} \makeatother


6

The package bigfoot provides much better footnote breaking facilities than the default. Loading it alone will often fix bad breaking issues. By default it also defines: \newcount\footnotewidowpenalty \footnotewidowpenalty=250 \newcount\footnoteclubpenalty \footnoteclubpenalty=250 \newcount\finalfootnotewidowpenalty \finalfootnotewidowpenalty=4000 ...



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