The LYX Tutorial
The LYX Tutorial
The LYX Tutorial
Principal maintainer of this le is Amir Karger. If you have comments or error corrections, please send them to the LYX Documentation mailing list, [email protected].
Contents
1 Introduction
1.1 1.2 Welcome to LYX! . . . . . . . . . . . . . . . What the Tutorial is and What it isn't . . . 1.2.1 Getting the Most out of the Tutorial 1.2.2 What You Won't Find: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5 5 6 6
2.2
Your First LYX Document . . . . . . . . . . . . . . . 2.1.1 Typing, Viewing, and Printing . . . . . . . . 2.1.2 Simple Operations . . . . . . . . . . . . . . . 2.1.3 WYSIWYM: Whitespace in LYX . . . . . . . Environments . . . . . . . . . . . . . . . . . . . . . . 2.2.1 Sections and Subsections . . . . . . . . . . . 2.2.2 Lists and sublists . . . . . . . . . . . . . . . . 2.2.3 Other Environments: Verses, Quotations, and Text classes . . . . . . . . . . Templates: Writing a Letter . Document Titles . . . . . . . Labels and Cross-References . Footnotes and Margin Notes . Bibliographies . . . . . . . . . Table of Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . More . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7 8 8 9 10 10 11 13
3 Writing Documents
3.1 3.2 3.3 3.4 3.5 3.6 3.7 4.1 4.2 4.3 4.4
15
15 16 17 17 19 20 20
4 Using Math
Math Mode . . . . . . . . . . . . . . . . . . . Navigating an Equation . . . . . . . . . . . . Exponents and Indices . . . . . . . . . . . . . The Math Panel . . . . . . . . . . . . . . . . . 4.4.1 Greek and symbols . . . . . . . . . . . 4.4.2 Square roots, accents, and delimiters . 4.4.3 Fractions . . . . . . . . . . . . . . . . 4.4.4 TEX mode: Limits, log, sin and others 3
23
23 24 24 25 25 25 26 26
CONTENTS 4.4.5 Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.6 Display mode . . . . . . . . . . . . . . . . . . . . . . . . . More Math Stu . . . . . . . . . . . . . . . . . . . . . . . . . . . Other Major LYX Features . . . . . . . . . . . . . A LYX for L TEX Users . . . . . . . . . . . . . . . . 5.2.1 TEX Mode . . . . . . . . . . . . . . . . . A 5.2.2 Importing L TEX Documents tex2lyx . A 5.2.3 Converting LYX Documents to L TEX . . . A 5.2.4 L TEX Preamble . . . . . . . . . . . . . . . 5.2.5 BibTEX . . . . . . . . . . . . . . . . . . . Errors! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 27 28
5 Miscellaneous
29
29 30 30 31 31 31 32 32
5.3
Chapter 1
Introduction
1.1 Welcome to LYX!
A This le is designed for all of you who have never heard of L TEX, or don't know A it very well. Now, don't panic - you won't need to learn L TEX to use LYX. That is, after all, the whole point of LYX: to provide an almost-WYSIWYG interface A to L TEX. There are some things you will need to learn, however, in order to use LYX eectively. Some of you probably found your way to this document because you tried to put two spaces after a . or tried to put 3 blank lines between paragraphs. After much frustration, you found you couldn't. In fact, you'll nd that most of the little tricks you're accustomed to using in other word processors just won't work in LYX. That's because most word processors you've used before allow you to manually enter all spacings, font changes, and so on. So you end up not only writing a document but typesetting it, too. LYX does the typesetting for you, in a consistent fashion, letting you focus on the important things, like the content of your writing.
So, bear with us and read on. Reading this tutorial is denitely worth the time.
CHAPTER 1. INTRODUCTION
Unnecessary. If you're really curious about learning some of the neat tricks A A you can do with L TEX, you can always go get a L TEX book. There are several good ones on the market. No need to reinvent the wheel, after all. . . So, brave soul, it's time to move onwards. Time for your rst document . . .
Chapter 2
as written and typeset by a LYX master. The example les can be found in the examples/ directory, which you can get to by selecting File Open and then clicking on the Examples button. Open the raw document, and use File Save As to save a copy in your own directory for you to work on. As you x parts of the raw document, check to see how those changes aect the dvi output. By the way, the examples/ directory contains lots of other examples les. They will show you how to do various fancy things with LYX. They are especially useful to display things that (due to length or other reasons) won't t in the documentation. After you read the Tutorial, or when you're confused about how to do something fancy in LYX, take a look at these les.
Print by using File Print and hitting OK. Congratulations! You've written and printed your rst LYX document. All of the rest is just details, which is covered in the rest of the Tutorial, the User's Guide, and the Extended Features.
Undo LYX has multiple levels of undo, which means you can undo everything
you've done since your current editing session started, by selecting Edit Undo over and over again. If you undo too much, just select Edit Redo to get it back.
Currently, undo is limited to 100 steps. Undo also doesn't work for everything ; for instance, changes to the document layout. Each of these is really a LYX bug.
3 You can save time by leaving xdvi running in the background. Then, you can use View A Update DVI and just click on the xdvi window (or unminimize it) after L TEX nishes running.
Cut/Paste/Copy Use Edit Cut, Edit Copy, and Edit Paste to cut, copy,
and paste. Or automatically paste selected text (including selections from other programs) with the middle mouse button.
Find/Replace Use Edit Find & Replace for a search. In the dialog, search
with the Find button, and use the Replace button to replace a word you've found4 . If you like, you can specify whether to make the search casesensitive, or to search for only complete words; you can also search backwards through the document.
Character Formatting You can emphasize text (which will generally put characters in italics), put it in bold face, or in Noun Style (usually
small caps, used for people's names) from the toggle buttons in the Edit Text Style dialog. you to do some of the more popular functions, such as Paste and Print.
Toolbar There are buttons on the toolbar (just below the menus) which allow
Of course, you haven't yet written enough to make most of these functions useful. As you write more, though, try undoing, pasting, etc.
10
more powerful and versatile than multiple spaces or blank lines and ways to change font sizes, character styles, and paragraph alignments by hand. The idea, though, is that you can write your whole document, focusing on content, and just worry about that ne-tuning at the end. With standard word processors, you'll be distracted by document formatting throughout the writing process.
2.2 Environments
Dierent parts of a document have dierent purposes; we call these parts environments. Most of a document is made up of regular text. Section (chapter, subsection, etc.) titles let the reader know that a new topic or subtopic will be discussed. Certain types of documents have special environments. A journal article will have an abstract, and a title. A letter will have neither of these, but will probably have an environment that gives the writer's address. Environments are a major part of the What You See Is What You Mean philosophy of LYX. A given environment may require a certain font style, font size, indenting, line spacing, and more. This problem is aggravated, because the exact formatting for a given environment may change: one journal may use boldface, 18 point, centered type for section titles while another uses italicized, 15 point, left justied type; dierent languages may have dierent standards for indenting; and bibliography formats can vary widely. LYX lets you avoid learning all the dierent formatting styles. The Environment box is located on the left end of the toolbar (just under the File menu). It indicates which environment you're currently writing in. While you were writing your rst document, it said Standard, which is the default environment for text. Now you will put a number of environments in your new document so that you can see how they work. You'll do so with the Environment menu, which you open by clicking on the down arrow icon just to the right of the Environment box.
2.2. ENVIRONMENTS
11
Hit Return again, and select Section from the Environment menu again. LYX writes a 2 and waits for you to type a title. Type More Stuff, and you'll see that LYX again sets it as a section title. It gets better. Go to the end of Section 1 again (after my rst LYX document) and hit Return again, and select Section from the Environment menu again. Again, LYX writes 2 and waits for you to type a title. Type About This Document. Section More Stu, which used to be Section 2, has been automatically renumbered to Section 3! In true WYSIWYM fashion, you just need to identify the text that makes up the section titles, and LYX takes care of numbering the sections and typesetting them. Hit Return to get back to the Standard environment, and type the following ve lines:
Sections and subsections are described below. Section Description Sections are bigger than subsections. Subsection description Subsections are smaller than sections.
Click on the second line and select Subsection from the Environment menu. LYX numbers the subsection 2.1, and typesets it in a font which is bigger than regular text but smaller than the section title. Change the fourth line Subsection environment as well. As you probably expected, LYX automatically numbered the section 2.2. If you put yet another section before Section 2, Section 2 will be renumbered as Section 3, and the subsections will be renumbered to 3.1 and 3.2. Further levels of sectioning include Subsubsection, Paragraph, and Subparagraph. We'll let you play with these on your own. You may notice that paragraph and subparagraph headings are not numbered by default, and that subparagraphs are indented; see the User's Guide to change this. Chapter headings are actually the highest level of sectioning, above Sections, but you're only allowed to use them in certain types (text classes) of LYX documents (see Section 3.1). Finally, you may want to have sections or subsections that are not numbered. There are environments for this as well. If you change one of your section headings to the Section* environment (you may have to scroll down in the Environment menu to nd it), LYX will use the same font size for the heading as it uses for a regular section, but it won't number that section. There are corresponding starred heading environments for Subsection and Subsubsection. Try changing some of your sections or subsections to the starred environments, and note how the other sections' numbers are updated. Exercise: Fix the section and subsection headings in example_raw.lyx.
12
or from renumbering a whole list when you want to add a point in the middle of the list, and lets you concentrate on the list content.6 Dierent types of documents logically require dierent list environments: A slide presentation might use the Itemize environment's bulleted lists to describe dierent points. An outline would use the Enumerate environment's numbered lists (and lettered sublists). A document describing several software packages could use the Description environment, where each item in the list begins with a bold-faced word.
A The List environment not found in L TEX is a slightly dierent form of Description.
Let's write a list of reasons why LYX is better than other word processors. Somewhere in your document, type: Lyx is better than other word processors because: and hit Return. Now select Itemize from the Environment menu. LYX writes a bullet (actually, an asterisk, which will be converted to a round circle on output) on the line. Type in your reasons:
Typesetting is done for you. Math is WYSIWYG Lists are very easy to create!
List environments, unlike headings, do not end when you type Return. Instead, LYX assumes you're going on to the next item in the list. The above will therefore result in a three-item list. If you want more than one paragraph within one list item, one way is to use the Protected Break, which you get by typing C-Return. In order to get out of the list, you need to reselect the Standard environment (or just use the keybinding, M-p s). A You've got a beautiful itemized list. You might want to run L TEX to see how the list looks when printed out. But what if you wanted to number the reasons? Well, just select the whole list7 and choose Enumerate from the Environment menu. Pow! As we mentioned, if you add or delete a list item, LYX will x the numbering. While the list is still selected, you can change to the other two list environments, Description and List, in order to see what they look like. For those two environments, each list item is made up of a term, which is the item's rst word, followed by a denition, which is the rest of the paragraph (until you hit Return.) The term is either typeset in boldface (Description) or separated by a
6 Yes, we're overemphasizing this point throughout the Tutorial. But it is the main philosophy of LYX, so please forgive us. 7 L X won't let you select the rst bullet unless you also select the paragraph before the Y list, which you probably don't want to do. Similarly, you can't select the actual number in a numbered section title. Don't worry about it.
2.2. ENVIRONMENTS
13
Tab 8 (List) from the rest of the paragraph. If you want to have more than one word in the denition, then separate the words with Protected Blanks. Exercise: Typeset the list in example_raw.lyx You can nest lists within each other in all sorts of interesting ways. An obvious example would be writing outlines. Numbered and bulleted lists will have dierent numbering and bulleting schemes for sublists. See the User's Guide for details on the dierent sorts of lists, as well as examples which use a lot of nesting.
8 But a typesetter's tab, which will change to t the size of the largest term, not a pathetic, rigid, unchangeable typewriter Tab.
14
Chapter 3
Writing Documents
The previous chapter hopefully allowed you to get used to writing in LYX. It introduced you to the basic editing operations in LYX, as well as the powerful method of writing with environments. Most people who use LYX, though, will want to write documents: papers, articles, books, manuals, or letters. This chapter is meant to take you from simply writing text with LYX to writing a complete document. It will introduce you to text classes, which allow you to write dierent sorts of documents. It will then describe many of the additions that turn text into a document, such as titles, footnotes, cross references, bibliographies, and tables of contents.
15
16
Font sizes, one- or two-column printing, and page headings are just some of the ways journals' typesettings dier from one another. As the Computer Age continues to mature, journals have begun accepting electronic submissions, A creating L TEX style les so that authors can submit correctly typeset articles. LYX is set up to support this as well. For example, LYX supports typesetting (and extra environments) for the American Mathematics Society journals using the Article (AMS) text class. Here's a very quick reference to some of the text classes. See the Special Document Classes section of the Extended Features manual for many more details. Name article article (AMS) report book slides letter Notes one-sided, no chapters layout & environments for American Math Society longer than article, two-sided report + front and back matter transparencies (also including FoilTEX) lots of extra environments for address, signature. . .
17
want to write a letter, you can use the new template to save time. We probably don't have to suggest an actual exercise here; just write a letter to someone!3 Templates can be a huge time-saver, and we urge you to use them whenever possible. In addition, they can help a person learn how to use some of the fancier text classes. Finally, they may be useful for a person who is conguring LYX for a bunch of less computer-aware users. When they're rst learning LYX, it will be much less intimidating if they have a letter template customized for their company, for example.
18
label name, and gives you a suggestion. When you click on OK, the label name will be placed in a box next to the section title. By the way, you could have put the label right anywhere within the section as well; section references will refer to the last section or subsection whose heading comes before the label. However, putting it on the same line as the section title (or, perhaps, on the rst line of the section's text) ensures that page references will reference the beginning of the section. So far you haven't done anything the dvi le will look exactly the same, since labels don't show up in the printed document. However, now that you've added a label, you can refer to that label with cross-references. We'll do that next.
If you want to know more about this document, then see Section , which can be found on page .
Now with the cursor after the word section choose Insert Cross Reference. The Reference dialog pops up. It shows a list of the possible labels you can reference. At the moment, there should be only one, sec:aboutdocument. Select it (it may be selected by default), and click Apply. Now put the cursor after the word page, and change the reference type to use the page number then click Apply. (To be really correct, you should put a Protected Blank in between the word Section and the reference. Same for the page reference.) LYX puts the references in a box right where the cursor was. In the printed document, this reference marker will be replaced with either the page or section number (depending on what you selected in the Reference dialog). Use View Update DVI, and you'll see that on the last page we refer to Section 2 and Page 1 (or whatever page Section 2's title is on). Conveniently, a cross-reference acts as a hyperlink when you're editing a document in LYX; clicking on it will pop up the Reference dialog, clicking Go to Label will move the cursor to the referenced label.
19
writing a journal article), it may be convenient to leave the Reference dialog open. If you want to make sure that the cross-referencing gets the pages right even for larger documents, Copy a couple pages of text from the User's Guide to the clipboard, and Paste the stolen text into your document5 . Exercise: Fix the references in example_raw.lyx
20
Change your LYX footnote back to text, then select and change it to a margin A note. Run L TEX again to see what the margin note looks like. Exercise: Fix the footnote in example_raw.lyx
3.6 Bibliographies
Bibliographies (at least in the exact sciences) are similar to cross references. The bibliography contains a list of references at the end of the document, and they can be referenced from within the document. Like section titles, LYX and A L TEX make your job easier by automatically numbering the bibliography items and changing citations when the items' numbers change. Go to the end of the document and switch to the Bibliography environment. Now, each paragraph you type will be a reference. Type The Lyx Tutorial, by the LyX Documentation Team as your rst reference. Note that LYX automatically puts a number in a box before each reference. Click on the boxed reference number, and a Bibliography item dialog box appears. You use the rst eld, the Key, to refer to this reference within the LYX document. By default, it is a number. Change the Key eld to lyxtutorial to make it easy to remember. Now pick somewhere in your document that you would like to insert a reference. Do so with Insert Citation. A Citation dialog appears. The right panel in this dialog lists all the bibliography entries, and this eld allows you to choose which bibliography item you want to cite. Select lyxtutorial (right now, that's the only item in the bibliography), then use the left arrow in the center to insert it. (You can have multiple citations in the same place by transferring a number A of keys this way.) Now run L TEX, and you'll see that the citation appears in brackets in the text, referring to the bibliography at the end of the document. How are the other elds used? The Text after eld in the Citation dialog will put a remark (such as a reference to a page or chapter within the referenced book or article) in the brackets after the reference. If you want the references to have labels instead of numbers in the printed output (for example, some journals would use [Smi95] to refer to a paper written by Smith in 1995), use the Label eld in the Bibliography Entry Settings dialog. As usual, you can see the User's Guide for details. Exercise: Fix the bibliography and citation in example_raw.lyx
21
This may not appear to be very useful. However, if you look at your dvi le, you will see that a table of contents has been generated, listing the various sections and subsections in your document. As usual, if you reorder sections or create new ones, you will see those changes in the dvi le when you update it. The table of contents is not printed in the on-screen version of the document, because you can't edit it anyway. However, you can display the table of contents in a separate window by clicking on the table of contents button, or by using Document Table of Contents. The menu command will work even if you don't have a table of contents inset in your document. This is a very useful tool. You can use the Table of Contents window to move around your document. Clicking on a (sub)section title in the Table of Contents window will highlight that line and move the cursor (in the LYX editing window) to that place in the document. You can also use the arrow keys to move up and down in the table of contents. You may therefore nd it convenient to leave this window open throughout editing sessions. You can get similar functionality from the Navigate menu, though, where the table of contents appears automatically. To get rid of the Table of Contents, you can delete the table of contents button just like any other text. Exercise: Fix the table of contents in example_raw.lyx
22
Chapter 4
Using Math
A L TEX is used by many scientists because it outputs great looking equations, avoiding the control characters used by word processors and their equation editors. Many of these scientists are frustrated, however, because writing equations A in L TEX is more like programming than writing. Happily, LYX has WYSIWYM A support for equations. If you are used to L TEX, you'll nd that all of the usual AT X math commands can be typed in normally, but they will show up in a L E A WYSIWYM fashion. If, on the other hand, you've never written in L TEX, then the Math Panel will allow you to write professional-looking math quickly and easily1 .
23
24
A Run L TEX and look at the dvi le. Notice that the expression was typeset nicely, with spaces between the letters and the equals sign, and a superscript 2. Letters in math mode are assumed to be variables, and come out in italics. Numbers are just numbers. This math editor is another example of the WYSIWYM philosophy. In A L TEX, you write a mathematical expression using text and commands like \sqrt; this can be frustrating, because you can't see what an expression looks A like until you L TEX the le, and may have to spend time to nd missing brackets or other bugs. On the other hand, LYX doesn't attempt to get the expression to look perfect (WYSIWYG), but it gives you an extremely good idea of what A the expression will look like. L TEX then takes care of the professional typesetting. 99% of the time, you won't have to make any changes to the font sizes or A spacing that L TEX outputs. This way (sorry to be so repetitive) you can focus on the content of your mathematical expressions, not their format.
25
Writing a subscript (index) is just as easy start one by typing the underscore key, _. You can subscript and superscript both subscripts and super2 scripts like this: Aa0 +b2 + C a0 +b . Exercise: Put equation 1 of example_raw.lyx into math mode.
26
as regular text, which will look bad if you have a big fraction or matrix inside the parentheses. Using the Delimiter window will guarantee that the delimiters are sized based on what's inside them. You can also put delimiters or a square root sign or a decoration on already existing text. Select the portion of the formula that you want to adjust, and then click on the button you want from the Math Panel. Try using this to change Newton's second law from scalar to vector form (f = ma to f = m ). Once a you've learned about matrices, this is how you'll put parentheses or brackets around them.
4.4.3 Fractions
Fractions are very simple in Mathed. Just click on the Fraction button in the Math Panel, which shows a fraction with blue squares in the numerator and the denominator. LYX writes two insertion points in a fraction. As you would expect, you can use arrow keys or the mouse to move around a fraction. Click on the top square and type 1. Now hit Down and type 2. You've made a fraction! Of course you can type anything within each of the two boxes: variables with exponents, square roots, other fractions, whatever. Exercise: Put equation 2 of example_raw.lyx into math mode.
4.4.5 Matrices
Click on the Matrix button in the Math Panel. The dialog has two sliding bars which allow you to choose how many rows and columns you want in your matrix. Choose 2 rows and 3 columns and hit Apply or OK. LYX prints 6 insertion points in a 23 matrix. As usual, you can put any sort of Mathed expression (a square
27
root, another matrix, etc.) in each insertion point. You can also leave some of the insertion points empty if you want. Tab can be used to move horizontally between the columns of a matrix. Alternatively, you can use the arrow keys to move around - hitting Right at the end of one box will move to the next box, Down will move to the next row, etc. If you suddenly need more rows or columns, use Edit Math Add Row and Add Column. They add a row or column just after the current position. Overdid it? Use Delete Row and Delete Column from the same menu. See the User's Guide for information on how to change the horizontal alignment of each column, and how to change the vertical position of the whole matrix. Note that if you want to write a table containing text, you should use LYX' wonderful table support, rather than trying to write text in a matrix.
Subscripts and superscripts for limits and sums (but not integrals) are written under rather than next to the symbols Text is centered Other than these dierences, though, displayed expressions and inline expressions are very similar. One nal note about the way displayed formulae are typeset: be careful about whether you're putting your equation into a new paragraph or not. If your formula is in the middle of a sentence or paragraph, then don't press Return. Doing so will cause the text after the formula to start a new paragraph. That text will therefore be indented, which is probably not what you want. Exercise: Put the various equations in example_raw.lyx into display mode, and see how they're typeset dierently.
28
Exercise: Using various tools you've learned able to write an equation like2 : log8 x 0 f (x) = 5 1 x i=1 i +
try?
2 After you've done it the hard way, why don't you give Insert Math Cases environment a
Chapter 5
Miscellaneous
5.1 Other Major LYX Features
We haven't gone through all the possible commands in LYX, and we aren't planning on it. As usual, see the User's Guide for more information. We'll just mention a couple more major things LYX can do. . . LYX has WYSIWYM support for tables. Use the Insert Table to get a table. Click on the table with the right button to get a Table Settings dialog box which allows extensive table editing. LYX also supports including pictures in a number of formats (including A JPEG and other bitmap formats, PostScript and raw L TEX) within documents. (You guessed it: Insert Graphics. Then click on the gure to choose the le to include, rotate or scale it, etc.) Tables and gures can have captions, and LYX will automatically generate lists of gures and/or tables. Version control is supported, using RCS (man rcsintro for more info). LYX is heavily congurable. Everything from how the LYX window looks to how the output comes out can be congured in a number of ways. Much conguration is done through Tools Preferences. For more information on this, check out Help Customization. LYX is being developed by a team of programmers on ve continents. Therefore, LYX has better support for non-English languages (such as Dutch, German, French, Greek, Czech, Turkish, . . . ) than many word processors. Even some right-to-left languages like Hebrew or Arabic are supported. You can write documents in other languages, but you can also congure LYX to show its menus and error messages in other languages. The LYX menus feature keybindings. This means that you can do File Open by typing M-F followed by O or by using the binding which is shown 29
30
CHAPTER 5. MISCELLANEOUS next to it in the menu (C-O by default). Keybindings are also congurable. For information on this, check out Help Customization.
A LYX can read in L TEX documents. See Section 5.2.2.
Spellchecking and thesaurus facilities are available. The text box near the bottom of the LYX window is called the minibuer (after a similar feature in emacs). This gives you access to all sorts of interesting functionality, including functionality which could break your document. In other words, don't type in the minibuer unless you know what you're doing.
31
As a special case, if you type a brace in TEX mode, then the beginning and ending braces will be inserted in red, then take you out of TEX mode and place the cursor between the braces. This makes it more convenient to type commands that LYX doesn't know which take an argument. A LYX can't do absolutely everything that L TEX can do (yet?). Some fancy functions are not supported at all, while some work but aren't WYSIWYM. TEX A mode allows users to get the full exibility of L TEX, while having all the convenient features of LYX, like WYSIWYM math, tables, and editing. LYX could A never support every L TEX package. However, by typing \usepackage{foo} in the preamble (see Section 5.2.4.2), you can use any package you want although you won't have WYSIWYM support for that package's features.
A 5.2.2 Importing L TEX Documents tex2lyx
A You can import a L TEX le into LYX by using the File Import LaTEX command in LYX. This will call tex2lyx which will create a le foo.lyx from the le foo.tex and then open that le. If the translation doesn't work, you can try calling tex2lyx from the command line, possibly using fancier options. A tex2lyx will translate most legal L TEX, but not everything. It will leave things it doesn't understand in TEX mode, so after translating a le with tex2lyx, you can look for red text and hand-edit it to look right. A tex2lyx has its own manpage. Read it to nd out about which L TEX commands and environments aren't supported, bugs (and how to get around them), and how to use the various options.
32
CHAPTER 5. MISCELLANEOUS
type in the dialog window (or from the document settings dialog, depending on the frontend). Anything you type will (like with TEX mode) be sent directly to A L TEX.
5.2.5 BibTEX
LYX has support for BibTEX, which allows you to build databases of bibliographical references to be used in multiple documents. Select Insert List / TOC BibTEX Reference to include a bib le. Click on the resulting BibTEX Generated References button, and you will get a BibTEX dialog. In the Database eld, type what you would type inside the braces of a \bibliography{} command1 . Similarly, in the Style eld, type what you would type inside the braces of a \bibliographystyle{} command. After you've done this, you can use citations from any bibliographies you're including with Insert Citation (see Section 3.6). LYX will take care of running BibTEX. The box in the Citation dialog will show a list of all the references in your bib le.
5.3 Errors!
A Sometimes when you L TEX a document, there will be errors, things that LYX A A or L TEX can't understand. When this happens, LYX will open a LTEX Errors dialog. Clicking on individual errors in this dialog will take you to the place in A the LYX document where the error occurs and also display the detailed L TEX error message.