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