Tag Info

Hot answers tagged

31

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


16

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.


14

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


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


14

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


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


12

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


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


10

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


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


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

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

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


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

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


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

You really don't want to do this;-) \documentclass{article} \textheight4.5\baselineskip \usepackage{lipsum} \begin{document} \flushbottom \baselineskip=1\baselineskip plus 12pt minus 2pt\relax \showthe\baselineskip \lipsum \end{document} If you remove the plus component and only have the minus component then TeX will only squeeze and never shrink. ...


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


6

There are possibilities but it is a bit difficult to achieve. The listingspackage contains many hooks but unfortunately none that actually allows implementing this directly (at least I couldn't see one after some quick reading). Problem is that each line in a listing is effectively a single paragraph and so there is some \parskip between the lines that make ...


6

In the chatroom David Carlisle and egreg helped me to point out the issue. Thanks for your engagement. After \section normally you don't have any breaks avoiding orphans. Normally implies we have exceptions. To allow colour specification you are buying an unwanted breakpoint. To demonstrate this I use the following example: \documentclass{article} ...


6

Please always post a compete document that shows the problem not just a fragment. Setting widow penalty to 3000 makes it less desirable to break with a widow line, but even if you set it to 10000 to make it infinitely bad to break there, TeX may still do so if it has no better alternative. If you have a full page of text with no stretchable space on the ...


5

You can use \widowpenalties; with \widowpenalties 3 10000 10000 0 you add a penalty of 10000 between the last three lines and none between preceding lines. See also How to avoid page-breaks inside paragraphs? \documentclass{scrartcl} \usepackage{lipsum} \newenvironment{env} {\begin{addmargin}{2em}\widowpenalties 3 10000 10000 0 } {\end{addmargin}} ...


5

If you want to change the value of \widowpenalty in the footnotes only, you can say \patchcmd{\@footnotetext}{\dfn@latex@footnotetext{#1}} {\dfn@latex@footnotetext{\widowpenalty150 #1}}{}{} after having loaded dblfnote (requires etoolbox). Note also that the setting \clubpenalty in your class is not correct, as LaTeX changes the value of this parameter ...


5

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


4

Ok, I don't know how much of a bad hack this is, but here's an attempt which tries to redefine \par at the end of \] so that it can detect whether it comes directly after the displayed math. \documentclass{article} \usepackage{etoolbox} %Remove the following % to get "one line of text" onto the first page: \postdisplaypenalty=100 ...



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