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