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