]> git.lyx.org Git - lyx.git/blob - lib/examples/multicol.lyx
update all lyx documents to the latest file format
[lyx.git] / lib / examples / multicol.lyx
1 #LyX 1.4.0cvs created this file. For more info see http://www.lyx.org/
2 \lyxformat 243
3 \begin_document
4 \begin_header
5 \textclass article
6 \begin_preamble
7 \usepackage{multicol}
8 \end_preamble
9 \language english
10 \inputencoding default
11 \fontscheme default
12 \graphics default
13 \paperfontsize default
14 \spacing single
15 \papersize default
16 \use_geometry false
17 \use_amsmath 0
18 \cite_engine basic
19 \use_bibtopic false
20 \paperorientation portrait
21 \secnumdepth 3
22 \tocdepth 3
23 \paragraph_separation indent
24 \defskip medskip
25 \quotes_language english
26 \quotes_times 2
27 \papercolumns 1
28 \papersides 1
29 \paperpagestyle default
30 \tracking_changes false
31 \output_changes true
32 \end_header
33
34 \begin_body
35
36 \begin_layout Title
37
38 Multiple Columns
39 \end_layout
40
41 \begin_layout Author
42
43 by 
44 \noun on
45 Lars Gullik Bjønnes
46 \end_layout
47
48 \begin_layout Section
49
50 Purpose
51 \end_layout
52
53 \begin_layout Standard
54
55 The aim for this chapter is to show how the LaTeX package 
56 \family typewriter
57 multicol
58 \family default
59  can be used in a LyX document.
60  As LyX doesn't support the 
61 \family typewriter
62 multicol
63 \family default
64  package natively yet, we have to use some small hacks.
65  By reading this section it should be obvious how to do this.
66 \end_layout
67
68 \begin_layout Subsection
69
70 Limitations 
71 \end_layout
72
73 \begin_layout Standard
74
75 The 
76 \family typewriter
77 multicol
78 \family default
79  package allows switching between one and multicolumn format on the same
80  page.
81  Footnotes are handled correctly (for the most part), but will be placed
82  at the bottom of the page and not under each column.
83  LaTeX's float mechanism, however, is partly disabled in the current implementat
84 ion.
85  At the moment only page-wide floats can be used within the scope of the
86  environment.
87 \end_layout
88
89 \begin_layout Subsection
90
91 Examples
92 \end_layout
93
94 \begin_layout Subsubsection
95
96 Two columns
97 \end_layout
98
99 \begin_layout Standard
100
101 If you want to have two columns in your text, you have use LaTeX mode to
102  insert 
103 \family typewriter
104
105 \backslash
106 begin{multicols}{2}
107 \family default
108  at the point where you want the two column layout to start, and then 
109 \family typewriter
110
111 \backslash
112 end{multicols}
113 \family default
114  where you want it to end.
115  Like this:
116 \end_layout
117
118 \begin_layout Standard
119
120
121 \begin_inset VSpace -2ex
122 \end_inset
123
124
125 \end_layout
126
127
128 \begin_layout Standard
129
130
131 \begin_inset ERT
132 status collapsed
133
134 \begin_layout Standard
135
136 \backslash
137 begin{multicols}{2}
138 \end_layout
139
140 \end_inset
141
142
143 \end_layout
144
145 \begin_layout Standard
146 \noindent
147
148 \series bold
149 \size small
150 The Adventure of the Empty House
151 \series default
152
153 \newline
154 by 
155 \noun on
156 Sir Arthur Conan Doyle
157 \end_layout
158
159 \begin_layout Standard
160
161
162 \size small
163 It was in the spring of the year 1894 that all London was interested, and
164  the fashionable world dismayed, by the murder of the Honourable Ronald
165  Adair under most unusual and inexplicable circumstances.
166  The public has already learned those particulars of the crime which came
167  out in the police investigation, but a good deal was suppressed upon that
168  occasion, since the case for the prosecution was so overwhelmingly strong
169  that it was not necessary to bring forward all the facts.
170  Only now, at the end of nearly ten years, am I allowed to supply those
171  missing links which make up the whole of that remarkable chain.
172  The crime was of interest in itself, but that interest was as nothing to
173  me compared to the inconceivable sequel, which afforded me the greatest
174  shock and surprise of any event in my adventurous life.
175  Even now, after this long interval, I find myself thrilling as I think
176  of it, and feeling once more that sudden flood of joy, amazement, and increduli
177 ty which utterly submerged my mind.
178  Let me say to that public, which has shown some interest in those glimpses
179  which I have occasionally given them of the thoughts and actions of a very
180  remarkable man, that they are not to blame me if I have not shared my knowledge
181  with them, for I should have considered it my first duty to do so, had
182  I not been barred by a positive prohibition from his own lips, which was
183  only withdrawn upon the third of last month.
184 \end_layout
185
186 \begin_layout Standard
187
188
189 \begin_inset ERT
190 status collapsed
191
192 \begin_layout Standard
193
194 \backslash
195 end{multicols}
196 \end_layout
197
198 \end_inset
199
200
201 \end_layout
202
203 \begin_layout Subsubsection
204
205 Multiple columns
206 \end_layout
207
208 \begin_layout Standard
209
210 The same pattern is used when you want more than two columns.
211  (You can have more than 3 columns if you want , but that might not be very
212  pleasant for the eye.)
213 \end_layout
214
215 \begin_layout Standard
216
217
218 \begin_inset VSpace -2ex
219 \end_inset
220
221
222 \end_layout
223
224
225 \begin_layout Standard
226
227
228 \begin_inset ERT
229 status collapsed
230
231 \begin_layout Standard
232
233 \backslash
234 begin{multicols}{3}
235 \end_layout
236
237 \end_inset
238
239
240 \end_layout
241
242 \begin_layout Standard
243
244
245 \size footnotesize
246 It can be imagined that my close intimacy with Sherlock Holmes had interested
247  me deeply in crime, and that after his disappearance I never failed to
248  read with care the various problems which came before the public.
249  And I even attempted, more than once, for my own private satisfaction,
250  to employ his methods in their solution, though with indifferent success.
251  There was none, however, which appealed to me like this tragedy of Ronald
252  Adair.
253  As I read the evidence at the inquest, which led up to a verdict of willful
254  murder against some person or persons unknown, I realized more clearly
255  than I had ever done the loss which the community had sustained by the
256  death of Sherlock Holmes.
257  There were points about this strange business which would, I was sure,
258  have specially appealed to him, and the efforts of the police would have
259  been supplemented, or more probably anticipated, by the trained observation
260  and the alert mind of the first criminal agent in Europe.
261  All day, as I drove upon my round, I turned over the case in my mind and
262  found no explanation which appeared to me to be adequate.
263  At the risk of telling a twice-told tale, I will recapitulate the facts
264  as they were known to the public at the conclusion of the inquest.
265 \end_layout
266
267 \begin_layout Standard
268
269
270 \begin_inset ERT
271 status collapsed
272
273 \begin_layout Standard
274
275 \backslash
276 end{multicols}
277 \end_layout
278
279 \end_inset
280
281
282 \end_layout
283
284 \begin_layout Subsubsection
285
286 Columns inside columns
287 \end_layout
288
289 \begin_layout Standard
290
291 You can even have columns inside columns:
292 \end_layout
293
294 \begin_layout Standard
295
296
297 \begin_inset VSpace -2ex
298 \end_inset
299
300
301 \end_layout
302
303
304 \begin_layout Standard
305
306
307 \begin_inset ERT
308 status collapsed
309
310 \begin_layout Standard
311
312 \backslash
313 begin{multicols}{2}
314 \end_layout
315
316 \end_inset
317
318
319 \end_layout
320
321 \begin_layout Standard
322
323
324 \size footnotesize
325 The Honourable Ronald Adair was the second son of the Earl of Maynooth,
326  at that time governor of one of the Australian colonies.
327  Adair's mother had returned from Australia to undergo the operation for
328  cataract, and she, her son Ronald, and her daughter Hilda were living together
329  at 427 Park Lane.
330 \end_layout
331
332 \begin_layout Standard
333
334
335 \begin_inset VSpace -2ex
336 \end_inset
337
338
339 \end_layout
340
341
342 \begin_layout Standard
343
344
345 \begin_inset ERT
346 status collapsed
347
348 \begin_layout Standard
349
350 \backslash
351 begin{multicols}{2}
352 \end_layout
353
354 \end_inset
355
356
357 \end_layout
358
359 \begin_layout Standard
360
361
362 \size footnotesize
363 The youth moved in the best society--had, so far as was known, no enemies
364  and no particular vices.
365  He had been engaged to Miss Edith Woodley, of Carstairs, but the engagement
366  had been broken off by mutual consent some months before, and there was
367  no sign that it had left any very profound feeling behind it.
368  For the rest {sic} the man's life moved in a narrow and conventional circle,
369  for his habits were quiet and his nature unemotional.
370  Yet it was upon this easy-going young aristocrat that death came, in most
371  strange and unexpected form, between the hours of ten and eleven-twenty
372  on the night of March 30, 1894.
373 \end_layout
374
375 \begin_layout Standard
376
377
378 \begin_inset ERT
379 status collapsed
380
381 \begin_layout Standard
382
383 \backslash
384 end{multicols}
385 \end_layout
386
387 \end_inset
388
389
390 \end_layout
391
392 \begin_layout Standard
393
394
395 \size footnotesize
396 Ronald Adair was fond of cards--playing continually, but never for such
397  stakes as would hurt him.
398  He was a member of the Baldwin, the Cavendish, and the Bagatelle card clubs.
399  It was shown that, after dinner on the day of his death, he had played
400  a rubber of whist at the latter club.
401  He had also played there in the afternoon.
402
403 \size default
404  
405 \size footnotesize
406 The evidence of those who had played with him-- Mr.
407  Murray, Sir John Hardy, and Colonel Moran--showed that the game was whist,
408  and that there was a fairly equal fall of the cards.
409  Adair might have lost five pounds, but not more.
410  His fortune was a considerable one, and such a loss could not in any way
411  affect him.
412  He had played nearly every day at one club or other, but he was a cautious
413  player, and usually rose a winner.
414  It came out in evidence that, in partnership with Colonel Moran, he had
415  actually won as much as four hundred and twenty pounds in a sitting, some
416  weeks before, from Godfrey Milner and Lord Balmoral.
417  So much for his recent history as it came out at the inquest.
418 \end_layout
419
420 \begin_layout Standard
421
422
423 \begin_inset ERT
424 status collapsed
425
426 \begin_layout Standard
427
428 \backslash
429 end{multicols}
430 \end_layout
431
432 \end_inset
433
434
435 \end_layout
436
437 \begin_layout Subsection
438
439 Advanced Examples
440 \end_layout
441
442 \begin_layout Standard
443
444 As you probably know 
445 \family typewriter
446 multicol
447 \family default
448  has several customizing variables.
449  The following examples shows how these can be used from LyX.
450 \end_layout
451
452 \begin_layout Subsubsection
453
454 Preface and Skip
455 \end_layout
456
457 \begin_layout Standard
458
459 If there is less than 5cm left on the page, a page break will be inserted
460  before this bit, which has a preface text above the two columns: 
461 \end_layout
462
463 \begin_layout Standard
464
465
466 \begin_inset ERT
467 status collapsed
468
469 \begin_layout Standard
470
471 \backslash
472 begin{multicols}{2}[
473 \end_layout
474
475 \end_inset
476
477 And the story continues and continues and continues and continues\SpecialChar \ldots{}
478
479 \begin_inset ERT
480 status collapsed
481
482 \begin_layout Standard
483 ][5cm]
484 \end_layout
485
486 \end_inset
487
488
489 \end_layout
490
491 \begin_layout Standard
492
493
494 \size small
495 On the evening of the crime, he returned from the club exactly at ten.
496  His mother and sister were out spending the evening with a relation.
497  The servant deposed that she heard him enter the front room on the second
498  floor, generally used as his sitting-room.
499  She had lit a fire there, and as it smoked she had opened the window.
500  No sound was heard from the room until eleven-twenty, the hour of the return
501  of Lady Maynooth and her daughter.
502  Desiring to say good-night, she attempted to enter her son's room.
503  The door was locked on the inside, and no answer could be got to their
504  cries and knocking.
505  Help was obtained, and the door forced.
506  The unfortunate young man was found lying near the table.
507  His head had been horribly mutilated by an expanding revolver bullet, but
508  no weapon of any sort was to be found in the room.
509  On the table lay two bank notes for ten pounds each and seventeen pounds
510  ten in silver and gold, the money arranged in little piles of varying amount.
511  There were some figures also upon a sheet of paper, with the names of some
512  club friends opposite to them, from which it was conjectured that before
513  his death he was endeavouring to make out his losses or winnings at cards.
514 \end_layout
515
516 \begin_layout Standard
517
518
519 \begin_inset ERT
520 status collapsed
521
522 \begin_layout Standard
523
524 \backslash
525 end{multicols}
526 \end_layout
527
528 \end_inset
529
530
531 \end_layout
532
533 \begin_layout Subsubsection
534
535 Preface and sections
536 \end_layout
537
538 \begin_layout Standard
539
540 What if you want the preface to be a sectioning command? That can be done,
541  but only through LaTeX commands inside the parameters for the 
542 \family typewriter
543 multicols
544 \family default
545  command.
546  Because of this, the section command can not be provided by LyX:
547 \end_layout
548
549 \begin_layout Standard
550
551
552 \begin_inset ERT
553 status collapsed
554
555 \begin_layout Standard
556
557 \backslash
558 begin{multicols}{2}[
559 \backslash
560 subsubsection{
561 \end_layout
562
563 \end_inset
564
565 This is the sectioning command as a preface
566 \begin_inset ERT
567 status collapsed
568
569 \begin_layout Standard
570 }][5cm]
571 \end_layout
572
573 \end_inset
574
575
576 \end_layout
577
578 \begin_layout Standard
579
580
581 \size small
582 A minute examination of the circumstances served only to make the case more
583  complex.
584  In the first place, no reason could be given why the young man should have
585  fastened the door upon the inside.
586  There was the possibility that the murderer had done this, and had afterwards
587  escaped by the window.
588  The drop was at least twenty feet, however, and a bed of crocuses in full
589  bloom lay beneath.
590  Neither the flowers nor the earth showed any sign of having been disturbed,
591  nor were there any marks upon the narrow strip of grass which separated
592  the house from the road.
593  Apparently, therefore, it was the young man himself who had fastened the
594  door.
595  But how did he come by his death? No one could have climbed up to the window
596  without leaving traces.
597  Suppose a man had fired through the window, he would indeed be a remarkable
598  shot who could with a revolver inflict so deadly a wound.
599  Again, Park Lane is a frequented thoroughfare; there is a cab stand within
600  a hundred yards of the house.
601  No one had heard a shot.
602  And yet there was the dead man and there the revolver bullet, which had
603  mushroomed out, as soft-nosed bullets will, and so inflicted a wound which
604  must have caused instantaneous death.
605  Such were the circumstances of the Park Lane Mystery, which were further
606  complicated by entire absence of motive, since, as I have said, young Adair
607  was not known to have any enemy, and no attempt had been made to remove
608  the money or valuables in the room.
609 \end_layout
610
611 \begin_layout Standard
612
613
614 \begin_inset ERT
615 status collapsed
616
617 \begin_layout Standard
618
619 \backslash
620 end{multicols}
621 \end_layout
622
623 \end_inset
624
625
626 \end_layout
627
628 \begin_layout Subsubsection
629
630 Free Space
631 \end_layout
632
633 \begin_layout Standard
634
635 The 
636 \family typewriter
637 multicol
638 \family default
639  package demands that a certain amount of space is available before and
640  after a multicolumn section.
641  In addition 
642 \family typewriter
643 multicol
644 \family default
645  inserts a given space in front of and after the multicol section.
646  The commands to change the default settings for this must be given just
647  before the 
648 \family typewriter
649
650 \backslash
651 begin{multicols}
652 \family default
653 .
654  This example puts a space of 3 cm in front of and after the multicolumn
655  text:
656 \end_layout
657
658 \begin_layout Standard
659
660
661 \begin_inset ERT
662 status collapsed
663
664 \begin_layout Standard
665
666 \backslash
667 setlength{
668 \backslash
669 multicolsep}{3cm}
670 \backslash
671 begin{multicols}{2}
672 \end_layout
673
674 \end_inset
675
676
677 \end_layout
678
679 \begin_layout Standard
680
681
682 \size small
683 All day I turned these facts over in my mind, endeavouring to hit upon some
684  theory which could reconcile them all, and to find that line of least resistanc
685 e which my poor friend had declared to be the starting-point of every investigat
686 ion.
687  I confess that I made little progress.
688  In the evening I strolled across the Park, and found myself about six o'clock
689  at the Oxford Street end of Park Lane.
690  A group of loafers upon the pavements, all staring up at a particular window,
691  directed me to the house which I had come to see.
692  A tall, thin man with coloured glasses, whom I strongly suspected of being
693  a plain-clothes detective, was pointing out some theory of his own, while
694  the others crowded round to listen to what he said.
695  I got as near him as I could, but his observations seemed to me to be absurd,
696  so I withdrew again in some disgust.
697  As I did so I struck against an elderly, deformed man, who had been behind
698  me, and I knocked down several books which he was carrying.
699  I remember that as I picked them up, I observed the title of one of them,
700  THE ORIGIN OF TREE WORSHIP, and it struck me that the fellow must be some
701  poor bibliophile, who, either as a trade or as a hobby, was a collector
702  of obscure volumes.
703  I endeavoured to apologize for the accident, but it was evident that these
704  books which I had so unfortunately maltreated were very precious objects
705  in the eyes of their owner.
706  With a snarl of contempt he turned upon his heel, and I saw his curved
707  back and white side-whiskers disappear among the throng.
708 \end_layout
709
710 \begin_layout Standard
711
712
713 \begin_inset ERT
714 status collapsed
715
716 \begin_layout Standard
717
718 \backslash
719 end{multicols}
720 \end_layout
721
722 \end_inset
723
724
725 \end_layout
726
727 \begin_layout Paragraph
728
729 Note:
730 \end_layout
731
732 \begin_layout Standard
733
734 The values you set with 
735 \family typewriter
736
737 \backslash
738 setlength
739 \family default
740  must be reset to default after use, or you will get the modified value
741  in the rest of your document.
742 \end_layout
743
744 \begin_layout Standard
745
746
747 \begin_inset ERT
748 status collapsed
749
750 \begin_layout Standard
751
752 \backslash
753 setlength{
754 \backslash
755 multicolsep}{13pt}
756 \end_layout
757
758 \end_inset
759
760
761 \end_layout
762
763 \begin_layout Subsubsection
764
765 Column Width and Separation
766 \end_layout
767
768 \begin_layout Standard
769
770 The width of the columns inside the 
771 \family sans
772 multicols
773 \family default
774  environment is automatically calculated, but you can modify the space between
775  two columns explicitly.
776  The space between the following two columns is 3 cm wide:
777 \end_layout
778
779 \begin_layout Standard
780
781
782 \begin_inset ERT
783 status collapsed
784
785 \begin_layout Standard
786
787 \backslash
788 setlength{
789 \backslash
790 columnsep}{3cm}
791 \backslash
792 begin{multicols}{2}
793 \end_layout
794
795 \end_inset
796
797
798 \end_layout
799
800 \begin_layout Standard
801
802
803 \size small
804 My observations of No.
805  427 Park Lane did little to clear up the problem in which I was interested.
806  The house was separated from the street by a low wall and railing, the
807  whole not more than five feet high.
808  It was perfectly easy, therefore, for anyone to get into the garden, but
809  the window was entirely inaccessible, since there was no water pipe or
810  anything which could help the most active man to climb it.
811  More puzzled than ever, I retraced my steps to Kensington.
812  I had not been in my study five minutes when the maid entered to say that
813  a person desired to see me.
814  To my astonishment it was none other than my strange old book collector,
815  his sharp, wizened face peering out from a frame of white hair, and his
816  precious volumes, a dozen of them at least, wedged under his right arm.
817 \end_layout
818
819 \begin_layout Standard
820
821
822 \begin_inset ERT
823 status collapsed
824
825 \begin_layout Standard
826
827 \backslash
828 end{multicols}
829 \end_layout
830
831 \end_inset
832
833
834 \end_layout
835
836 \begin_layout Standard
837
838 Once again, we have to reset the value after use to avoid using it in the
839  rest of the document.
840 \end_layout
841
842 \begin_layout Standard
843
844
845 \begin_inset ERT
846 status collapsed
847
848 \begin_layout Standard
849
850 \backslash
851 setlength{
852 \backslash
853 columnsep}{10pt}
854 \end_layout
855
856 \end_inset
857
858
859 \end_layout
860
861 \begin_layout Subsubsection
862
863 Vertical Lines
864 \end_layout
865
866 \begin_layout Standard
867
868 Between every two columns, a rule of width 
869 \family typewriter
870
871 \backslash
872 columnseprule
873 \family default
874  is placed.
875  If this rule is set to 0 pt, the rule is suppressed.
876  In the following example, the line separating the two columns is 2 pt wide.
877 \end_layout
878
879 \begin_layout Standard
880
881
882 \begin_inset ERT
883 status collapsed
884
885 \begin_layout Standard
886
887 \backslash
888 setlength{
889 \backslash
890 columnseprule}{2pt}
891 \backslash
892 begin{multicols}{2}
893 \end_layout
894
895 \end_inset
896
897
898 \end_layout
899
900 \begin_layout Standard
901
902
903 \size small
904
905 \begin_inset Quotes eld
906 \end_inset
907
908 You're surprised to see me, sir,
909 \begin_inset Quotes erd
910 \end_inset
911
912  said he, in a strange, croaking voice.
913 \end_layout
914
915 \begin_layout Standard
916
917
918 \size small
919 I acknowledged that I was.
920 \end_layout
921
922 \begin_layout Standard
923
924
925 \size small
926
927 \begin_inset Quotes eld
928 \end_inset
929
930 Well, I've a conscience, sir, and when I chanced to see you go into this
931  house, as I came hobbling after you, I thought to myself, I'll just step
932  in and see that kind gentleman, and tell him that if I was a bit gruff
933  in my manner there was not any harm meant, and that I am much obliged to
934  him for picking up my books.
935 \begin_inset Quotes erd
936 \end_inset
937
938
939 \end_layout
940
941 \begin_layout Standard
942
943
944 \size small
945
946 \begin_inset Quotes eld
947 \end_inset
948
949 You make too much of a trifle,
950 \begin_inset Quotes erd
951 \end_inset
952
953  said I.
954  
955 \begin_inset Quotes eld
956 \end_inset
957
958 May I ask how you knew who I was?
959 \begin_inset Quotes erd
960 \end_inset
961
962
963 \end_layout
964
965 \begin_layout Standard
966
967
968 \size small
969
970 \begin_inset Quotes eld
971 \end_inset
972
973 Well, sir, if it isn't too great a liberty, I am a neighbour of yours, for
974  you'll find my little bookshop at the corner of Church Street, and very
975  happy to see you, I am sure.
976  Maybe you collect yourself, sir.
977  Here's 
978 \noun on
979 British\InsetSpace ~
980 Birds
981 \noun default
982 , and 
983 \noun on
984 Catullus
985 \noun default
986 , and 
987 \noun on
988 The Holy War
989 \noun default
990 --a bargain, every one of them.
991  With five volumes you could just fill that gap on that second shelf.
992  It looks untidy, does it not, sir?
993 \begin_inset Quotes erd
994 \end_inset
995
996
997 \end_layout
998
999 \begin_layout Standard
1000
1001
1002 \begin_inset ERT
1003 status collapsed
1004
1005 \begin_layout Standard
1006
1007 \backslash
1008 end{multicols}
1009 \end_layout
1010
1011 \end_inset
1012
1013
1014 \end_layout
1015
1016 \begin_layout Standard
1017
1018 As usual, we reset the value after use.
1019 \end_layout
1020
1021 \begin_layout Standard
1022
1023
1024 \begin_inset ERT
1025 status collapsed
1026
1027 \begin_layout Standard
1028
1029 \backslash
1030 setlength{
1031 \backslash
1032 columnseprule}{0pt}
1033 \end_layout
1034
1035 \end_inset
1036
1037
1038 \end_layout
1039
1040 \begin_layout Standard
1041
1042 You'll have to go to the library to read the rest of the story.
1043 \begin_inset Foot
1044 status collapsed
1045
1046 \begin_layout Standard
1047
1048 \SpecialChar \ldots{}
1049 or cheat like we did and find it at the Gutenberg project somewhere on the
1050  Web.
1051 \end_layout
1052
1053 \end_inset
1054
1055  Believe it or not, but it's actually a bit of a cliff-hanger at this point
1056  in the story\SpecialChar \ldots{}
1057
1058 \end_layout
1059
1060 \end_body
1061 \end_document