1 LyX Hints

Table of Contents

1.1 Let LyX do the Typesetting

LyX with its handmaiden LaTeX is typesetting software. Let LaTeX do the typesetting for you.
This means that you should not decide things like fonts, font sizes, indentation, tab setting etc. Instead, concentrate on getting the content right first. Don’t take too much notice of the appearance of the layout on screen. Use LyX’s View DVI option to see what the finished product will look like.
The reason that the appearance of the text on the screen differs from what you see on the printed document is that the fonts used are different for each medium. Screen fonts perforce have low resolution limited by the pixel size of the dots on a monitor screen (usually 100 dots per inch at best). Printer fonts are much finer - up to 1200 dots per inch on good quality printers. To get the best of both worlds, you need to use a different set of fonts designed for each medium. Also you can dynamically change the size of LyX’s screen display to any dimensions that suit you - Lyx will typeset the screen display to suit. The printed page will have different geometry.

1.1.1 Document Fonts

LaTeX fonts have 3 properties: shape, series, and family.
Shape may be Upright (the default), Italic, Slanted, and small caps.
Family may be Roman (the default), Sans serif, or Typewriter.
Series may be Medium (the default), or Bold.
Traditionally the Roman family is used for long documents because the serifs aid legibility and reduce fatigue for long periods of reading. The Sans Serif, which appears cleaner to some eyes, is suitable for brochures, pamphlets, short notices, and promotional material which is intended for instant impact rather than lengthy study. Typewriter is used to indicate computer input or output.
Italic is used for emphasis. Slanted is less slanted than Italic. Bold is available for emphasis, and should be used very sparingly.

1.2 How do I set fonts and sizes?

1.2.1 Use the environment pulldown

You tell LyX how to typeset the final document by identifying the logical components of the document: Section, Subsection, Subsubsection, Paragraph, Subparagraph, etc or the various list structures: Itemize, Enumerate, Description, List, etc. Ordinary text is identified as Standard. You select these components from the pulldown at the top left of the icon bar at the top of the screen.
LyX (or rather LaTeX) has built-in rules developed over the centuries by the great publishing houses of Europe for determining the fonts, sizes, spacing, and indentation of the text. LaTeX knows, for example, exactly how much bigger and bolder a Section header should be than a Subsection header and how far it should be spaced above the paragraph. It will also look after the numbering of Sections for you. LaTeX will produce a beautiful document with fonts used appropriately and consistently to make a harmonious whole.

1.2.2 Change font properties

It is possible for you to override LyX’s default font decisions. If you really must, select the text and then use the menu option: Layout → Character. But avoid explicitly changing fonts in this way as it is difficult to undo.
A common mistake by users is to use too many fonts and sizes. The font properties should always indicate document structure and should be consistent throughout the document.

1.2.3 Change the font for the whole document

Surprisingly, there is no direct support in LyX for changing the default document font to, say, sans serif. But you can do so using LaTeX commands in the Preamble via the Layout → Preamble menu option. The command is:
\renewcommand\familydefault{\sfdefault}

1.3 Document Classes - article

LyX (and LaTeX) have many classes of documents: (article, book, letter, report, etc). Use the class article, which is the default, even for letters. The article class has everything you need for letters as well as articles.

1.3.1 Why not use the letter class for letters?

You would expect that the letter class should be ideal for letters. But no! The letter class follows US conventions which are unpalatable to human beings from other cultures.

1.4 Section Numbering

LyX and LaTeX have a hierarchy of sections in descending order of importance: Part, Section, Subsection, Subsubsection, Paragraph, Subparagraph, and beneath that Standard (which is the default for ordinary text). You identify a line of text as one of these by choosing from the environment list pulldown (at the left of the icon bar at the top of the LyX window). For each of these, LyX will select a suitable combination of font size and bolding relative to the basic font of the Standard environment.
You can set the level of numbering of these sections using the menu option:
Layout →  Document →  Section number depth. Setting it to 0 or less turns off numbering (probably what you want in letters). Setting it to 5 means that the Subparagraphs are numbered like 2.1.4.5.2

1.4.1 Use Section Numbering For

1.4.2 Turn Numbering off for

1.5 How do I set margins?

Use the menu option: Layout →  Paper to set the Paper size (usually A4). The Paper option allows you to accept the standard defaults or to set your own. You can define these in various units. Most people use mm or in (millimetres or inches). Be aware that there is an implicit margin of 1 inch. (In general, printers will not print closer to the edge than 1 inch). So if you set a margin of, say, 15mm the actual margin you get will be 1 inch plus 15mm (i.e. 40mm).
A general policy of publishers is that you should have between 7 and 15 words per line. Any more than that becomes hard to read. That is why newspapers have many columns on each page. If you are consistently getting more than 15 words to the line on a long document, you will greatly improve legibility by either using wider margins or setting the document to 2 column mode (via the option: Layout → Document). Try them both and decide which you prefer.

1.5.1 Two Column mode

Setting and unsetting two-column mode is easy. You can set 1 or 2 column using the option: Layout → Document by clicking on the One or Two button in the Columns frame. The appearance on the screen will not change at all. But when you print or view the document, LaTeX will typset the document and display it in the mode you have chosen.

1.5.2 Viewing and Printing

To view the file, use the option:View dvi. How to do this is version dependent. Prior to version 1.1.6, you use the menu option: File →  View dvi. For vesion 1.1.6 and later, you use the menu option: View →  DVI.
To print the document, you can either click on the printer button on the icon bar, or you can use the menu option: File → Print.

1.6 It won’t let me add extra spaces.

Normally LyX will not allow you to enter 2 or more consecutive spaces. It ignores the TAB key (unless you are in a table). This is because the underlying LaTeX program will typeset varying sized spaces between words to obtain good-looking block paragraphs with left and right adjustment avoiding rivers of space snaking up and down the pages. LyX will not call on LaTeX to do the typesetting until you view or print the document.

1.6.1 Protected Blanks

What if you do want to (despite LyX’s policy of not letting you) add extra spaces? Use the option Insert → Special Character. This has provision for inserting protected blanks (which LyX and LaTeX will not remove), horizontal fills, hyphens, ellipses, quotes, etc. There is also a shortcut method: hold down the control key and hit the space bar:   . You will see a little blue symbol on the screen underlining the protected blank.

1.6.2 Vertical Spaces

Just as LyX quietly removes extra spaces, it also removes extra blank lines. LyX assumes that when you hit the ENTER key, you are ending the current paragraph. Extra lines created by hitting a sequence ENTER keystrokes are quietly removed. If you wish to force an end of line within a paragraph, you type CTRL-ENTER (hold down CTRL and hit ENTER). This would be appropriate where you want a long phrase or name to not be broken by an end of line.
A frequent problem with letters is that you want to put extra blank lines (e.g. before the final signature). LyX has several ways to do this in principled fashion. In descending order of preference:

1.6.3 Page Breaks

Letter templates need a pagebreak under the final signature line. Select the last line with the mouse, choose the menu option: Layout → Paragraph, then click on the Below button in the Pagebreaks frame.

1.6.4 Lists

LyX does lists. Don’t try to lay them out yourself. Use the top left pulldown to choose one of 4 types of list:
Examples:
  1. This is the 1st element of an Enumerate list.
  2. And this is the 2nd.
  3. And so on. LyX has done the numbering for us. If we inserted new elements, LyX would renumber them.
Description is a list that looks like this. If I put enough text in here to force a new line then you will be able to see how LaTeX typesets this sort of list.
Description 2 is the 2nd element of the Description. Notice that I put in a protected blank before the 2 to tell LyX that the 2 was part of the label.
List This is the first element of a List list (as opposed to an Itemize, Enumerate, Description list.
List 2 This is the 2nd element. I put the protected blank in to show you how to have a phrase as the key.
In all of the above, LyX chose all the spacing, bolding etc. appropriate for the context we had chosen.

1.6.5 Paragraph separation: skip or indent

Use the menu option: Layout → Document and click Indent or Skip in the Separation frame.
Indent The 2nd and subsequent paragraph of each section is indented. This is how publishers lay out books and is the more economical option. You are not wasting space on the page.
Skip This option puts a blank line between paragraphs. This is the method favoured in business letters and in business or technical documentation.

1.6.6 Address and Right Address

The Address and Right Address are special paragraphs available from the sections pulldown, and are intended for letters.
To use them, select Address (or Right Address) from the pulldown, then enter the lines of the address using Control-ENTER instead of ENTER between lines. If you hit ENTER, LyX will assume that you have completed the address and will revert to the Standard environment.
Right Address puts the address left adjusted against the right margin. Address puts the address paragraph agains the left margin.

1.6.7 Don’t use Addresses. Use tables instead.

If you intend the document to be a template for merging with data to produce maildrops, avoid the Address and Right Address paragraphs. Use tables instead. The reason is that LaTeX will not tolerate empty lines within the Address paragraph. You will get LaTeX errors when you try to view or print the merged document. The cure is easy. Put a protected blank in the empty address line, or delete the empty address line. But if you use tables instead, there will be no error and no trouble.
If the document is a normal letter (not a mailmerge template), there is no problem using Addresses.

1.6.8 LyX Tables

You can put a table (a rectangular grid of elements, with or without border lines) anywhere you wish in the text. Click on the grid icon on the icon bar or use the menu option: Insert → Table. Enter the numbers of rows and columns, then fill in the grid which Lyx produces. The table rows and columns will stretch or shrink to match the size of the contents you enter into the cells. It is your responsibility to make sure that the table will fit into the available space on the page. If the table ends up too wide, the excess will not be printed.

1.6.9 Entering Table data

Just type. To advance to the next cell, you can TAB or arrow. The ENTER key will take you to the beginning of the next row.

1.6.10 Positioning of tables

To position the table where you want (left, centre, or right), use the menu option: Layout → Paragraph and click the appropriate radio button in the Alignment frame. LyX versions prior to 1.2 centre tables by default. Version 1.2 changes this behaviour and places tables at the left margin.

1.6.11 Properties of tables or cells

To adjust any properties for the table or one of its cells, right-click in the cell. LyX will pop up a dialogue box. Generally it is pretty obvious how to set or unset properties such as lines drawn at the borders of cells. If you select a group of cells (by clicking and dragging), then right click, the properties you set will be applied to all the cells selected.

1.6.12 Multicolumns

If you want a cell to span more than 1 columns, select a contiguous group of cells and right click. Then in the Special Cell frame click the Multicolumn button. Look at the example here. There are 2 instances of cells spanning 2 columns
right left centred col 4 col 5
1 a row 1
2 bb 2 multicol cells
3 ccc row 3 2 multicol cells
4 dddd row 4

1.7 Special Characters

1.7.1 Accents é, è, ê, etc

To insert accented characters such as the e-acute in café, you enter a command into the minibuffer (the status bar at the bottom of the LyX window). To get into the minibuffer, you type ALT and X simultaneously. This will clear the minibuffer and put the cursor in there. You now type the appropriate command for accent-acute, accent-grave, accent-circumflex, etc then hit ENTER. LyX will return you to the main window where you type the letter (e in café). The ALT-X trick in fact allows a LyX guru to enter a whole range of commands to perform all the actions that LyX can do. Alternatively you can enter the LaTeX command \’{e} for \’e and select it with the mouse and click on the TeX button.
It is preferable to use the minibuffer method, because LyX actually plugs in the appropriate Latin-1 character into the text. It is immediately visible on the screen and thereafter looks like any other character. The TeX method on the other hand is a piece of ERT (Evil Red Text) and only appears correct when Viewed or Printed.
If you know the appropriate control character, you may be able to directly enter accented characters from the keyboard. (Most continental people know how to do this!)

1.7.2 Special Symbols \textsterling, €, © , etc

To enter these, you need to do 3 things:
For a full list of symbols in the textcomp package, visit Herbert Voss’s website via www.lyx.org and click on Hints. They include arrows: textleftarrow etc, currency textpeso, textlira, textdollar, etc, and things like textdegreecelsius, textregistered, etc

1.7.3 Mathematical expressions, fractions etc

LyX and LaTeX offer superb support for the display of Mathematical symbols, expressions, formulas, equations, fractions etc. To put maths stuff into a document, either click on the (a + b)/(c) icon and type in the expression you want, or use the menu option: Math and point and click to select from the options displayed. When you enter a space, LyX will take you out of Maths input mode back to normal text. While in Maths mode, LyX displays everything in blue. When you revert back to text the display changes back to the normal black text.
A whimsical decision by Donald Knuth (the inventor of TeX) resulted in the card suits being regarded as maths symbols. So enter maths mode and choose them from the Math Panel ♣♦♥♠ . To get the maths panel, use the menu option: Math → Math Panel → Misc and click on the symbol you want. An alternative method is to type \clubsuit (or whichever) while in Maths mode.
Similarly you can display Greek letters by typing \alpha, \beta, etc while in maths mode: α β . The Greek capitals are \Gamma, \Delta, etc (Note there is no \Alpha, \Beta etc. as these are the same as A, B.) The 2 forms of sigma (nonfinal and final) are \sigma and \varsigma respectively: σ ς. In fact, there are also variant forms of the letters epsilon, theta, pi, rho, and phi. These are \vartheta, \varpi etc but, as they are simply alternate styles, don’t use them!

1.7.4 Form elements: boxes, underlines, frames etc

LyX and LaTeX are really intended for producing beautiful books (as Donald Knuth tells us). It can however also be used to produce standard business style forms. But to do so, you have to resort to raw LaTeX commands (things with leading backslashes \ and often with arguments inside curly braces {} e.g. \underline{\hspace{4in}} which would typeset a 4 inch space underlined. LaTeX commands require some expertise and a good LaTeX reference book. But some examples here will be useful for typical form elements.

1.7.5 How to input LaTeX commands

To insert inline TeX commands into LyX text:
  1. Type in the command e.g. \hfill
  2. Select the text of the command by clicking and dragging
  3. click the TeX button on the icon bar of the LyX window
1.7.5.1 Underlines.
Normally you should not use underline for emphasis in a document. In a form however you may want to use an underline or a box frame to indicate where a client will fill in a space.
TeX: \underline{Rates}
Print: Rates
1.7.5.2 Frame boxes
To put a frame box around a space use the TeX \framebox command.
TeX: \framebox[1.5in][l]{\hspace{0.4in}/\hspace{0.4in}/}
Print:  ⁄   ⁄ 
The arguments to the \framebox command are:
  1. 1.5in = the (optional) width of the frame. The [ ] square brackets indicate an optional argument. If you omit this, the frame will fit its contents.
  2. l = left adjust the contents of the curly braces {} within the frame. Alternatives are: c and r
  3. The contents of the frame. In this case 2 slashes / / with 0.4 inch spaces around them.
1.7.5.3 Horizontal lines
To put a line across the page: use \hrule. It will be the text width of the page.
\hrule
1.7.5.4 Boxes (for ticks)
To make a box (for people to tick) you must
1.7.5.5 Struts
Forms largely consist of LyX tables with borders turned on and off as required and multicolumn cells set where appropriate. A common need is to try to force a cell to be bigger. (LyX tries to fit rows and columns snugly around their contents.) A useful trick here is to create a strut. A strut is a line often of zero width to make it invisible.
No strut this row strut below
\rule[-2mm]{0mm}{8mm}
The arguments to the \rule command are:
  1. -2mm which means it is lowered 2mm below the line of text
  2. 0mm which is the width of the line (making it invisible)
  3. 8mm which is the height of the strut.
1.7.5.6 Fills
All the elements we have mentioned so far have fixed dimensions. A LaTeX \fill is a flexible expandible (or rubber band) element which expands to fill the space available (usually the \textwidth). There are 4 convenience commands
\hfill which is a synonym for \hspace{\fill}
\hrulefill which fills with a line
\dotfill which fills with dots
\vfill which is a synonym for \vspace{\fill}.
examples
first \hfill last will produce:
first last.
first \dotfill last will produce:
first \dotfill  last.
first \hrulefill  last. will produce:
first \hrulefill  last.
Multiple fills
If you have 2 or more fills in a line, they will have the total available space shared equally among them:
first \hfill second \hfill \hfill last produces:
first second last

2 Customising Page Styles

2.1 Page Headers and Footers

The menu option: Layout →  Document →  Pagestyle give you a choice of decoration of the page ranging from empty to fancy. Fancy will give you headers and footers to each page. The footers will be empty by default except that the page number will be in the centre footer. The left and right footers can be populated with things like the filename of the document, or the author, or the date. To exploit this, you need to enter the LaTeX command into the preamble via the menu option: Layout →  Preamble.

2.1.1 LaTeX Preamble

LyX allow you to customise the LaTeX preamble which is generated for every file when you View or Print it. Use the menu option: Layout →  Preamble. Inside the preamble, everything is TeX. You do not click the TeX button.

2.2 Headers

To put customised letterhead into each page of your document use the LaTeX commands. By default, if you set fancyhead as your page style the contents of the LaTeX values \lhead, \chead, \rhead will display at the top of every page with a line (an \hrule) across the page beneath the header. By default \lhead is set to the current section header slanted and large, and \rhead is set to the current subsection header, and \chead is empty.

2.2.1 \lhead Syntax

You can set you company name in the left header with syntax like the following:
\lhead[LO,LE]{\LARGE{\bfseries ACME Co Ltd}}
Similarly, the \chead and \rhead LaTeX commands can be used to set the values to be displayed in the centre and right headers respectively. Often you will want to put your address and phone or fax numbers in these.

2.2.2 Company Logo in Header

You can put an image in the head of each page. You need a Postscript of PDF file containing the logo. You then write a dozen lines or so of LaTeX code into the preamble. See Herbert Voss’s website via the LyX webpage (www.lyx.org) Tips and Tricks.

2.3 Footers

You can put what you want in the left, right, and centre of the foot of each page by entering the appropriate LaTeX command in the LyX preamble. Use \fancyfoot:

2.3.1 \fancyfoot[LO,LE]{text}

Use the \fancyfoot{text} command to set the footer. The optional arguments LO, CO, RO, LE, CE, RE indicate Left, Centre, Right, Odd (Right page}, Even {Left page}. The L,C, and R refer to the side of the page. The O and E refer to the pages themselves. The text between the curly braces {} will appear at the foot of each page.

2.3.2 \scriptsize

The footer of the page should usually be in small print. A suitable command for this is the LaTeX command \scriptsize. e.g.
\scriptsize{lyxhints.lyx}
Type the above as the argument within the braces of the \fancyfoot command.

2.3.3 \jobname

The TeX expression \jobname will give you the filename of your document (without the suffix). \jobname.lyx will append the .lyx suffix on to it. So a good way to put the the filename at the bottom of the page is:
\scriptsize{\jobname.lyx}
put into the \fancyfoot command in the preamble.

2.3.4 Dates

To put the date into a footer, you can type the date in directly. e.g. 23 June 2002 or you can use the TeX command \today to get the current date (revised each time LaTeX typesets the document). The format of the date will depend on the language setting you have chosen. Beware accepting the default (which is american and will put the month and day in the wrong order).

3 Inserts

Often you will want to include a selection of standard clauses in a document. These can be kept in separate files (LyX documents or plain text). To put them into your current document, you use the menu option: Insert.
There are 4 methods supported: Insert, Include, Input, and Verbatim.

3.1 Insert LyX File

Insert LyX File This copies the file into your document (stripping its LyX header and footer). The insert now becomes an integral part of your text and you can modify it as you wish.
The other 3 methods are reached by the menu option:Insert → Include File. These all pop up a dialogue box with a file browser and a frame with 3 radio buttons:

3.2 Include, Input, and Verbatim

Use include A grey buttom will appear on the screen. The text of the file will be typeset on a separate page. The text will not be copied into your document. But when you View or Print the the document, it will be typeset and included in the output.
Use input A button will appear on the screen. The text of the file will be typeset inline (where the cursor is). The text will not be copied into your document.
Verbatim This option is intended for including computer code listings (which you do not want to typeset).

3.3 Use Insert or Input

The include and input methods above hold within your document a reference to the file. The contents of the insert are not copied into your text (unless you click on the load button in the dialogue). This means that any subsequent changes to the insert file will appear on the output whenever you Print or View your document. If you want to retain the original document for reference purposes you should use the Insert method instead. (The insert method copies the insert file. It is thereafter separate from the original and unaffected by any changes to the original).

4 Foreign Languages

4.1 Greek

To write (say) Greek in a document, try entering in TeX mode between $ symbols the names if the Greek letters you want. For example for Ellenikh enter
$E\lambda\lambda\epsilon\nu\iota\kappa\eta. Eλλϵνικη
Note that the Greek capital E is the same as our normal E so we don’t (and can’t) enter \Eta.

4.2 Egyptian

To do Hieroglyphs, you need the LaTeX package: hieroglf
In the preamble enter
\usepackage{hieroglf}
then in the text of your document enter:
\pmglyph{k:l-e-o-p-a-t:r-a}