Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
Dernière révision Les deux révisions suivantes
3_composition:texte:pages:empecher_un_saut_de_page_entre_deux_lignes [2018/05/23 23:24]
joseph.wright
3_composition:texte:pages:empecher_un_saut_de_page_entre_deux_lignes [2018/12/04 00:46]
jejust
Ligne 1: Ligne 1:
---- +====== ​Preventing page breaks between lines ====== 
-section: Adjusting the typesetting +
-subsection: Page layout +
-revised: 2014-06-10 +
---- +
-Preventing page breaks between lines+
  
 One commonly requires that a block of typeset material be kept on the One commonly requires that a block of typeset material be kept on the
 same page; it turns out to be surprisingly tricky to arrange this. same page; it turns out to be surprisingly tricky to arrange this.
  
-LaTeX provides a `samepageenvironment which claims it+LaTeX provides a ''​samepage'' ​environment which claims it
 does this sort of thing for you.  It proceeds by setting infinite does this sort of thing for you.  It proceeds by setting infinite
-penalties for all sorts of page-break situations; but in many+penalties for all sorts of page break situations; but in many
 situations where you want to prevent a page break, situations where you want to prevent a page break,
-`samepagedoesn'​t help.  If you're trying to keep running+''​samepage'' ​doesn'​t help.  If you're trying to keep running
 text together, you need to end the paragraph inside the environment text together, you need to end the paragraph inside the environment
-(see [preserving paragraph parameters](FAQ-paraparam.md)).+(see [[FAQ-paraparam|preserving paragraph parameters]]).
 Also, if the things you are trying to keep together insert their own Also, if the things you are trying to keep together insert their own
-pagebreak ​hints, ​`samepagehas no power over them (though +page break hints, ​''​samepage'' ​has no power over them (though 
-list items' attempts&​nbsp;&​mdash; ​they suggest page breaks between items&​nbsp;&​mdash;​ +list items' attempts ​--- they suggest page breaks between items --- 
-are subverted by `samepage`).  Naturally, if +are subverted by ''​samepage''​).  Naturally, if 
-`samepage` _does_ ​work, it is capable of leaving+''​samepage''​ //​does// ​work, it is capable of leaving
 stuff jutting out at the bottom of the page. stuff jutting out at the bottom of the page.
  
 Another convenient trick is to set all the relevant stuff in a Another convenient trick is to set all the relevant stuff in a
-`\parbox(or a `minipageif it contains things like +''​\parbox'' ​(or a ''​minipage'' ​if it contains things like 
-verbatim text that may not be used in the argument of a `\parbox`). +verbatim text that may not be used in the argument of a ''​\parbox''​). 
-The resulting box certainly ​_won't_ break between pages, but+The resulting box certainly ​//won't// break between pages, but
 that's not to say that it will actually do what you want it to do: that's not to say that it will actually do what you want it to do:
 again, the box may be left jutting out at the bottom of the page. again, the box may be left jutting out at the bottom of the page.
  
-Why do neither of these obvious things work?&​nbsp;&​mdash; ​Because TeX can't+Why do neither of these obvious things work? --- Because TeX can't
 really distinguish between infinitely awful things. really distinguish between infinitely awful things.
-`Samepagewill make any possible break point ''​infinitely +''​Samepage'' ​will make any possible break point 
-bad'' ​and boxes don't even offer the option of breaks, but if the+"​infinitely ​bad" ​and boxes don't even offer the option of breaks, but if the
 alternative is the leave an infinitely bad few centimetres of blank alternative is the leave an infinitely bad few centimetres of blank
 paper at the bottom of the page, TeX will take the line of least paper at the bottom of the page, TeX will take the line of least
 resistance and do nothing. resistance and do nothing.
  
-This problem still arises even if you have `\raggedbottomin +This problem still arises even if you have ''​\raggedbottom'' ​in 
-effect: TeX doesn'​t notice the value of _that_ ​until it starts+effect: TeX doesn'​t notice the value of //​that// ​until it starts
 actually shipping a page out.  One approach is to set: actually shipping a page out.  One approach is to set:
-```latex+ 
 +<​code ​latex>
 \raggedbottom \raggedbottom
 \addtolength{\topskip}{0pt plus 10pt} \addtolength{\topskip}{0pt plus 10pt}
-``` +</​code>​ 
-The `10ptoffers a hint to the output routine that the column is+The ''​10pt'' ​offers a hint to the output routine that the column is
 stretchable;​ this will cause TeX to be more tolerant of the need to stretchable;​ this will cause TeX to be more tolerant of the need to
 stretch while building the page.  If you're doing this as a temporary stretch while building the page.  If you're doing this as a temporary
-measure, cancel the change to `\topskipby: +measure, cancel the change to ''​\topskip'' ​by: 
-```latex+ 
 +<​code ​latex>
 \addtolength{\topskip}{0pt plus-10pt} \addtolength{\topskip}{0pt plus-10pt}
-``` +</​code>​ 
-as well as resetting ​`\flushbottom`.  (Note that the `10ptnever+as well as resetting ​''​\flushbottom''​.  (Note that the ''​10pt'' ​never
 actually shows up, because it is overwhelmed when the page is shipped actually shows up, because it is overwhelmed when the page is shipped
-out by the stretchability introduced by `\raggedbottom`; however, it +out by the stretchability introduced by ''​\raggedbottom''​; however, it 
-could well have an effect if `\flushbottomwas in effect.)+could well have an effect if ''​\flushbottom'' ​was in effect.)
  
 An alternative (which derives from a suggestion by Knuth in the An alternative (which derives from a suggestion by Knuth in the
-TeXbook) is the package [`needspace`](https://​ctan.org/​pkg/​needspaceor the [`memoir`](https://​ctan.org/​pkg/​memoirclass, +TeXbook) is the package [[ctanpkg>​needspace|needspace]] or the [[ctanpkg>​memoir|memoir]] class, 
-which both define a command ​`\needspacewhose argument tells it+which both define a command ​''​\needspace'' ​whose argument tells it
 what space is needed. ​ If the space isn't available, the current page what space is needed. ​ If the space isn't available, the current page
 is cleared, and the matter that needs to be kept together will be is cleared, and the matter that needs to be kept together will be
-inserted on the new page.  For example, if 4&nbsp;lines of text need to be+inserted on the new page.  For example, if 4 lines of text need to be
 kept together, the sequence kept together, the sequence
-```latex+ 
 +<​code ​latex>
 \par \par
 \needspace{4\baselineskip} \needspace{4\baselineskip}
Ligne 70: Ligne 69:
 <text generating lines 1-4> <text generating lines 1-4>
 % now stuff we don't mind about % now stuff we don't mind about
-```+</​code>​
 Yet another trick by Knuth is useful if you have a sequence of small Yet another trick by Knuth is useful if you have a sequence of small
 blocks of text that need, individually,​ to be kept on their own page. blocks of text that need, individually,​ to be kept on their own page.
-Insert the command ​`\filbreakbefore each small block, and the+Insert the command ​''​\filbreak'' ​before each small block, and the
 effect is achieved. ​ The technique can be used in the case of effect is achieved. ​ The technique can be used in the case of
-sequences of LaTeX-style sections, by incorporating ​`\filbreak` +sequences of LaTeX-style sections, by incorporating ​''​\filbreak''​ 
-into the definition of a command (as in  +into the definition of a command (as in 
-[patching commands](FAQ-patch.md)).  A simple and effective+[[FAQ-patch|patching commands]]).  A simple and effective
 patch would be: patch would be:
-<!-- {% raw %} --> + 
-```latex+ 
 +<​code ​latex>
 \let\oldsubsubsection=\subsubsection \let\oldsubsubsection=\subsubsection
 \renewcommand{\subsubsection}{% \renewcommand{\subsubsection}{%
Ligne 86: Ligne 86:
   \oldsubsubsection   \oldsubsubsection
 } }
-``` +</code> 
-<!-- {% endraw %} -->+
 While the trick works for consecutive sequences of blocks, it's While the trick works for consecutive sequences of blocks, it's
 slightly tricky to get out of such sequences unless the sequence is slightly tricky to get out of such sequences unless the sequence is
-interrupted by a forced page break (such as `\clearpage`, which may +interrupted by a forced page break (such as ''​\clearpage''​, which may 
-be introduced by a `\chaptercommand, or the end of the document).+be introduced by a ''​\chapter'' ​command, or the end of the document).
 If the sequence is not interrupted,​ the last block is likely to be If the sequence is not interrupted,​ the last block is likely to be
 forced onto a new page, regardless of whether it actually needs it. forced onto a new page, regardless of whether it actually needs it.
Ligne 102: Ligne 102:
 decide, case by case, how to deal with problems at the last decide, case by case, how to deal with problems at the last
 proof-reading stage. ​ At this stage, you can manually alter page proof-reading stage. ​ At this stage, you can manually alter page
-breaking, using either ​`\pagebreakor `\clearpage`, or you can +breaking, using either ​''​\pagebreak'' ​or ''​\clearpage''​, or you can 
-place a `\nopagebreakcommand to suppress unfortunate breaks.+place a ''​\nopagebreak'' ​command to suppress unfortunate breaks.
 Otherwise, you can make small adjustments to the page geometry, using Otherwise, you can make small adjustments to the page geometry, using
-`\enlargethispage`.  Supposing you have a line or two that stray: +''​\enlargethispage''​.  Supposing you have a line or two that stray: 
-issue the command ​`\enlargethispage{2`\baselineskip`}and+issue the command ​''​\enlargethispage{2''​\baselineskip''​}'' ​and
 two lines are added to the page you're typesetting. ​ Whether this two lines are added to the page you're typesetting. ​ Whether this
 looks impossibly awful or entirely acceptable depends on the document looks impossibly awful or entirely acceptable depends on the document
 context, but the command remains a useful item in the armoury. context, but the command remains a useful item in the armoury.
  
-Note that both `\pagebreakand `\nopagebreaktake an optional+Note that both ''​\pagebreak'' ​and ''​\nopagebreak'' ​take an optional
 number argument to adjust how the command is to be interpreted. ​ Thus number argument to adjust how the command is to be interpreted. ​ Thus
-`\pagebreak[0]`, the command ​''​suggests'' ​that a page break +''​\pagebreak[0]''​, the command ​"suggests" ​that a page break 
-might be worth doing, whereas ​`\pagebreak[4]''​demands'' ​+might be worth doing, whereas ​''​\pagebreak[4]'' ​"demands" ​
-page break. ​ Similarly ​`\nopagebreak[0]makes a suggestion,​ +page break. ​ Similarly ​''​\nopagebreak[0]'' ​makes a suggestion,​ 
-while `\nopagebreak[4]is a demand. ​ In both commands, the+while ''​\nopagebreak[4]'' ​is a demand. ​ In both commands, the
 default value of the optional argument is 4. default value of the optional argument is 4.
  
 +-----
 +
 +//Source:// [[faquk>​FAQ-nopagebrk|Preventing page breaks between lines]]
 +
 +{{htmlmetatags>​metatag-keywords=(LaTeX,​formatting)
 +metatag-og:​title=(Preventing page breaks between lines)
 +metatag-og:​site_name=(FAQ LaTeX francophone)
 +}}
  
3_composition/texte/pages/empecher_un_saut_de_page_entre_deux_lignes.txt · Dernière modification: 2021/02/13 19:23 par yannick.tanguy
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0