]> git.lyx.org Git - lyx.git/blob - lib/doc/Tutorial.lyx
documentation files:
[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 \end_preamble
33 \use_default_options false
34 \begin_modules
35 logicalmkup
36 \end_modules
37 \maintain_unincluded_children false
38 \language english
39 \language_package default
40 \inputencoding auto
41 \fontencoding global
42 \font_roman default
43 \font_sans default
44 \font_typewriter default
45 \font_default_family default
46 \use_non_tex_fonts false
47 \font_sc false
48 \font_osf false
49 \font_sf_scale 100
50 \font_tt_scale 100
51
52 \graphics default
53 \default_output_format default
54 \output_sync 0
55 \bibtex_command default
56 \index_command default
57 \paperfontsize 12
58 \spacing single
59 \use_hyperref true
60 \pdf_title "The LyX Tutorial"
61 \pdf_author "LyX Team"
62 \pdf_subject "LyX-documentation Tutorial"
63 \pdf_keywords "LyX, documentation"
64 \pdf_bookmarks true
65 \pdf_bookmarksnumbered true
66 \pdf_bookmarksopen true
67 \pdf_bookmarksopenlevel 1
68 \pdf_breaklinks false
69 \pdf_pdfborder false
70 \pdf_colorlinks true
71 \pdf_backref false
72 \pdf_pdfusetitle false
73 \pdf_quoted_options "linkcolor=black, citecolor=black, urlcolor=blue, filecolor=blue,pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false"
74 \papersize default
75 \use_geometry false
76 \use_amsmath 0
77 \use_esint 0
78 \use_mhchem 1
79 \use_mathdots 1
80 \cite_engine basic
81 \use_bibtopic false
82 \use_indices false
83 \paperorientation portrait
84 \suppress_date false
85 \use_refstyle 0
86 \index Index
87 \shortcut idx
88 \color #008000
89 \end_index
90 \secnumdepth 3
91 \tocdepth 2
92 \paragraph_separation indent
93 \paragraph_indentation default
94 \quotes_language english
95 \papercolumns 1
96 \papersides 2
97 \paperpagestyle headings
98 \tracking_changes false
99 \output_changes false
100 \html_math_output 0
101 \html_css_as_file 0
102 \html_be_strict false
103 \end_header
104
105 \begin_body
106
107 \begin_layout Title
108 The LyX Tutorial
109 \end_layout
110
111 \begin_layout Author
112 by the LyX Team
113 \begin_inset Foot
114 status collapsed
115
116 \begin_layout Plain Layout
117 If you have comments or error corrections, please send them to the LyX Documenta
118 tion mailing list, 
119 \family typewriter
120
121 \begin_inset CommandInset href
122 LatexCommand href
123 target "lyx-docs@lists.lyx.org"
124 type "mailto:"
125
126 \end_inset
127
128
129 \family default
130 .
131 \end_layout
132
133 \end_inset
134
135
136 \end_layout
137
138 \begin_layout Standard
139 \begin_inset CommandInset toc
140 LatexCommand tableofcontents
141
142 \end_inset
143
144
145 \end_layout
146
147 \begin_layout Chapter
148 Introduction
149 \end_layout
150
151 \begin_layout Section
152 Welcome to LyX!
153 \end_layout
154
155 \begin_layout Standard
156 This file is designed for all of you who have never heard of LaTeX, or do
157  not know it very well.
158  Now, do not panic - you will not need to learn LaTeX to use LyX.
159  That is, after all, the whole point of LyX: to provide an almost-WYSIWYG
160  interface to LaTeX.
161  There are some things you will need to learn, however, in order to use
162  LyX effectively.
163 \end_layout
164
165 \begin_layout Standard
166 Some of you probably found your way to this document because you tried to
167  put two spaces after a 
168 \begin_inset Quotes eld
169 \end_inset
170
171 .
172 \begin_inset Quotes erd
173 \end_inset
174
175  or tried to put three blank lines between paragraphs.
176  You found out you could not and in fact, you will find out that most of
177  the little tricks you are accustomed to use in other word processors will
178  not work in LyX.
179  That is because most word processors you have  used before allow you to
180  manually enter all spacings, font changes, and so on.
181  So you end up not only writing a document but typesetting it, too.
182  LyX does the typesetting for you, in a consistent fashion, letting you
183  focus on the important things, like the content of your writing.
184 \end_layout
185
186 \begin_layout Standard
187 So read on to learn more about LyX.
188  Reading this tutorial is definitely worth the time.
189 \end_layout
190
191 \begin_layout Section
192 What the Tutorial 
193 \emph on
194 is
195 \emph default
196  and what it 
197 \emph on
198 is not
199 \end_layout
200
201 \begin_layout Standard
202 Before we get started with this section, we want to make a quick note of
203  something.
204  The 
205 \emph on
206 Tutorial
207 \emph default
208  uses the notation outlined in the 
209 \emph on
210 Introduction
211 \emph default
212  manual.
213  If you came to this manual first, please read the 
214 \emph on
215 Introduction
216 \emph default
217  before you continue with the 
218 \emph on
219 Tutorial
220 \emph default
221 .
222 \end_layout
223
224 \begin_layout Standard
225 Now that you know which fonts mean what, we want to talk a bit about what
226  this 
227 \emph on
228 Tutorial
229 \emph default
230  is for.
231 \end_layout
232
233 \begin_layout Subsection
234 Getting the most out of the Tutorial
235 \end_layout
236
237 \begin_layout Standard
238 This tutorial consists of examples and exercises.
239  To get the most out of this document, you should read through the document,
240  typing all the little things we are telling you to type and trying out
241  all of the exercises to see if you get them right.
242  For convenience, you might want to print out the PDF version of this document.
243 \end_layout
244
245 \begin_layout Standard
246 If you are familiar with LaTeX, you will probably be able to read the 
247 \emph on
248 Tutorial
249 \emph default
250  somewhat faster, since many LyX ideas are just LaTeX ideas in disguise.
251  However, LyX has features you will want to learn about.
252  Even if you do not feel like reading the rest of the 
253 \emph on
254 Tutorial
255 \emph default
256 , you should definitely check out Section
257 \begin_inset space ~
258 \end_inset
259
260
261 \begin_inset CommandInset ref
262 LatexCommand ref
263 reference "sec:latexusers"
264
265 \end_inset
266
267 , which is specifically written for experienced LaTeX users.
268 \end_layout
269
270 \begin_layout Subsection
271 What you 
272 \emph on
273 will not
274 \emph default
275  find
276 \end_layout
277
278 \begin_layout Itemize
279 Detailed explanations of all of LyX's features.
280 \end_layout
281
282 \begin_deeper
283 \begin_layout Standard
284 Look in the 
285 \emph on
286 User's Guide
287 \emph default
288  when you need this.
289 \end_layout
290
291 \end_deeper
292 \begin_layout Itemize
293 Detailed explanations of LaTeX.
294 \end_layout
295
296 \begin_deeper
297 \begin_layout Standard
298 Unnecessary.
299  If you want to learn some of the neat tricks you can do with LaTeX in LyX,
300  you can have a look at the 
301 \emph on
302 Embedded
303 \begin_inset space ~
304 \end_inset
305
306 Objects
307 \emph default
308  manual.
309 \end_layout
310
311 \end_deeper
312 \begin_layout Standard
313 It is time to move onwards, time for your first document \SpecialChar \ldots{}
314
315 \end_layout
316
317 \begin_layout Chapter
318 Getting started with LyX
319 \end_layout
320
321 \begin_layout Section
322 Your first LyX document
323 \end_layout
324
325 \begin_layout Standard
326 OK\SpecialChar \@.
327  You are ready to start writing.
328  Before you do, there are a few things we need to mention, which will hopefully
329  make the Tutorial more instructive and useful.
330  
331 \end_layout
332
333 \begin_layout Standard
334 Because there is information we cannot give you in the Tutorial, the 
335 \emph on
336 first
337 \emph default
338  
339 \series medium
340 thing that you need to do is find the
341 \series default
342  other 
343 \series medium
344 help files.
345  This is very simple:
346 \series default
347  Start up LyX, Choose the 
348 \emph on
349 User's Guide
350 \emph default
351  from the 
352 \family sans
353 Help
354 \family default
355  menu.
356  You may want to load the 
357 \emph on
358 Tutorial
359 \emph default
360  as well (if you are not reading it within LyX already).
361  This way, you can read them while you are writing your own file.
362 \begin_inset Foot
363 status collapsed
364
365 \begin_layout Plain Layout
366 They can also serve as good examples of how to use the many features of
367  LyX.
368 \end_layout
369
370 \end_inset
371
372  Note that once you have got more than one document open, you can use the
373  
374 \family sans
375 View
376 \family default
377  menu or the document tabs to switch between them.
378 \end_layout
379
380 \begin_layout Standard
381 In this Tutorial, we are going to assume that you have a fully working version
382  of LyX, as well as a LaTeX-distribution, a DVI-, and a PDF-viewer.
383  This should be the case on all major Linux- and BSD-distributions, as well
384  as on Windows, where this is setup by the LyX installers.
385 \end_layout
386
387 \begin_layout Standard
388 Finally, we have written a file called 
389 \family typewriter
390 example_raw.lyx
391 \family default
392  to let you practice your LyX skills.
393  Imagine that it was typed by someone who did not know about any of LyX's
394  great features.
395  As you learn new LyX functions, we will suggest that you fix those parts
396  of 
397 \family typewriter
398 example_raw.lyx
399 \family default
400 .
401  It also contains `subtle' hints about how to fix things.
402 \begin_inset Foot
403 status collapsed
404
405 \begin_layout Plain Layout
406 The hints are located in yellow 
407 \begin_inset Quotes eld
408 \end_inset
409
410 Notes
411 \begin_inset Quotes erd
412 \end_inset
413
414 .
415  Access the text in a note by clicking on it.
416 \end_layout
417
418 \end_inset
419
420  If you want to cheat, or check what you have done, there is also a file
421  called 
422 \family typewriter
423 example_lyxified.lyx
424 \family default
425  which contains the same text written and typeset by a LyX master.
426 \end_layout
427
428 \begin_layout Standard
429 The example files can be found in the 
430 \family typewriter
431 examples
432 \family default
433  directory of LyX's installation folder.
434  Open the raw document, and use 
435 \family sans
436 File\SpecialChar \menuseparator
437 Save
438 \begin_inset space ~
439 \end_inset
440
441 As
442 \family default
443  to save a copy in your own directory for you to work on.
444  As you fix parts of the raw document, check to see how those changes affect
445  the DVI output.
446 \end_layout
447
448 \begin_layout Standard
449 By the way, the 
450 \family typewriter
451 examples
452 \family default
453  directory contains lots of other examples files.
454  They will show you how to do various fancy things with LyX.
455  After you have read the Tutorial, or when you are confused about how to
456  do something fancy in LyX, take a look at these files.
457 \end_layout
458
459 \begin_layout Subsection
460 Typing, Viewing, and Exporting
461 \end_layout
462
463 \begin_layout Itemize
464 Open a new file with 
465 \family sans
466 File\SpecialChar \menuseparator
467 New
468 \end_layout
469
470 \begin_layout Itemize
471 Type a sentence like: 
472 \family typewriter
473 This is my first LyX document!
474 \end_layout
475
476 \begin_layout Itemize
477 Save your document with 
478 \family sans
479 File\SpecialChar \menuseparator
480 Save
481 \begin_inset space ~
482 \end_inset
483
484 As\SpecialChar \@.
485
486 \end_layout
487
488 \begin_layout Itemize
489 Run LaTeX to create a DVI file, with 
490 \family sans
491 View\SpecialChar \menuseparator
492 DVI
493 \family default
494  or the toolbar button 
495 \begin_inset Graphics
496         filename ../images/buffer-view_dvi.png
497         scale 75
498
499 \end_inset
500
501 .
502  LyX will open a DVI-viewer program displaying your document as it will
503  look when printed.
504 \begin_inset Foot
505 status collapsed
506
507 \begin_layout Plain Layout
508 You can save time by leaving the DVI-viewer running in the background.
509  Then, you can use 
510 \family sans
511 View\SpecialChar \menuseparator
512 Update\SpecialChar \menuseparator
513 DVI
514 \family default
515  or the toolbar button 
516 \begin_inset Graphics
517         filename ../images/buffer-update_dvi.png
518         scale 75
519
520 \end_inset
521
522  and just click on the DVI-viewer window (or unminimize it) after LaTeX
523  finishes running.
524 \end_layout
525
526 \end_inset
527
528
529 \end_layout
530
531 \begin_layout Itemize
532 Export the ready to print document with 
533 \family sans
534 File\SpecialChar \menuseparator
535 Export
536 \family default
537  to a format you want
538 \family sans
539 .
540 \end_layout
541
542 \begin_layout Standard
543 Congratulations! You have written your first LyX document.
544  All of the rest is just details, which are covered in the other manuals.
545 \end_layout
546
547 \begin_layout Subsection
548 Simple Operations
549 \end_layout
550
551 \begin_layout Standard
552 LyX can of course do most of the things you are used to do with a word processor.
553  It will word-wrap and indent paragraphs automatically.
554  Here is a quick description of how to do some simple actions.
555 \end_layout
556
557 \begin_layout Description
558 Undo LyX has multiple levels of undo, which means you can undo everything
559  you have  done since your current editing session started, by selecting
560  
561 \family sans
562 Edit\SpecialChar \menuseparator
563 Undo
564 \family default
565  (toolbar button 
566 \begin_inset Graphics
567         filename ../images/undo.png
568         scale 75
569
570 \end_inset
571
572 ) over and over again.
573  If you undo too much, just select 
574 \family sans
575 Edit\SpecialChar \menuseparator
576 Redo
577 \family default
578  (toolbar button 
579 \begin_inset Graphics
580         filename ../images/redo.png
581         scale 75
582
583 \end_inset
584
585 ) to get it back.
586  
587 \end_layout
588
589 \begin_deeper
590 \begin_layout Standard
591 Currently, undo is limited to 100 steps.
592 \end_layout
593
594 \end_deeper
595 \begin_layout Description
596 Cut/Paste/Copy Use 
597 \family sans
598 Edit\SpecialChar \menuseparator
599 Cut
600 \family default
601  (toolbar button 
602 \begin_inset Graphics
603         filename ../images/cut.png
604         scale 75
605
606 \end_inset
607
608 ), 
609 \family sans
610 Edit\SpecialChar \menuseparator
611 Copy
612 \family default
613  (toolbar button 
614 \begin_inset Graphics
615         filename ../images/copy.png
616         scale 75
617
618 \end_inset
619
620 ), and 
621 \family sans
622 Edit\SpecialChar \menuseparator
623 Paste
624 \family default
625  (toolbar button 
626 \begin_inset Graphics
627         filename ../images/paste.png
628         scale 75
629
630 \end_inset
631
632 ) to cut, copy, and paste.
633  Or automatically paste selected text (including selections from other programs)
634  with the 
635 \emph on
636 middle mouse button
637 \emph default
638 .
639 \end_layout
640
641 \begin_layout Description
642 Find/Replace Use 
643 \family sans
644 Edit\SpecialChar \menuseparator
645 Find
646 \begin_inset space ~
647 \end_inset
648
649 &
650 \begin_inset space ~
651 \end_inset
652
653 Replace
654 \family default
655  (toolbar button 
656 \begin_inset Graphics
657         filename ../images/dialog-show_findreplace.png
658         scale 75
659
660 \end_inset
661
662 ) to search.
663  In the dialog, search with the 
664 \family sans
665 Find
666 \begin_inset space ~
667 \end_inset
668
669 Next
670 \family default
671  button, and use the 
672 \family sans
673 Replace
674 \family default
675  button to replace a word you have  found.
676 \begin_inset Foot
677 status collapsed
678
679 \begin_layout Plain Layout
680 Close the window when you are done or leave it open if you find it more
681  convenient.
682  Most dialog boxes in LyX can operate like this.
683  Just be sure you have the right window focus when you are trying to type
684  in the main LyX window or a LyX dialog.
685 \end_layout
686
687 \end_inset
688
689  If you like, you can specify whether to make the search case-sensitive,
690  or to search for only complete words; you can also search backwards through
691  the document.
692 \end_layout
693
694 \begin_layout Description
695 Character
696 \begin_inset space ~
697 \end_inset
698
699 Formatting You can 
700 \emph on
701 emphasize
702 \emph default
703  text (which will by default print characters in italics), set it in 
704 \series bold
705 bold face
706 \series default
707 , in 
708 \noun on
709 Noun Style
710 \noun default
711  (usually small caps, used for people's names), or use your own formatting
712  by using the 
713 \family sans
714 Edit\SpecialChar \menuseparator
715 Text
716 \begin_inset space ~
717 \end_inset
718
719 Style
720 \family default
721  dialog (toolbar button 
722 \begin_inset Graphics
723         filename ../images/dialog-show_character.png
724         scale 75
725
726 \end_inset
727
728 ).
729 \end_layout
730
731 \begin_layout Description
732 Toolbar There are buttons on the toolbar (just below the menus) which allow
733  you to do some of the more popular functions, such as 
734 \family sans
735 Paste
736 \family default
737  and 
738 \family sans
739 Print
740 \family default
741 .
742 \end_layout
743
744 \begin_layout Standard
745 Of course, you have not yet written enough to make most of these functions
746  useful.
747  As you write more, though, try undoing, pasting, etc.
748 \end_layout
749
750 \begin_layout Subsection
751 WYSIWYM: Whitespace in LyX
752 \end_layout
753
754 \begin_layout Standard
755 One of the hardest things for new users to get used to is the way that LyX
756  handles whitespace.
757  As many times as you hit 
758 \family sans
759 Return
760 \family default
761 , you will only get one blank line.
762  As many times as you hit 
763 \family sans
764 Space
765 \family default
766 , you will only get one space.
767  On a blank line, LyX will not let you type even one space.
768  The 
769 \family sans
770 Tab
771 \family default
772  key will not move you forward one tab stop; in fact there 
773 \emph on
774 are
775 \emph default
776  no tab stops! There is no ruler at the top of the page to let you set tabs
777  or margins, either.
778 \end_layout
779
780 \begin_layout Standard
781 Many word processors are based on the WYSIWYG principle: 
782 \begin_inset Quotes eld
783 \end_inset
784
785 What You See Is What You Get.
786 \begin_inset Quotes erd
787 \end_inset
788
789  LyX, on the other hand, is based on the principle that 
790 \begin_inset Quotes eld
791 \end_inset
792
793 What You See Is What You 
794 \emph on
795 Mean
796 \emph default
797 .
798 \begin_inset Quotes erd
799 \end_inset
800
801  You type what you mean, and LyX will take care of typesetting it for you,
802  so that the output looks nice.
803  A 
804 \family sans
805 Return
806 \family default
807  grammatically separates paragraphs, and a 
808 \family sans
809 Space
810 \family default
811  grammatically separates words, so there is no reason to have several of
812  them in a row; a 
813 \family sans
814 Tab
815 \family default
816  has no grammatical function at all, so LyX does not support it.
817  Using LyX, you will spend more of your time worrying about the 
818 \emph on
819 content
820 \emph default
821  of your document, and less time worrying about the 
822 \emph on
823 format.
824
825 \emph default
826  See the 
827 \emph on
828 Introduction
829 \emph default
830  for more information on the WYSIWYM concept.
831 \end_layout
832
833 \begin_layout Standard
834 LyX does have (many) ways to fine-tune the formatting of your document.
835  After all, LyX might not typeset 
836 \emph on
837 exactly
838 \emph default
839  what you mean.
840  The 
841 \emph on
842 User's Guide
843 \emph default
844  has information about all that.
845  It includes horizontal fills and vertical space — which are more powerful
846  and versatile than multiple spaces or blank lines — and ways to change
847  font sizes, character styles, and paragraph alignments by hand.
848  The idea, though, is that you can write your whole document, focusing on
849  content, and just worry about that fine-tuning at the end.
850  With standard word processors, you will be distracted by document formatting
851  throughout the writing process.
852 \end_layout
853
854 \begin_layout Section
855 Environments
856 \end_layout
857
858 \begin_layout Standard
859 Different parts of a document have different purposes; we call these parts
860  
861 \emph on
862 environments
863 \emph default
864 .
865  Most of a document is made up of regular text.
866  Section titles (chapter, subsection, etc.) let the reader know that a new
867  topic or subtopic will be discussed.
868  Certain types of documents have special environments.
869  A journal article will have an abstract and a title.
870  A letter will have neither of these, but will probably have an environment
871  that gives the writer's address.
872 \end_layout
873
874 \begin_layout Standard
875 Environments are a major part of the 
876 \begin_inset Quotes eld
877 \end_inset
878
879 What You See Is What You Mean
880 \begin_inset Quotes erd
881 \end_inset
882
883  philosophy of LyX.
884  A given environment may require a certain font style, font size, indenting,
885  line spacing, and more.
886  This problem is aggravated, because the exact formatting for a given environmen
887 t may change: one journal may use boldface, 18 point, centered type for
888  section titles while another uses italicized, 15 point, left justified
889  type; different languages may have different standards for indenting; and
890  bibliography formats can vary widely.
891  LyX lets you avoid learning all the different formatting styles.
892 \end_layout
893
894 \begin_layout Standard
895 The 
896 \family sans
897 Environment
898 \family default
899  choice box is located on the left end of the toolbar and looks like this:
900  
901 \begin_inset Graphics
902         filename clipart/ToolbarEnvBox.png
903         scale 75
904         clip
905
906 \end_inset
907
908 .
909  It indicates in which environment you are currently writing.
910  While you were writing your first document, it said 
911 \begin_inset Quotes eld
912 \end_inset
913
914 Standard,
915 \begin_inset Quotes erd
916 \end_inset
917
918  which is the default environment for text.
919  Now you will put a number of environments in your new document so that
920  you can see how they work.
921 \end_layout
922
923 \begin_layout Subsection
924 Sections and Subsections
925 \end_layout
926
927 \begin_layout Standard
928 Type the word 
929 \family typewriter
930 Introduction
931 \family default
932  on the first line of your LyX file, and select 
933 \family sans
934 Section
935 \family default
936  in the 
937 \family sans
938 Environment
939 \family default
940  box.
941 \begin_inset Foot
942 status collapsed
943
944 \begin_layout Plain Layout
945 You do not have to 
946 \emph on
947 select
948 \emph default
949  the line.
950  If nothing is selected, LyX changes the paragraph you are currently in
951  to the selected environment.
952  Alternatively, you can change several paragraphs to a different environment
953  by selecting them before picking an environment.
954 \end_layout
955
956 \end_inset
957
958  Be sure to use 
959 \family sans
960 Section
961 \family default
962  and 
963 \emph on
964 not
965 \emph default
966  
967 \family sans
968 Section*
969 \family default
970 , which will be covered below.
971  LyX numbers the section 
972 \begin_inset Quotes eld
973 \end_inset
974
975 1
976 \begin_inset Quotes erd
977 \end_inset
978
979  and typesets the section heading (title) in a larger font.
980  Now hit 
981 \family sans
982 Return
983 \family default
984 \SpecialChar \@.
985  Note that the 
986 \family sans
987 Environment
988 \family default
989  box changes from 
990 \begin_inset Quotes eld
991 \end_inset
992
993 Section
994 \begin_inset Quotes erd
995 \end_inset
996
997  back to 
998 \begin_inset Quotes eld
999 \end_inset
1000
1001 Standard
1002 \begin_inset Quotes erd
1003 \end_inset
1004
1005 .
1006  Section headings, like most environments, are assumed to end when you type
1007  
1008 \family sans
1009 Return
1010 \family default
1011 \SpecialChar \@.
1012  Type the document introduction: 
1013 \end_layout
1014
1015 \begin_layout LyX-Code
1016 This is an introduction to my first LyX document.
1017 \end_layout
1018
1019 \begin_layout Standard
1020 Hit 
1021 \family sans
1022 Return
1023 \family default
1024  again, and select 
1025 \family sans
1026 Section
1027 \family default
1028  from the 
1029 \family sans
1030 Environment
1031 \family default
1032  box again.
1033  LyX writes a 
1034 \begin_inset Quotes eld
1035 \end_inset
1036
1037 2
1038 \begin_inset Quotes erd
1039 \end_inset
1040
1041  and waits for you to type a title.
1042  Type 
1043 \begin_inset Quotes eld
1044 \end_inset
1045
1046
1047 \family typewriter
1048 More
1049 \begin_inset space ~
1050 \end_inset
1051
1052 Stuff
1053 \family default
1054
1055 \begin_inset Quotes erd
1056 \end_inset
1057
1058 , and you will see that LyX again sets it as a section title.
1059 \end_layout
1060
1061 \begin_layout Standard
1062 It gets better.
1063  Go to the end of Section
1064 \begin_inset space ~
1065 \end_inset
1066
1067 1 again (after 
1068 \begin_inset Quotes eld
1069 \end_inset
1070
1071 my first LyX document
1072 \begin_inset Quotes erd
1073 \end_inset
1074
1075 ) and hit 
1076 \family sans
1077 Return
1078 \family default
1079  again, and select 
1080 \family sans
1081 Section
1082 \family default
1083  from the 
1084 \family sans
1085 Environment
1086 \family default
1087  box again.
1088  Again, LyX writes 
1089 \begin_inset Quotes eld
1090 \end_inset
1091
1092 2
1093 \begin_inset Quotes erd
1094 \end_inset
1095
1096  and waits for you to type a title.
1097  Type 
1098 \family typewriter
1099 About This Document
1100 \family default
1101 .
1102  Section
1103 \begin_inset space ~
1104 \end_inset
1105
1106
1107 \begin_inset Quotes eld
1108 \end_inset
1109
1110 More Stuff
1111 \begin_inset Quotes erd
1112 \end_inset
1113
1114 , which was Section
1115 \begin_inset space ~
1116 \end_inset
1117
1118 2, has been automatically renumbered to Section
1119 \begin_inset space ~
1120 \end_inset
1121
1122 3! In true WYSIWYM fashion, you just need to identify the text that makes
1123  up the section titles, and LyX takes care of numbering the sections and
1124  typesetting them.
1125 \end_layout
1126
1127 \begin_layout Standard
1128 Hit 
1129 \family sans
1130 Return
1131 \family default
1132  to get back to the 
1133 \family sans
1134 Standard
1135 \family default
1136  environment, and type the following five lines:
1137 \end_layout
1138
1139 \begin_layout LyX-Code
1140 Sections and subsections are described below.
1141 \end_layout
1142
1143 \begin_layout LyX-Code
1144 Section Description
1145 \end_layout
1146
1147 \begin_layout LyX-Code
1148 Sections are bigger than subsections.
1149 \end_layout
1150
1151 \begin_layout LyX-Code
1152 Subsection description
1153 \end_layout
1154
1155 \begin_layout LyX-Code
1156 Subsections are smaller than sections.
1157 \end_layout
1158
1159 \begin_layout Standard
1160 Click on the second line and select 
1161 \family sans
1162 Subsection
1163 \family default
1164  from the 
1165 \family sans
1166 Environment
1167 \family default
1168  box.
1169  LyX numbers the subsection 
1170 \begin_inset Quotes eld
1171 \end_inset
1172
1173 2.1
1174 \begin_inset Quotes erd
1175 \end_inset
1176
1177 , and typesets it in a font which is bigger than regular text but smaller
1178  than the section title.
1179  Change the fourth line to the 
1180 \family sans
1181 Subsection
1182 \family default
1183  environment as well.
1184  As you probably expected, LyX automatically numbered the section 
1185 \begin_inset Quotes eld
1186 \end_inset
1187
1188 2.2
1189 \begin_inset Quotes erd
1190 \end_inset
1191
1192 .
1193  If you put yet another section before Section
1194 \begin_inset space ~
1195 \end_inset
1196
1197 2, Section
1198 \begin_inset space ~
1199 \end_inset
1200
1201 2 will be renumbered as Section 3, and the subsections will be renumbered
1202  to 
1203 \begin_inset Quotes eld
1204 \end_inset
1205
1206 3.1
1207 \begin_inset Quotes erd
1208 \end_inset
1209
1210  and 
1211 \begin_inset Quotes eld
1212 \end_inset
1213
1214 3.2
1215 \begin_inset Quotes erd
1216 \end_inset
1217
1218 .
1219  
1220 \end_layout
1221
1222 \begin_layout Standard
1223 Further levels of sectioning include 
1224 \family sans
1225 Subsubsection
1226 \family default
1227
1228 \family sans
1229 Paragraph
1230 \family default
1231 , and 
1232 \family sans
1233 Subparagraph
1234 \family default
1235 .
1236  We will let you play with these on your own.
1237  You may notice that paragraph and subparagraph headings are not numbered
1238  by default, and that subparagraphs are indented; see the 
1239 \emph on
1240 User's Guide
1241 \emph default
1242  for an explanation and how to change this.
1243  
1244 \family sans
1245 Chapter
1246 \family default
1247  headings are actually the highest level of sectioning, above 
1248 \family sans
1249 Section
1250 \family default
1251 s, but you are only allowed to use them in certain types (text classes)
1252  of LyX documents (see Section
1253 \begin_inset space ~
1254 \end_inset
1255
1256
1257 \begin_inset CommandInset ref
1258 LatexCommand ref
1259 reference "sec:Document-Classes"
1260
1261 \end_inset
1262
1263 ).
1264  
1265 \end_layout
1266
1267 \begin_layout Standard
1268 Finally, you may want to have sections or subsections that are not numbered.
1269  There are environments for this as well.
1270  If you change one of your section headings to the 
1271 \family sans
1272 Section*
1273 \family default
1274  environment (you may have to scroll down in the 
1275 \family sans
1276 Environment
1277 \family default
1278  box to find it), LyX will use the same font size for the heading as it
1279  uses for a regular section, but it will not number that section.
1280  There are corresponding 
1281 \begin_inset Quotes eld
1282 \end_inset
1283
1284 starred
1285 \begin_inset Quotes erd
1286 \end_inset
1287
1288  heading environments for 
1289 \family sans
1290 Subsection
1291 \family default
1292  and 
1293 \family sans
1294 Subsubsection
1295 \family default
1296 .
1297  Try changing some of your sections or subsections to the starred environments,
1298  and note how the other section numbers are updated.
1299 \end_layout
1300
1301 \begin_layout Standard
1302
1303 \series bold
1304 Exercise
1305 \series default
1306 : Fix the section and subsection headings in 
1307 \family typewriter
1308 example_raw.lyx
1309 \family default
1310 .
1311  
1312 \end_layout
1313
1314 \begin_layout Subsection
1315 Lists and sublists
1316 \end_layout
1317
1318 \begin_layout Standard
1319 LyX has several different environments for typesetting lists.
1320  The various list environments free you from hitting 
1321 \family sans
1322 Tab
1323 \family default
1324  a million times when writing an outline, or from renumbering a whole list
1325  when you want to add a point in the middle of the list.
1326  Different types of documents logically require different list environments:
1327 \end_layout
1328
1329 \begin_layout Itemize
1330 A slide presentation might use the 
1331 \family sans
1332 Itemize
1333 \family default
1334  environment's bulleted lists to describe different points.
1335  
1336 \end_layout
1337
1338 \begin_layout Itemize
1339 An outline would use the 
1340 \family sans
1341 Enumerate
1342 \family default
1343  environment's numbered lists (and lettered sublists).
1344  
1345 \end_layout
1346
1347 \begin_layout Itemize
1348 A document describing several software packages could use the 
1349 \family sans
1350 Description
1351 \family default
1352  environment, where each item in the list begins with a bold-faced word.
1353  
1354 \end_layout
1355
1356 \begin_layout Itemize
1357 The 
1358 \family sans
1359 List
1360 \family default
1361  environment is a variation on the 
1362 \family sans
1363 Description
1364 \family default
1365  environment.
1366 \end_layout
1367
1368 \begin_layout Standard
1369 Let us write a list of reasons why LyX is better than other word processors.
1370  Somewhere in your document, type:
1371 \end_layout
1372
1373 \begin_layout Standard
1374
1375 \family typewriter
1376 LyX is better than other word processors because: 
1377 \end_layout
1378
1379 \begin_layout Standard
1380 and hit 
1381 \family sans
1382 Return
1383 \family default
1384 .
1385  Now select 
1386 \family sans
1387 Itemize
1388 \family default
1389  from the 
1390 \family sans
1391 Environment
1392 \family default
1393  box.
1394  LyX writes a 
1395 \begin_inset Quotes eld
1396 \end_inset
1397
1398 bullet
1399 \begin_inset Quotes erd
1400 \end_inset
1401
1402  on the line.
1403  Type in your reasons: 
1404 \end_layout
1405
1406 \begin_layout LyX-Code
1407 Typesetting is done for you.
1408 \end_layout
1409
1410 \begin_layout LyX-Code
1411 Math is WYSIWYG
1412 \end_layout
1413
1414 \begin_layout LyX-Code
1415 Lists are very easy to create!
1416 \end_layout
1417
1418 \begin_layout Standard
1419 List environments, unlike headings, do not end when you type 
1420 \family sans
1421 Return
1422 \family default
1423 .
1424  Instead, LyX assumes you are going on to the next item in the list.
1425  The above will therefore result in a three-item list.
1426  If you want more than one paragraph within one list 
1427 \emph on
1428 item
1429 \emph default
1430 , one way is to use the 
1431 \family sans
1432 Protected
1433 \begin_inset space ~
1434 \end_inset
1435
1436 Break
1437 \family default
1438 , which you get by typing 
1439 \family sans
1440 Ctrl+Return
1441 \family default
1442 .
1443  In order to get out of the list, you need to reselect the 
1444 \family sans
1445 Standard
1446 \family default
1447  environment (or just use the key binding, 
1448 \family sans
1449 Alt+P
1450 \begin_inset space ~
1451 \end_inset
1452
1453 S
1454 \family default
1455 ).
1456 \end_layout
1457
1458 \begin_layout Standard
1459 You have got a beautiful itemized list.
1460  You might want to run LaTeX to see how the list looks when printed out.
1461  But what if you wanted to number the reasons? Well, just select the whole
1462  list
1463 \begin_inset Foot
1464 status collapsed
1465
1466 \begin_layout Plain Layout
1467 LyX will not let you select the first bullet unless you also select the
1468  paragraph 
1469 \emph on
1470 before
1471 \emph default
1472  the list, which you probably do not want to do.
1473  Similarly, you cannot select the actual number in a numbered section title.
1474  This is on purpose because the bullet or number depends on the document
1475  settings or text position, respectively.
1476 \end_layout
1477
1478 \end_inset
1479
1480  and choose 
1481 \family sans
1482 Enumerate
1483 \family default
1484  from the 
1485 \family sans
1486 Environment
1487 \family default
1488  box.
1489  Pow! As we mentioned, if you add or delete a list item, LyX will fix the
1490  numbering.
1491 \end_layout
1492
1493 \begin_layout Standard
1494 While the list is still selected, you can change to the other two list environme
1495 nts, 
1496 \family sans
1497 Description
1498 \family default
1499  and 
1500 \family sans
1501 List
1502 \family default
1503 , in order to see what they look like.
1504  For those two environments, each list item is made up of a term, which
1505  is the item's first word, followed by a definition, which is the rest of
1506  the paragraph (until you hit 
1507 \family sans
1508 Return
1509 \family default
1510 .) The term is either typeset in boldface (
1511 \family sans
1512 Description
1513 \family default
1514 ) or separated by a 
1515 \begin_inset Quotes eld
1516 \end_inset
1517
1518 Tab
1519 \begin_inset Quotes erd
1520 \end_inset
1521
1522
1523 \begin_inset Foot
1524 status collapsed
1525
1526 \begin_layout Plain Layout
1527 But a typesetter's tab, which will change to fit the size of the largest
1528  term, not a pathetic, rigid, unchangeable typewriter 
1529 \family sans
1530 Tab
1531 \family default
1532 .
1533 \end_layout
1534
1535 \end_inset
1536
1537  (
1538 \family sans
1539 List
1540 \family default
1541 ) from the rest of the paragraph.
1542  If you want to have more than one word in the definition, then separate
1543  the words with 
1544 \family sans
1545 Protected
1546 \begin_inset space ~
1547 \end_inset
1548
1549 Space
1550 \family default
1551 s.
1552 \end_layout
1553
1554 \begin_layout Standard
1555
1556 \series bold
1557 Exercise
1558 \series default
1559 : Typeset the list in 
1560 \family typewriter
1561 example_raw.lyx
1562 \end_layout
1563
1564 \begin_layout Standard
1565 You can nest lists within each other in all sorts of interesting ways.
1566  An obvious example would be writing outlines.
1567  Numbered and bulleted lists will have different numbering and bulleting
1568  schemes for sublists.
1569  See the 
1570 \emph on
1571 User's Guide
1572 \emph default
1573  for details on the different sorts of lists and for examples of nestings.
1574 \end_layout
1575
1576 \begin_layout Subsection
1577 Other environments: Verses, Quotations, and more
1578 \end_layout
1579
1580 \begin_layout Standard
1581 There are two environments for setting quotations apart from surrounding
1582  text: 
1583 \family sans
1584 Quote
1585 \family default
1586  for short quotes and 
1587 \family sans
1588 Quotation
1589 \family default
1590  for longer ones.
1591  Computer code (the 
1592 \family sans
1593 LyX-Code
1594 \family default
1595  environment 
1596 \begin_inset Foot
1597 status collapsed
1598
1599 \begin_layout Plain Layout
1600 used in this Tutorial for the long typing examples
1601 \end_layout
1602
1603 \end_inset
1604
1605 ) is written in a 
1606 \family typewriter
1607 typewriter
1608 \family default
1609  font; this environment is the only place in LyX where you are allowed to
1610  use multiple spaces to allow code indenting.
1611  You can even write poetry using the 
1612 \family sans
1613 Verse
1614 \family default
1615  style, using 
1616 \family sans
1617 Return
1618 \family default
1619  to separate stanzas, and 
1620 \family sans
1621 Ctrl+Return
1622 \family default
1623  to separate lines within a stanza.
1624  See the 
1625 \emph on
1626 User's Guide
1627 \emph default
1628  for more complete descriptions of all of the available LyX environments.
1629 \end_layout
1630
1631 \begin_layout Standard
1632
1633 \series bold
1634 Exercise
1635 \series default
1636 : Correctly typeset the 
1637 \family sans
1638 Quote, LyX-Code,
1639 \family default
1640  and 
1641 \family sans
1642 Verse
1643 \family default
1644  in
1645 \begin_inset Newline newline
1646 \end_inset
1647
1648
1649 \family typewriter
1650 example_raw.lyx
1651 \end_layout
1652
1653 \begin_layout Chapter
1654 Writing Documents
1655 \end_layout
1656
1657 \begin_layout Standard
1658 The previous chapter hopefully allowed you to get used to writing in LyX.
1659  It introduced you to the basic editing operations in LyX, as well as the
1660  powerful method of writing with environments.
1661  Most people who use LyX, though, will want to write documents: papers,
1662  articles, books, manuals, or letters.
1663  This chapter is meant to take you from simply writing text with LyX to
1664  writing a complete document.
1665  It will introduce you to text classes, which allow you to write different
1666  sorts of documents.
1667  It will then describe many of the additions that turn text into a document,
1668  such as titles, footnotes, cross references, bibliographies, and tables
1669  of contents.
1670 \end_layout
1671
1672 \begin_layout Section
1673 Document Classes
1674 \begin_inset CommandInset label
1675 LatexCommand label
1676 name "sec:Document-Classes"
1677
1678 \end_inset
1679
1680
1681 \end_layout
1682
1683 \begin_layout Standard
1684 Different sorts of documents should be typeset differently.
1685  For example, books are generally printed double-sided, while articles are
1686  single-sided.
1687  In addition, many documents contain special environments: letters contain
1688  some environments — such as the sender's address and the signature — which
1689  do not make sense in a book or article.
1690  The LyX 
1691 \emph on
1692 document class
1693 \emph default
1694
1695 \begin_inset Foot
1696 status collapsed
1697
1698 \begin_layout Plain Layout
1699 for LaTeX users: this is equivalent to the LaTeX document class
1700 \end_layout
1701
1702 \end_inset
1703
1704  takes care of these large scale differences between different sorts of
1705  documents.
1706  This Tutorial, for example, was written in the 
1707 \family sans
1708 Book
1709 \family default
1710  document class.
1711  Document classes are another major part of the WYSIWYM philosophy; they
1712  tell LyX how to typeset the document, so you do not need to know how.
1713 \end_layout
1714
1715 \begin_layout Standard
1716 Your document is probably being written in the 
1717 \family sans
1718 Article
1719 \family default
1720  document class.
1721 \begin_inset Foot
1722 status collapsed
1723
1724 \begin_layout Plain Layout
1725 That is usually the default document class
1726 \end_layout
1727
1728 \end_inset
1729
1730  Try changing to other document classes (using the 
1731 \family sans
1732 Document\SpecialChar \menuseparator
1733 Settings
1734 \family default
1735  dialog) to see how they are typeset differently.
1736  If you change your document to the 
1737 \family sans
1738 Book
1739 \family default
1740  document class and look at the 
1741 \family sans
1742 Environment
1743 \family default
1744  box, you will see that most of the allowed environments are the same.
1745  However, you can now use the 
1746 \family sans
1747 Chapter
1748 \family default
1749  environment.
1750  If you are ever unsure about which environments you can use in a given
1751  document class, just consult the 
1752 \family sans
1753 Environment
1754 \family default
1755  box.
1756 \end_layout
1757
1758 \begin_layout Standard
1759 Font sizes, one- or two-column printing, and page headings are just some
1760  of the ways journals' typesettings differ from one another.
1761  As the Computer Age continues to mature, journals have begun accepting
1762  electronic submissions, creating LaTeX 
1763 \begin_inset Quotes eld
1764 \end_inset
1765
1766 style files
1767 \begin_inset Quotes erd
1768 \end_inset
1769
1770  so that authors can submit correctly typeset articles.
1771  LyX is set up to support this as well.
1772  For example, LyX supports typesetting (and extra environments) for the
1773  American Mathematics Society journals using the 
1774 \family sans
1775 Article
1776 \begin_inset space ~
1777 \end_inset
1778
1779 (AMS)
1780 \family default
1781  document class.
1782 \end_layout
1783
1784 \begin_layout Standard
1785 Here is a very quick reference to some of the document classes.
1786  See the 
1787 \emph on
1788 Special Document Classes
1789 \emph default
1790  section of the 
1791 \emph on
1792 Additional Features
1793 \emph default
1794  manual for many more details.
1795 \end_layout
1796
1797 \begin_layout Standard
1798 \align center
1799 \begin_inset Tabular
1800 <lyxtabular version="3" rows="7" columns="2">
1801 <features tabularvalignment="middle">
1802 <column alignment="center" valignment="top" width="0pt">
1803 <column alignment="center" valignment="top" width="0pt">
1804 <row>
1805 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1806 \begin_inset Text
1807
1808 \begin_layout Plain Layout
1809 Name
1810 \end_layout
1811
1812 \end_inset
1813 </cell>
1814 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1815 \begin_inset Text
1816
1817 \begin_layout Plain Layout
1818 Notes
1819 \end_layout
1820
1821 \end_inset
1822 </cell>
1823 </row>
1824 <row>
1825 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1826 \begin_inset Text
1827
1828 \begin_layout Plain Layout
1829 article
1830 \end_layout
1831
1832 \end_inset
1833 </cell>
1834 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1835 \begin_inset Text
1836
1837 \begin_layout Plain Layout
1838 one-sided, no chapters
1839 \end_layout
1840
1841 \end_inset
1842 </cell>
1843 </row>
1844 <row>
1845 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1846 \begin_inset Text
1847
1848 \begin_layout Plain Layout
1849 article (AMS)
1850 \end_layout
1851
1852 \end_inset
1853 </cell>
1854 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1855 \begin_inset Text
1856
1857 \begin_layout Plain Layout
1858 layout & environments for American Math Society
1859 \end_layout
1860
1861 \end_inset
1862 </cell>
1863 </row>
1864 <row>
1865 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1866 \begin_inset Text
1867
1868 \begin_layout Plain Layout
1869 report
1870 \end_layout
1871
1872 \end_inset
1873 </cell>
1874 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1875 \begin_inset Text
1876
1877 \begin_layout Plain Layout
1878 longer than article, two-sided
1879 \end_layout
1880
1881 \end_inset
1882 </cell>
1883 </row>
1884 <row>
1885 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
1886 \begin_inset Text
1887
1888 \begin_layout Plain Layout
1889 book
1890 \end_layout
1891
1892 \end_inset
1893 </cell>
1894 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
1895 \begin_inset Text
1896
1897 \begin_layout Plain Layout
1898 report + front and back matter
1899 \end_layout
1900
1901 \end_inset
1902 </cell>
1903 </row>
1904 <row>
1905 <cell alignment="center" valignment="top" bottomline="true" leftline="true" usebox="none">
1906 \begin_inset Text
1907
1908 \begin_layout Plain Layout
1909 presentation
1910 \end_layout
1911
1912 \end_inset
1913 </cell>
1914 <cell alignment="center" valignment="top" bottomline="true" leftline="true" rightline="true" usebox="none">
1915 \begin_inset Text
1916
1917 \begin_layout Plain Layout
1918 transparencies
1919 \end_layout
1920
1921 \end_inset
1922 </cell>
1923 </row>
1924 <row>
1925 <cell alignment="center" valignment="top" bottomline="true" leftline="true" usebox="none">
1926 \begin_inset Text
1927
1928 \begin_layout Plain Layout
1929 letter
1930 \end_layout
1931
1932 \end_inset
1933 </cell>
1934 <cell alignment="center" valignment="top" bottomline="true" leftline="true" rightline="true" usebox="none">
1935 \begin_inset Text
1936
1937 \begin_layout Plain Layout
1938 lots of extra environments for address, signature\SpecialChar \ldots{}
1939
1940 \end_layout
1941
1942 \end_inset
1943 </cell>
1944 </row>
1945 </lyxtabular>
1946
1947 \end_inset
1948
1949
1950 \end_layout
1951
1952 \begin_layout Section
1953 Templates: Writing a Letter
1954 \end_layout
1955
1956 \begin_layout Standard
1957 One way to write a letter would be to open a new file, and choose a 
1958 \family sans
1959 Letter
1960 \family default
1961  class in the 
1962 \family sans
1963 Document\SpecialChar \menuseparator
1964 Settings
1965 \family default
1966  dialog.
1967  While this is the most obvious way to write a letter, it seems like extra
1968  work.
1969  Every time you write a business letter, you want to have your address,
1970  the address to which you are sending it, a body, a signature, etc.
1971  LyX therefore has a 
1972 \emph on
1973 template
1974 \emph default
1975  for letters, which contains a sample letter; once you have a template,
1976  you can just replace a couple of parts of the letter with your text each
1977  time you write a letter.
1978 \end_layout
1979
1980 \begin_layout Standard
1981 Open a new file with 
1982 \family sans
1983 File\SpecialChar \menuseparator
1984 New
1985 \begin_inset space ~
1986 \end_inset
1987
1988 from
1989 \begin_inset space ~
1990 \end_inset
1991
1992 Template
1993 \family default
1994 .
1995  Select 
1996 \family typewriter
1997 letter.lyx
1998 \family default
1999  as the template.
2000  Save and print the file to see how the various environments are typeset.
2001 \end_layout
2002
2003 \begin_layout Standard
2004 When you look at the 
2005 \family sans
2006 Environment
2007 \family default
2008  box, you will see several environments, like the 
2009 \family sans
2010 My
2011 \begin_inset space ~
2012 \end_inset
2013
2014 Address
2015 \family default
2016  environment, which do not even exist in most other document classes.
2017  Others, like 
2018 \family sans
2019 Description
2020 \family default
2021 , are familiar.
2022  You can play around for a while to figure out how the various environments
2023  work.
2024  You will notice for example that the 
2025 \family sans
2026 Signature
2027 \family default
2028  environment has the word 
2029 \begin_inset Quotes eld
2030 \end_inset
2031
2032 Signature:
2033 \begin_inset Quotes eld
2034 \end_inset
2035
2036  in red before the actual text of the signature.
2037  This word does not show up in the actual letter, as you will see if you
2038  view/export the file.
2039  It is just there to let you know where the signature goes.
2040  Also, note that it does not matter where in the file the 
2041 \family sans
2042 Signature
2043 \family default
2044  line is placed.
2045  Remember, LyX is WYSIWYM; you can put the 
2046 \family sans
2047 Signature
2048 \family default
2049  environment anywhere you want, but LyX knows that in the printout, the
2050  signature should be at the end.
2051 \end_layout
2052
2053 \begin_layout Standard
2054 A template is just a regular LyX file.
2055  This means you can fill in your address and signature and save the file
2056  as a new template.
2057  From now on, any time you want to write a letter, you can use the new template
2058  to save time.
2059  We do not have to suggest an actual 
2060 \begin_inset Quotes eld
2061 \end_inset
2062
2063 exercise
2064 \begin_inset Quotes erd
2065 \end_inset
2066
2067  here; just write a letter to someone!
2068 \begin_inset Foot
2069 status collapsed
2070
2071 \begin_layout Plain Layout
2072 One warning, if you are writing from a template.
2073  If you erase all of the text in an environment — for example, if you erase
2074  the whole 
2075 \family sans
2076 My
2077 \begin_inset space ~
2078 \end_inset
2079
2080 Address
2081 \family default
2082  field so that you can replace it with your own — and then you move the
2083  cursor without writing any text, the environment may disappear.
2084  This is because most environments cannot exist without any text in them.
2085  Just reselect the environment from the 
2086 \family sans
2087 Environment
2088 \family default
2089  box to get it back.
2090 \end_layout
2091
2092 \end_inset
2093
2094
2095 \end_layout
2096
2097 \begin_layout Standard
2098 Templates can be a huge time-saver, and we urge you to use them whenever
2099  possible.
2100  In addition, they can help a person learn how to use some of the fancier
2101  document classes.
2102  Finally, they may be useful for a person who is configuring LyX for a bunch
2103  of less computer-aware users.
2104  When they are first learning LyX, it will be much less intimidating if
2105  they have a letter template customized for their company, for example.
2106 \end_layout
2107
2108 \begin_layout Section
2109 Document Titles
2110 \end_layout
2111
2112 \begin_layout Standard
2113 LyX (like LaTeX) considers the title — which may contain the actual title,
2114  the author, the date, and even an abstract of a paper — to be a separate
2115  part of the document.
2116 \end_layout
2117
2118 \begin_layout Standard
2119 Go back to your LyX document and make sure it is using the 
2120 \family sans
2121 Article
2122 \family default
2123  document class.
2124 \begin_inset Foot
2125 status collapsed
2126
2127 \begin_layout Plain Layout
2128 You should not be using the letter any more, since the 
2129 \family sans
2130 Letter
2131 \family default
2132  document class does not allow titles.
2133 \end_layout
2134
2135 \end_inset
2136
2137  Type a title on the first line, and change the line to the 
2138 \family sans
2139 Title
2140 \family default
2141  environment.
2142  On the next line, type your name and change it to the 
2143 \family sans
2144 Author
2145 \family default
2146  environment.
2147  On the next line, write the date in the 
2148 \family sans
2149 Date
2150 \family default
2151  environment.
2152  Type a paragraph or two summarizing your document using the 
2153 \family sans
2154 Abstract
2155 \family default
2156  environment.
2157  Notice how the title is presented when it is printed out.
2158  If you change the document format to Book, you will get a separate title
2159  page, like the first page of this tutorial.
2160 \end_layout
2161
2162 \begin_layout Standard
2163
2164 \series bold
2165 Exercise
2166 \series default
2167 : Fix the title, date, and author in 
2168 \family typewriter
2169 example_raw.lyx
2170 \end_layout
2171
2172 \begin_layout Section
2173 Labels and Cross-References
2174 \end_layout
2175
2176 \begin_layout Standard
2177 You can label section headings, list items, formulas, footnotes, and floats
2178 \begin_inset Foot
2179 status collapsed
2180
2181 \begin_layout Plain Layout
2182 Floats are explained in the 
2183 \emph on
2184 User's Guide
2185 \emph default
2186  and the 
2187 \emph on
2188 Embedded Objects
2189 \emph default
2190  manual.
2191 \end_layout
2192
2193 \end_inset
2194
2195  in your document.
2196  Once you do so, you can refer to this section in other parts of the document,
2197  using cross-references.
2198  You can refer either to the section's number, or to the page that the section
2199  appears on.
2200  As with section numbering, LyX also takes care about cross-reference numbering
2201  for you.
2202  Automatic labels and cross-references are among the most significant advantages
2203  of LyX (and LaTeX) over conventional word processors.
2204  
2205 \end_layout
2206
2207 \begin_layout Subsection
2208 Your first label
2209 \end_layout
2210
2211 \begin_layout Standard
2212 Go to our second section, whose title is 
2213 \begin_inset Quotes eld
2214 \end_inset
2215
2216 About This Document
2217 \begin_inset Quotes erd
2218 \end_inset
2219
2220 .
2221  Click at the end of the section title line, and select 
2222 \family sans
2223 Insert\SpecialChar \menuseparator
2224 Label
2225 \family default
2226  or the toolbar button 
2227 \begin_inset Graphics
2228         filename ../images/label-insert.png
2229         scale 75
2230         scaleBeforeRotation
2231
2232 \end_inset
2233
2234 .
2235  A dialog asks you for a label name, and gives you a suggestion.
2236  When you click on 
2237 \family sans
2238 OK
2239 \family default
2240 , the label name will be placed in a box next to the section title.
2241 \end_layout
2242
2243 \begin_layout Standard
2244 So far you have not done anything — the DVI output will look exactly the
2245  same, since labels do not show up in the printed document.
2246  However, now that you have added a label, you can refer to that label with
2247  cross-references.
2248  We will do that next.
2249 \end_layout
2250
2251 \begin_layout Subsection
2252 Your first cross-reference
2253 \end_layout
2254
2255 \begin_layout Standard
2256 Place the cursor somewhere in Section
2257 \begin_inset space ~
2258 \end_inset
2259
2260 2 of your document.
2261  Type 
2262 \end_layout
2263
2264 \begin_layout LyX-Code
2265 If you want to know more about this document, then see 
2266 \begin_inset Newline newline
2267 \end_inset
2268
2269 Section, which can be found on page.
2270 \end_layout
2271
2272 \begin_layout Standard
2273 Now — with the cursor after the word 
2274 \begin_inset Quotes eld
2275 \end_inset
2276
2277 Section
2278 \begin_inset Quotes erd
2279 \end_inset
2280
2281  — choose 
2282 \family sans
2283 Insert\SpecialChar \menuseparator
2284 Cross
2285 \begin_inset space ~
2286 \end_inset
2287
2288 Reference
2289 \family default
2290  or the toolbar button 
2291 \begin_inset Graphics
2292         filename ../images/dialog-show-new-inset_ref.png
2293         scale 75
2294         scaleBeforeRotation
2295
2296 \end_inset
2297
2298 .
2299  The Cross-reference dialog pops up.
2300  It shows a list of the possible labels you can reference.
2301  At the moment, there should be only one, 
2302 \begin_inset Quotes eld
2303 \end_inset
2304
2305 sec:About-This-Document
2306 \begin_inset Quotes erd
2307 \end_inset
2308
2309 .
2310  First, select the drop-down menu labeled Format and select 
2311 \begin_inset Quotes eld
2312 \end_inset
2313
2314 <reference> on page <page>
2315 \begin_inset Quotes erd
2316 \end_inset
2317
2318 .
2319  Then select 
2320 \begin_inset Quotes eld
2321 \end_inset
2322
2323 sec:About-This-Document
2324 \begin_inset Quotes erd
2325 \end_inset
2326
2327  (it may be selected by default), and a reference marker will appear containing
2328  
2329 \begin_inset Quotes eld
2330 \end_inset
2331
2332 Ref+Text: sec:About-This-Document
2333 \begin_inset Quotes erd
2334 \end_inset
2335
2336  (To be really correct, you should put a 
2337 \family sans
2338 Protected
2339 \begin_inset space ~
2340 \end_inset
2341
2342 Space
2343 \family default
2344  in between the word 
2345 \begin_inset Quotes eld
2346 \end_inset
2347
2348 Section
2349 \begin_inset Quotes erd
2350 \end_inset
2351
2352  and the reference).
2353  Alternatively to that method, you can right-click on a label and use in
2354  the appearing context menu 
2355 \family sans
2356 Copy as Reference
2357 \family default
2358 .
2359  The cross-reference to this label is now in the clipboard and can be copied
2360  to the actual cursor position via the menu 
2361 \family sans
2362 Edit\SpecialChar \menuseparator
2363 Paste
2364 \family default
2365  (shortcut 
2366 \family sans
2367 Ctrl+V
2368 \family default
2369 ).
2370  In the printed document, this reference marker will be replaced with the
2371  section number and then the page number.
2372  View your document as DVI, and you will see that LaTeX has been even cleverer
2373  than that.
2374  It refers to 
2375 \begin_inset Quotes eld
2376 \end_inset
2377
2378 Section 2
2379 \begin_inset Quotes erd
2380 \end_inset
2381
2382  and depending how much text you have between the start of Section
2383 \begin_inset space ~
2384 \end_inset
2385
2386 2 and 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 \[
4134 f(x)=\left\{ \begin{array}{cc}
4135 \log_{8}x & x>0\\
4136 0 & x=0\\
4137 \sum_{i=1}^{5}\alpha_{i}+\sqrt{-\frac{1}{x}} & x<0
4138 \end{array}\right.
4139 \]
4140
4141 \end_inset
4142
4143
4144 \end_layout
4145
4146 \begin_layout Section
4147 More Math Stuff
4148 \end_layout
4149
4150 \begin_layout Standard
4151 LyX's math editor can do a lot more.
4152  Now you are familiar with the basics, you can refer to the 
4153 \emph on
4154 User's Guide
4155 \emph default
4156  for tips on how to:
4157 \end_layout
4158
4159 \begin_layout Itemize
4160 Label and number expressions
4161 \end_layout
4162
4163 \begin_layout Itemize
4164 Create multi-line equations
4165 \end_layout
4166
4167 \begin_layout Itemize
4168 Change typefaces, e.
4169 \begin_inset space \thinspace{}
4170 \end_inset
4171
4172 g.
4173 \begin_inset space \space{}
4174 \end_inset
4175
4176 to write bold-face text in an expression.
4177 \end_layout
4178
4179 \begin_layout Itemize
4180 Fine-tune font sizes and spacing within an expression.
4181  (Do not worry about this until your final draft!)
4182 \end_layout
4183
4184 \begin_layout Itemize
4185 Write macros.
4186  These are very powerful, because you just define them once at the top of
4187  the document, and then you can use them throughout the document.
4188 \end_layout
4189
4190 \begin_layout Itemize
4191 Do lots of other things that we have no space for in this Tutorial.
4192 \end_layout
4193
4194 \begin_layout Chapter
4195 Miscellaneous
4196 \end_layout
4197
4198 \begin_layout Section
4199 Other major LyX Features
4200 \end_layout
4201
4202 \begin_layout Standard
4203 We have not gone through all the possible commands in LyX, and we are not
4204  planning on it.
4205  As usual, see the 
4206 \emph on
4207 User's Guide
4208 \emph default
4209  and the 
4210 \emph on
4211 Embedded
4212 \begin_inset space ~
4213 \end_inset
4214
4215 Objects
4216 \emph default
4217  manual for more information.
4218  We will just mention a couple more major things LyX can do:
4219 \end_layout
4220
4221 \begin_layout Itemize
4222 LyX has WYSIWYM support for tables.
4223  Use the 
4224 \family sans
4225 Insert\SpecialChar \menuseparator
4226 Table
4227 \family default
4228  (toolbar button 
4229 \begin_inset Graphics
4230         filename ../images/tabular-insert.png
4231         scale 75
4232         scaleBeforeRotation
4233
4234 \end_inset
4235
4236 ) to get a table.
4237  Click on the table with the 
4238 \emph on
4239 right button
4240 \emph default
4241  to get a 
4242 \family sans
4243 Table
4244 \begin_inset space ~
4245 \end_inset
4246
4247 Settings
4248 \family default
4249  dialog box which allows extensive table editing.
4250 \end_layout
4251
4252 \begin_layout Itemize
4253 LyX also supports including pictures in any format within documents.
4254  (You guessed it: 
4255 \family sans
4256 Insert\SpecialChar \menuseparator
4257 Graphics
4258 \family default
4259  (toolbar button 
4260 \begin_inset Graphics
4261         filename ../images/dialog-show-new-inset_graphics.png
4262         scale 75
4263         scaleBeforeRotation
4264
4265 \end_inset
4266
4267 ).
4268  Then browse for the figure file, rotate or scale it, etc.) Tables and figures
4269  can have captions, and LyX will automatically generate lists of figures
4270  and/or tables.
4271 \end_layout
4272
4273 \begin_layout Itemize
4274 LyX is heavily configurable.
4275  Everything from how the LyX window looks to how the output comes out can
4276  be configured in a number of ways.
4277  Much configuration is done through 
4278 \family sans
4279 Tools\SpecialChar \menuseparator
4280 Preferences
4281 \family default
4282 .
4283  For more information on this, check out 
4284 \family sans
4285 Help\SpecialChar \menuseparator
4286 Customization\SpecialChar \@.
4287
4288 \end_layout
4289
4290 \begin_layout Itemize
4291 LyX is being developed by a team of programmers on five continents.
4292  Therefore, LyX has better support for non-English languages (such as Dutch,
4293  German, French, Greek, Czech, Turkish, \SpecialChar \ldots{}
4294 ) than many word processors.
4295  Even the right-to-left languages Arabic, Farsi, and Hebrew and the Asian
4296  languages Chinese Japanese, and Korean are supported.
4297  You can write documents in other languages and you can also configure LyX
4298  to show its menus and error messages in other languages.
4299  
4300 \end_layout
4301
4302 \begin_layout Itemize
4303 The LyX menus feature keybindings.
4304  This means that you can do 
4305 \family sans
4306 File\SpecialChar \menuseparator
4307 Open
4308 \family default
4309  by pressing 
4310 \family sans
4311 Alt+F
4312 \family default
4313  followed by 
4314 \family sans
4315 O
4316 \family default
4317  or by using the binding which is shown next to it in the menu (Ctrl+O by
4318  default).
4319  Keybindings are also configurable.
4320  For information on this, check out 
4321 \family sans
4322 Help\SpecialChar \menuseparator
4323 Customization\SpecialChar \@.
4324
4325 \end_layout
4326
4327 \begin_layout Itemize
4328 LyX can read LaTeX documents.
4329  See section
4330 \begin_inset space ~
4331 \end_inset
4332
4333
4334 \begin_inset CommandInset ref
4335 LatexCommand ref
4336 reference "sec:tex2lyx"
4337
4338 \end_inset
4339
4340 .
4341 \end_layout
4342
4343 \begin_layout Itemize
4344 Spell-checking, thesaurus, and word count facilities are available.
4345 \end_layout
4346
4347 \begin_layout Itemize
4348 Generation of indexes and nomenclatures/glossaries is supported.
4349 \end_layout
4350
4351 \begin_layout Section
4352 LyX for LaTeX Users
4353 \begin_inset CommandInset label
4354 LatexCommand label
4355 name "sec:latexusers"
4356
4357 \end_inset
4358
4359
4360 \end_layout
4361
4362 \begin_layout Standard
4363 If you do not know anything about LaTeX, you do not have to read this section.
4364  Actually, you might want to 
4365 \emph on
4366 learn
4367 \emph default
4368  about LaTeX, and then read this chapter.
4369  However, some who begin to use LyX will be familiar with LaTeX.
4370  If you are such a person, you may be wondering if LyX can really do everything
4371  LaTeX can do.
4372  The short answer is that LyX can do pretty much everything LaTeX can do
4373  in one form or another, and it definitely simplifies most parts of writing
4374  a LaTeX document.
4375 \end_layout
4376
4377 \begin_layout Standard
4378 Because this is just a tutorial, we are only going to mention things that
4379  new LyX users will most likely be interested in.
4380  In the interests of keeping the Tutorial short, we will give only minimal
4381  information here.
4382  The 
4383 \emph on
4384 Additional
4385 \begin_inset space ~
4386 \end_inset
4387
4388 Features
4389 \emph default
4390  and the 
4391 \emph on
4392 Embedded
4393 \begin_inset space ~
4394 \end_inset
4395
4396 Objects
4397 \emph default
4398  manual have a great deal of information on differences between LyX and
4399  LaTeX, and how to do various LaTeX tricks in LyX.
4400 \end_layout
4401
4402 \begin_layout Subsection
4403 TeX Mode 
4404 \end_layout
4405
4406 \begin_layout Standard
4407 Anything that you enter in TeX mode will be passed straight to LaTeX, and
4408  will be displayed in red on the screen.
4409  You can use TeX commands in LyX by choosing 
4410 \family sans
4411 Insert\SpecialChar \menuseparator
4412 TeX
4413 \begin_inset space ~
4414 \end_inset
4415
4416 Code
4417 \family default
4418  (toolbar button 
4419 \begin_inset Graphics
4420         filename ../images/ert-insert.png
4421         scale 75
4422         scaleBeforeRotation
4423
4424 \end_inset
4425
4426 ).
4427  This creates a box where everything within it is passed straight to LaTeX.
4428 \end_layout
4429
4430 \begin_layout Standard
4431 In a math formula, TeX mode is handled a bit differently.
4432  TeX mode is there entered by typing a backslash.
4433  The backslash is not written out, but anything you type afterwards will
4434  be in red.
4435  You exit TeX mode by typing 
4436 \family sans
4437 Space
4438 \family default
4439  or some other non-alphabetic character, like a number, underscore, caret,
4440  or parenthesis.
4441  Once you exit TeX mode, if LyX knows the TeX command you have  typed in,
4442  it will convert it to WYSIWYM\SpecialChar \@.
4443  So if you type 
4444 \begin_inset Quotes eld
4445 \end_inset
4446
4447
4448 \family typewriter
4449
4450 \backslash
4451 gamma
4452 \family default
4453
4454 \begin_inset Quotes erd
4455 \end_inset
4456
4457  in a formula and then press 
4458 \family sans
4459 Space
4460 \family default
4461 , LyX will change the red 
4462 \begin_inset Quotes eld
4463 \end_inset
4464
4465 gamma
4466 \begin_inset Quotes erd
4467 \end_inset
4468
4469  to a blue 
4470 \begin_inset Quotes eld
4471 \end_inset
4472
4473
4474 \begin_inset Formula $\gamma$
4475 \end_inset
4476
4477
4478 \begin_inset Quotes erd
4479 \end_inset
4480
4481 .
4482  This will work for almost all, non-complicated math macros.
4483  This may be faster than using the 
4484 \family sans
4485 Math
4486 \begin_inset space ~
4487 \end_inset
4488
4489 Toolbar
4490 \family default
4491 , and will be especially convenient for experienced LaTeX users.
4492 \end_layout
4493
4494 \begin_layout Standard
4495 As a special case, if you type 
4496 \begin_inset Quotes eld
4497 \end_inset
4498
4499
4500 \family typewriter
4501
4502 \backslash
4503 {
4504 \family default
4505
4506 \begin_inset Quotes erd
4507 \end_inset
4508
4509  in a formula, the beginning 
4510 \emph on
4511 and
4512 \emph default
4513  ending braces will be inserted in red while the cursor is placed between
4514  the braces.
4515  This makes it more convenient to type those commands which take an argument.
4516 \end_layout
4517
4518 \begin_layout Standard
4519 LyX cannot do absolutely everything that LaTeX can do.
4520  Some fancy functions are not supported at all, while some work but are
4521  not WYSIWYM.
4522  TeX mode allows users to get the full flexibility of LaTeX, while having
4523  all the convenient features of LyX, like WYSIWYM math, tables, and editing.
4524  LyX could never support every LaTeX package.
4525  However, by typing 
4526 \family typewriter
4527
4528 \backslash
4529 usepackage{foo}
4530 \family default
4531  in the preamble (see Section
4532 \begin_inset space ~
4533 \end_inset
4534
4535
4536 \begin_inset CommandInset ref
4537 LatexCommand ref
4538 reference "sec:preamble"
4539
4540 \end_inset
4541
4542 ), you can use any package you want — although you will not have WYSIWYM
4543  support for that package's features.
4544 \end_layout
4545
4546 \begin_layout Subsection
4547 Importing LaTeX Documents — 
4548 \family typewriter
4549 tex2lyx
4550 \family default
4551
4552 \begin_inset CommandInset label
4553 LatexCommand label
4554 name "sec:tex2lyx"
4555
4556 \end_inset
4557
4558
4559 \end_layout
4560
4561 \begin_layout Standard
4562 You can import a LaTeX file into LyX by using the 
4563 \family sans
4564 File\SpecialChar \menuseparator
4565 Import\SpecialChar \menuseparator
4566 LaTeX
4567 \begin_inset space ~
4568 \end_inset
4569
4570 (plain)
4571 \family default
4572  menu in LyX.
4573  This will call the program 
4574 \family typewriter
4575 tex2lyx
4576 \family default
4577  which will create a file foo.lyx from the file foo.tex.
4578  LyX will then open that file.
4579  If the translation does not work, you can try calling 
4580 \family typewriter
4581 tex2lyx
4582 \family default
4583  from the command line, possibly using fancier options.
4584 \end_layout
4585
4586 \begin_layout Standard
4587 Even when the translation does work, 
4588 \family typewriter
4589 tex2lyx
4590 \family default
4591  may not translate everything, though it does handle most legal LaTeX.
4592  It will leave things it does not understand in TeX mode; so, after translating
4593  a file with 
4594 \family typewriter
4595 tex2lyx
4596 \family default
4597 , you can look for the red text and manually edit it to get it right.
4598 \end_layout
4599
4600 \begin_layout Standard
4601
4602 \family typewriter
4603 tex2lyx
4604 \family default
4605  has its own documentation (manpage), which Unix/Linux users can access
4606  via the console command 
4607 \family typewriter
4608 man
4609 \begin_inset space ~
4610 \end_inset
4611
4612 tex2lyx
4613 \family default
4614 .
4615  The manpage describes which LaTeX commands and environments are not supported,
4616  what bugs you might run into (and how to get around them), and how to use
4617  the various options.
4618 \end_layout
4619
4620 \begin_layout Standard
4621 It is important to understand that 
4622 \family typewriter
4623 tex2lyx
4624 \family default
4625  can only translate files whose document class is 
4626 \begin_inset Quotes eld
4627 \end_inset
4628
4629 known
4630 \begin_inset Quotes erd
4631 \end_inset
4632
4633  to LyX, that is, for which there is a corresponding LyX 
4634 \family sans
4635 layout file
4636 \family default
4637 .
4638  If there is no layout file, then you will get an error saying that the
4639  conversion could not be performed.
4640  So, unless you have a layout for the document class of your LaTeX file,
4641  
4642 \family typewriter
4643 tex2lyx
4644 \family default
4645  simply will not know how to translate the LaTeX that it finds there into
4646  things LyX understands.
4647  More about layout files and how they are created is explained in detail
4648  in Chapter 5 of the 
4649 \emph on
4650 Customization
4651 \emph default
4652  manual.
4653 \end_layout
4654
4655 \begin_layout Subsection
4656 Converting LyX Documents to LaTeX
4657 \end_layout
4658
4659 \begin_layout Standard
4660 You might wish to convert a LyX Document to a LaTeX file.
4661  For example, a co-worker or co-author who does not have LyX might want
4662  to read it.
4663  Select 
4664 \family sans
4665 File\SpecialChar \menuseparator
4666 Export\SpecialChar \menuseparator
4667 LaTeX
4668 \family default
4669 .
4670  This will create a file 
4671 \family typewriter
4672 whatever.tex
4673 \family default
4674  from the 
4675 \family typewriter
4676 whatever.lyx
4677 \family default
4678  file you are editing.
4679  LyX always creates temporary LaTeX files when viewing or printing files.
4680 \end_layout
4681
4682 \begin_layout Subsection
4683 LaTeX Preamble
4684 \end_layout
4685
4686 \begin_layout Subsubsection
4687 Document Class
4688 \end_layout
4689
4690 \begin_layout Standard
4691 The 
4692 \family sans
4693 Document\SpecialChar \menuseparator
4694 Settings
4695 \family default
4696  dialog takes care of the document-wide options.
4697  You can change there the document class, default font size and paper size.
4698  Document class options but also options for LaTeX packages can be entered
4699  there in the 
4700 \family sans
4701 Class
4702 \begin_inset space ~
4703 \end_inset
4704
4705 options
4706 \family default
4707  area.
4708 \end_layout
4709
4710 \begin_layout Subsubsection
4711 Other Preamble Matter
4712 \begin_inset CommandInset label
4713 LatexCommand label
4714 name "sec:preamble"
4715
4716 \end_inset
4717
4718
4719 \end_layout
4720
4721 \begin_layout Standard
4722 If you have special commands to put in the preamble of a LaTeX file, you
4723  can use them in a LyX document as well.
4724  Select 
4725 \family sans
4726 Document\SpecialChar \menuseparator
4727 Settings\SpecialChar \menuseparator
4728 LaTeX
4729 \begin_inset space ~
4730 \end_inset
4731
4732 Preamble
4733 \family default
4734  and type in the dialog window (or from the document settings dialog, depending
4735  on the frontend).
4736  Anything you type will (as with TeX mode) be sent directly to LaTeX.
4737 \end_layout
4738
4739 \begin_layout Subsection
4740 BibTeX
4741 \end_layout
4742
4743 \begin_layout Standard
4744 LyX has support for BibTeX, which allows you to build databases of bibliographic
4745 al references to be used in multiple documents.
4746  Select 
4747 \family sans
4748 Insert\SpecialChar \menuseparator
4749 List
4750 \begin_inset space \thinspace{}
4751 \end_inset
4752
4753 /
4754 \begin_inset space \thinspace{}
4755 \end_inset
4756
4757 TOC\SpecialChar \menuseparator
4758 BibTeX
4759 \begin_inset space ~
4760 \end_inset
4761
4762 Bibliography
4763 \family default
4764  to include a 
4765 \family typewriter
4766 BibTeX
4767 \family default
4768  file.
4769  In the 
4770 \family sans
4771 Database
4772 \family default
4773  field you load BibTeX files, in the 
4774 \family sans
4775 Style
4776 \family default
4777  field you can load BibTeX style files.
4778 \end_layout
4779
4780 \begin_layout Standard
4781 After you have done this, you can use citations from any bibliographies
4782  you are including with 
4783 \family sans
4784 Insert\SpecialChar \menuseparator
4785 Citation
4786 \family default
4787  (see Section
4788 \begin_inset space ~
4789 \end_inset
4790
4791
4792 \begin_inset CommandInset ref
4793 LatexCommand ref
4794 reference "sec:bibliographies"
4795
4796 \end_inset
4797
4798 ).
4799  LyX will take care of running BibTeX.
4800  The box in the 
4801 \family sans
4802 Citation
4803 \family default
4804  dialog will show a list of all the references in your 
4805 \family typewriter
4806 BibTeX
4807 \family default
4808  file.
4809 \end_layout
4810
4811 \begin_layout Section
4812 Errors!
4813 \end_layout
4814
4815 \begin_layout Standard
4816 Sometimes when you try to view a document, there will be errors, things
4817  that LyX or LaTeX cannot understand.
4818  When this happens, LyX will open a 
4819 \family sans
4820 LaTeX
4821 \begin_inset space ~
4822 \end_inset
4823
4824 Errors
4825 \family default
4826  dialog.
4827  Clicking on individual errors in this dialog will take you to the place
4828  in the LyX document where the error occurs and also display the detailed
4829  LaTeX error message.
4830 \end_layout
4831
4832 \end_body
4833 \end_document