Go to page:

Search:   Help

Navigation

Groups

LyX documentation

Edit

Shared groups

Links

FAQ /

Using

Categories: FAQ, Numbering
<< ERT | Page list | Running >>

Questions related to using LyX

In this section, we attempt to address the truly most frequently asked questions. For a broader range of not-so-frequently asked questions and many "how do I?" topics, see Herbert Voss' spectacular collection at [1] (this page no longer exists; it appears to have been replaced at [2], but this seems LaTeX, not LyX specific). You are doing yourself a large disservice if you don't check there before sending a message to the mailing lists!

§ General questions

§§ How do I get rid of the date under the title?

The simplest solution is to open the menu Layout->Preamble and add the line

  \date{ }

in the preamble window.

(Note: In version 1.4.2, the preamble window can be found in Document->Settings...->LaTeX Preamble.)

§How do I change the spacing in an Itemize/Enumerate/Description list environment?

For individual lists, you'll have to do this by hand: for example, for one particular list, you can add the following LaTeX code at the beginning of the list:

  \setlength{\itemsep}{0mm}

If you want to change the appearance of lists globally, look here

§Equation numbering doesn't work. Help?

To number an equation, use Insert -> Math -> Display formula (Shift+Ctrl+M). Make sure you are not using inline formulas. Place the equation on a paragraph of its own, and then insert a label (Insert -> Label) inside the blue box of the equation.

§How do I number equations by section?

Add the following two lines to your LaTeX preamble:

  \@addtoreset{equation}{section}
  \renewcommand{\theequation}{\thesection.\arabic{equation}}

§How do I number equations globally?

Try the Covington package, or define your own counter in LaTeX.

§Is it possible to do this for figures and tables as well?

Replace the phrase \theequation with \thetable or \thefigure and then replace equation with table or figure. Don't forget to adapt the \@addtoreset command, too.

§How do I change to footnote numbers to symbols (star, dagger, etc.)?

Add \renewcommand{\thefootnote}{\fnsymbol{footnote}} to your LaTeX preamble.

§How do I kill widows and orphans?

Okay, we are not playing Duke Nukem here! To eliminate widows and orphans (first line from a paragraph at the bottom of the page and the last line from a paragraph at the top of the page), add the following to the LaTeX preamble:

  \widowpenalty=10000
  \clubpenalty=10000

and perhaps

  \raggedbottom

§How do I get a formatted list which starts with e.g. 1. a)?

If you want a list which looks like

1. a) First alternative
   b) Second alternative
   c) Third alternative

then try the following

1. {}
   a) First alternative
   b) Second alternative
   c) Third

where {} is in ERT (i.e. a placeholder not generating output. Specifically, set the style to "enumerate", enter the brackets in ERT, change the environment depth, and add the three elements. LyX will auto-label the entries.

§How do I count words in LyX?

LyX 1.4: Select Tools->Word Count to count the words of the whole document or of a given selection.

LyX < 1.4:

Run a spellcheck; it will display the total number of words checked. Make sure the cursor is at the top of the document when you start the spellchecker so that everything is counted.

Alternative 1 (in *nix): Export as text and run 'wc'. You can do this in one step by exporting as 'custom' (text-format) and piping the result to 'wc'. I think you use File->Export->Custom, but I'm not able to check this right now. /Christian

Alternative 2: See http://www.ctan.org/tex-archive/macros/latex/contrib/wordcount/ where you can find a shell-script that counts the words in a .tex-file. In principle, you should be able to define a special export format which calls this script on an exported .tex-file.

§How do I insert a fixed amount of horizontal space?

LaTeX offers a range of predefined horizontal spaces: \enspace (1/2 em), \thinspace (1/6 em), \negthinspace (-1/6 em), \quad (1 em), \qquad (2 em), etc. An "em" is roughly the width of the letter "m" in the current font.

LyX 1.4 supports all these natively. You can insert them via the minibuffer, i.e. with the shortcut M-x space-insert <spacetype>, where <spacetype> is the LaTeX command without the backslash.

With LyX < 1.4, you have to insert the LaTeX commands with ERT.

For customized lengths, LaTeX has the \hspace command, which takes any valid TeX length as its argument; units can be mm (millimeters), cm (centimeters), in (inches), pt (points = 1/72 inch), em (width of letter "m"), or ex (height of letter "x"). Examples: \hspace{1in}, \hspace{2.5em}, etc. This is not yet supported natively by LyX. You have to use ERT.

§How can I make citations show up as [1,2,3,6] or [1-3,6] rather than [1][2][3][6]?

Insert \usepackage{cite} into the LaTeX preamble. Most LaTeX distributions should have this package included. LyX supports this package, if you insert multiple citations separated by commas into the citation dialog, e. g. [Smalley_JCP,Jarrold_Sci], instead of just one citation after the other: [Smalley_JCP] [Jarrold_Sci].

§How do I change the colour of the output of sections, subsections etc.?

How to colour a document: (add this to the preamble of your document)

 \usepackage{color}
 \let\mySection\section

 \renewcommand\section[1]{%
   \textcolor{green}{\mySection{#1}}%

This particular one would colour all sections green in the output, just replace the \section with \subsection or any other type and you can change the colour.

This tip was orginally given to me on the LyX Users group by Herbert Voss.

§How do I get a superscript/subscript in the text?

From LyX-1.3.x onwards there should be the menu item

Insert->Special character->Superscript.

In older versions, insert an in-line math formula, enter it and insert a superscript inset (by typing the "hat" symbol, possibly followed by a blank) and then type the text of your superscript.

Unfortunately there is only a math super/subscript, to be used also in non-math text.

N.B.: for text superscripts, you should use ERT and \textsuperscript{text}, because the math superscript does not look good in normal text. Some document classes (e.g. KOMA) also have a \textsubscript. If yours doesn't, you can define one in the preamble:

  \DeclareRobustCommand*\textsubscript[1]{%
    \@textsubscript{\selectfont#1}}
  \newcommand{\@textsubscript}[1]{%
    {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}

§Figure related questions

§What is the difference between a "figure" and a "figure float"?

This is an example of less-than-ideal terminology. "Figure" is what I would really call a "graphic"; it basically means insert a picture file. "Figure float" is more what one means by a figure in a paper: it includes the graphic, the caption, the figure label, etc. You should almost always insert a figure float first, then put a figure inside that.

Tables work in the same manner. Put a table float in first, then insert the table within that.

§How do I get LyX to put the figure exactly where I want it?

Select Layout->Document. In the Float Placement box, type "!htp". This tells LaTeX to try really hard to put the figure here first, then the top of a page, then on a page by itself. This is a global setting: all figure will then obey this rule set.

If you want to control how each figure behaves, right-click in the figure float and you will get a dialog allowing to control the figure behavior.

§What does "Too many unprocessed floats" mean?

LaTeX can handle only a limited number of floating elements floating at a given time. For example, if Figure 4 can't be fit in a good location (using the default rules of top of the page, then bottom, then a page of its own) and Figure 5 comes along, they will both continue to float toward the end of the document until a good location can be found. If nothing good turns up, they will just be placed at the end of the document. If there are too many of these, LaTeX overruns a counter and emits the "too many unprocessed floats" error. This is not a bug in LaTeX, this is simply too many figures with too little text :-)

The easiest way to work around this is to insert a \clearpage command somewhere in the document where a pagebreak would be appropriate. While a pagebreak would simply start a new page, \clearpage processes all remaining floats, then begins a new page. This may lead to an unsightly stack of figures in the middle of your document; you may need to use several \clearpages to make things balance nicely.

§Math related questions

§How do I put normal text inside a mathematical equation?

Type "M-m m" while inside the equation to enter "math text mode".

§How do I make a cube root (or higher)?

Type "M-m r" to insert a nifty "root box". Use the cursor keys to navigate the entry boxes.

§Table related questions

§How do I put a multiline text in a table cell?

There are several ways, and the one you should use depends on what you need to do exactly.

  • Select a width to the column, and then you can use ctrl+enter (line break) in that column.
  • Like above, but select a width only to a single cell in the column, by clicking the "multi column" button for that cell and then setting the width.
  • Write the text in two more more consecutive vertical cells. You can disable the lines between the cells by making the cells multi-column, and then disable the lines you don't need.

FAQ Numbering

<< ERT | FAQ.PageList | Running >>

Edit - History - Print - Recent Changes - All Recent Changes - Search
Page last modified on 2008-01-06 14:57 CET