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