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