]> git.lyx.org Git - wiki-uploads.git/blob - LyX/Manuals/kozma-boxes.lyx
Import uploads from wiki
[wiki-uploads.git] / LyX / Manuals / kozma-boxes.lyx
1 #LyX 1.3 created this file. For more info see http://www.lyx.org/
2 \lyxformat 221
3 \textclass article
4 \begin_preamble
5 \binoppenalty=10000
6 \relpenalty=10000
7
8 \newcommand{\brmul}{\discretionary{\mbox{$\,\cdot$}}{}{}}
9 \end_preamble
10 \options draft
11 \language english
12 \inputencoding auto
13 \fontscheme default
14 \graphics default
15 \float_placement b
16 \paperfontsize default
17 \spacing single 
18 \papersize Default
19 \paperpackage a4
20 \use_geometry 0
21 \use_amsmath 1
22 \use_natbib 0
23 \use_numerical_citations 0
24 \paperorientation portrait
25 \secnumdepth 3
26 \tocdepth 3
27 \paragraph_separation indent
28 \defskip medskip
29 \quotes_language english
30 \quotes_times 2
31 \papercolumns 1
32 \papersides 1
33 \paperpagestyle default
34
35 \layout Title
36
37 How to deal with underfull and overfull boxes
38 \layout Author
39
40 Gady Kozma
41 \layout Date
42
43 July 17th, 2004
44 \layout Section
45
46 What are we talking about?
47 \layout Standard
48
49 Like all wordprocessing software, LaTeX, and therefore LyX, will encounter
50  from time to time a situation where it is unable to divide text into lines
51  or divide the paper into pages in an aesthetic manner.
52  Unlike some other wordprocessors, LaTeX will complain about it, by printing
53  messages like 
54 \family typewriter 
55 overfull hbox
56 \family default 
57  and 
58 \family typewriter 
59 underfull vbox
60 \family default 
61 .
62  More notably
63 \begin_inset Foot
64 collapsed false
65
66 \layout Standard
67
68 A third difference between LaTeX and some other word processors which is
69  perhaps less notable, but important nonetheless, is the fact that LaTeX
70  breaks lines in a more-than-average intelligent manner.
71  Specifically, if LaTeX encounters a problem in a certain line, it can rearrange
72  all lines leading up to it.
73  As a result, it is less likely that LaTeX will have problems breaking any
74  line after the second line of a given paragraph.
75 \end_inset 
76
77 , its reaction to the first problem is not to create a line with enormous
78  white gaps but to create a line that sticks out of the margin.
79 \layout Standard
80
81 Unfortunately, LyX doesn't have a very convenient mechanism to find the
82  places in the document where LaTeX thought there were problems of this
83  kind.
84  Thus you must use either of the following methods: choose 
85 \family sans 
86 \bar under 
87 V
88 \bar default 
89 iew\SpecialChar \menuseparator
90
91 \bar under 
92 L
93 \bar default 
94 atex\SpecialChar ~
95 Logfile
96 \family default 
97  and search for the error messages, or, usually easier, choose 
98 \family sans 
99 \bar under 
100 F
101 \bar default 
102 ile\SpecialChar \menuseparator
103
104 \bar under 
105 E
106 \bar default 
107 xport\SpecialChar \menuseparator
108
109 \bar under 
110 L
111 \bar default 
112 atex
113 \family default 
114  and use a terminal to run LaTeX directly, i.e.\SpecialChar ~
115 type the command 
116 \family typewriter 
117 latex myfile.tex
118 \family default 
119 .
120  LaTeX will spew out mysterious error messages, among them the infamous
121  
122 \family typewriter 
123 overfull hbox
124 \family default 
125  and 
126 \family typewriter 
127 underfull vbox
128 \family default 
129  messages.
130 \layout Standard
131
132 Always remember that these problems are 
133 \emph on 
134 very
135 \emph default 
136  sensitive to font, font size, and page size.
137  Therefore if this is not the final version of the document, if at all possible,
138  just ignore them.
139  The time to handle them is when your work has taken on its final form.
140  And don't worry about this too much.
141  It shouldn't take you more than a few minutes work per 10 pages to fix
142  even a complicated document.
143 \layout Standard
144
145 Before using all the sophisticated techniques discussed here always remember
146  it might be easier to just change the formulation of the text a little.
147  Hey, don't give me that look! Cosi Fanni Tutti.
148 \layout Section
149
150 Overfull hboxes
151 \layout Standard
152
153 An 
154 \begin_inset Quotes eld
155 \end_inset 
156
157 hbox
158 \begin_inset Quotes erd
159 \end_inset 
160
161  is an object that LaTeX tries to fill horizontally, typically a line.
162  It's 
163 \begin_inset Quotes eld
164 \end_inset 
165
166 overfull
167 \begin_inset Quotes erd
168 \end_inset 
169
170  when LaTeX cannot push all the things it wants to into the line.
171  The reason is typically a long word or a formula at the end which, if pushed
172  to the next line would make the line too spacey.
173  So LaTeX calls for help.
174  Here is where you step in.
175 \layout Standard
176
177 Before you start, check if the complaint is for real.
178  LaTeX will sometimes complain about hardly noticeable problems.
179  If you cannot spot the problem immediately, one solution is as follows:
180  in the 
181 \family sans 
182 E
183 \bar under 
184 x
185 \bar default 
186 tra\SpecialChar ~
187 options
188 \family default 
189  box of the 
190 \family sans 
191 \bar under 
192 D
193 \bar default 
194 ocument
195 \family default 
196  tab of 
197 \family sans 
198 \bar under 
199 L
200 \bar default 
201 ayout\SpecialChar \menuseparator
202
203 \bar under 
204 D
205 \bar default 
206 ocument
207 \family default 
208  add the word 
209 \family typewriter 
210 draft
211 \family default 
212 .
213 \begin_inset Foot
214 collapsed false
215
216 \layout Standard
217
218 Note that this will have other effects.
219  For example, all pictures will be replaced by empty rectangles in the output.
220 \end_inset 
221
222  In most document classes (in particular the standard and AMS classes) this
223  will cause a small black box to be printed to the right of the problematic
224  line.
225  If you cannot see the problem --- good for you.
226  Ignore it and move on to the next error.
227  Otherwise proceed reading.
228 \layout Standard
229
230
231 \begin_inset ERT
232 status Collapsed
233
234 \layout Standard
235
236 \backslash 
237 begin{sloppypar}
238 \end_inset 
239
240 The second easiest solution (after ignoring the problem) is being sloppy
241  about it.
242 \begin_inset Foot
243 collapsed false
244
245 \layout Standard
246
247 The paragraph with the footnote mark, for example, if set like that.
248  Notice the extra wide space in this line! This is due to sloppily pushing
249  the text 
250 \family typewriter 
251
252 \backslash 
253 end{sloppypar}
254 \family default 
255  to the next line.
256 \end_inset 
257
258  This is done by the LaTeX commands 
259 \family typewriter 
260
261 \backslash 
262 begin{sloppypar}
263 \family default 
264  and 
265 \family typewriter 
266
267 \backslash 
268 end{sloppypar}
269 \family default 
270 .
271  To enter them, change to TeX mode (a.k.a Evil Red Text) --- use 
272 \family sans 
273 \bar under 
274 I
275 \bar default 
276 nsert\SpecialChar \menuseparator
277
278 \bar under 
279 T
280 \bar default 
281 eX
282 \family default 
283  --- and write 
284 \family typewriter 
285
286 \backslash 
287 begin{sloppypar}
288 \family default 
289  in the beginning of the paragraph and 
290 \family typewriter 
291
292 \backslash 
293 end{sloppypar}
294 \family default 
295  at the end.
296  Your lines will contain too much space, but at least they won't stick out
297  of the margins.
298  If you don't want to do that on a paragraph by paragraph basis, just put
299  
300 \family typewriter 
301
302 \backslash 
303 sloppy
304 \family default 
305  in your preamble (use 
306 \family sans 
307 \bar under 
308 L
309 \bar default 
310 ayout\SpecialChar \menuseparator
311 P
312 \bar under 
313 r
314 \bar default 
315 eamble
316 \family default 
317 , or, in LyX Qt, use 
318 \family sans 
319 \bar under 
320 L
321 \bar default 
322 ayout\SpecialChar \menuseparator
323
324 \bar under 
325 D
326 \bar default 
327 ocument
328 \family default 
329  and move to the 
330 \family sans 
331 Preamble
332 \family default 
333  section) or where you want the sloppy mode to start (use TeX mode).
334  The opposite of 
335 \family typewriter 
336
337 \backslash 
338 sloppy
339 \family default 
340  is 
341 \family typewriter 
342
343 \backslash 
344 fussy
345 \family default 
346 , the default behavior.
347  Both commands take effect from the beginning of the paragraph (or part
348  thereof, if you have a display formula) where they are found.
349 \begin_inset ERT
350 status Collapsed
351
352 \layout Standard
353
354 \backslash 
355 end{sloppypar}
356 \end_inset 
357
358
359 \layout Standard
360
361 If the problem is a long word which LaTeX cannot, or would not, hyphenate,
362  the simplest solution is to add a hyphenation mark where you think the
363  word should be broken.
364  Use 
365 \family sans 
366 \bar under 
367 I
368 \bar default 
369 nsert\SpecialChar \menuseparator
370
371 \bar under 
372 S
373 \bar default 
374 pecial Character\SpecialChar \menuseparator
375 Hyphenation\SpecialChar ~
376
377 \bar under 
378 P
379 \bar default 
380 oint
381 \family default 
382 .
383  If you want the word to be broken but do not want a hyphen to appear (for
384  example, you are breaking a URL
385 \begin_inset Foot
386 collapsed false
387
388 \layout Standard
389
390 If you enter a URL, the easiest method is 
391 \family sans 
392 \bar under 
393 I
394 \bar default 
395 nsert\SpecialChar \menuseparator
396
397 \bar under 
398 U
399 \bar default 
400 RL
401 \family default 
402  which in most LaTeX installations also takes care of breaking lines for
403  you.
404  Note though that the LaTeX system in 
405 \family typewriter 
406 arXiv.org
407 \family default 
408  is an exception and won't break URLs across lines, so if you plan to submit
409  your paper there, plan ahead.
410 \end_inset 
411
412 ) you need to add the TeX command 
413 \family typewriter 
414
415 \backslash 
416 linebreak
417 \family default 
418 .
419  Notice that this is 
420 \series bold 
421 not 
422 \series default 
423 the same as 
424 \family sans 
425 \bar under 
426 I
427 \bar default 
428 nsert\SpecialChar \menuseparator
429
430 \bar under 
431 S
432 \bar default 
433 pecial Character\SpecialChar \menuseparator
434
435 \bar under 
436 L
437 \bar default 
438 inebreak
439 \family default 
440 ! This will force LaTeX to break in that point.
441  Usually, however, you would want to use 
442 \family typewriter 
443
444 \backslash 
445 linebreak[
446 \family default 
447
448 \begin_inset Formula $n$
449 \end_inset 
450
451
452 \family typewriter 
453 ]
454 \family default 
455 , which only recommends to LaTeX to break the line there rather than forces
456  it to do so.
457  The number 
458 \begin_inset Formula $n$
459 \end_inset 
460
461  is the level of recommendation, from 0 to 4, with 
462 \family typewriter 
463
464 \backslash 
465 linebreak[0]
466 \family default 
467  being the weakest (and usually what you want) and 
468 \family typewriter 
469
470 \backslash 
471 linebreak[4]
472 \family default 
473  the strongest, and equivalent to just 
474 \family typewriter 
475
476 \backslash 
477 linebreak
478 \family default 
479 .
480  Using this method instead of simply 
481 \family typewriter 
482
483 \backslash 
484 linebreak
485 \family default 
486  will mean that you'll have less work the 
487 \emph on 
488 next
489 \emph default 
490  time you change font.
491  
492 \layout Standard
493
494 More about this can be found in 
495 \family typewriter 
496 http://dont.really.go.there/this/
497 \begin_inset ERT
498 status Collapsed
499
500 \layout Standard
501
502 \backslash 
503 linebreak[0]
504 \end_inset 
505
506 is/
507 \begin_inset ERT
508 status Collapsed
509
510 \layout Standard
511
512 \backslash 
513 linebreak[0]
514 \end_inset 
515
516 just/
517 \begin_inset ERT
518 status Collapsed
519
520 \layout Standard
521
522 \backslash 
523 linebreak[0]
524 \end_inset 
525
526 to/demonstrate/how/this/works
527 \family default 
528 .
529 \layout Subsection
530
531 Inline formulas
532 \layout Standard
533
534 Formulas inside you text pose more of a problem as LaTeX is typically shy
535  of breaking formulas, and many authors consider breaking formulas across
536  lines an ugly habit
537 \begin_inset Foot
538 collapsed false
539
540 \layout Standard
541
542 Section 
543 \begin_inset ERT
544 status Collapsed
545
546 \layout Standard
547
548 \backslash 
549 ref{ssec:agrevate}
550 \end_inset 
551
552  is for you guys.
553  Naturally, using the techniques there will only aggravate overfull hbox
554  problems.
555 \end_inset 
556
557 .
558  The first option you should consider is probably to make the formula into
559  a display formula (
560 \family sans 
561 \bar under 
562 I
563 \bar default 
564 nsert\SpecialChar \menuseparator
565 Mat
566 \bar under 
567 h
568 \bar default 
569 \SpecialChar \menuseparator
570
571 \bar under 
572 D
573 \bar default 
574 isplay\SpecialChar ~
575 Formula
576 \family default 
577 ).
578  If you want to keep the formula inline, you can try the 
579 \family typewriter 
580
581 \backslash 
582 linebreak
583 \family default 
584  mechanism above.
585  Notice that to create evil red text in math mode you don't need to select
586  it from a menu, it is activated automatically by the 
587 \family typewriter 
588
589 \backslash 
590
591 \family default 
592  sign and terminated by the 
593 \family typewriter 
594 [
595 \family default 
596  --- the 
597 \family typewriter 
598 [0]
599 \family default 
600  will not appear in red but don't worry about it.
601  In many cases it works inside formulas.
602  The main case where it doesn't is inside grouped parenthesis, by which
603  I mean parenthesis entered using the parenthesis button in the math panel
604  (
605 \family sans 
606 \bar under 
607 I
608 \bar default 
609 nsert
610 \family default 
611 \SpecialChar \menuseparator
612
613 \family sans 
614 Mat
615 \bar under 
616 h
617 \family default 
618 \bar default 
619 \SpecialChar \menuseparator
620
621 \family sans 
622 Math\SpecialChar ~
623 Pane
624 \bar under 
625 l
626 \family default 
627 \bar default 
628 ).
629  LaTeX will simply ignore 
630 \family typewriter 
631
632 \backslash 
633 linebreak
634 \family default 
635  commands inside a grouped parenthesis.
636  Here is an example:
637 \layout Quote
638
639 I love long formulas in the middle of my text, like 
640 \begin_inset Formula $\int1/(t\log t\log\log t\linebreak\log\log\log t)\, dt=\log\log\log\log x$
641 \end_inset 
642
643 .
644  But when I write 
645 \begin_inset Formula $\log\left(\sin x+\cos x+\linebreak\tan x\right)$
646 \end_inset 
647
648  the grouped parenthesis always makes my formulas stick to the right.
649 \layout Standard
650
651 The solution is to replace them with regular parenthesis.
652  You would probably want to enlarge them, though.
653  To do that, just write 
654 \family typewriter 
655
656 \backslash 
657 big
658 \family default 
659  before each parenthesis.
660  If 
661 \family typewriter 
662
663 \backslash 
664 big
665 \family default 
666  is not big enough, just try 
667 \family typewriter 
668
669 \backslash 
670 Big
671 \family sans 
672
673 \family typewriter 
674
675 \backslash 
676 bigg
677 \family sans 
678  
679 \family default 
680 or 
681 \family typewriter 
682
683 \backslash 
684 Bigg
685 \family default 
686 .
687  Table 
688 \begin_inset LatexCommand \ref{tbl:bigBigg}
689
690 \end_inset 
691
692  shows how they look.
693 \begin_inset Float table
694 placement htbp
695 wide false
696 collapsed false
697
698 \layout Standard
699 \align center 
700
701 \begin_inset  Tabular
702 <lyxtabular version="3" rows="5" columns="2">
703 <features>
704 <column alignment="center" valignment="top" leftline="true" rightline="true" width="0pt">
705 <column alignment="center" valignment="top" leftline="true" rightline="true" width="0pt">
706 <row topline="true">
707 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
708 \begin_inset Text
709
710 \layout Standard
711
712 regular
713 \end_inset 
714 </cell>
715 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
716 \begin_inset Text
717
718 \layout Standard
719
720
721 \begin_inset Formula $([\{|\}])\langle\lfloor\lceil/\uparrow\Uparrow\Downarrow\downarrow\backslash\rceil\rfloor\rangle$
722 \end_inset 
723
724
725 \end_inset 
726 </cell>
727 </row>
728 <row topline="true">
729 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
730 \begin_inset Text
731
732 \layout Standard
733
734
735 \family typewriter 
736
737 \backslash 
738 big
739 \end_inset 
740 </cell>
741 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
742 \begin_inset Text
743
744 \layout Standard
745
746
747 \begin_inset Formula $\big(\big[\big\{\big|\,\big\}\big]\big)\big\langle\big\lfloor\big\lceil\big/\big\uparrow\big\Uparrow\big\Downarrow\big\downarrow\big\backslash\big\rceil\big\rfloor\big\rangle$
748 \end_inset 
749
750  
751 \end_inset 
752 </cell>
753 </row>
754 <row topline="true">
755 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
756 \begin_inset Text
757
758 \layout Standard
759
760
761 \family typewriter 
762
763 \backslash 
764 Big
765 \end_inset 
766 </cell>
767 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
768 \begin_inset Text
769
770 \layout Standard
771
772
773 \begin_inset Formula $\Big(\Big[\Big\{\Big|\Big\}\Big]\Big)\Big\langle\Big\lfloor\Big\lceil\Big/\Big\uparrow\Big\Uparrow\Big\Downarrow\Big\downarrow\Big\backslash\Big\rceil\Big\rfloor\Big\rangle$
774 \end_inset 
775
776
777 \end_inset 
778 </cell>
779 </row>
780 <row topline="true">
781 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
782 \begin_inset Text
783
784 \layout Standard
785
786
787 \family typewriter 
788
789 \backslash 
790 bigg
791 \end_inset 
792 </cell>
793 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
794 \begin_inset Text
795
796 \layout Standard
797
798
799 \begin_inset Formula $\bigg(\bigg[\bigg\{\bigg|\bigg\}\bigg]\bigg)\bigg\langle\bigg\lfloor\bigg\lceil\bigg/\bigg\uparrow\bigg\Uparrow\bigg\Downarrow\bigg\downarrow\bigg\backslash\bigg\rceil\bigg\rfloor\bigg\rangle$
800 \end_inset 
801
802  
803 \end_inset 
804 </cell>
805 </row>
806 <row topline="true" bottomline="true">
807 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
808 \begin_inset Text
809
810 \layout Standard
811 \align center 
812
813 \family typewriter 
814
815 \backslash 
816 Bigg
817 \end_inset 
818 </cell>
819 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
820 \begin_inset Text
821
822 \layout Standard
823
824
825 \begin_inset Formula $\Bigg(\Bigg[\Bigg\{\Bigg|\Bigg\}\Bigg]\Bigg)\Bigg\langle\Bigg\lfloor\Bigg\lceil\Bigg/\Bigg\uparrow\Bigg\Uparrow\Bigg\Downarrow\Bigg\downarrow\Bigg\backslash\Bigg\rceil\Bigg\rfloor\Bigg\rangle$
826 \end_inset 
827
828
829 \end_inset 
830 </cell>
831 </row>
832 </lyxtabular>
833
834 \end_inset 
835
836
837 \layout Caption
838
839
840 \begin_inset LatexCommand \label{tbl:bigBigg}
841
842 \end_inset 
843
844 parenthesis and friends in various sizes.
845 \end_inset 
846
847
848 \layout Standard
849
850 Apropos table 
851 \begin_inset LatexCommand \ref{tbl:bigBigg}
852
853 \end_inset 
854
855 , one should be careful to distinguish between the symbols 
856 \begin_inset Formula $\langle$
857 \end_inset 
858
859  and 
860 \begin_inset Formula $\rangle$
861 \end_inset 
862
863  use for scalar product and bra-ket notation and the simple bigger/smaller
864  signs 
865 \begin_inset Formula $<>$
866 \end_inset 
867
868 .
869  Not only are they different in appearance, TeX will also space them differently.
870  There is no GUI for entering the symbols 
871 \begin_inset Formula $\langle$
872 \end_inset 
873
874
875 \begin_inset Formula $\rangle$
876 \end_inset 
877
878 , nor for the symbols 
879 \begin_inset Formula $\lfloor$
880 \end_inset 
881
882
883 \begin_inset Formula $\lceil$
884 \end_inset 
885
886 ,
887 \begin_inset Formula $\backslash$
888 \end_inset 
889
890
891 \begin_inset Formula $\rceil$
892 \end_inset 
893
894
895 \begin_inset Formula $\rfloor$
896 \end_inset 
897
898  --- from the math panel you can only insert the grouped version, not the
899  
900 \begin_inset Quotes eld
901 \end_inset 
902
903 stand alone
904 \begin_inset Quotes erd
905 \end_inset 
906
907  version.
908  I simply enter them using their TeX shortcuts and LyX understands and transform
909 s them to the appropriate characters automatically.
910  The shortcuts are, respectively, 
911 \family typewriter 
912
913 \backslash 
914 langle
915 \family default 
916
917 \family typewriter 
918
919 \backslash 
920 rangle
921 \family default 
922
923 \family typewriter 
924
925 \backslash 
926 lfloor
927 \family sans 
928
929 \family typewriter 
930
931 \backslash 
932 lceil
933 \family sans 
934
935 \family typewriter 
936
937 \backslash 
938 backslash
939 \family default 
940  or 
941 \family typewriter 
942
943 \backslash 
944
945 \backslash 
946
947 \family default 
948
949 \family typewriter 
950
951 \backslash 
952 rceil
953 \family sans 
954
955 \family typewriter 
956
957 \backslash 
958 rfloor
959 \family default 
960 .
961  
962 \layout Standard
963
964 If you use inverted parenthesis, as for example in the old-fashioned style
965  
966 \begin_inset Formula $\left]0,1\right[$
967 \end_inset 
968
969 , you need to tell LaTeX which is left and which is right in order for it
970  to get the spacing right.
971  You do that by replacing the various 
972 \family typewriter 
973
974 \backslash 
975 big
976 \family default 
977  constructs with 
978 \family typewriter 
979
980 \backslash 
981 bigl
982 \family default 
983  and 
984 \family typewriter 
985
986 \backslash 
987 bigr
988 \family default 
989 .
990  For example
991 \begin_inset Note
992 collapsed false
993
994 \layout Standard
995
996 will do the spacing correctly 
997 \series bold 
998 only
999 \series default 
1000  if you insert them as grouped parenthesis.
1001  If you have line-breaking problems with these constructs, and you converted
1002  them into non-grouped parenthesis, you will have to tweak the spacing yourself.
1003  This is explained in the 
1004 \emph on 
1005 User's Guide
1006 \emph default 
1007 , as of this writing in section 5.1.8, 
1008 \emph on 
1009 Altering Spacing
1010 \emph default 
1011 .
1012 \end_inset 
1013
1014
1015 \layout Quote
1016
1017
1018 \begin_inset Formula $I=\bigl]0,1\bigr[$
1019 \end_inset 
1020
1021  looks much better than 
1022 \begin_inset Formula $I=\bigr]0,1\bigl[$
1023 \end_inset 
1024
1025 .
1026  Notice how the 
1027 \begin_inset Formula $=$
1028 \end_inset 
1029
1030  and the 
1031 \begin_inset Formula $]$
1032 \end_inset 
1033
1034  are cramped together in the second example, which has the right and left
1035  
1036 \family typewriter 
1037
1038 \backslash 
1039 big
1040 \family default 
1041  commands reversed.
1042  
1043 \layout Standard
1044
1045 There is also a 
1046 \family typewriter 
1047
1048 \backslash 
1049 bigm
1050 \family default 
1051  construct for notations such as 
1052 \begin_inset Formula $\mathbb{P}\bigl(X\bigm|Y\bigr)$
1053 \end_inset 
1054
1055 .
1056 \layout Standard
1057
1058 There are corresponding constructs specific for 
1059 \begin_inset Formula $|$
1060 \end_inset 
1061
1062  signs --- the commands 
1063 \family typewriter 
1064
1065 \backslash 
1066 lvert
1067 \family default 
1068  and 
1069 \family typewriter 
1070
1071 \backslash 
1072 rvert
1073 \family default 
1074 .
1075  I cannot in honesty vouch for or against them.
1076  Check the documentation for the 
1077 \family sans 
1078 amsmath
1079 \family default 
1080  package which should come with your TeX distribution --- try e.g.
1081  
1082 \family typewriter 
1083 /usr/share/texmf/doc/latex/amsmath/amsldoc.dvi
1084 \family default 
1085  --- where these things are thoroughly explained.
1086 \layout Subsection
1087
1088 Display formulas
1089 \layout Standard
1090
1091 Display formulas can also be too long, quite easily so in fact, and will
1092  create an 
1093 \family typewriter 
1094 overfull hbox
1095 \family default 
1096  warning.
1097  There isn't much to do about it except transform them into multi-line equations.
1098  Multi-line equations are covered quite fully in the 
1099 \emph on 
1100 User's Guide
1101 \emph default 
1102  (as of writing this, in section 5.4).
1103 \layout Standard
1104
1105 As in the case of inline equations, you might need to break parenthesis
1106  across lines and run into various problems.
1107  The simplest solution is to use the 
1108 \begin_inset Quotes eld
1109 \end_inset 
1110
1111 no parenthesis
1112 \begin_inset Quotes erd
1113 \end_inset 
1114
1115  square at the bottom right corner of the parenthesis panel (remember to
1116  uncheck the 
1117 \family typewriter 
1118 \bar under 
1119 K
1120 \bar default 
1121 eep matched
1122 \family default 
1123  box if you are using LyX Qt), for example
1124 \begin_inset Formula \begin{eqnarray*}
1125 f(n) & = & \pi\left(\frac{1}{2}+\frac{1}{3}+\frac{1}{4}+\dotsb\right.\\
1126  &  & \left.\dotsb+\frac{n-2}{n-1}+\frac{n-1}{n}\right)\end{eqnarray*}
1127
1128 \end_inset 
1129
1130 But what if there were no fractions on the bottom line? The parenthesis
1131  would come out too small.
1132  Obviously, one could solve this using the 
1133 \family typewriter 
1134
1135 \backslash 
1136 big
1137 \family default 
1138
1139 \family typewriter 
1140
1141 \backslash 
1142 Big
1143 \family default 
1144
1145 \family typewriter 
1146
1147 \backslash 
1148 bigg
1149 \family default 
1150  etc.\SpecialChar ~
1151 mechanism.
1152  But there is another solution, using the 
1153 \family typewriter 
1154
1155 \backslash 
1156 vphantom
1157 \family default 
1158  LaTeX command.
1159  Let us demonstrate with an example
1160 \begin_inset Formula \begin{align*}
1161  & \left(\sum_{i=1}^{\infty}\textrm{The parenthesis on this line are large due to the }\sum\textrm{ sign,}\right.\\
1162  & \left.\textrm{so lets add here a vphantom command with the same construct}\vphantom{\sum_{i=1}^{\infty}}\right).\end{align*}
1163
1164 \end_inset 
1165
1166 For those reading the printed version, the lower line has a 
1167 \family typewriter 
1168
1169 \backslash 
1170 vphantom{
1171 \family default 
1172
1173 \begin_inset Formula ${\displaystyle \sum_{i=1}^{\infty}}$
1174 \end_inset 
1175
1176
1177 \family typewriter 
1178 }
1179 \family default 
1180  which doesn't appear at all, but makes the parenthesis large.
1181  You can put anything you want inside the 
1182 \family typewriter 
1183 {}
1184 \family default 
1185  signs --- whatever you put does not show but its height is considered when
1186  the line height is calculated.
1187 \layout Standard
1188
1189 There is nothing stopping you from using the 
1190 \family typewriter 
1191
1192 \backslash 
1193 vphantom
1194 \family default 
1195  trick on inline formulas, but it really more suitable for using in large,
1196  complicated display formulas.
1197 \layout Subsection
1198
1199 More on hyphenation
1200 \layout Standard
1201
1202 There are a number of issues you might want to know about if you have hyphenatio
1203 n problems.
1204  First of all, hyphenation is language sensitive.
1205  Really! You can change the default language of the document via the 
1206 \family sans 
1207 Language
1208 \family default 
1209  tab of the
1210 \family sans 
1211  
1212 \bar under 
1213 L
1214 \bar default 
1215 ayout\SpecialChar \menuseparator
1216
1217 \bar under 
1218 D
1219 \bar default 
1220 ocument
1221 \family default 
1222  popup, or you can change a particular piece of text via the 
1223 \family sans 
1224 \bar under 
1225 L
1226 \bar default 
1227 ayout\SpecialChar \menuseparator
1228
1229 \bar under 
1230 C
1231 \bar default 
1232 haracter
1233 \family default 
1234  popup.
1235  A typical LaTeX installation will support hyphenation in English, French,
1236  German, Spanish, Russian and a few others.
1237 \layout Standard
1238
1239 The second thing you have to know is that there is a package to help with
1240  hyphenation problems: 
1241 \family typewriter 
1242 hyphenat
1243 \family default 
1244 .
1245  The most popular uses of 
1246 \family typewriter 
1247 hyphenat
1248 \family default 
1249  are to turn hyphenation off completely, or to allow hyphenation of text
1250  in the 
1251 \family typewriter 
1252 typewriter
1253 \family default 
1254  font,
1255 \begin_inset Foot
1256 collapsed false
1257
1258 \layout Standard
1259
1260 By default, any text in typewriter font is never hyphenated.
1261  URLs are only a specific case.
1262 \end_inset 
1263
1264  and it has some advanced tools in addition.
1265  More likely than not, it is a part of your LaTeX distribution.
1266  Read the documentation, it could be in, for example, 
1267 \family typewriter 
1268 /usr/share/texmf/doc/latex/styles/hyphenat.dvi
1269 \family default 
1270 .
1271 \layout Standard
1272
1273 Finally, there are special cases where you want special effects when the
1274  line is broken --- not just any old hyphen.
1275  For these unusual cases, you need the 
1276 \family typewriter 
1277
1278 \backslash 
1279 discretionary
1280 \family default 
1281  command.
1282  Since this is a bit off topic, I've put the full description in an appendix.
1283  
1284 \layout Subsection
1285
1286
1287 \begin_inset LatexCommand \label{ssec:agrevate}
1288
1289 \end_inset 
1290
1291 More on breaking inline formulas
1292 \layout Standard
1293
1294 LaTeX (and TeX) will break inline formulas around equality-like signs, e.g.\SpecialChar ~
1295
1296 \begin_inset Formula $=$
1297 \end_inset 
1298
1299
1300 \begin_inset Formula $\approx$
1301 \end_inset 
1302
1303
1304 \begin_inset Formula $\leq$
1305 \end_inset 
1306
1307  etc., and less willingly around binary operators like 
1308 \begin_inset Formula $+$
1309 \end_inset 
1310
1311
1312 \begin_inset Formula $\cdot$
1313 \end_inset 
1314
1315
1316 \begin_inset Formula $\wedge$
1317 \end_inset 
1318
1319 .
1320  To make LaTeX less or more likely to break formulas in that way, do the
1321  following: in the latex preamble add the following commands:
1322 \layout LyX-Code
1323
1324
1325 \backslash 
1326 relpenalty=
1327 \begin_inset Formula $n$
1328 \end_inset 
1329
1330
1331 \layout LyX-Code
1332
1333
1334 \backslash 
1335 binoppenalty=
1336 \begin_inset Formula $m$
1337 \end_inset 
1338
1339
1340 \layout Standard
1341
1342 where 
1343 \begin_inset Formula $n$
1344 \end_inset 
1345
1346  and 
1347 \begin_inset Formula $m$
1348 \end_inset 
1349
1350  are two numbers that tell LaTeX how bad is it to break formulas around
1351  equality-like signs and binary operators respectively.
1352  The default values (for both TeX and LaTeX) are 500 and 700.
1353  The value 10000 is used as 
1354 \begin_inset Formula $\infty$
1355 \end_inset 
1356
1357  so if you set either to 10000 TeX will never break your formulas in that
1358  kind of position.
1359 \layout Subsection
1360
1361 Underfull hboxes
1362 \layout Standard
1363
1364 These are quite rare, but can happen, e.g.\SpecialChar ~
1365 when you use forced linebreaks.
1366  Here is an example:
1367 \layout Quote
1368
1369 Wow, why is this line like that?
1370 \begin_inset ERT
1371 status Collapsed
1372
1373 \layout Standard
1374
1375 \backslash 
1376 linebreak 
1377 \end_inset 
1378
1379 Oh, because I asked so explicitly.
1380  Silly me.
1381 \layout Standard
1382
1383 Similarly, the use of 
1384 \family typewriter 
1385 sloppypar
1386 \family default 
1387  can cause 
1388 \family typewriter 
1389 underfull hbox
1390 \family default 
1391  errors.
1392 \layout Section
1393
1394 Underfull vboxes
1395 \layout Standard
1396
1397 A vbox is something that LaTeX tries to fill vertically, typically a page.
1398  For some unknown reason, when LaTeX cannot fill the page because the last
1399  object is too large, it will not do as it does for lines and go over the
1400  margins, but it will prefer to put the offending object on the next page.
1401  Hence the error will usually be 
1402 \family typewriter 
1403 underfull vbox
1404 \family default 
1405  and the visible symptom will be pages which are too short, have too much
1406  space between the text and the footnotes or that have too much space between
1407  paragraphs, formulas etc.
1408 \layout Standard
1409
1410 The range of solutions to underfull vboxes is more restricted.
1411  Most notably it is to tell LaTeX where to break pages yourself.
1412  This is covered in the 
1413 \emph on 
1414 User's Guide
1415 \emph default 
1416  under 
1417 \begin_inset Quotes eld
1418 \end_inset 
1419
1420 forcing page breaks
1421 \begin_inset Quotes erd
1422 \end_inset 
1423
1424  (as of the time of writing, this is subsection 6.4.4).
1425  Unfortunately, in many cases the offending object is a multi-line formula,
1426  and you cannot enter a pagebreak inside a formula using the 
1427 \family sans 
1428 \bar under 
1429 L
1430 \bar default 
1431 ayout\SpecialChar \menuseparator
1432
1433 \bar under 
1434 P
1435 \bar default 
1436 aragraph
1437 \family default 
1438  popup.
1439  A simple solution might be to break the formula into two formulas, possibly
1440  forcing a pagebreak between them, but actually there's a better way so
1441  read on.
1442 \layout Standard
1443
1444 It is possible to allow page breaks inside formulas, globally or on a formula-by
1445 -formula basis.
1446  To understand how, we first need to differentiate between LaTeX formula
1447  environment and AMS formula environments.
1448  The (regular) LaTeX formula environment are what you get when you hit 
1449 \family sans 
1450 C-Return
1451 \family default 
1452  inside a formula, or by choosing 
1453 \family sans 
1454 \bar under 
1455 I
1456 \bar default 
1457 nsert\SpecialChar \menuseparator
1458 Mat
1459 \bar under 
1460 h
1461 \bar default 
1462 \SpecialChar \menuseparator
1463
1464 \bar under 
1465 E
1466 \bar default 
1467 qnarry\SpecialChar ~
1468 environment
1469 \family default 
1470 .
1471  The AMS formula environment are supported in LyX using 
1472 \family sans 
1473 \bar under 
1474 I
1475 \bar default 
1476 nsert\SpecialChar \menuseparator
1477 Mat
1478 \bar under 
1479 h
1480 \bar default 
1481 \SpecialChar \menuseparator
1482 AMS\SpecialChar ~
1483 *
1484 \family default 
1485 .
1486  Generally speaking the AMS environments are more flexible, provide nicer
1487  spacing and more options (see the AMS documentation already mentioned).
1488  The only real issue with using them are potential incompatibilities between
1489  the AMS package and the document class you might be using, which might
1490  be more common than you think, especially if you got the documentclass
1491  files from some European journal.
1492  All the documentclasses supported by LyX, however, are fully compatible
1493  with the AMS package, so you should worry about that only if you plan to
1494  export your document as LaTeX and do all the configuration work manually
1495  on that file.
1496 \layout Standard
1497
1498 For the LaTeX formula environments you have only one option, to allow page
1499  breaks globally and completely.
1500  This is done by putting the command 
1501 \family typewriter 
1502
1503 \backslash 
1504 allowdisplaybreaks
1505 \family default 
1506  in your LaTeX preamble.
1507  For the AMS math environment you have the following options:
1508 \layout Itemize
1509
1510 You can put a 
1511 \family typewriter 
1512
1513 \backslash 
1514 displaybreak
1515 \family default 
1516  or a 
1517 \family typewriter 
1518
1519 \backslash 
1520 displaybreak[
1521 \family sans 
1522
1523 \begin_inset Formula $n$
1524 \end_inset 
1525
1526
1527 \family typewriter 
1528 ]
1529 \family default 
1530  in a specific formula in a specific position where you allow the page to
1531  break.
1532  
1533 \begin_inset Formula $n$
1534 \end_inset 
1535
1536  is as for the 
1537 \family typewriter 
1538
1539 \backslash 
1540 linebreak
1541 \family default 
1542  command.
1543  
1544 \layout Itemize
1545
1546 You can allow page breaks in all AMS equation environments globally.
1547  Put the command 
1548 \family typewriter 
1549
1550 \backslash 
1551 allowdisplaybreaks[
1552 \family sans 
1553
1554 \begin_inset Formula $n$
1555 \end_inset 
1556
1557
1558 \family typewriter 
1559 ]
1560 \family default 
1561  in your preamble where the parameter of permissiveness 
1562 \begin_inset Formula $n$
1563 \end_inset 
1564
1565  is between 1 (not 0!) and 4.
1566  Note that 
1567 \family typewriter 
1568
1569 \backslash 
1570 allowdisplaybreaks[4]
1571 \family default 
1572  is identical to 
1573 \family typewriter 
1574
1575 \backslash 
1576 allowdisplaybreaks
1577 \family default 
1578  and will affect the LaTeX math environments too.
1579 \layout Standard
1580
1581 See some examples in appendix 
1582 \begin_inset LatexCommand \ref{sec:Page-break-examples}
1583
1584 \end_inset 
1585
1586 .
1587 \layout Section
1588
1589 About this document
1590 \layout Standard
1591
1592 If you have any comments about this document I would love to hear them.
1593  I am especially interested in new LaTeX tips and tricks! There always seem
1594  to be more.
1595  My e-mail is 
1596 \family typewriter 
1597 gadykozma@hotmail.com
1598 \family default 
1599 .
1600 \layout Standard
1601
1602 This document is in the public domain.
1603  Please do with it as you please.
1604 \layout Section
1605 \start_of_appendix 
1606 The discretionary command
1607 \layout Standard
1608
1609 The discretionary command takes three arguments, i.e.\SpecialChar ~
1610 its general format is
1611  
1612 \family typewriter 
1613
1614 \backslash 
1615 discretionary{
1616 \family default 
1617 \shape italic 
1618 a
1619 \family typewriter 
1620 \shape default 
1621 }{
1622 \family default 
1623 \shape italic 
1624 b
1625 \family typewriter 
1626 \shape default 
1627 }{
1628 \family default 
1629 \shape italic 
1630 c
1631 \family typewriter 
1632 \shape default 
1633 }
1634 \family default 
1635 .
1636  The third argument is the text to put in the usual case, namely the line
1637  is not broken there.
1638  The first and second are for breaking lines, and appear in the end of the
1639  first line and the beginning of the second.
1640  Thus the usual hyphenation point is equivalent to 
1641 \family typewriter 
1642
1643 \backslash 
1644 discretionary{-}{}{}
1645 \family default 
1646  but the German 
1647 \family typewriter 
1648
1649 \backslash 
1650 ck
1651 \family default 
1652  command is equivalent to 
1653 \family typewriter 
1654
1655 \backslash 
1656 discretionary{k-}{k}{ck}
1657 \family default 
1658 .
1659  That's right, in German, sometimes when you break a ck across lines you
1660  want the broken text to be k-k.
1661 \begin_inset Foot
1662 collapsed false
1663
1664 \layout Standard
1665
1666 I don't know the first thing about German, so all this should be taken with
1667  a mountain of salt.
1668 \end_inset 
1669
1670  
1671 \layout Standard
1672
1673 Here is a particularly freaky example.
1674  In the preamble, define the following:
1675 \layout LyX-Code
1676
1677
1678 \backslash 
1679 newcommand{
1680 \backslash 
1681 brmul}
1682 \newline 
1683 {
1684 \backslash 
1685 discretionary{
1686 \backslash 
1687 mbox{$
1688 \backslash 
1689 ,
1690 \backslash 
1691 cdot$}}{}{}}
1692 \layout Standard
1693
1694 Next, add a formula like that 
1695 \begin_inset Formula $f(x)=x\log x\brmul\log\log x$
1696 \end_inset 
1697
1698  (if you are reading the printed version, there is a 
1699 \family typewriter 
1700
1701 \backslash 
1702 brmul
1703 \family default 
1704  between the 
1705 \begin_inset Formula $\log x$
1706 \end_inset 
1707
1708  and the 
1709 \begin_inset Formula $\log\log x$
1710 \end_inset 
1711
1712 ) and play around with the surrounding text to force it to break between
1713  the 
1714 \begin_inset Formula $\log x$
1715 \end_inset 
1716
1717  and the 
1718 \begin_inset Formula $\log\log x$
1719 \end_inset 
1720
1721 .
1722  For example:
1723 \layout Quote
1724
1725 When using, inside the line, long formulas like 
1726 \begin_inset Formula $f(x)=x\log x\brmul\log\log x$
1727 \end_inset 
1728
1729 , strange things could happen.
1730 \layout Standard
1731
1732 VoilĂ ! A multiplication sign (
1733 \family typewriter 
1734
1735 \backslash 
1736 cdot
1737 \family default 
1738  is the code for 
1739 \begin_inset Quotes eld
1740 \end_inset 
1741
1742
1743 \begin_inset Formula $\cdot$
1744 \end_inset 
1745
1746
1747 \begin_inset Quotes erd
1748 \end_inset 
1749
1750
1751 \begin_inset Foot
1752 collapsed false
1753
1754 \layout Standard
1755
1756
1757 \family typewriter 
1758
1759 \backslash 
1760 ,
1761 \family default 
1762  gives the standard space before the multiplication sign.
1763  What about the 
1764 \family typewriter 
1765
1766 \backslash 
1767 mbox
1768 \family default 
1769  and the 
1770 \family typewriter 
1771 $
1772 \family default 
1773  signs? Weird LaTeX working mode issues.
1774  Don't ask me, I only fiddle until it works.
1775 \end_inset 
1776
1777 ) appears in the middle of the formula.
1778  
1779 \layout Section
1780
1781
1782 \begin_inset LatexCommand \label{sec:Page-break-examples}
1783
1784 \end_inset 
1785
1786 Page break examples
1787 \layout Standard
1788
1789
1790 \begin_inset Formula \begin{align*}
1791 \textrm{Gauss number} & =1+2+3+4+5+6+7+8+9+10\\
1792  & +11+12+13+14+15+16+17+18+19+20\\
1793  & +21+22+23+24+25+26+27+28+29+30\\
1794  & \textrm{this line contains a }\mathtt{{displaybreak[3]}}\textrm{ command}\displaybreak[3]\\
1795  & \textrm{as you can see, in such a bad position it is not enough to force}\\
1796  & \textrm{a break.}\\
1797  & \textrm{this line contains a }\mathtt{{displaybreak}}\textrm{ command}\displaybreak\\
1798  & \textrm{as you can see, this command is absolute.}\\
1799  & +31+32+33+34+35+36+37+38+39+40\\
1800  & +\dotsb+100=5050\end{align*}
1801
1802 \end_inset 
1803
1804
1805 \the_end