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