]> git.lyx.org Git - lyx.git/blob - lib/doc/Tutorial.lyx
manuals: add a link where to find the latest PDF version
[lyx.git] / lib / doc / Tutorial.lyx
1 #LyX 1.5.4svn created this file. For more info see http://www.lyx.org/
2 \lyxformat 276
3 \begin_document
4 \begin_header
5 \textclass book
6 \begin_preamble
7 % DO NOT ALTER THIS PREAMBLE!!!
8 %
9 %This preamble is designed to ensure that the document prints
10 % out as advertised. If you mess with this preamble,
11 % parts of the document may not print out as expected.  If you
12 % have problems LaTeXing this file, please contact 
13 % the documentation team
14 % email: lyx-docs@lists.lyx.org
15
16 \usepackage{ifpdf} % part of the hyperref bundle
17 \ifpdf % if pdflatex is used
18
19  % set fonts for nicer pdf view
20  \IfFileExists{lmodern.sty}{\usepackage{lmodern}}{}
21
22  % link all cross references and URLs in pdf output
23  \usepackage[colorlinks=true, bookmarks, bookmarksnumbered,
24   bookmarksopen, bookmarksopenlevel=2,
25   linkcolor=black, citecolor=black, urlcolor=blue, filecolor=blue,
26   pdfpagelayout=OneColumn, pdfnewwindow=true,
27   pdfstartview=XYZ, plainpages=false, pdfpagelabels,
28   pdfauthor={LyX Team}, pdftex,
29   pdftitle={The LyX Tutorial},pdfsubject={LyX-documentation Tutorial},
30   pdfkeywords={LyX, documentation}]{hyperref}
31  
32 \else % if dvi or ps is produced
33
34  % link all cross references and URLs in dvi output
35  \usepackage[ps2pdf]{hyperref}
36
37 \fi % end if pdflatex is used
38
39  % the pages of the TOC are numbered roman
40  % and a pdf-bookmark for the TOC is added
41  \pagenumbering{roman}
42  \let\myTOC\tableofcontents
43  \renewcommand\tableofcontents{%
44    \pdfbookmark[1]{Contents}{}
45    \myTOC
46    \cleardoublepage
47    \pagenumbering{arabic} }
48
49 % redefine the \LyX macro for PDF bookmarks
50 \def\LyX{\texorpdfstring{%
51   L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@}
52   {LyX }}
53 \end_preamble
54 \language english
55 \inputencoding auto
56 \font_roman default
57 \font_sans default
58 \font_typewriter default
59 \font_default_family default
60 \font_sc false
61 \font_osf false
62 \font_sf_scale 100
63 \font_tt_scale 100
64 \graphics default
65 \paperfontsize 12
66 \spacing single
67 \papersize default
68 \use_geometry false
69 \use_amsmath 0
70 \use_esint 0
71 \cite_engine basic
72 \use_bibtopic false
73 \paperorientation portrait
74 \secnumdepth 3
75 \tocdepth 2
76 \paragraph_separation indent
77 \defskip medskip
78 \quotes_language english
79 \papercolumns 1
80 \papersides 2
81 \paperpagestyle headings
82 \tracking_changes false
83 \output_changes false
84 \author "" 
85 \author "" 
86 \end_header
87
88 \begin_body
89
90 \begin_layout Title
91 The LyX Tutorial
92 \end_layout
93
94 \begin_layout Author
95 by the LyX Team
96 \begin_inset Foot
97 status collapsed
98
99 \begin_layout Standard
100 If you have comments or error corrections, please send them to the LyX Documenta
101 tion mailing list, 
102 \family typewriter
103 lyx-docs@lists.lyx.org
104 \family default
105 .
106 \end_layout
107
108 \end_inset
109
110
111 \end_layout
112
113 \begin_layout Standard
114 \begin_inset LatexCommand tableofcontents
115
116 \end_inset
117
118
119 \end_layout
120
121 \begin_layout Chapter
122 Introduction
123 \end_layout
124
125 \begin_layout Section
126 Welcome to LyX!
127 \end_layout
128
129 \begin_layout Standard
130 This file is designed for all of you who have never heard of LaTeX, or don't
131  know it very well.
132  Now, don't panic - you won't need to learn LaTeX to use LyX.
133  That is, after all, the whole point of LyX: to provide an almost-WYSIWYG
134  interface to LaTeX.
135  There are some things you will need to learn, however, in order to use
136  LyX effectively.
137 \end_layout
138
139 \begin_layout Standard
140 Some of you probably found your way to this document because you tried to
141  put two spaces after a 
142 \begin_inset Quotes eld
143 \end_inset
144
145 .
146 \begin_inset Quotes erd
147 \end_inset
148
149  or tried to put 3 blank lines between paragraphs.
150  You found out you couldn't and in fact, you'll find out that most of the
151  little tricks you're accustomed to use in other word processors won't work
152  in LyX.
153  That's because most word processors you've used before allow you to manually
154  enter all spacings, font changes, and so on.
155  So you end up not only writing a document but typesetting it, too.
156  LyX does the typesetting for you, in a consistent fashion, letting you
157  focus on the important things, like the content of your writing.
158 \end_layout
159
160 \begin_layout Standard
161 So read on to learn more about LyX.
162  Reading this tutorial is definitely worth the time.
163 \end_layout
164
165 \begin_layout Section
166 What the Tutorial 
167 \emph on
168 is
169 \emph default
170  and what it 
171 \emph on
172 isn't
173 \end_layout
174
175 \begin_layout Standard
176 Before we get started with this section, we want to make a quick note of
177  something.
178  The 
179 \emph on
180 Tutorial
181 \emph default
182  uses the notation outlined in the 
183 \emph on
184 Introduction
185 \emph default
186  manual.
187  If you came to this manual first, please read the 
188 \emph on
189 Introduction
190 \emph default
191  before you continue with the 
192 \emph on
193 Tutorial
194 \emph default
195 .
196 \end_layout
197
198 \begin_layout Standard
199 Now that you know which fonts mean what, we want to talk a bit about what
200  this 
201 \emph on
202 Tutorial
203 \emph default
204  is for.
205 \end_layout
206
207 \begin_layout Subsection
208 Getting the most out of the Tutorial
209 \end_layout
210
211 \begin_layout Standard
212 This tutorial consists of examples and exercises.
213  To get the most out of this document, you should read through the document,
214  typing all the little things we're telling you to type and trying out all
215  of the exercises to see if you get them right.
216  For convenience, you might want to print out the PDF version of this document.
217 \end_layout
218
219 \begin_layout Standard
220 If you are familiar with LaTeX, you'll probably be able to read the 
221 \emph on
222 Tutorial
223 \emph default
224  somewhat faster, since many LyX ideas are just LaTeX ideas in disguise.
225  However, LyX have features you'll want to learn about.
226  Even if you don't feel like reading the rest of the 
227 \emph on
228 Tutorial
229 \emph default
230 , you should definitely check out Section\InsetSpace ~
231
232 \begin_inset LatexCommand ref
233 reference "sec:latexusers"
234
235 \end_inset
236
237 , which is specifically written for experienced LaTeX users.
238 \end_layout
239
240 \begin_layout Subsection
241 What you 
242 \emph on
243 won't
244 \emph default
245  find
246 \end_layout
247
248 \begin_layout Itemize
249 Detailed explanations of all of LyX's features.
250 \end_layout
251
252 \begin_deeper
253 \begin_layout Standard
254 Look in the 
255 \emph on
256 User's Guide
257 \emph default
258  when you need this.
259 \end_layout
260
261 \end_deeper
262 \begin_layout Itemize
263 Detailed explanations of LaTeX.
264 \end_layout
265
266 \begin_deeper
267 \begin_layout Standard
268 Unnecessary.
269  If you want to learn some of the neat tricks you can do with LaTeX in LyX,
270  you can have a look at the 
271 \emph on
272 Embedded\InsetSpace ~
273 Objects
274 \emph default
275  manual.
276 \end_layout
277
278 \end_deeper
279 \begin_layout Standard
280 It's time to move onwards, time for your first document \SpecialChar \ldots{}
281
282 \end_layout
283
284 \begin_layout Chapter
285 Getting started with LyX
286 \end_layout
287
288 \begin_layout Section
289 Your first LyX document
290 \begin_inset LatexCommand label
291 name "sec:Your-first-LyX"
292
293 \end_inset
294
295
296 \end_layout
297
298 \begin_layout Standard
299 OK\SpecialChar \@.
300  You're ready to start writing.
301  Before you do, there are a few things we need to mention, which will hopefully
302  make the Tutorial more instructive and useful.
303  
304 \end_layout
305
306 \begin_layout Standard
307 Because there are informations we can't give you in the Tutorial, the 
308 \emph on
309 first
310 \emph default
311  
312 \series medium
313 thing that you need to do is find the
314 \series default
315  other 
316 \series medium
317 help files.
318  This is very simple:
319 \series default
320  Start up LyX, Choose the 
321 \emph on
322 User's Guide
323 \emph default
324  from the 
325 \family sans
326 Help
327 \family default
328  menu.
329  You may want to load the 
330 \emph on
331 Tutorial
332 \emph default
333  as well (if you're not reading it within LyX already).
334  This way, you can read them while you're writing your own file.
335 \begin_inset Foot
336 status collapsed
337
338 \begin_layout Standard
339 They can also serve as good examples of how to use the many features of
340  LyX.
341 \end_layout
342
343 \end_inset
344
345  Note that once you've got more than one document open, you can use the
346  
347 \family sans
348 View
349 \family default
350  menu or the document tabs to switch between them.
351 \end_layout
352
353 \begin_layout Standard
354 In this Tutorial, we're going to assume that you have a fully working version
355  of LyX, as well as a LaTeX-distribution, a DVI-, and a PDF-viewer.
356  This should be the case on all major Linux- and BSD-distribution, as well
357  as on Windows, where this is setup by the LyX installer.
358 \end_layout
359
360 \begin_layout Standard
361 Finally, we've written a file to let you practice your LyX skills on, it's
362  called 
363 \family typewriter
364 example_raw.lyx
365 \family default
366 .
367  Imagine that it was typed by someone who didn't know about any of LyX's
368  great features.
369  As you learn new LyX functions, we'll suggest that you fix those parts
370  of 
371 \family typewriter
372 example_raw.lyx
373 \family default
374 .
375  It also contains 
376 \begin_inset Quotes eld
377 \end_inset
378
379 subtle
380 \begin_inset Quotes erd
381 \end_inset
382
383  hints about how to fix things
384 \begin_inset Foot
385 status collapsed
386
387 \begin_layout Standard
388 The hints are located in yellow 
389 \begin_inset Quotes eld
390 \end_inset
391
392 Notes
393 \begin_inset Quotes erd
394 \end_inset
395
396 .
397  Access the text in a note by clicking on it.
398 \end_layout
399
400 \end_inset
401
402 .
403  If you want to cheat, or check what you've done, there's also a file called
404  
405 \family typewriter
406 example_lyxified.lyx
407 \family default
408  which contains the same text written and typeset by a LyX master.
409 \end_layout
410
411 \begin_layout Standard
412 The example files can be found in the 
413 \family typewriter
414 examples
415 \family default
416  directory of LyX's installation folder.
417  Open the raw document, and use 
418 \family sans
419 File\SpecialChar \menuseparator
420 Save\InsetSpace ~
421 As
422 \family default
423  to save a copy in your own directory for you to work on.
424  As you fix parts of the raw document, check to see how those changes affect
425  the DVI output.
426 \end_layout
427
428 \begin_layout Standard
429 By the way, the 
430 \family typewriter
431 examples
432 \family default
433  directory contains lots of other examples files.
434  They will show you how to do various fancy things with LyX.
435  After you read the Tutorial, or when you're confused about how to do something
436  fancy in LyX, take a look at these files.
437 \end_layout
438
439 \begin_layout Subsection
440 Typing, Viewing, and Exporting
441 \end_layout
442
443 \begin_layout Itemize
444 Open a new file with 
445 \family sans
446 File\SpecialChar \menuseparator
447 New
448 \end_layout
449
450 \begin_layout Itemize
451 Type a sentence like: 
452 \family typewriter
453 This is my first LyX document!
454 \end_layout
455
456 \begin_layout Itemize
457 Save your document with 
458 \family sans
459 File\SpecialChar \menuseparator
460 Save\InsetSpace ~
461 As\SpecialChar \@.
462
463 \end_layout
464
465 \begin_layout Itemize
466 Run LaTeX to create a DVI file, with 
467 \family sans
468 View\SpecialChar \menuseparator
469 DVI
470 \family default
471  or the toolbar button 
472 \begin_inset Graphics
473         filename ../images/buffer-view_dvi.png
474         scale 75
475
476 \end_inset
477
478 .
479  LyX will open a DVI-viewer program displaying your document looking like
480  when printed.
481 \begin_inset Foot
482 status collapsed
483
484 \begin_layout Standard
485 You can save time by leaving the DVI-viewer running in the background.
486  Then, you can use 
487 \family sans
488 View\SpecialChar \menuseparator
489 Update\SpecialChar \menuseparator
490 DVI
491 \family default
492  or the toolbar button 
493 \begin_inset Graphics
494         filename ../images/buffer-update_dvi.png
495         scale 75
496
497 \end_inset
498
499  and just click on the DVI-viewer window (or unminimize it) after LaTeX
500  finishes running.
501 \end_layout
502
503 \end_inset
504
505
506 \end_layout
507
508 \begin_layout Itemize
509 Export the ready to print document with 
510 \family sans
511 File\SpecialChar \menuseparator
512 Export
513 \family default
514  to a format you want
515 \family sans
516 .
517 \end_layout
518
519 \begin_layout Standard
520 Congratulations! You've written your first LyX document.
521  All of the rest is just details, which is covered in the other manuals.
522 \end_layout
523
524 \begin_layout Subsection
525 Simple Operations
526 \end_layout
527
528 \begin_layout Standard
529 LyX can of course do most of the things you're used to do with a word processor.
530  It will word-wrap and indent paragraphs automatically.
531  Here's a quick description of how to do some simple actions.
532 \end_layout
533
534 \begin_layout Description
535 Undo LyX has multiple levels of undo, which means you can undo everything
536  you've done since your current editing session started, by selecting 
537 \family sans
538 Edit\SpecialChar \menuseparator
539 Undo
540 \family default
541  (toolbar button 
542 \begin_inset Graphics
543         filename ../images/undo.png
544         scale 75
545
546 \end_inset
547
548 ) over and over again.
549  If you undo too much, just select 
550 \family sans
551 Edit\SpecialChar \menuseparator
552 Redo
553 \family default
554  (toolbar button 
555 \begin_inset Graphics
556         filename ../images/redo.png
557         scale 75
558
559 \end_inset
560
561 ) to get it back.
562  
563 \end_layout
564
565 \begin_deeper
566 \begin_layout Standard
567 Currently, undo is limited to 100 steps.
568  Undo also doesn't work for 
569 \emph on
570 everything
571 \emph default
572 ; for instance, not for changes to the document layout what is really a
573  LyX bug.
574 \end_layout
575
576 \end_deeper
577 \begin_layout Description
578 Cut/Paste/Copy Use 
579 \family sans
580 Edit\SpecialChar \menuseparator
581 Cut
582 \family default
583  (toolbar button 
584 \begin_inset Graphics
585         filename ../images/cut.png
586         scale 75
587
588 \end_inset
589
590 ), 
591 \family sans
592 Edit\SpecialChar \menuseparator
593 Copy
594 \family default
595  (toolbar button 
596 \begin_inset Graphics
597         filename ../images/copy.png
598         scale 75
599
600 \end_inset
601
602 ), and 
603 \family sans
604 Edit\SpecialChar \menuseparator
605 Paste
606 \family default
607  (toolbar button 
608 \begin_inset Graphics
609         filename ../images/paste.png
610         scale 75
611
612 \end_inset
613
614 ) to cut, copy, and paste.
615  Or automatically paste selected text (including selections from other programs)
616  with the 
617 \emph on
618 middle mouse button
619 \emph default
620 .
621 \end_layout
622
623 \begin_layout Description
624 Find/Replace Use 
625 \family sans
626 Edit\SpecialChar \menuseparator
627 Find\InsetSpace ~
628 &\InsetSpace ~
629 Replace
630 \family default
631  (toolbar button 
632 \begin_inset Graphics
633         filename ../images/dialog-show_findreplace.png
634         scale 75
635
636 \end_inset
637
638 ) to search.
639  In the dialog, search with the 
640 \family sans
641 Find\InsetSpace ~
642 Next
643 \family default
644  button, and use the 
645 \family sans
646 Replace
647 \family default
648  button to replace a word you've found
649 \begin_inset Foot
650 status collapsed
651
652 \begin_layout Standard
653 Close the window when you're done or leave it open if you find it more convenien
654 t.
655  Most dialog boxes in LyX can operate like this.
656  Just be sure you have the right window focus when you're trying to type
657  in the main LyX window or a LyX dialog.
658 \end_layout
659
660 \end_inset
661
662 .
663  If you like, you can specify whether to make the search case-sensitive,
664  or to search for only complete words; you can also search backwards through
665  the document.
666 \end_layout
667
668 \begin_layout Description
669 Character\InsetSpace ~
670 Formatting You can 
671 \emph on
672 emphasize
673 \emph default
674  text (which will by default print characters in italics), set it in 
675 \series bold
676 bold face
677 \series default
678 , or in 
679 \noun on
680 Noun Style
681 \noun default
682  (usually small caps, used for people's names) from the toggle buttons in
683  the 
684 \family sans
685 Edit\SpecialChar \menuseparator
686 Text\InsetSpace ~
687 Style
688 \family default
689  dialog (toolbar button 
690 \begin_inset Graphics
691         filename ../images/dialog-show_character.png
692         scale 75
693
694 \end_inset
695
696 ).
697 \end_layout
698
699 \begin_layout Description
700 Toolbar There are buttons on the toolbar (just below the menus) which allow
701  you to do some of the more popular functions, such as 
702 \family sans
703 Paste
704 \family default
705  and 
706 \family sans
707 Print
708 \family default
709 .
710 \end_layout
711
712 \begin_layout Standard
713 Of course, you haven't yet written enough to make most of these functions
714  useful.
715  As you write more, though, try undoing, pasting, etc.
716 \end_layout
717
718 \begin_layout Subsection
719 WYSIWYM: Whitespace in LyX
720 \begin_inset LatexCommand label
721 name "sec:whitespace"
722
723 \end_inset
724
725
726 \end_layout
727
728 \begin_layout Standard
729 One of the hardest things for new users to get used to is the way that LyX
730  handles whitespace.
731  As many times as you hit 
732 \family sans
733 Return
734 \family default
735 , you'll only get one blank line.
736  As many times as you hit 
737 \family sans
738 Space
739 \family default
740 , you'll only get one space.
741  On a blank line, LyX won't let you type even one space.
742  The 
743 \family sans
744 Tab
745 \family default
746  key won't move you forward one tab stop; in fact there 
747 \emph on
748 are
749 \emph default
750  no tab stops! There's no ruler at the top of the page to let you set tabs
751  or margins, either.
752 \end_layout
753
754 \begin_layout Standard
755 Many commercial word processors are based on the WYSIWYG principle: 
756 \begin_inset Quotes eld
757 \end_inset
758
759 What You See Is What You Get.
760 \begin_inset Quotes erd
761 \end_inset
762
763  LyX, on the other hand, is based on the principle that 
764 \begin_inset Quotes eld
765 \end_inset
766
767 What You See Is What You 
768 \emph on
769 Mean
770 \emph default
771 .
772 \begin_inset Quotes erd
773 \end_inset
774
775  You type what you mean, and LyX will take care of typesetting it for you,
776  so that the output looks nice.
777  A 
778 \family sans
779 Return
780 \family default
781  grammatically separates paragraphs, and a 
782 \family sans
783 Space
784 \family default
785  grammatically separates words, so there is no reason to have several of
786  them in a row; a 
787 \family sans
788 Tab
789 \family default
790  has no grammatical function at all, so LyX does not support it.
791  Using LyX, you'll spend more of your time worrying about the 
792 \emph on
793 content
794 \emph default
795  of your document, and less time worrying about the 
796 \emph on
797 format.
798
799 \emph default
800  See the 
801 \emph on
802 Introduction
803 \emph default
804  for more information on the WYSIWYM concept.
805 \end_layout
806
807 \begin_layout Standard
808 LyX does have (many) ways to fine-tune the formatting of your document.
809  After all, LyX might not typeset 
810 \emph on
811 exactly
812 \emph default
813  what you mean.
814  The 
815 \emph on
816 User's Guide
817 \emph default
818  has information about all that.
819  It includes 
820 \family sans
821 HFill
822 \family default
823 s and vertical space --- which are more powerful and versatile than multiple
824  spaces or blank lines --- and ways to change font sizes, character styles,
825  and paragraph alignments by hand.
826  The idea, though, is that you can write your whole document, focusing on
827  content, and just worry about that fine-tuning at the end.
828  With standard word processors, you'll be distracted by document formatting
829  throughout the writing process.
830 \end_layout
831
832 \begin_layout Section
833 Environments
834 \end_layout
835
836 \begin_layout Standard
837 Different parts of a document have different purposes; we call these parts
838  
839 \emph on
840 environments
841 \emph default
842 .
843  Most of a document is made up of regular text.
844  Section titles (chapter, subsection, etc.) let the reader know that a new
845  topic or subtopic will be discussed.
846  Certain types of documents have special environments.
847  A journal article will have an abstract and a title.
848  A letter will have neither of these, but will probably have an environment
849  that gives the writer's address.
850 \end_layout
851
852 \begin_layout Standard
853 Environments are a major part of the 
854 \begin_inset Quotes eld
855 \end_inset
856
857 What You See Is What You Mean
858 \begin_inset Quotes erd
859 \end_inset
860
861  philosophy of LyX.
862  A given environment may require a certain font style, font size, indenting,
863  line spacing, and more.
864  This problem is aggravated, because the exact formatting for a given environmen
865 t may change: one journal may use boldface, 18 point, centered type for
866  section titles while another uses italicized, 15 point, left justified
867  type; different languages may have different standards for indenting; and
868  bibliography formats can vary widely.
869  LyX lets you avoid learning all the different formatting styles.
870 \end_layout
871
872 \begin_layout Standard
873 The 
874 \family sans
875 Environment
876 \family default
877  choice box is located on the left end of the toolbar and looks like this:
878  
879 \begin_inset Graphics
880         filename clipart/ToolbarEnvBox.png
881         scale 75
882         clip
883
884 \end_inset
885
886 .
887  It indicates which environment you're currently writing in.
888  While you were writing your first document, it said 
889 \begin_inset Quotes eld
890 \end_inset
891
892 Standard,
893 \begin_inset Quotes erd
894 \end_inset
895
896  which is the default environment for text.
897  Now you will put a number of environments in your new document so that
898  you can see how they work.
899 \end_layout
900
901 \begin_layout Subsection
902 Sections and Subsections
903 \end_layout
904
905 \begin_layout Standard
906 Type the word 
907 \family typewriter
908 Introduction
909 \family default
910  on the first line of your LyX file, and select 
911 \family sans
912 Section
913 \family default
914  in the 
915 \family sans
916 Environment
917 \family default
918  box.
919 \begin_inset Foot
920 status collapsed
921
922 \begin_layout Standard
923 You don't have to 
924 \emph on
925 select
926 \emph default
927  the line.
928  If nothing is selected, LyX changes the paragraph you are currently in
929  to the selected environment.
930  Alternatively, you can change several paragraphs to a different environment
931  by selecting them before picking an environment.
932 \end_layout
933
934 \end_inset
935
936  Be sure to use 
937 \family sans
938 Section
939 \family default
940  and 
941 \emph on
942 not
943 \emph default
944  
945 \family sans
946 Section*
947 \family default
948 , which will be covered below.
949  LyX numbers the section 
950 \begin_inset Quotes eld
951 \end_inset
952
953 1
954 \begin_inset Quotes erd
955 \end_inset
956
957  and typesets the section heading (title) in a larger font.
958  Now hit 
959 \family sans
960 Return
961 \family default
962 \SpecialChar \@.
963  Note that the 
964 \family sans
965 Environment
966 \family default
967  box changes from 
968 \begin_inset Quotes eld
969 \end_inset
970
971 Section
972 \begin_inset Quotes erd
973 \end_inset
974
975  back to 
976 \begin_inset Quotes eld
977 \end_inset
978
979 Standard
980 \begin_inset Quotes erd
981 \end_inset
982
983 .
984  Section headings, like most environments, are assumed to end when you type
985  
986 \family sans
987 Return
988 \family default
989 \SpecialChar \@.
990  Type the document introduction: 
991 \end_layout
992
993 \begin_layout LyX-Code
994 This is an introduction to my first LyX document.
995 \end_layout
996
997 \begin_layout Standard
998 Hit 
999 \family sans
1000 Return
1001 \family default
1002  again, and select 
1003 \family sans
1004 Section
1005 \family default
1006  from the 
1007 \family sans
1008 Environment
1009 \family default
1010  box again.
1011  LyX writes a 
1012 \begin_inset Quotes eld
1013 \end_inset
1014
1015 2
1016 \begin_inset Quotes erd
1017 \end_inset
1018
1019  and waits for you to type a title.
1020  Type 
1021 \begin_inset Quotes eld
1022 \end_inset
1023
1024
1025 \family typewriter
1026 More\InsetSpace ~
1027 Stuff
1028 \family default
1029
1030 \begin_inset Quotes erd
1031 \end_inset
1032
1033 , and you'll see that LyX again sets it as a section title.
1034 \end_layout
1035
1036 \begin_layout Standard
1037 It gets better.
1038  Go to the end of Section\InsetSpace ~
1039 1 again (after 
1040 \begin_inset Quotes eld
1041 \end_inset
1042
1043 my first LyX document
1044 \begin_inset Quotes erd
1045 \end_inset
1046
1047 ) and hit 
1048 \family sans
1049 Return
1050 \family default
1051  again, and select 
1052 \family sans
1053 Section
1054 \family default
1055  from the 
1056 \family sans
1057 Environment
1058 \family default
1059  box again.
1060  Again, LyX writes 
1061 \begin_inset Quotes eld
1062 \end_inset
1063
1064 2
1065 \begin_inset Quotes erd
1066 \end_inset
1067
1068  and waits for you to type a title.
1069  Type 
1070 \family typewriter
1071 About This Document
1072 \family default
1073 .
1074  Section\InsetSpace ~
1075
1076 \begin_inset Quotes eld
1077 \end_inset
1078
1079 More Stuff
1080 \begin_inset Quotes erd
1081 \end_inset
1082
1083 , which used to be Section\InsetSpace ~
1084 2, has been automatically renumbered to Section\InsetSpace ~
1085 3!
1086  In true WYSIWYM fashion, you just need to identify the text that makes
1087  up the section titles, and LyX takes care of numbering the sections and
1088  typesetting them.
1089 \end_layout
1090
1091 \begin_layout Standard
1092 Hit 
1093 \family sans
1094 Return
1095 \family default
1096  to get back to the 
1097 \family sans
1098 Standard
1099 \family default
1100  environment, and type the following five lines:
1101 \end_layout
1102
1103 \begin_layout LyX-Code
1104 Sections and subsections are described below.
1105 \end_layout
1106
1107 \begin_layout LyX-Code
1108 Section Description
1109 \end_layout
1110
1111 \begin_layout LyX-Code
1112 Sections are bigger than subsections.
1113 \end_layout
1114
1115 \begin_layout LyX-Code
1116 Subsection description
1117 \end_layout
1118
1119 \begin_layout LyX-Code
1120 Subsections are smaller than sections.
1121 \end_layout
1122
1123 \begin_layout Standard
1124 Click on the second line and select 
1125 \family sans
1126 Subsection
1127 \family default
1128  from the 
1129 \family sans
1130 Environment
1131 \family default
1132  box.
1133  LyX numbers the subsection 
1134 \begin_inset Quotes eld
1135 \end_inset
1136
1137 2.1
1138 \begin_inset Quotes erd
1139 \end_inset
1140
1141 , and typesets it in a font which is bigger than regular text but smaller
1142  than the section title.
1143  Change the fourth line 
1144 \family sans
1145 Subsection
1146 \family default
1147  environment as well.
1148  As you probably expected, LyX automatically numbered the section 
1149 \begin_inset Quotes eld
1150 \end_inset
1151
1152 2.2
1153 \begin_inset Quotes erd
1154 \end_inset
1155
1156 .
1157  If you put yet another section before Section\InsetSpace ~
1158 2, Section\InsetSpace ~
1159 2 will be renumbered
1160  as Section 3, and the subsections will be renumbered to 
1161 \begin_inset Quotes eld
1162 \end_inset
1163
1164 3.1
1165 \begin_inset Quotes erd
1166 \end_inset
1167
1168  and 
1169 \begin_inset Quotes eld
1170 \end_inset
1171
1172 3.2
1173 \begin_inset Quotes erd
1174 \end_inset
1175
1176 .
1177  
1178 \end_layout
1179
1180 \begin_layout Standard
1181 Further levels of sectioning include 
1182 \family sans
1183 Subsubsection
1184 \family default
1185
1186 \family sans
1187 Paragraph
1188 \family default
1189 , and 
1190 \family sans
1191 Subparagraph
1192 \family default
1193 .
1194  We'll let you play with these on your own.
1195  You may notice that paragraph and subparagraph headings are not numbered
1196  by default, and that subparagraphs are indented; see the 
1197 \emph on
1198 User's Guide
1199 \emph default
1200  for an explanation and how to change this.
1201  
1202 \family sans
1203 Chapter
1204 \family default
1205  headings are actually the highest level of sectioning, above 
1206 \family sans
1207 Section
1208 \family default
1209 s, but you're only allowed to use them in certain types (text classes) of
1210  LyX documents (see Section\InsetSpace ~
1211
1212 \begin_inset LatexCommand ref
1213 reference "sec:Document-Classes"
1214
1215 \end_inset
1216
1217 ).
1218  
1219 \end_layout
1220
1221 \begin_layout Standard
1222 Finally, you may want to have sections or subsections that are not numbered.
1223  There are environments for this as well.
1224  If you change one of your section headings to the 
1225 \family sans
1226 Section*
1227 \family default
1228  environment (you may have to scroll down in the 
1229 \family sans
1230 Environment
1231 \family default
1232  box to find it), LyX will use the same font size for the heading as it
1233  uses for a regular section, but it won't number that section.
1234  There are corresponding 
1235 \begin_inset Quotes eld
1236 \end_inset
1237
1238 starred
1239 \begin_inset Quotes erd
1240 \end_inset
1241
1242  heading environments for 
1243 \family sans
1244 Subsection
1245 \family default
1246  and 
1247 \family sans
1248 Subsubsection
1249 \family default
1250 .
1251  Try changing some of your sections or subsections to the starred environments,
1252  and note how the other sections' numbers are updated.
1253 \end_layout
1254
1255 \begin_layout Standard
1256
1257 \series bold
1258 Exercise
1259 \series default
1260 : Fix the section and subsection headings in 
1261 \family typewriter
1262 example_raw.lyx
1263 \family default
1264 .
1265  
1266 \end_layout
1267
1268 \begin_layout Subsection
1269 Lists and sublists
1270 \end_layout
1271
1272 \begin_layout Standard
1273 LyX has several different environments for typesetting lists.
1274  The various list environments free you from hitting 
1275 \family sans
1276 Tab
1277 \family default
1278  a million times when writing an outline, or from renumbering a whole list
1279  when you want to add a point in the middle of the list.
1280  Different types of documents logically require different list environments:
1281 \end_layout
1282
1283 \begin_layout Itemize
1284 A slide presentation might use the 
1285 \family sans
1286 Itemize
1287 \family default
1288  environment's bulleted lists to describe different points.
1289  
1290 \end_layout
1291
1292 \begin_layout Itemize
1293 An outline would use the 
1294 \family sans
1295 Enumerate
1296 \family default
1297  environment's numbered lists (and lettered sublists).
1298  
1299 \end_layout
1300
1301 \begin_layout Itemize
1302 A document describing several software packages could use the 
1303 \family sans
1304 Description
1305 \family default
1306  environment, where each item in the list begins with a bold-faced word.
1307  
1308 \end_layout
1309
1310 \begin_layout Itemize
1311 The 
1312 \family sans
1313 List
1314 \family default
1315  environment --- not found in LaTeX --- is a slightly different form of
1316  the 
1317 \family sans
1318 Description
1319 \family default
1320  environment.
1321 \end_layout
1322
1323 \begin_layout Standard
1324 Let's write a list of reasons why LyX is better than other word processors.
1325  Somewhere in your document, type:
1326 \end_layout
1327
1328 \begin_layout Standard
1329
1330 \family typewriter
1331 LyX is better than other word processors because: 
1332 \end_layout
1333
1334 \begin_layout Standard
1335 and hit 
1336 \family sans
1337 Return
1338 \family default
1339 .
1340  Now select 
1341 \family sans
1342 Itemize
1343 \family default
1344  from the 
1345 \family sans
1346 Environment
1347 \family default
1348  box.
1349  LyX writes a 
1350 \begin_inset Quotes eld
1351 \end_inset
1352
1353 bullet
1354 \begin_inset Quotes erd
1355 \end_inset
1356
1357  on the line.
1358  Type in your reasons: 
1359 \end_layout
1360
1361 \begin_layout LyX-Code
1362 Typesetting is done for you.
1363 \end_layout
1364
1365 \begin_layout LyX-Code
1366 Math is WYSIWYG
1367 \end_layout
1368
1369 \begin_layout LyX-Code
1370 Lists are very easy to create!
1371 \end_layout
1372
1373 \begin_layout Standard
1374 List environments, unlike headings, do not end when you type 
1375 \family sans
1376 Return
1377 \family default
1378 .
1379  Instead, LyX assumes you're going on to the next item in the list.
1380  The above will therefore result in a three-item list.
1381  If you want more than one paragraph within one list 
1382 \emph on
1383 item
1384 \emph default
1385 , one way is to use the 
1386 \family sans
1387 Protected\InsetSpace ~
1388 Break
1389 \family default
1390 , which you get by typing 
1391 \family sans
1392 C-Return
1393 \family default
1394 .
1395  In order to get out of the list, you need to reselect the 
1396 \family sans
1397 Standard
1398 \family default
1399  environment (or just use the keybinding, 
1400 \family sans
1401 M-p\InsetSpace ~
1402 s
1403 \family default
1404 ).
1405 \end_layout
1406
1407 \begin_layout Standard
1408 You've got a beautiful itemized list.
1409  You might want to run LaTeX to see how the list looks when printed out.
1410  But what if you wanted to number the reasons? Well, just select the whole
1411  list
1412 \begin_inset Foot
1413 status collapsed
1414
1415 \begin_layout Standard
1416 LyX won't let you select the first bullet unless you also select the paragraph
1417  
1418 \emph on
1419 before
1420 \emph default
1421  the list, which you probably don't want to do.
1422  Similarly, you can't select the actual number in a numbered section title.
1423  This is on purpose because the bullet or number depends on the document
1424  settings or text position, respectively.
1425 \end_layout
1426
1427 \end_inset
1428
1429  and choose 
1430 \family sans
1431 Enumerate
1432 \family default
1433  from the 
1434 \family sans
1435 Environment
1436 \family default
1437  box.
1438  Pow! As we mentioned, if you add or delete a list item, LyX will fix the
1439  numbering.
1440 \end_layout
1441
1442 \begin_layout Standard
1443 While the list is still selected, you can change to the other two list environme
1444 nts, 
1445 \family sans
1446 Description
1447 \family default
1448  and 
1449 \family sans
1450 List
1451 \family default
1452 , in order to see what they look like.
1453  For those two environments, each list item is made up of a term, which
1454  is the item's first word, followed by a definition, which is the rest of
1455  the paragraph (until you hit 
1456 \family sans
1457 Return
1458 \family default
1459 .) The term is either typeset in boldface (
1460 \family sans
1461 Description
1462 \family default
1463 ) or separated by a 
1464 \begin_inset Quotes eld
1465 \end_inset
1466
1467 Tab
1468 \begin_inset Quotes erd
1469 \end_inset
1470
1471
1472 \begin_inset Foot
1473 status collapsed
1474
1475 \begin_layout Standard
1476 But a typesetter's tab, which will change to fit the size of the largest
1477  term, not a pathetic, rigid, unchangeable typewriter 
1478 \family sans
1479 Tab
1480 \family default
1481 .
1482 \end_layout
1483
1484 \end_inset
1485
1486  (
1487 \family sans
1488 List
1489 \family default
1490 ) from the rest of the paragraph.
1491  If you want to have more than one word in the definition, then separate
1492  the words with 
1493 \family sans
1494 Protected\InsetSpace ~
1495 Blank
1496 \family default
1497 s.
1498 \end_layout
1499
1500 \begin_layout Standard
1501
1502 \series bold
1503 Exercise
1504 \series default
1505 : Typeset the list in 
1506 \family typewriter
1507 example_raw.lyx
1508 \end_layout
1509
1510 \begin_layout Standard
1511 You can nest lists within each other in all sorts of interesting ways.
1512  An obvious example would be writing outlines.
1513  Numbered and bulleted lists will have different numbering and bulleting
1514  schemes for sublists.
1515  See the 
1516 \emph on
1517 User's Guide
1518 \emph default
1519  for details on the different sorts of lists and for examples of nestings.
1520 \end_layout
1521
1522 \begin_layout Subsection
1523 Other environments: Verses, Quotations, and more
1524 \end_layout
1525
1526 \begin_layout Standard
1527 There are two environments for setting quotations apart from surrounding
1528  text: 
1529 \family sans
1530 Quote
1531 \family default
1532  for short quotes and 
1533 \family sans
1534 Quotation
1535 \family default
1536  for longer ones.
1537  Computer code (the 
1538 \family sans
1539 LyX-Code
1540 \family default
1541  environment 
1542 \begin_inset Foot
1543 status collapsed
1544
1545 \begin_layout Standard
1546 used in this Tutorial for the long typing examples
1547 \end_layout
1548
1549 \end_inset
1550
1551 ) is written in a 
1552 \family typewriter
1553 typewriter
1554 \family default
1555  font; this environment is the only place in LyX where you're allowed to
1556  use multiple spaces to allow code indenting.
1557  You can even write poetry using the 
1558 \family sans
1559 Verse
1560 \family default
1561  style, using 
1562 \family sans
1563 Return
1564 \family default
1565  to separate stanzas, and 
1566 \family sans
1567 C-Return
1568 \family default
1569  to separate lines within a stanza.
1570  See the 
1571 \emph on
1572 User's Guide
1573 \emph default
1574  for more complete descriptions of all of the available LyX environments.
1575 \end_layout
1576
1577 \begin_layout Standard
1578
1579 \series bold
1580 Exercise
1581 \series default
1582 : Correctly typeset the 
1583 \family sans
1584 Quote, LyX-Code,
1585 \family default
1586  and 
1587 \family sans
1588 Verse
1589 \family default
1590  in
1591 \newline
1592
1593 \family typewriter
1594 example_raw.lyx
1595 \end_layout
1596
1597 \begin_layout Chapter
1598 Writing Documents
1599 \end_layout
1600
1601 \begin_layout Standard
1602 The previous chapter hopefully allowed you to get used to writing in LyX.
1603  It introduced you to the basic editing operations in LyX, as well as the
1604  powerful method of writing with environments.
1605  Most people who use LyX, though, will want to write documents: papers,
1606  articles, books, manuals, or letters.
1607  This chapter is meant to take you from simply writing text with LyX to
1608  writing a complete document.
1609  It will introduce you to text classes, which allow you to write different
1610  sorts of documents.
1611  It will then describe many of the additions that turn text into a document,
1612  such as titles, footnotes, cross references, bibliographies, and tables
1613  of contents.
1614 \end_layout
1615
1616 \begin_layout Section
1617 Document Classes
1618 \begin_inset LatexCommand label
1619 name "sec:Document-Classes"
1620
1621 \end_inset
1622
1623
1624 \end_layout
1625
1626 \begin_layout Standard
1627 Different sorts of documents should be typeset differently.
1628  For example, books are generally printed double-sided, while articles are
1629  single-sided.
1630  In addition, many documents contain special environments: letters contain
1631  some environments --- such as the sender's address and the signature ---
1632  which do not make sense in a book or article.
1633  The LyX 
1634 \emph on
1635 document class
1636 \emph default
1637
1638 \begin_inset Foot
1639 status collapsed
1640
1641 \begin_layout Standard
1642 for LaTeX users: this is equivalent to the LaTeX document class
1643 \end_layout
1644
1645 \end_inset
1646
1647  takes care of these large scale differences between different sorts of
1648  documents.
1649  This Tutorial, for example, was written in the 
1650 \family sans
1651 Book
1652 \family default
1653  document class.
1654  Document classes are another major part of the WYSIWYM philosophy; they
1655  tell LyX how to typeset the document, so you don't need to know how.
1656 \end_layout
1657
1658 \begin_layout Standard
1659 Your document is probably being written in the 
1660 \family sans
1661 Article
1662 \family default
1663  document class.
1664 \begin_inset Foot
1665 status collapsed
1666
1667 \begin_layout Standard
1668 That's usually the default document class
1669 \end_layout
1670
1671 \end_inset
1672
1673  Try changing to other document classes (using the 
1674 \family sans
1675 Document\SpecialChar \menuseparator
1676 Settings
1677 \family default
1678  dialog) to see how they are typeset differently.
1679  If you change your document to the 
1680 \family sans
1681 Book
1682 \family default
1683  document class and look at the 
1684 \family sans
1685 Environment
1686 \family default
1687  box, you'll see that most of the allowed environments are the same.
1688  However, you can now use the 
1689 \family sans
1690 Chapter
1691 \family default
1692  environment.
1693  If you are ever unsure about which environments you can use in a given
1694  document class, just consult the 
1695 \family sans
1696 Environment
1697 \family default
1698  box.
1699 \end_layout
1700
1701 \begin_layout Standard
1702 Font sizes, one- or two-column printing, and page headings are just some
1703  of the ways journals' typesettings differ from one another.
1704  As the Computer Age continues to mature, journals have begun accepting
1705  electronic submissions, creating LaTeX 
1706 \begin_inset Quotes eld
1707 \end_inset
1708
1709 style files
1710 \begin_inset Quotes erd
1711 \end_inset
1712
1713  so that authors can submit correctly typeset articles.
1714  LyX is set up to support this as well.
1715  For example, LyX supports typesetting (and extra environments) for the
1716  American Mathematics Society journals using the 
1717 \family sans
1718 Article\InsetSpace ~
1719 (AMS)
1720 \family default
1721  document class.
1722 \end_layout
1723
1724 \begin_layout Standard
1725 Here is a very quick reference to some of the document classes.
1726  See the 
1727 \emph on
1728 Special Document Classes
1729 \emph default
1730  section of the 
1731 \emph on
1732 Extended Features
1733 \emph default
1734  manual for many more details.
1735 \end_layout
1736
1737 \begin_layout Standard
1738 \align center
1739 \begin_inset Tabular
1740 <lyxtabular version="3" rows="7" columns="2">
1741 <features>
1742 <column alignment="center" valignment="top" leftline="true" width="0pt">
1743 <column alignment="center" valignment="top" leftline="true" rightline="true" width="0pt">
1744 <row topline="true" bottomline="true">
1745 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1746 \begin_inset Text
1747
1748 \begin_layout Standard
1749 Name
1750 \end_layout
1751
1752 \end_inset
1753 </cell>
1754 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1755 \begin_inset Text
1756
1757 \begin_layout Standard
1758 Notes
1759 \end_layout
1760
1761 \end_inset
1762 </cell>
1763 </row>
1764 <row topline="true">
1765 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1766 \begin_inset Text
1767
1768 \begin_layout Standard
1769 article
1770 \end_layout
1771
1772 \end_inset
1773 </cell>
1774 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1775 \begin_inset Text
1776
1777 \begin_layout Standard
1778 one-sided, no chapters
1779 \end_layout
1780
1781 \end_inset
1782 </cell>
1783 </row>
1784 <row topline="true">
1785 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1786 \begin_inset Text
1787
1788 \begin_layout Standard
1789 article (AMS)
1790 \end_layout
1791
1792 \end_inset
1793 </cell>
1794 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1795 \begin_inset Text
1796
1797 \begin_layout Standard
1798 layout & environments for American Math Society
1799 \end_layout
1800
1801 \end_inset
1802 </cell>
1803 </row>
1804 <row topline="true">
1805 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1806 \begin_inset Text
1807
1808 \begin_layout Standard
1809 report
1810 \end_layout
1811
1812 \end_inset
1813 </cell>
1814 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1815 \begin_inset Text
1816
1817 \begin_layout Standard
1818 longer than article, two-sided
1819 \end_layout
1820
1821 \end_inset
1822 </cell>
1823 </row>
1824 <row topline="true" bottomline="true">
1825 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1826 \begin_inset Text
1827
1828 \begin_layout Standard
1829 book
1830 \end_layout
1831
1832 \end_inset
1833 </cell>
1834 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1835 \begin_inset Text
1836
1837 \begin_layout Standard
1838 report + front and back matter
1839 \end_layout
1840
1841 \end_inset
1842 </cell>
1843 </row>
1844 <row bottomline="true">
1845 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1846 \begin_inset Text
1847
1848 \begin_layout Standard
1849 presentation
1850 \end_layout
1851
1852 \end_inset
1853 </cell>
1854 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1855 \begin_inset Text
1856
1857 \begin_layout Standard
1858 transparencies
1859 \end_layout
1860
1861 \end_inset
1862 </cell>
1863 </row>
1864 <row bottomline="true">
1865 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1866 \begin_inset Text
1867
1868 \begin_layout Standard
1869 letter
1870 \end_layout
1871
1872 \end_inset
1873 </cell>
1874 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1875 \begin_inset Text
1876
1877 \begin_layout Standard
1878 lots of extra environments for address, signature\SpecialChar \ldots{}
1879
1880 \end_layout
1881
1882 \end_inset
1883 </cell>
1884 </row>
1885 </lyxtabular>
1886
1887 \end_inset
1888
1889
1890 \end_layout
1891
1892 \begin_layout Section
1893 Templates: Writing a Letter
1894 \end_layout
1895
1896 \begin_layout Standard
1897 One way to write a letter would be to open a new file, and choose a 
1898 \family sans
1899 Letter
1900 \family default
1901  class in the 
1902 \family sans
1903 Document\SpecialChar \menuseparator
1904 Settings
1905 \family default
1906  dialog.
1907  While this is the most obvious way to write a letter, it seems like extra
1908  work.
1909  Every time you write a business letter, you want to have your address,
1910  the address you're sending to, a body, a signature, etc.
1911  LyX therefore has a 
1912 \emph on
1913 template
1914 \emph default
1915  for letters, which contains a sample letter; once you have a template,
1916  you can just replace a couple parts of the letter with your text each time
1917  you write a letter.
1918 \end_layout
1919
1920 \begin_layout Standard
1921 Open a new file with 
1922 \family sans
1923 File\SpecialChar \menuseparator
1924 New\InsetSpace ~
1925 from\InsetSpace ~
1926 Template
1927 \family default
1928 .
1929  Select 
1930 \family typewriter
1931 letter.lyx
1932 \family default
1933  as the template.
1934  Save and print the file to see how the various environments are typeset.
1935 \end_layout
1936
1937 \begin_layout Standard
1938 When you look at the 
1939 \family sans
1940 Environment
1941 \family default
1942  box, you'll see several environments, like the 
1943 \family sans
1944 My\InsetSpace ~
1945 Address
1946 \family default
1947  environment, which don't even exist in most other document classes.
1948  Others, like 
1949 \family sans
1950 Quote
1951 \family default
1952  and 
1953 \family sans
1954 Description
1955 \family default
1956 , are familiar.
1957  You can play around for a while to figure out how the various environments
1958  work.
1959  You'll notice for example that the 
1960 \family sans
1961 Signature
1962 \family default
1963  environment has the word 
1964 \begin_inset Quotes eld
1965 \end_inset
1966
1967 Signature:
1968 \begin_inset Quotes eld
1969 \end_inset
1970
1971  in red before the actual text of the signature.
1972  This word doesn't show up in the actual letter, as you'll see if you view/expor
1973 t the file.
1974  It's just there to let you know where the signature goes.
1975  Also, note that it doesn't matter where in the file the 
1976 \family sans
1977 Signature
1978 \family default
1979  line is placed.
1980  Remember, LyX is WYSIWYM; you can put the 
1981 \family sans
1982 Signature
1983 \family default
1984  environment anywhere you want, but LyX knows that in the printout, the
1985  signature should be at the end.
1986 \end_layout
1987
1988 \begin_layout Standard
1989 A template is just a regular LyX file.
1990  This means you can fill in your address and signature and save the file
1991  as a new template.
1992  From now on, any time you want to write a letter, you can use the new template
1993  to save time.
1994  We don't have to suggest an actual 
1995 \begin_inset Quotes eld
1996 \end_inset
1997
1998 exercise
1999 \begin_inset Quotes erd
2000 \end_inset
2001
2002  here; just write a letter to someone!
2003 \begin_inset Foot
2004 status collapsed
2005
2006 \begin_layout Standard
2007 One warning, if you're writing from a template.
2008  If you erase all of the text in an environment --- for example, if you
2009  erase the whole 
2010 \family sans
2011 My\InsetSpace ~
2012 Address
2013 \family default
2014  field so that you can replace it with your own --- and then you move the
2015  cursor without writing any text, the environment may disappear.
2016  This is because most environments cannot exist without any text in them.
2017  Just reselect the environment from the 
2018 \family sans
2019 Environment
2020 \family default
2021  box to get it back.
2022 \end_layout
2023
2024 \end_inset
2025
2026
2027 \end_layout
2028
2029 \begin_layout Standard
2030 Templates can be a huge time-saver, and we urge you to use them whenever
2031  possible.
2032  In addition, they can help a person learn how to use some of the fancier
2033  document classes.
2034  Finally, they may be useful for a person who is configuring LyX for a bunch
2035  of less computer-aware users.
2036  When they're first learning LyX, it will be much less intimidating if they
2037  have a letter template customized for their company, for example.
2038 \end_layout
2039
2040 \begin_layout Section
2041 Document Titles
2042 \end_layout
2043
2044 \begin_layout Standard
2045 LyX (like LaTeX) considers the title --- which may contain the actual title,
2046  the author, the date, and even an abstract of a paper --- to be a separate
2047  part of the document.
2048 \end_layout
2049
2050 \begin_layout Standard
2051 Go back to your LyX document and make sure it's using the 
2052 \family sans
2053 Article
2054 \family default
2055  document class.
2056 \begin_inset Foot
2057 status collapsed
2058
2059 \begin_layout Standard
2060 You should not be using the letter any more, since the 
2061 \family sans
2062 Letter
2063 \family default
2064  document class doesn't allow titles.
2065 \end_layout
2066
2067 \end_inset
2068
2069  Type a title on the first line, and change the line to the 
2070 \family sans
2071 Title
2072 \family default
2073  environment.
2074  On the next line, type your name and change it to the 
2075 \family sans
2076 Author
2077 \family default
2078  environment.
2079  On the next line, write the date in the 
2080 \family sans
2081 Date
2082 \family default
2083  environment.
2084  Type a paragraph or two summarizing your document using the 
2085 \family sans
2086 Abstract
2087 \family default
2088  environment.
2089  Notice how the title is presented when it's printed out.
2090  If you changed the document format to Book, you'll get a separate title
2091  page, like the first page of this tutorial.
2092 \end_layout
2093
2094 \begin_layout Standard
2095
2096 \series bold
2097 Exercise
2098 \series default
2099 : Fix the title, date, and author in 
2100 \family typewriter
2101 example_raw.lyx
2102 \end_layout
2103
2104 \begin_layout Section
2105 Labels and Cross-References
2106 \begin_inset LatexCommand label
2107 name "sec:labels"
2108
2109 \end_inset
2110
2111
2112 \end_layout
2113
2114 \begin_layout Standard
2115 You can label section headings, list items, formulas, footnotes, and floats
2116 \begin_inset Foot
2117 status collapsed
2118
2119 \begin_layout Standard
2120 Floats are explained in the 
2121 \emph on
2122 User's Guide
2123 \emph default
2124  and the 
2125 \emph on
2126 Embedded Objects
2127 \emph default
2128  manual.
2129 \end_layout
2130
2131 \end_inset
2132
2133  in your document.
2134  Once you do so, you can refer to this section in other parts of the document,
2135  using cross-references.
2136  You can refer either to the section's number, or to the page that the section
2137  appears on.
2138  As with section numbering, LyX also takes care about cross-reference numbering
2139  for you.
2140  Automatic labels and cross-references are one of the best advantages of
2141  LyX (and LaTeX) over conventional word processors.
2142 \end_layout
2143
2144 \begin_layout Subsection*
2145 Your first label
2146 \end_layout
2147
2148 \begin_layout Standard
2149 Go to our second section, whose title is 
2150 \begin_inset Quotes eld
2151 \end_inset
2152
2153 About This Document
2154 \begin_inset Quotes erd
2155 \end_inset
2156
2157 .
2158  Click at the end of the section title line, and select 
2159 \family sans
2160 Insert\SpecialChar \menuseparator
2161 Label
2162 \family default
2163  or the toolbar button 
2164 \begin_inset Graphics
2165         filename ../images/label-insert.png
2166         scale 75
2167         scaleBeforeRotation
2168
2169 \end_inset
2170
2171 .
2172  A dialog asks you for a label name, and gives you a suggestion.
2173  When you click on 
2174 \family sans
2175 OK
2176 \family default
2177 , the label name will be placed in a box next to the section title.
2178 \end_layout
2179
2180 \begin_layout Standard
2181 By the way, you could have put the label right anywhere within the section
2182  as well; section references will refer to the last section or subsection
2183  whose heading comes before the label.
2184  However, putting it on the same line as the section title (or, perhaps,
2185  on the first line of the section's text) ensures that page references will
2186  reference the beginning of the section.
2187 \end_layout
2188
2189 \begin_layout Standard
2190 So far you haven't done anything --- the DVI output will look exactly the
2191  same, since labels don't show up in the printed document.
2192  However, now that you have added a label, you can refer to that label with
2193  cross-references.
2194  We'll do that next.
2195 \end_layout
2196
2197 \begin_layout Subsection*
2198 Your first cross-reference
2199 \end_layout
2200
2201 \begin_layout Standard
2202 Place the cursor somewhere in Section\InsetSpace ~
2203 2 of your document.
2204  Type 
2205 \end_layout
2206
2207 \begin_layout LyX-Code
2208 If you want to know more about this document, then see 
2209 \newline
2210 Section , which can
2211  be found on page .
2212 \end_layout
2213
2214 \begin_layout Standard
2215 Now --- with the cursor after the word 
2216 \begin_inset Quotes eld
2217 \end_inset
2218
2219 section
2220 \begin_inset Quotes erd
2221 \end_inset
2222
2223  --- choose 
2224 \family sans
2225 Insert\SpecialChar \menuseparator
2226 Cross\InsetSpace ~
2227 Reference
2228 \family default
2229  or the toolbar button 
2230 \begin_inset Graphics
2231         filename ../images/dialog-show-new-inset_ref.png
2232         scale 75
2233         scaleBeforeRotation
2234
2235 \end_inset
2236
2237 .
2238  The 
2239 \family sans
2240 Cross-reference
2241 \family default
2242  dialog pops up.
2243  It shows a list of the possible labels you can reference.
2244  At the moment, there should be only one, 
2245 \begin_inset Quotes eld
2246 \end_inset
2247
2248 sec:About-This-Document
2249 \begin_inset Quotes erd
2250 \end_inset
2251
2252 .
2253  Select it (it may be selected by default), and click 
2254 \family sans
2255 Apply
2256 \family default
2257 .
2258  Now put the cursor after the word 
2259 \begin_inset Quotes eld
2260 \end_inset
2261
2262 page
2263 \begin_inset Quotes erd
2264 \end_inset
2265
2266 , and change the reference format to use the page number then click 
2267 \family sans
2268 Apply
2269 \family default
2270 .
2271  (To be really correct, you should put a 
2272 \family sans
2273 Protected\InsetSpace ~
2274 Blank
2275 \family default
2276  in between the word 
2277 \begin_inset Quotes eld
2278 \end_inset
2279
2280 Section
2281 \begin_inset Quotes erd
2282 \end_inset
2283
2284  and the reference.
2285  Same for the page reference.)
2286 \end_layout
2287
2288 \begin_layout Standard
2289 LyX puts the references in a box right where the cursor was.
2290  In the printed document, this reference marker will be replaced with either
2291  the page or section number (depending on what you selected in the 
2292 \family sans
2293 Cross-reference
2294 \family default
2295  dialog).
2296  View your document as DVI, and you'll see that on the last page we refer
2297  to 
2298 \begin_inset Quotes eld
2299 \end_inset
2300
2301 Section\InsetSpace ~
2302 2
2303 \begin_inset Quotes erd
2304 \end_inset
2305
2306  and 
2307 \begin_inset Quotes eld
2308 \end_inset
2309
2310 Page\InsetSpace ~
2311 1
2312 \begin_inset Quotes erd
2313 \end_inset
2314
2315  (or whatever page Section\InsetSpace ~
2316 2's title is on).
2317 \end_layout
2318
2319 \begin_layout Standard
2320 Conveniently, a cross-reference acts as a hyperlink when you are editing
2321  a document in LyX; clicking on it will pop up the 
2322 \family sans
2323 Cross-Reference
2324 \family default
2325  dialog, clicking 
2326 \family sans
2327 Go\InsetSpace ~
2328 to\InsetSpace ~
2329 Label
2330 \family default
2331  will move the cursor to the referenced label.
2332 \end_layout
2333
2334 \begin_layout Subsection*
2335 More fun with labels
2336 \end_layout
2337
2338 \begin_layout Standard
2339 We told you that LyX takes care about numbering cross-references; now you
2340  can test that.
2341  Add a new section before Section\InsetSpace ~
2342 2.
2343  Update the DVI view, and --- voilà! --- the section cross reference changed
2344  to 
2345 \begin_inset Quotes eld
2346 \end_inset
2347
2348 3
2349 \begin_inset Quotes erd
2350 \end_inset
2351
2352 ! Change the section 
2353 \begin_inset Quotes eld
2354 \end_inset
2355
2356 About this Document
2357 \begin_inset Quotes erd
2358 \end_inset
2359
2360  to a subsection, and the cross-reference will reference Subsection\InsetSpace ~
2361 2.1 instead
2362  of Section\InsetSpace ~
2363 3.
2364  The page reference won't change unless you add a whole page of text before
2365  the label, of course.
2366  
2367 \end_layout
2368
2369 \begin_layout Standard
2370 If you want some more practice with labels, then try putting a new label
2371  where your first cross-reference was, and refer to that label from elsewhere
2372  in the document.
2373  If you'll be inserting cross-references often, it may be convenient to
2374  leave the 
2375 \family sans
2376 Cross-reference
2377 \family default
2378  dialog open.
2379 \end_layout
2380
2381 \begin_layout Standard
2382 If you want to make sure that the cross-referencing gets the pages right
2383  even for larger documents, 
2384 \family sans
2385 Copy
2386 \family default
2387  a couple pages of text from the 
2388 \emph on
2389 User's Guide
2390 \emph default
2391  to the clipboard, and 
2392 \family sans
2393 Paste
2394 \family default
2395  the stolen text into your document.
2396 \begin_inset Foot
2397 status collapsed
2398
2399 \begin_layout Standard
2400 By the way, copying a chapter title may cause an error, because chapters
2401  aren't allowed in the article class, see section\InsetSpace ~
2402
2403 \begin_inset LatexCommand ref
2404 reference "sec:Document-Classes"
2405
2406 \end_inset
2407
2408 .
2409  If this happens, just delete the chapter title.
2410 \end_layout
2411
2412 \end_inset
2413
2414
2415 \end_layout
2416
2417 \begin_layout Standard
2418
2419 \series bold
2420 Exercise
2421 \series default
2422 : Fix the references in 
2423 \family typewriter
2424 example_raw.lyx
2425 \end_layout
2426
2427 \begin_layout Section
2428 Footnotes and Margin Notes
2429 \end_layout
2430
2431 \begin_layout Standard
2432 Footnotes can be added using the toolbar button 
2433 \begin_inset Graphics
2434         filename ../images/footnote-insert.png
2435         scale 75
2436         scaleBeforeRotation
2437
2438 \end_inset
2439
2440  or the menu 
2441 \family sans
2442 Insert\SpecialChar \menuseparator
2443 Footnote
2444 \family default
2445 .
2446  Click at the end of the word 
2447 \begin_inset Quotes eld
2448 \end_inset
2449
2450 LyX
2451 \begin_inset Quotes erd
2452 \end_inset
2453
2454  somewhere in your document and click the 
2455 \begin_inset Graphics
2456         filename ../images/footnote-insert.png
2457         scale 75
2458         scaleBeforeRotation
2459
2460 \end_inset
2461
2462  button.
2463  A footnote box appears where you can enter the text of the footnote.
2464  LyX should place the cursor at the beginning of the footnote box.
2465  Type
2466 \end_layout
2467
2468 \begin_layout LyX-Code
2469 LyX is a typesetting word processor.
2470 \end_layout
2471
2472 \begin_layout Standard
2473 Now click on the button labelled 
2474 \begin_inset Quotes eld
2475 \end_inset
2476
2477 foot
2478 \begin_inset Quotes erd
2479 \end_inset
2480
2481 .
2482  The footnote box is closed, leaving the button showing where the footnote
2483  marker will be in the printed text; this is called 
2484 \begin_inset Quotes eld
2485 \end_inset
2486
2487 folding
2488 \begin_inset Quotes erd
2489 \end_inset
2490
2491  the footnote.
2492  You can unfold the footnote at any time --- and re-edit its text, if you
2493  want --- by clicking again on the 
2494 \begin_inset Quotes eld
2495 \end_inset
2496
2497 foot
2498 \begin_inset Quotes erd
2499 \end_inset
2500
2501  button.
2502 \end_layout
2503
2504 \begin_layout Standard
2505 You may wonder why the footnote button is a word instead of a number.
2506  The answer is that LyX takes care about the footnote numbering for you
2507  in the printed text.
2508  You can see this yourself by looking at the DVI file (or printout).
2509  If you add other footnotes, LyX will renumber the footnotes.
2510  Since LyX (well, LaTeX, actually) takes care of the footnote numbering,
2511  there's really no need to put the numbers in the LyX file.
2512 \end_layout
2513
2514 \begin_layout Standard
2515 A footnote can be cut and pasted like normal text.
2516  Go ahead; try it! All you need to do is select the footnote button
2517 \begin_inset Foot
2518 status collapsed
2519
2520 \begin_layout Standard
2521 It may be easier to select it using the keyboard.
2522  You might accidentally open the footnote if you're trying to select the
2523  marker itself with the mouse.
2524 \end_layout
2525
2526 \end_inset
2527
2528  and 
2529 \family sans
2530 Cut
2531 \family default
2532  and 
2533 \family sans
2534 Paste
2535 \family default
2536  it.
2537  In addition, you can change regular text to a footnote, by selecting it
2538  and hitting the 
2539 \begin_inset Graphics
2540         filename ../images/footnote-insert.png
2541         scale 75
2542         scaleBeforeRotation
2543
2544 \end_inset
2545
2546  button; change a footnote to regular text by hitting the 
2547 \family sans
2548 Backspace
2549 \family default
2550  key when the cursor is in the first position of a footnote, or by hitting
2551  the 
2552 \family sans
2553 Delete
2554 \family default
2555  key when the cursor is in the very last position of the footnote, respectively.
2556 \end_layout
2557
2558 \begin_layout Standard
2559 Margin notes can be added using the menu 
2560 \family sans
2561 Insert\SpecialChar \menuseparator
2562 Marginal\InsetSpace ~
2563 Note
2564 \family default
2565  or the toolbar button 
2566 \begin_inset Graphics
2567         filename ../images/marginalnote-insert.png
2568         scale 75
2569         scaleBeforeRotation
2570
2571 \end_inset
2572
2573 \SpecialChar \@.
2574  Margin notes are like footnotes, except that: 
2575 \end_layout
2576
2577 \begin_layout Itemize
2578 the on-screen boxes say 
2579 \begin_inset Quotes eld
2580 \end_inset
2581
2582 margin
2583 \begin_inset Quotes erd
2584 \end_inset
2585
2586  instead of 
2587 \begin_inset Quotes eld
2588 \end_inset
2589
2590 foot
2591 \begin_inset Quotes erd
2592 \end_inset
2593
2594
2595 \end_layout
2596
2597 \begin_layout Itemize
2598 the notes will be placed in the margin, instead of below the text 
2599 \end_layout
2600
2601 \begin_layout Itemize
2602 margin notes are not numbered
2603 \end_layout
2604
2605 \begin_layout Standard
2606 Change your LyX footnote back to text, then select and change it to a margin
2607  note.
2608  Run LaTeX again to see what the margin note looks like.
2609 \end_layout
2610
2611 \begin_layout Standard
2612
2613 \series bold
2614 Exercise
2615 \series default
2616 : Fix the footnote in 
2617 \family typewriter
2618 example_raw.lyx
2619 \end_layout
2620
2621 \begin_layout Section
2622 Bibliographies
2623 \begin_inset LatexCommand label
2624 name "sec:bibliographies"
2625
2626 \end_inset
2627
2628
2629 \end_layout
2630
2631 \begin_layout Standard
2632 Bibliographies (at least in the exact sciences) are similar to cross references.
2633  The bibliography contains a list of references at the end of the document,
2634  and they can be referenced from within the document.
2635  Like section titles, LyX and LaTeX make your job easier by automatically
2636  numbering the bibliography items and changing citations when the item numbers
2637  change.
2638 \end_layout
2639
2640 \begin_layout Standard
2641 Go to the end of the document and switch to the 
2642 \family sans
2643 Bibliography
2644 \family default
2645  environment.
2646  Now, each paragraph you type will be a reference.
2647  Type 
2648 \begin_inset Quotes eld
2649 \end_inset
2650
2651
2652 \family typewriter
2653 The Lyx Tutorial, by the LyX Documentation Team
2654 \family default
2655
2656 \begin_inset Quotes erd
2657 \end_inset
2658
2659  as your first reference.
2660  Note that LyX automatically puts a number in a box before each reference.
2661  Click on the boxed reference number, and the 
2662 \family sans
2663 Bibliography\InsetSpace ~
2664 item
2665 \family default
2666  dialog box appears.
2667  The 
2668 \family sans
2669 Key
2670 \family default
2671  is to refer to this reference within the LyX document, the 
2672 \family sans
2673 Label
2674 \family default
2675  appears in output.
2676  When no 
2677 \family sans
2678 Label
2679 \family default
2680  is set (default), you will see the number of the bibliography in the output.
2681  Change now the 
2682 \family sans
2683 Key
2684 \family default
2685  field to 
2686 \begin_inset Quotes eld
2687 \end_inset
2688
2689 lyxtutorial
2690 \begin_inset Quotes erd
2691 \end_inset
2692
2693  to make it easy to remember.
2694 \end_layout
2695
2696 \begin_layout Standard
2697 Now pick somewhere in your document that you would like to insert a reference.
2698  Do so with 
2699 \family sans
2700 Insert\SpecialChar \menuseparator
2701 Citation
2702 \family default
2703  or the toolbar button 
2704 \begin_inset Graphics
2705         filename ../images/dialog-show-new-inset_citation.png
2706         scale 75
2707         scaleBeforeRotation
2708
2709 \end_inset
2710
2711 .
2712  A 
2713 \family sans
2714 Citation
2715 \family default
2716  dialog appears.
2717  The right panel in this dialog lists all the bibliography entries, and
2718  this field allows you to choose which bibliography item you want to cite.
2719  Select 
2720 \begin_inset Quotes eld
2721 \end_inset
2722
2723 lyxtutorial
2724 \begin_inset Quotes erd
2725 \end_inset
2726
2727  (right now, that's the only item in the bibliography), then use the 
2728 \family sans
2729 Add
2730 \family default
2731  button in the center to insert it.
2732  (You can have multiple citations in the same place by transferring a number
2733  of keys this way.) Now view your file as DVI, and you'll see that the citation
2734  appears in brackets in the text, referring to the bibliography at the end
2735  of the document.
2736 \end_layout
2737
2738 \begin_layout Standard
2739 The 
2740 \family sans
2741 Text\InsetSpace ~
2742 after
2743 \family default
2744  field in the 
2745 \family sans
2746 Citation
2747 \family default
2748  dialog will put a remark (such as a reference to a page or chapter within
2749  the referenced book or article) in the brackets after the reference.
2750  If you want the references to have labels instead of numbers in the printed
2751  output (for example, some journals would use 
2752 \begin_inset Quotes eld
2753 \end_inset
2754
2755 [Smi95]
2756 \begin_inset Quotes erd
2757 \end_inset
2758
2759  to refer to a paper written by Smith in 1995), use the 
2760 \family sans
2761 Label
2762 \family default
2763  field in the 
2764 \family sans
2765 Bibliography\InsetSpace ~
2766 item
2767 \family default
2768  dialog.
2769  As usual, see the 
2770 \emph on
2771 User's Guide
2772 \emph default
2773  for details.
2774 \end_layout
2775
2776 \begin_layout Standard
2777
2778 \series bold
2779 Exercise:
2780 \series default
2781  Fix the bibliography and citation in 
2782 \family typewriter
2783 example_raw.lyx
2784 \end_layout
2785
2786 \begin_layout Section
2787 Table of Contents
2788 \end_layout
2789
2790 \begin_layout Standard
2791 You may want to put a table of contents at the beginning of your document.
2792  LyX makes this very easy to do.
2793  Just hit 
2794 \family sans
2795 Return
2796 \family default
2797  after your document title and before your first section title and choose
2798  
2799 \family sans
2800 Insert\SpecialChar \menuseparator
2801 List\InsetSpace ~
2802 /\InsetSpace ~
2803 TOC\SpecialChar \menuseparator
2804 Table\InsetSpace ~
2805 of\InsetSpace ~
2806 Contents
2807 \family default
2808 .
2809  The words 
2810 \begin_inset Quotes eld
2811 \end_inset
2812
2813 Table of Contents
2814 \begin_inset Quotes erd
2815 \end_inset
2816
2817  will appear in a button on the first line of the document.
2818  
2819 \end_layout
2820
2821 \begin_layout Standard
2822 This may not appear to be very useful.
2823  However, if you look at your DVI file, you will see that a table of contents
2824  has been generated, listing the various sections and subsections in your
2825  document.
2826  As usual, if you reorder sections or create new ones, you will see those
2827  changes in the DVI file when you update it.
2828  
2829 \end_layout
2830
2831 \begin_layout Standard
2832 The table of contents is not printed in the on-screen version of the document
2833  to keep the overview in your file.
2834  But you can display the table of contents in a separate window by clicking
2835  on the table of contents button, or by using 
2836 \family sans
2837 Document\SpecialChar \menuseparator
2838 Outline
2839 \family default
2840  or the toolbar button 
2841 \begin_inset Graphics
2842         filename ../images/dialog-toggle_toc.png
2843         scale 75
2844         scaleBeforeRotation
2845
2846 \end_inset
2847
2848 .
2849  This menu will work even if you don't have a table of contents inset in
2850  your document.
2851  This is a very useful tool where you can move around your document parts.
2852  Clicking on a (sub)section title in the 
2853 \family sans
2854 Outline
2855 \family default
2856  window will highlight that line and move the display (in the LyX editing
2857  window) to that place in the document.
2858  You can also use the arrow keys to move up and down in the table of contents.
2859  You may therefore find it convenient to leave this window open throughout
2860  editing sessions.
2861  You can get similar functionality from the 
2862 \family sans
2863 Navigate
2864 \family default
2865  menu, though, where the table of contents appears automatically.
2866 \end_layout
2867
2868 \begin_layout Standard
2869 To get rid of the Table of Contents, you can delete the table of contents
2870  button just like any other text.
2871 \end_layout
2872
2873 \begin_layout Standard
2874
2875 \series bold
2876 Exercise
2877 \series default
2878 : Fix the table of contents in 
2879 \family typewriter
2880 example_raw.lyx
2881 \end_layout
2882
2883 \begin_layout Chapter
2884 Using Math
2885 \end_layout
2886
2887 \begin_layout Standard
2888 LaTeX is used by many scientists because it outputs great looking equations,
2889  avoiding the control characters used by word processors and their equation
2890  editors.
2891  Many of these scientists are frustrated, however, because writing equations
2892  in LaTeX is more like programming than writing.
2893  Happily, LyX has WYSIWYM support for equations.
2894  If you are used to LaTeX, you'll find that all of the usual LaTeX math
2895  commands can be typed in normally, but they will show up in a WYSIWYM fashion.
2896  If, on the other hand, you've never written in LaTeX, then the 
2897 \family sans
2898 Math\InsetSpace ~
2899 Panel
2900 \family default
2901  will allow you to write professional-looking math quickly and easily.
2902 \end_layout
2903
2904 \begin_layout Section
2905 Math Mode
2906 \end_layout
2907
2908 \begin_layout Standard
2909 Somewhere in your LyX document, type: 
2910 \end_layout
2911
2912 \begin_layout LyX-Code
2913 I like what Einstein said, E=mc^2, because it's so simple.
2914  
2915 \end_layout
2916
2917 \begin_layout Standard
2918 Now, that equation doesn't look very good in LyX and in the output; there's
2919  no space between the letters and the equals sign, and you'd like to write
2920  an actual superscript for the 
2921 \begin_inset Quotes eld
2922 \end_inset
2923
2924 2
2925 \begin_inset Quotes erd
2926 \end_inset
2927
2928 .
2929  That bad typesetting happened because we didn't tell LyX that we were writing
2930  a mathematical expression, so it typeset the equation like regular old
2931  text.
2932 \end_layout
2933
2934 \begin_layout Standard
2935 Instead, we create a formula that will get typeset properly.
2936  In order to create a formula, just click the toolbar button 
2937 \begin_inset Graphics
2938         filename ../images/math-mode.png
2939         scale 75
2940         scaleBeforeRotation
2941
2942 \end_inset
2943
2944  or use the menu 
2945 \family sans
2946 Insert\SpecialChar \menuseparator
2947 Math\SpecialChar \menuseparator
2948 Inline\InsetSpace ~
2949 Formula
2950 \family default
2951 .
2952  LyX will insert a little blue square, which is an empty math formula.
2953  Now just type 
2954 \family typewriter
2955 E=mc^2
2956 \family default
2957  again.
2958  The expression is typed in blue, and the blue square disappears as soon
2959  as the formula is not empty.
2960  Now type 
2961 \family sans
2962 Esc
2963 \family default
2964  to leave the equation The purple markers disappear, leaving the cursor
2965  to the right of the expression, and now if you type something, it will
2966  be regular text.
2967 \end_layout
2968
2969 \begin_layout Standard
2970 Run LaTeX and look at the output.
2971  Notice that the expression was typeset nicely, with spaces between the
2972  letters and the equals sign, and a superscript 
2973 \begin_inset Quotes eld
2974 \end_inset
2975
2976 2
2977 \begin_inset Quotes erd
2978 \end_inset
2979
2980 .
2981  Letters in math mode are assumed to be variables, and come out in italics.
2982  Numbers are just numbers.
2983 \end_layout
2984
2985 \begin_layout Standard
2986 This math editor is another example of the WYSIWYM philosophy.
2987  In LaTeX, you write a mathematical expression using text and commands like
2988  
2989 \family typewriter
2990
2991 \backslash
2992 sqrt
2993 \family default
2994 ; this can be frustrating, because you can't see what an expression looks
2995  like until you LaTeX the file, and may have to spend time to find e.\InsetSpace \thinspace{}
2996 g.\InsetSpace ~
2997 missing
2998  brackets.
2999  LyX doesn't attempt to get the expression to look perfect (WYSIWYG), but
3000  it gives you an extremely good idea of what the expression will look like.
3001  LaTeX then takes care of the professional typesetting.
3002 \end_layout
3003
3004 \begin_layout Section
3005 Navigating an Equation
3006 \end_layout
3007
3008 \begin_layout Standard
3009 Now let's change 
3010 \begin_inset Formula $E=mc^{2}$
3011 \end_inset
3012
3013  to 
3014 \begin_inset Formula $E=1+mc^{2}$
3015 \end_inset
3016
3017 .
3018  Use the arrow keys to move the cursor into the expression.
3019  Note that when you enter the expression, the purple markers appear to let
3020  you know you're editing math.
3021  Now you can use 
3022 \family sans
3023 Left
3024 \family default
3025  and 
3026 \family sans
3027 Right
3028 \family default
3029  to move the cursor past the equals sign, and just type 
3030 \begin_inset Quotes eld
3031 \end_inset
3032
3033 1+
3034 \begin_inset Quotes erd
3035 \end_inset
3036
3037 .
3038  Again, you can use the arrow keys or 
3039 \family sans
3040 Esc
3041 \family default
3042  to leave the formula\SpecialChar \@.
3043
3044 \end_layout
3045
3046 \begin_layout Standard
3047 Other than the special keys described below, typing in math mode is like
3048  editing regular text.
3049  Use 
3050 \family sans
3051 Delete
3052 \family default
3053  (or 
3054 \family sans
3055 Backspace
3056 \family default
3057 ) to delete things.
3058  Select text either with the arrow keys or with the mouse.
3059  
3060 \family sans
3061 Edit\SpecialChar \menuseparator
3062 Undo
3063 \family default
3064  works in math mode as well as cut and paste.
3065  One thing to be careful of: If you are left or right outside a formula
3066  and you press 
3067 \family sans
3068 Delete
3069 \family default
3070  or 
3071 \family sans
3072 Backspace
3073 \family default
3074 , respectively, you delete the whole formula.
3075  Luckily, you can just use 
3076 \family sans
3077 Undo
3078 \family default
3079  to get it back.
3080 \end_layout
3081
3082 \begin_layout Standard
3083 What if you want to change 
3084 \begin_inset Formula $E=mc^{2}$
3085 \end_inset
3086
3087  to 
3088 \begin_inset Formula $E=mc^{2.5}+1$
3089 \end_inset
3090
3091 ? Again, you can use the mouse to click in the right place.
3092  However, you can also use the arrow keys.
3093  If the cursor is just after the 
3094 \begin_inset Quotes eld
3095 \end_inset
3096
3097 c
3098 \begin_inset Quotes erd
3099 \end_inset
3100
3101  but before the 
3102 \begin_inset Quotes eld
3103 \end_inset
3104
3105 2
3106 \begin_inset Quotes erd
3107 \end_inset
3108
3109 , then press 
3110 \family sans
3111 Up
3112 \family default
3113  and the cursor is moved to the level of the superscript, just before the
3114  
3115 \begin_inset Quotes eld
3116 \end_inset
3117
3118 2
3119 \begin_inset Quotes erd
3120 \end_inset
3121
3122 .
3123  Add the 
3124 \begin_inset Quotes eld
3125 \end_inset
3126
3127 .5
3128 \begin_inset Quotes erd
3129 \end_inset
3130
3131 .
3132  Now, hitting 
3133 \family sans
3134 Down
3135 \family default
3136  will move the cursor back to the regular level.
3137  When you hit 
3138 \family sans
3139 Space
3140 \family default
3141  instead of 
3142 \family sans
3143 Down
3144 \family default
3145 , the cursor will be placed 
3146 \emph on
3147 after
3148 \emph default
3149  the superscript (so that you can then type the 
3150 \begin_inset Quotes eld
3151 \end_inset
3152
3153 +1
3154 \begin_inset Quotes erd
3155 \end_inset
3156
3157 ).
3158 \end_layout
3159
3160 \begin_layout Section
3161 Exponents and Indices
3162 \end_layout
3163
3164 \begin_layout Standard
3165 An exponent can be entered from the 
3166 \family sans
3167 Math\InsetSpace ~
3168 Toolbar
3169 \family default
3170  (see below), but it's actually simpler just to type the caret key, 
3171 \begin_inset Quotes eld
3172 \end_inset
3173
3174 ^
3175 \begin_inset Quotes erd
3176 \end_inset
3177
3178 .
3179  LyX will place another blue rectangle in the superscript, so that whatever
3180  you write next will be superscripted, and in a smaller font size.
3181  Everything you type until you hit a 
3182 \family sans
3183 Space
3184 \family default
3185  (or 
3186 \family sans
3187 Esc
3188 \family default
3189  to exit the formula entirely) will be in the superscript.
3190 \end_layout
3191
3192 \begin_layout Standard
3193 Writing a subscript (index) is just as easy --- start one by typing the
3194  underscore key, 
3195 \begin_inset Quotes eld
3196 \end_inset
3197
3198 _
3199 \begin_inset Quotes eld
3200 \end_inset
3201
3202 .
3203  You can subscript and superscript both subscripts and superscripts like
3204  this: 
3205 \begin_inset Formula $A_{a_{0}+b^{2}}+C^{a_{0}+b^{2}}$
3206 \end_inset
3207
3208 .
3209  
3210 \end_layout
3211
3212 \begin_layout Standard
3213
3214 \series bold
3215 Exercise
3216 \series default
3217 : Put equation 1 of 
3218 \family typewriter
3219 example_raw.lyx
3220 \family default
3221  into math mode.
3222 \end_layout
3223
3224 \begin_layout Section
3225 The Math Toolbar
3226 \end_layout
3227
3228 \begin_layout Standard
3229 The 
3230 \family sans
3231 Math\InsetSpace ~
3232 Toolbar
3233 \family default
3234  is a convenient way to enter symbols or to perform complicated formula
3235  operations.
3236  Many of these operations can be accomplished from the keyboard or the 
3237 \family sans
3238 Edit\SpecialChar \menuseparator
3239 Math
3240 \family default
3241  or 
3242 \family sans
3243 Insert\SpecialChar \menuseparator
3244 Math
3245 \family default
3246  menus.
3247  However, we're going to concentrate on using the 
3248 \family sans
3249 Math\InsetSpace ~
3250 Toolbars
3251 \family default
3252 , just to let you know what's out there; you can learn keyboard shortcuts
3253  later, from other manuals.
3254 \end_layout
3255
3256 \begin_layout Standard
3257 The 
3258 \family sans
3259 math toolbar
3260 \family default
3261  is shown when the cursor is in a formula and can also be turned on manually
3262  in the menu 
3263 \family sans
3264 View\SpecialChar \menuseparator
3265 Toolbars
3266 \family default
3267 .
3268  When you click there on 
3269 \begin_inset Quotes eld
3270 \end_inset
3271
3272 Math
3273 \begin_inset Quotes erd
3274 \end_inset
3275
3276  the toolbar will be shown permanently at the bottom; this state is visualized
3277  in the 
3278 \family sans
3279 Toolbars
3280 \family default
3281  menu with a checkmark.
3282  When you click in this state again on 
3283 \begin_inset Quotes eld
3284 \end_inset
3285
3286 Math
3287 \begin_inset Quotes erd
3288 \end_inset
3289
3290  in the 
3291 \family sans
3292 Toolbars
3293 \family default
3294  menu, the 
3295 \family sans
3296 math toolbar
3297 \family default
3298  is only shown when the cursor is within a formula; this state is visualized
3299  by the renaming of the menu entry from 
3300 \begin_inset Quotes eld
3301 \end_inset
3302
3303 Math
3304 \begin_inset Quotes erd
3305 \end_inset
3306
3307  to 
3308 \begin_inset Quotes eld
3309 \end_inset
3310
3311 Math\InsetSpace ~
3312 (auto)
3313 \begin_inset Quotes erd
3314 \end_inset
3315
3316 .
3317 \end_layout
3318
3319 \begin_layout Subsection
3320 Greek and symbols
3321 \end_layout
3322
3323 \begin_layout Standard
3324 The 
3325 \family sans
3326 Math\InsetSpace ~
3327 Toolbar
3328 \family default
3329  which allow you to choose from a large array of symbols used in math: various
3330  arrows, relations, operators, and sums and integrals.
3331  Note that subscripting and superscripting allow you to put lower and upper
3332  limits on sums and integrals.
3333  
3334 \end_layout
3335
3336 \begin_layout Standard
3337 \begin_inset Quotes eld
3338 \end_inset
3339
3340 Nothing you can do that can't be done\SpecialChar \ldots{}
3341  All you need is 
3342 \begin_inset Formula $\heartsuit$
3343 \end_inset
3344
3345 .
3346 \begin_inset Quotes erd
3347 \end_inset
3348
3349  
3350 \end_layout
3351
3352 \begin_layout Subsection
3353 Square roots, accents, and delimiters
3354 \end_layout
3355
3356 \begin_layout Standard
3357 To type a square root, just click on the button 
3358 \begin_inset Graphics
3359         filename ../images/math/sqrt.png
3360         scale 75
3361         scaleBeforeRotation
3362
3363 \end_inset
3364
3365 .
3366  The square root appears, and the cursor is in a new insertion point inside
3367  the square root.
3368  You can type variables, numbers, other square roots, fractions, whatever
3369  you want.
3370  LyX will automatically resize the square root to fit what's inside.
3371 \end_layout
3372
3373 \begin_layout Standard
3374 Accenting a character (
3375 \begin_inset Formula $\overrightarrow{v}$
3376 \end_inset
3377
3378 ) or group of characters (
3379 \begin_inset Formula $\overrightarrow{a+b}$
3380 \end_inset
3381
3382 ) is done the same way.
3383  Decorations are available from the toolbar via the button 
3384 \begin_inset Graphics
3385         filename ../images/math/hat.png
3386         scale 75
3387         scaleBeforeRotation
3388
3389 \end_inset
3390
3391 .
3392  Click on a decoration, and LyX will insert that decoration with an insertion
3393  point under (or over) it.
3394  Just type what you want in the insertion point.
3395  There are two sets of decorations: those that resize with the text you
3396  type, and those that have fixed size, and are most appropriate for a single
3397  letter.
3398  
3399 \end_layout
3400
3401 \begin_layout Standard
3402 Delimiters such as parentheses, brackets, and braces work similarly, but
3403  are a bit more complicated.
3404  Hit the delimiter button 
3405 \begin_inset Graphics
3406         filename ../images/dialog-show_mathdelimiter.png
3407         scale 75
3408         scaleBeforeRotation
3409
3410 \end_inset
3411
3412  to pop up the 
3413 \family sans
3414 Delimiter
3415 \family default
3416  dialog.
3417  Your current selection of delimiters is displayed in a box.
3418  It's a pair of parentheses by default, but you can choose a pair of braces,
3419  a brace and a parenthesis, or choose the empty square to have something
3420  like 
3421 \begin_inset Quotes eld
3422 \end_inset
3423
3424
3425 \begin_inset Formula $a=\left\langle 7\right.$
3426 \end_inset
3427
3428
3429 \begin_inset Quotes erd
3430 \end_inset
3431
3432  (the empty delimiter is displayed as a broken line in LyX, but won't show
3433  up in the output).
3434 \end_layout
3435
3436 \begin_layout Standard
3437 If you're lazy, you can type actual parentheses in math mode, rather than
3438  using the 
3439 \family sans
3440 Delimiter
3441 \family default
3442  dialog.
3443  However, those parentheses will be the same size as regular text, which
3444  will look bad if you have a big fraction or matrix inside the parentheses.
3445  So better use in this case one of the three delimiter buttons that insert
3446  directly e.\InsetSpace \thinspace{}
3447 g.\InsetSpace ~
3448 a (\InsetSpace \thinspace{}
3449 ) pair.
3450 \end_layout
3451
3452 \begin_layout Standard
3453 You can also put delimiters or a square root sign or a decoration on already
3454  existing formula parts.
3455  Select the portion of the formula that you want to adjust, and then click
3456  on the button you want from the 
3457 \family sans
3458 Math\InsetSpace ~
3459 Toolbar
3460 \family default
3461 .
3462  Try using this to change Newton's second law from scalar to vector form
3463  (
3464 \begin_inset Formula $f=ma$
3465 \end_inset
3466
3467  to 
3468 \begin_inset Formula $\overrightarrow{f}=m\overrightarrow{a}$
3469 \end_inset
3470
3471 ).
3472  Once you've learned about matrices, this is how you'll put parentheses
3473  or brackets around them.
3474 \end_layout
3475
3476 \begin_layout Subsection
3477 Fractions
3478 \end_layout
3479
3480 \begin_layout Standard
3481 To create a fraction, click on the fraction button 
3482 \begin_inset Graphics
3483         filename ../images/math/frac.png
3484         lyxscale 75
3485         scale 60
3486         scaleBeforeRotation
3487
3488 \end_inset
3489
3490  in the 
3491 \family sans
3492 Math\InsetSpace ~
3493 Toolbar
3494 \family default
3495 .
3496  LyX writes two insertion points in a fraction.
3497  As you would expect, you can use arrow keys or the mouse to move around
3498  a fraction.
3499  Click on the top square and type 
3500 \begin_inset Quotes eld
3501 \end_inset
3502
3503 1
3504 \begin_inset Quotes erd
3505 \end_inset
3506
3507 .
3508  Now hit 
3509 \family sans
3510 Down
3511 \family default
3512  and type 
3513 \begin_inset Quotes eld
3514 \end_inset
3515
3516 2
3517 \begin_inset Quotes erd
3518 \end_inset
3519
3520 .
3521  You've made a fraction! Of course you can type anything within each of
3522  the two boxes: variables with exponents, square roots, other fractions,
3523  whatever.
3524  
3525 \end_layout
3526
3527 \begin_layout Standard
3528
3529 \series bold
3530 Exercise
3531 \series default
3532 : Put equation 2 of 
3533 \family typewriter
3534 example_raw.lyx
3535 \family default
3536  into math mode.
3537 \end_layout
3538
3539 \begin_layout Subsection
3540 TeX mode: Limits, log, sin and others
3541 \end_layout
3542
3543 \begin_layout Standard
3544 Because letters in math mode are considered to be variables, if you type
3545  
3546 \begin_inset Quotes eld
3547 \end_inset
3548
3549 sin
3550 \begin_inset Quotes erd
3551 \end_inset
3552
3553  in math mode, LyX thinks you are typing the product of the three variables
3554  
3555 \begin_inset Formula $s$
3556 \end_inset
3557
3558
3559 \begin_inset Formula $i$
3560 \end_inset
3561
3562 , and 
3563 \begin_inset Formula $n$
3564 \end_inset
3565
3566 .
3567  The three letters will be typeset in italics, when what you really wanted
3568  was the word 
3569 \begin_inset Quotes eld
3570 \end_inset
3571
3572 sin
3573 \begin_inset Quotes erd
3574 \end_inset
3575
3576  typeset in Roman.
3577  In addition, LyX won't put a space between the word 
3578 \begin_inset Quotes eld
3579 \end_inset
3580
3581 sin
3582 \begin_inset Quotes erd
3583 \end_inset
3584
3585  and the 
3586 \begin_inset Quotes eld
3587 \end_inset
3588
3589 x
3590 \begin_inset Quotes erd
3591 \end_inset
3592
3593  (pressing 
3594 \family sans
3595 Space
3596 \family default
3597  will exit the formula).
3598  So how do you get 
3599 \begin_inset Quotes eld
3600 \end_inset
3601
3602
3603 \begin_inset Formula $\sin(x)$
3604 \end_inset
3605
3606
3607 \begin_inset Quotes erd
3608 \end_inset
3609
3610  instead of 
3611 \begin_inset Quotes eld
3612 \end_inset
3613
3614
3615 \begin_inset Formula $sin(x)$
3616 \end_inset
3617
3618
3619 \begin_inset Quotes erd
3620 \end_inset
3621
3622 ?
3623 \end_layout
3624
3625 \begin_layout Standard
3626 Click on the 
3627 \family sans
3628 Math\InsetSpace ~
3629 Toolbar
3630 \family default
3631  button 
3632 \begin_inset Graphics
3633         filename ../images/math/functions.png
3634         scale 75
3635         scaleBeforeRotation
3636
3637 \end_inset
3638
3639  and then on 
3640 \begin_inset Quotes eld
3641 \end_inset
3642
3643 sin
3644 \begin_inset Quotes erd
3645 \end_inset
3646
3647  in the appearing function list.
3648  The word 
3649 \begin_inset Quotes eld
3650 \end_inset
3651
3652 sin
3653 \begin_inset Quotes erd
3654 \end_inset
3655
3656  is displayed in LyX in black, and set in upright roman type.
3657  The whole word is treated as one symbol, so if you type 
3658 \family sans
3659 Backspace
3660 \family default
3661 , it will delete the whole word.
3662  Now type 
3663 \begin_inset Quotes eld
3664 \end_inset
3665
3666 (x)
3667 \begin_inset Quotes erd
3668 \end_inset
3669
3670 , which will be written in blue italics, like you expect in a formula.
3671  In the output, the expression will be correctly typeset.
3672  Try it out.
3673 \end_layout
3674
3675 \begin_layout Standard
3676 The function list include other trigonometric functions and their inverses,
3677  hyperbolic functions, logarithms, limits, and quite a few others.
3678  These functions can take subscripts and superscripts, important for typing
3679  
3680 \begin_inset Quotes eld
3681 \end_inset
3682
3683
3684 \begin_inset Formula $\cos^{2}\theta$
3685 \end_inset
3686
3687
3688 \begin_inset Quotes erd
3689 \end_inset
3690
3691  or 
3692 \begin_inset Quotes eld
3693 \end_inset
3694
3695
3696 \begin_inset Formula $\lim_{n\rightarrow\infty}$
3697 \end_inset
3698
3699
3700 \begin_inset Quotes erd
3701 \end_inset
3702
3703 .
3704 \end_layout
3705
3706 \begin_layout Standard
3707
3708 \series bold
3709 Exercise
3710 \series default
3711 : Put equation 3 of 
3712 \family typewriter
3713 example_raw.lyx
3714 \family default
3715  into math mode.
3716 \end_layout
3717
3718 \begin_layout Subsection
3719 Matrices
3720 \begin_inset LatexCommand label
3721 name "sec:matrices"
3722
3723 \end_inset
3724
3725
3726 \end_layout
3727
3728 \begin_layout Standard
3729 Click on the matrix button 
3730 \begin_inset Graphics
3731         filename ../images/dialog-show_mathmatrix.png
3732         scale 75
3733         scaleBeforeRotation
3734
3735 \end_inset
3736
3737  in the 
3738 \family sans
3739 Math\InsetSpace ~
3740 Toolbar
3741 \family default
3742 .
3743  The appearing dialog allows you to choose how many rows and columns you
3744  want in your matrix.
3745  Choose 2 rows and 3 columns and hit 
3746 \family sans
3747 OK
3748 \family default
3749 .
3750  LyX prints 6 insertion points in a 
3751 \begin_inset Formula $2\times3$
3752 \end_inset
3753
3754  matrix.
3755  As usual, you can put any sort of formula expression (a square root, another
3756  matrix, etc.) in each insertion point.
3757  You can also leave some of the insertion points empty if you want.
3758 \end_layout
3759
3760 \begin_layout Standard
3761
3762 \family sans
3763 Tab
3764 \family default
3765  can be used to move horizontally between the columns of a matrix.
3766  Alternatively, you can use the arrow keys to move around - hitting 
3767 \family sans
3768 Right
3769 \family default
3770  at the end of one box will move to the next box, 
3771 \family sans
3772 Down
3773 \family default
3774  will move to the next row, etc.
3775 \end_layout
3776
3777 \begin_layout Standard
3778 If you need to change the number of rows and columns, use the menu 
3779 \family sans
3780 Edit\SpecialChar \menuseparator
3781 Math\SpecialChar \menuseparator
3782 Rows\InsetSpace \thinspace{}
3783 &\InsetSpace \thinspace{}
3784 Columns
3785 \family default
3786  or the math toolbar buttons 
3787 \begin_inset Graphics
3788         filename ../images/tabular-feature_append-row.png
3789         scale 75
3790         scaleBeforeRotation
3791
3792 \end_inset
3793
3794
3795 \begin_inset Graphics
3796         filename ../images/tabular-feature_delete-row.png
3797         scale 75
3798         scaleBeforeRotation
3799
3800 \end_inset
3801
3802
3803 \begin_inset Graphics
3804         filename ../images/tabular-feature_append-column.png
3805         scale 75
3806         scaleBeforeRotation
3807
3808 \end_inset
3809
3810
3811 \begin_inset Graphics
3812         filename ../images/tabular-feature_delete-column.png
3813         scale 75
3814         scaleBeforeRotation
3815
3816 \end_inset
3817
3818 .
3819 \end_layout
3820
3821 \begin_layout Standard
3822 See the 
3823 \emph on
3824 User's Guide
3825 \emph default
3826  for information on how to change the horizontal alignment of each column,
3827  and how to change the vertical position of the whole matrix.
3828  Note that if you want to write a table containing text, you should use
3829  LyX's wonderful table support, rather than trying to write text in a matrix.
3830 \end_layout
3831
3832 \begin_layout Subsection
3833 Display mode
3834 \end_layout
3835
3836 \begin_layout Standard
3837 All of the expressions we have written so far have been on the same line
3838  as the text that came before and after them, otherwise known as inline
3839  expressions.
3840  This is fine for short, simple expressions, but if you want to write larger
3841  ones, or if you want your expressions to stand out from the text, you need
3842  to write them in display mode.
3843  In addition, only displayed expressions can be labeled and numbered (see
3844  the 
3845 \emph on
3846 User's Guide
3847 \emph default
3848 ), and multi-line equations must be in display mode.
3849 \end_layout
3850
3851 \begin_layout Standard
3852 Click on the display button 
3853 \begin_inset Graphics
3854         filename ../images/math-display.png
3855         scale 75
3856         scaleBeforeRotation
3857
3858 \end_inset
3859
3860  in the 
3861 \family sans
3862 Math\InsetSpace ~
3863 Toolbar
3864 \family default
3865 , which represents a couple lines of text before and after a centered blue
3866  box.
3867  LyX inserts a formula, but the insertion point is on a new line, and it's
3868  centered within that line.
3869  Now type an expression and run LaTeX to see how it looks.
3870  The display button is actually a toggle; use it now to change a couple
3871  of your expressions to display mode and back.
3872  
3873 \end_layout
3874
3875 \begin_layout Standard
3876 Display mode has a couple differences from inline mode:
3877 \end_layout
3878
3879 \begin_layout Itemize
3880 The default font is larger for a few symbols, like 
3881 \begin_inset Formula $\sum$
3882 \end_inset
3883
3884  and 
3885 \begin_inset Formula $\int$
3886 \end_inset
3887
3888
3889 \end_layout
3890
3891 \begin_layout Itemize
3892 Subscripts and superscripts for limits and sums (but not integrals) are
3893  written under rather than next to the symbols
3894 \end_layout
3895
3896 \begin_layout Itemize
3897 Text is centered
3898 \end_layout
3899
3900 \begin_layout Standard
3901 Other than these differences, though, displayed expressions and inline expressio
3902 ns are very similar.
3903 \end_layout
3904
3905 \begin_layout Standard
3906 One final note about the way displayed formulas are typeset: Be careful
3907  about whether you're putting your equation into a new paragraph or not.
3908  If your formula is in the middle of a sentence or paragraph, then don't
3909  press 
3910 \family sans
3911 Return
3912 \family default
3913 .
3914  Doing so will cause the text 
3915 \emph on
3916 after
3917 \emph default
3918  the formula to start a new paragraph.
3919  That text will therefore eventually be indented, depending on your document
3920  paragraph settings, which is probably not what you want.
3921 \end_layout
3922
3923 \begin_layout Standard
3924
3925 \series bold
3926 Exercise
3927 \series default
3928 : Put the various equations in 
3929 \family typewriter
3930 example_raw.lyx
3931 \family default
3932  into display mode, and see how they're typeset differently.
3933 \end_layout
3934
3935 \begin_layout Standard
3936
3937 \series bold
3938 Exercise
3939 \series default
3940 : Using various tools you've learned in this section, you should be able
3941  to write an equation like
3942 \begin_inset Foot
3943 status collapsed
3944
3945 \begin_layout Standard
3946 After you've done it the hard way, give 
3947 \family sans
3948 Insert\SpecialChar \menuseparator
3949 Math\SpecialChar \menuseparator
3950 Cases\InsetSpace ~
3951 Environment
3952 \family default
3953  a try.
3954 \end_layout
3955
3956 \end_inset
3957
3958
3959 \begin_inset Formula \[
3960 f(x)=\left\{ \begin{array}{cc}
3961 \log_{8}x & x>0\\
3962 0 & x=0\\
3963 \sum_{i=1}^{5}\alpha_{i}+\sqrt{-\frac{1}{x}} & x<0\end{array}\right.\]
3964
3965 \end_inset
3966
3967
3968 \end_layout
3969
3970 \begin_layout Section
3971 More Math Stuff
3972 \end_layout
3973
3974 \begin_layout Standard
3975 LyX's math editor can do plenty more.
3976  By now, you're familiar with the basics, so we refer to the 
3977 \emph on
3978 User's Guide
3979 \emph default
3980  for tips on how to:
3981 \end_layout
3982
3983 \begin_layout Itemize
3984 Labeling and numbering expressions
3985 \end_layout
3986
3987 \begin_layout Itemize
3988 Multi-line equations
3989 \end_layout
3990
3991 \begin_layout Itemize
3992 Change typefaces, e.g., to write bold-face text in an expression.
3993 \end_layout
3994
3995 \begin_layout Itemize
3996 Fine-tune font sizes and spacing within an expression.
3997  (Don't worry about this until your final draft!)
3998 \end_layout
3999
4000 \begin_layout Itemize
4001 Write macros.
4002  These are very powerful, because you just define them once at the top of
4003  the document, and then you can use them throughout the document.
4004 \end_layout
4005
4006 \begin_layout Itemize
4007 Do lots of other things that can't be mentioned in this Tutorial.
4008 \end_layout
4009
4010 \begin_layout Chapter
4011 Miscellaneous
4012 \end_layout
4013
4014 \begin_layout Section
4015 Other major LyX Features
4016 \end_layout
4017
4018 \begin_layout Standard
4019 We haven't gone through all the possible commands in LyX, and we aren't
4020  planning on it.
4021  As usual, see the 
4022 \emph on
4023 User's Guide
4024 \emph default
4025  and the 
4026 \emph on
4027 Embedded\InsetSpace ~
4028 Objects
4029 \emph default
4030  manual for more information.
4031  We'll just mention a couple more major things LyX can do:
4032 \end_layout
4033
4034 \begin_layout Itemize
4035 LyX has WYSIWYM support for tables.
4036  Use the 
4037 \family sans
4038 Insert\SpecialChar \menuseparator
4039 Table
4040 \family default
4041  (toolbar button 
4042 \begin_inset Graphics
4043         filename ../images/tabular-insert.png
4044         scale 75
4045         scaleBeforeRotation
4046
4047 \end_inset
4048
4049 ) to get a table.
4050  Click on the table with the 
4051 \emph on
4052 right button
4053 \emph default
4054  to get a 
4055 \family sans
4056 Table\InsetSpace ~
4057 Settings
4058 \family default
4059  dialog box which allows extensive table editing.
4060 \end_layout
4061
4062 \begin_layout Itemize
4063 LyX also supports including pictures in any format within documents.
4064  (You guessed it: 
4065 \family sans
4066 Insert\SpecialChar \menuseparator
4067 Graphics
4068 \family default
4069  (toolbar button 
4070 \begin_inset Graphics
4071         filename ../images/dialog-show-new-inset_graphics.png
4072         scale 75
4073         scaleBeforeRotation
4074
4075 \end_inset
4076
4077 ).
4078  Then browse for the figure file, rotate or scale it, etc.) Tables and figures
4079  can have captions, and LyX will automatically generate lists of figures
4080  and/or tables.
4081 \end_layout
4082
4083 \begin_layout Itemize
4084 LyX is heavily configurable.
4085  Everything from how the LyX window looks to how the output comes out can
4086  be configured in a number of ways.
4087  Much configuration is done through 
4088 \family sans
4089 Tools\SpecialChar \menuseparator
4090 Preferences
4091 \family default
4092 .
4093  For more information on this, check out 
4094 \family sans
4095 Help\SpecialChar \menuseparator
4096 Customization\SpecialChar \@.
4097
4098 \end_layout
4099
4100 \begin_layout Itemize
4101 LyX is being developed by a team of programmers on five continents.
4102  Therefore, LyX has better support for non-English languages (such as Dutch,
4103  German, French, Greek, Czech, Turkish, \SpecialChar \ldots{}
4104 ) than many word processors.
4105  Even the right-to-left languages Arabic, Farsi, and Hebrew and the Asian
4106  languages Chinese Japanese, and Korean are supported.
4107  You can write documents in other languages and you can also configure LyX
4108  to show its menus and error messages in other languages.
4109  
4110 \end_layout
4111
4112 \begin_layout Itemize
4113 The LyX menus feature keybindings.
4114  This means that you can do 
4115 \family sans
4116 File\SpecialChar \menuseparator
4117 Open
4118 \family default
4119  by pressing 
4120 \family sans
4121 M-F
4122 \family default
4123  followed by 
4124 \family sans
4125 O
4126 \family default
4127  or by using the binding which is shown next to it in the menu (C-O by default).
4128  Keybindings are also configurable.
4129  For information on this, check out 
4130 \family sans
4131 Help\SpecialChar \menuseparator
4132 Customization\SpecialChar \@.
4133
4134 \end_layout
4135
4136 \begin_layout Itemize
4137 LyX can read LaTeX documents.
4138  See section\InsetSpace ~
4139
4140 \begin_inset LatexCommand ref
4141 reference "sec:tex2lyx"
4142
4143 \end_inset
4144
4145 .
4146 \end_layout
4147
4148 \begin_layout Itemize
4149 Spellchecking, thesaurus, and word count facilities are available.
4150 \end_layout
4151
4152 \begin_layout Itemize
4153 Generation of indexes and nomenclatures/glossaries is supported.
4154 \end_layout
4155
4156 \begin_layout Section
4157 LyX for LaTeX Users
4158 \begin_inset LatexCommand label
4159 name "sec:latexusers"
4160
4161 \end_inset
4162
4163
4164 \end_layout
4165
4166 \begin_layout Standard
4167 If you don't know anything about LaTeX, you don't have to read this section.
4168  Actually, you might want to 
4169 \emph on
4170 learn
4171 \emph default
4172  about LaTeX, and then read this chapter.
4173  However, some who begin to use LyX will be familiar with LaTeX.
4174  If you are such a person, you may be wondering if LyX can really do everything
4175  LaTeX can do.
4176  The short answer is that LyX can do pretty much everything LaTeX can do
4177  in one form or another, and it definitely simplifies most parts of writing
4178  a LaTeX document.
4179 \end_layout
4180
4181 \begin_layout Standard
4182 Because this is just a tutorial, we are only going to mention things that
4183  new LyX users will most likely be interested in.
4184  In the interests of keeping the Tutorial short, we will give only minimal
4185  information here.
4186  The the 
4187 \emph on
4188 Extended\InsetSpace ~
4189 Features
4190 \emph default
4191  and the 
4192 \emph on
4193 Embedded\InsetSpace ~
4194 Objects
4195 \emph default
4196  manual have a great deal of information on differences between LyX and
4197  LaTeX, and how to do various LaTeX tricks in LyX.
4198 \end_layout
4199
4200 \begin_layout Subsection
4201 TeX Mode 
4202 \end_layout
4203
4204 \begin_layout Standard
4205 Anything that you enter in TeX mode will be passed straight to LaTeX, and
4206  will be displayed in red on the screen.
4207  You can use TeX commands in LyX by choosing 
4208 \family sans
4209 Insert\SpecialChar \menuseparator
4210 TeX\InsetSpace ~
4211 Code
4212 \family default
4213  (toolbar button 
4214 \begin_inset Graphics
4215         filename ../images/ert-insert.png
4216         scale 75
4217         scaleBeforeRotation
4218
4219 \end_inset
4220
4221 ).
4222  This creates a box where everything within it is passed straight to LaTeX.
4223 \end_layout
4224
4225 \begin_layout Standard
4226 In a math formula, TeX mode is handled a bit differently.
4227  TeX mode is there entered by typing a backslash.
4228  The backslash is not written out, but anything you type afterwards will
4229  be in red.
4230  You exit TeX mode by typing 
4231 \family sans
4232 Space
4233 \family default
4234  or some other non-alphabetic character, like a number, underscore, caret,
4235  or parenthesis.
4236  Once you exit TeX mode, if LyX knows the TeX command you've typed in, it
4237  will convert it to WYSIWYM\SpecialChar \@.
4238  So if you type 
4239 \begin_inset Quotes eld
4240 \end_inset
4241
4242
4243 \family typewriter
4244
4245 \backslash
4246 gamma
4247 \family default
4248
4249 \begin_inset Quotes erd
4250 \end_inset
4251
4252  in a formula and then press 
4253 \family sans
4254 Space
4255 \family default
4256 , LyX will change the red 
4257 \begin_inset Quotes eld
4258 \end_inset
4259
4260 gamma
4261 \begin_inset Quotes erd
4262 \end_inset
4263
4264  to a blue 
4265 \begin_inset Quotes eld
4266 \end_inset
4267
4268
4269 \begin_inset Formula $\gamma$
4270 \end_inset
4271
4272
4273 \begin_inset Quotes erd
4274 \end_inset
4275
4276 .
4277  This will work for almost all, non-complicated math macros.
4278  This may be faster than using the 
4279 \family sans
4280 Math\InsetSpace ~
4281 Toolbar
4282 \family default
4283 , and will be especially convenient for experienced LaTeX users.
4284 \end_layout
4285
4286 \begin_layout Standard
4287 As a special case, if you type a brace in TeX mode, then the beginning 
4288 \emph on
4289 and
4290 \emph default
4291  ending braces will be inserted in red, then take you 
4292 \emph on
4293 out
4294 \emph default
4295  of TeX mode and place the cursor between the braces.
4296  This makes it more convenient to type commands that LyX doesn't know which
4297  take an argument.
4298 \end_layout
4299
4300 \begin_layout Standard
4301 LyX can't do absolutely everything that LaTeX can do.
4302  Some fancy functions are not supported at all, while some work but aren't
4303  WYSIWYM.
4304  TeX mode allows users to get the full flexibility of LaTeX, while having
4305  all the convenient features of LyX, like WYSIWYM math, tables, and editing.
4306  LyX could never support every LaTeX package.
4307  However, by typing 
4308 \family typewriter
4309
4310 \backslash
4311 usepackage{foo}
4312 \family default
4313  in the preamble (see section\InsetSpace ~
4314
4315 \begin_inset LatexCommand ref
4316 reference "sec:preamble"
4317
4318 \end_inset
4319
4320 ), you can use any package you want --- although you won't have WYSIWYM
4321  support for that package's features.
4322 \end_layout
4323
4324 \begin_layout Subsection
4325 Importing LaTeX Documents --- 
4326 \family typewriter
4327 tex2lyx
4328 \family default
4329
4330 \begin_inset LatexCommand label
4331 name "sec:tex2lyx"
4332
4333 \end_inset
4334
4335
4336 \end_layout
4337
4338 \begin_layout Standard
4339 You can import a LaTeX file into LyX by using the 
4340 \family sans
4341 File\SpecialChar \menuseparator
4342 Import\SpecialChar \menuseparator
4343 LaTeX\InsetSpace ~
4344 (plain)
4345 \family default
4346  menu in LyX.
4347  This will call the program 
4348 \family typewriter
4349 tex2lyx
4350 \family default
4351  which will create a file 
4352 \family typewriter
4353 foo.lyx
4354 \family default
4355  from the file 
4356 \family typewriter
4357 foo.tex
4358 \family default
4359  and then open that file.
4360  If the translation doesn't work, you can try calling 
4361 \family typewriter
4362 tex2lyx
4363 \family default
4364  from the command line, possibly using fancier options.
4365 \end_layout
4366
4367 \begin_layout Standard
4368
4369 \family typewriter
4370 tex2lyx
4371 \family default
4372  will translate most legal LaTeX, but not everything.
4373  It will leave things it doesn't understand in TeX mode, so after translating
4374  a file with 
4375 \family typewriter
4376 tex2lyx
4377 \family default
4378 , you can look for red text and hand-edit it to look right.
4379 \end_layout
4380
4381 \begin_layout Standard
4382
4383 \family typewriter
4384 tex2lyx
4385 \family default
4386  has its own manpage.
4387  Read it to find out about which LaTeX commands and environments aren't
4388  supported, bugs (and how to get around them), and how to use the various
4389  options.
4390 \end_layout
4391
4392 \begin_layout Subsection
4393 Converting LyX Documents to LaTeX
4394 \end_layout
4395
4396 \begin_layout Standard
4397 You might wish to convert a LyX Document to a LaTeX file.
4398  For example, a co-worker or co-author who doesn't have LyX might want to
4399  read it.
4400  Select 
4401 \family sans
4402 File\SpecialChar \menuseparator
4403 Export\SpecialChar \menuseparator
4404 LaTeX
4405 \family default
4406 .
4407  This will create a file 
4408 \family typewriter
4409 whatever.tex
4410 \family default
4411  from the 
4412 \family typewriter
4413 whatever.lyx
4414 \family default
4415  file you are editing.
4416  LyX always creates temporary LaTeX files when viewing or printing files.
4417 \end_layout
4418
4419 \begin_layout Subsection
4420 LaTeX Preamble
4421 \end_layout
4422
4423 \begin_layout Subsubsection
4424 Document Class
4425 \end_layout
4426
4427 \begin_layout Standard
4428 The 
4429 \family sans
4430 Document\SpecialChar \menuseparator
4431 Settings
4432 \family default
4433  dialog takes care of many of the options that you would input in a 
4434 \family typewriter
4435
4436 \backslash
4437 documentclass
4438 \family default
4439  command.
4440  Change the class, default font size and paper size here.
4441  Put any extra options to the 
4442 \family typewriter
4443
4444 \backslash
4445 documentclass
4446 \family default
4447  command in the 
4448 \family sans
4449 E
4450 \bar under
4451 x
4452 \bar default
4453 tra\InsetSpace ~
4454 Options
4455 \family default
4456  area.
4457 \end_layout
4458
4459 \begin_layout Subsubsection
4460 Other Preamble Matter
4461 \begin_inset LatexCommand label
4462 name "sec:preamble"
4463
4464 \end_inset
4465
4466
4467 \end_layout
4468
4469 \begin_layout Standard
4470 If you have special commands to put in the preamble of a LaTeX file, you
4471  can use them in a LyX document as well.
4472  Select 
4473 \family sans
4474 Document\SpecialChar \menuseparator
4475 Settings\SpecialChar \menuseparator
4476 LaTeX\InsetSpace ~
4477 Preamble
4478 \family default
4479  and type in the dialog window (or from the document settings dialog, depending
4480  on the frontend).
4481  Anything you type will (like with TeX mode) be sent directly to LaTeX.
4482 \end_layout
4483
4484 \begin_layout Subsection
4485 BibTeX
4486 \end_layout
4487
4488 \begin_layout Standard
4489 LyX has support for BibTeX, which allows you to build databases of bibliographic
4490 al references to be used in multiple documents.
4491  Select 
4492 \family sans
4493 \bar under
4494 I
4495 \bar default
4496 nsert\SpecialChar \menuseparator
4497 List\InsetSpace ~
4498 /\InsetSpace ~
4499 T
4500 \bar under
4501 O
4502 \bar default
4503 C\SpecialChar \menuseparator
4504
4505 \bar under
4506 B
4507 \bar default
4508 ibTeX\InsetSpace ~
4509 Bibliography
4510 \family default
4511  to include a 
4512 \family typewriter
4513 BibTeX
4514 \family default
4515  file.
4516  In the 
4517 \family sans
4518 Database
4519 \family default
4520  field you load BibTeX files, in the 
4521 \family sans
4522 Style
4523 \family default
4524  field you can load BibTeX style files.
4525 \end_layout
4526
4527 \begin_layout Standard
4528 After you've done this, you can use citations from any bibliographies you're
4529  including with 
4530 \family sans
4531 Insert\SpecialChar \menuseparator
4532 Citation
4533 \family default
4534  (see section\InsetSpace ~
4535
4536 \begin_inset LatexCommand ref
4537 reference "sec:bibliographies"
4538
4539 \end_inset
4540
4541 ).
4542  LyX will take care of running BibTeX.
4543  The box in the 
4544 \family sans
4545 Citation
4546 \family default
4547  dialog will show a list of all the references in your 
4548 \family typewriter
4549 BibTeX
4550 \family default
4551  file.
4552 \end_layout
4553
4554 \begin_layout Section
4555 Errors!
4556 \end_layout
4557
4558 \begin_layout Standard
4559 Sometimes when you LaTeX a document, there will be errors, things that LyX
4560  or LaTeX can't understand.
4561  When this happens, LyX will open a 
4562 \family sans
4563 LaTeX\InsetSpace ~
4564 Errors
4565 \family default
4566  dialog.
4567  Clicking on individual errors in this dialog will take you to the place
4568  in the LyX document where the error occurs and also display the detailed
4569  LaTeX error message.
4570 \end_layout
4571
4572 \end_body
4573 \end_document