\makeatletter \def\LyX{L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\spacefactor1000}% \newcommand{\lyxtitle}[1] {\thispagestyle{empty} \global\@topnum\z@ \section*{\LARGE \centering \sffamily \bfseries \protect#1 } } \newcommand{\lyxline}[1]{ {#1 \vspace{1ex} \hrule width \columnwidth \vspace{1ex}} } \newenvironment{lyxbibliography} { \begin{thebibliography}{99}} {\end{thebibliography}} \def\lxq{"} \newenvironment{lyxcode} {\list{}{ \rightmargin\leftmargin \raggedright \itemsep 0pt \parsep 0pt \ttfamily }% \item[] } {\endlist} \newcommand{\lyxlabel}[1]{#1 \hfill} \newenvironment{lyxlist}[1] {\begin{list}{} {\settowidth{\labelwidth}{#1} \setlength{\leftmargin}{\labelwidth} \addtolength{\leftmargin}{\labelsep} \renewcommand{\makelabel}{\lyxlabel}}} {\end{list}} \newcommand{\lyxletterstyle}{ \setlength\parskip{0.7em} \setlength\parindent{0pt} } \newcommand{\lyxaddress}[1]{ \par {\raggedright #1 \vspace{1.4em} \noindent\par} } \newcommand{\lyxrightaddress}[1]{ \par {\raggedleft \begin{tabular}{l}\ignorespaces #1 \end{tabular} \vspace{1.4em} \par} } \newcommand{\lyxformula}[1]{ \begin{eqnarray*} #1 \end{eqnarray*} } \newcommand{\lyxnumberedformula}[1]{ \begin{eqnarray} #1 \end{eqnarray} } \makeatother %% %% END The lyx specific LaTeX commands. %% \author[Andrew Lack]{Andrew F. Lack \\ City University \\ \ttfamily sa346@city.ac.uk} \title{An introduction to \LyX} \begin{Article} \section{\sffamily \Large What is \LyX?\rmfamily } Am I a dinosaur living beyond my `best before' date? Sometimes feels like it. To start with I use Unix. Every popular computing magazine you pick up today is filled with one word, and it isn't Unix. Then I use \LaTeX{} under Unix. People look at you as if you are from another planet. \LaTeX{}? You mean you can't \em see \em what it looks like as you type? But then I come across something like \LyX{} and my faith in humanity, or that part of it which still uses Unix and \LaTeX{}, is restored. \LyX{} is a full-featured ``near'' \scshape wysiwyg \upshape editor for creating and editing \LaTeX{} documents. Surprisingly, it's not currently available from the \scshape ctan \upshape archive, but by anonymous ftp from \ttfamily ftp.via.ecp.fr/pub/lyx. \rmfamily Binaries are available for some popular varieties of the Unix system, including Sun Solaris and Linux. To compile the source you'll need (to quote the authors) ``a good C\ttfamily ++ \rmfamily compiler'' as well as the \sffamily xforms \rmfamily library (available from \ttfamily ftp.via.ecp.fr/pub/xform\rmfamily s). Although the current version is only 0.10.7, and described as a beta version, it is reasonably complete and usable. The software is written by Matthias Ettrich ably assist by many others, too numerous to mention. This article was prepared using \LyX{}. While doing so, I only experienced 3~crashes over a period of several hours plus a few oddities which are described. \LyX{} is a front-end for an existing, working, \LaTeXe{} installation. It won't work with the older 2.09 release. It likes to use \bfseries xdvi \mdseries for screen previewing and \bfseries dvips \mdseries for printing, though other printer drivers may be usable by re-configuring \LyX{} via its configuation file. To create a \scshape wysiwyg \upshape word-processor for \LaTeX{} would be an extremely complicated task. So \LyX{} takes a different approach; it uses ``\ttfamily .lyx\rmfamily '' files, which internally resemble \TeX{}, but which are not. This allows \LyX{} to manage the `style' of the code creation which, in turn, simplifies what is already a complicated task. [How many different ways are there to make a word bold with \LaTeX{}? I can think of at least three, but \LyX{} only understands one.] \LyX{} then `interprets' the code in real-time---it does not constantly run \LaTeX{} in order to update the display. Thus the screen shows an approximation to the final output, not the \em exact \em output. Because \LyX{} uses its own internal format, you cannot use it to open a ``\ttfamily .tex\rmfamily '' file. Neither should you edit ``\ttfamily .lyx\rmfamily '' files using \bfseries vi \mdseries or other text editors. \LyX{} is not for \LaTeX{} `power users'. You'll find many things which are easy using \bfseries vi \mdseries are just not possible within \LyX{}, as I found while composing this review. However, if you are a \LaTeX{} beginner, or you have a requirement to `encourage' users away from inferior and troublesome PC word-processors, \LyX{} may be just what you need. \section{The main Window} The main window resembles any other GUI word processor.\footnote{ I'm being careful here not to mention that dreaded word word---damn } It has a menu bar along the top plus a single row of icons in the tool bar. At the bottom of the screen a status window gives the user messages about what's happening. Fig.~\ref{fig:fullscreen} shows the main \LyX{} window. \begin{figure*} {\centering \epsfig{file=lyx-full, width=1\textwidth} \par} \caption{\LyX{} showing the \em Character Layout \em and \em Maths Panels\label{fig:fullscreen}\em } \end{figure*} My first gripe is that the authors have chosen to use the \sffamily xforms \rmfamily library to give the application its look and feel. This is a bit like Motif, but has a number of deviations. Most significant among these is the way the scroll bars work. But once you've got over this the look and feel should be acceptable. According to the documentation which comes shipped with \LyX{}, the authors have had to do a lot of work on \sffamily xforms \rmfamily to get it into the current state. The choice of which tools appear in the tool bar is configurable via the \ttfamily .lyxrc \rmfamily file.\footnote{Users can have their own or can use a system-wide version } Those that are available by default are the only ones which currently have icons, so the choice isn't that great. This is where I get to air my second gripe---the font selection icons. There are only three; an exclamation mark for \em select emphasised style\em , I'm happy with that. But the second is a figure of a person (man?) which denotes something called noun style for setting small caps. Now this \em is \em weird. The third button has a user-customisable effect, which is set from the \bfseries Layout/Character \mdseries menu. The menu gets `pinned' to the display so enabling quick changes to family, series, shape and size. Even so, dedicated buttons for typewriter font and bold should be provided in a later release. On the left of the tool bar is the \em style selector. \em Here you can choose most of the important \LaTeX{} layout styles, such as sections (with and without asterisk) the three basic list environments, verse and quote. There's also the \textbf{\texttt{LaTeX}} option which allows the author to directly enter a \LaTeX{} command---these appear in red on the screen. More about this later. \section{Getting started} Choose \bfseries New \mdseries from the \bfseries File \mdseries menu. The file picker is definitely \em not \em Motif, which is one good thing to say about \sffamily xforms\rmfamily . You can also choose a file template which is used to initialise the document, by inserting its contents into the new one. And away you go! {As you type, \LyX{} automatically breaks the line and wraps the cursor onto the following line. You should only press \sffamily \(<\)Return\(>\) \rmfamily to end the paragraph. Using \sffamily \(<\)Control-Return\(>\) \rmfamily enters a \ttfamily \(\backslash\)\(\backslash\) \rmfamily command. If you make change to a paragraph, \LyX{} instantly re-formats the screen to show its new appearance. \LyX{} doesn't hyphenate words, it always breaks at word boundaries. However, remember \LyX{} is only \em approximating \em to the final appearance. Once you format the document, \TeX{} will be finding the line breaks instead.\par} {Use \sffamily \(<\)Control-Space\(>\) \rmfamily for an unbreakable space (tie) which is shown as a small red~{\footnotesize$\sqcup$}.\footnote{ I tried, unsuccessfully, to create this symbol by using \ttfamily \(\backslash\)verb*+ +. \rmfamily This produced a \LaTeX{} error, though not when I created a ``\ttfamily .tex\rmfamily '' file and then formatted that. } New paragraphs are automatically shown indented (but not, of course, immediately following a section). The menu \bfseries Layout/Paragraph \mdseries can be used to cancel paragraph indentation. This has a global effect on the document.\par} \LyX{} has intelligent quotes, which are used when the double-quote character is entered. You can select English, French or German quote marks, though the display always shows English. Clicking the floppy-disc icon in the tool bar automatically saves your document back to disc. There's also a timed-backup feature. From the \bfseries Edit \mdseries menu, there is an ``infinite'' depth undo facility. \LyX{} also supports PC-style \bfseries cut\mdseries , \bfseries copy \mdseries and \bfseries paste \mdseries via three buttons in the tool bar. It doesn't, however, support the normal X-selection, which is a shame, so you can't export from \LyX{} to other X-applications, though you can import using \bfseries Edit/Paste Primary Selection\mdseries . \subsection{Changing the Appearance} You have two choices about changing the visual appearance. You can either change the settings \em before \em you type something, or you can go back, highlight it and then apply some new combination of effects. For many commands `sensible' things happen when attributes are changed and nothing is highlit. For example if I were to pick left-block from the \bfseries Layout/Paragraph \mdseries menu in the middle of this paragraph, the new setting would be automatically applied to the whole of the current paragraph. \section{Lists} The easiest way to create a list is to enter each item as a separate paragraph, then highlight all the items and choose the required list type from the style drop-down. When a description list is used, the first word of the item is automatically emboldened and you must use unbreakable spaces (\sffamily \(<\)Control-Space\(>\)\rmfamily ) to include more than one word. \LyX{} provides a forth list-type, \bfseries list\mdseries , which which is based on the \LaTeX{} \ttfamily list \rmfamily environment. An example follows; \begin{lyxlist}{enumeratedx} \item [itemized]produces bullet-points \item [enumerated]produces numbered lists \item [description]produces a bold subject followed by a description \item [list]produces this type of list. Note that the width used for each label is the same. The actual width used is set by simply highlighting the entire list and setting the label width using the \bfseries Layout/Paragraph \mdseries menu, then clicking \bfseries Apply\mdseries . \end{lyxlist} \subsection{Lists within lists} The tool bar provides the button \em change environment depth\em . This is used to insert a new list `level' into an existing list. For example to achieve; \begin{itemize} \item This is an item of an \ttfamily itemize \rmfamily list \begin{itemize} \item This is the first item of a list \em within \em the first \end{itemize} \item end. \end{itemize} the \em change environment depth \em was used after entering the first item so that the following item was at the next level. After entering the second line, \sffamily \(<\)Return\(>\) \rmfamily puts \LyX{} back at the previous level. Using the highlight-then-apply model, it's possible to select a number of items for `moving' to a new level. \begin{enumerate} \item This is an item of an enumerated list \begin{itemize} \item When typed this was item 2, it will be moved to a new level \item When typed this was item 3 \end{itemize} \item When typed this was item 4 \end{enumerate} \section{Footnotes and marginal notes} A footnote is inserted into the document by using the dedicated button in the tool bar. This opens a text box on the screen into which the footnote text is entered. By clicking-left on the box's \em foot \em tab, the footnote is closed and a small red ``foot'' appears in the main text. Double-clicking left on this, re-opens the box for editing. Clicking-right in the opened box allows the footnote to be deleted (called \em melting\em ). Once the footnote has been melted, its text just becomes part of the document. The opposite it true as well, just highlight a piece of text, click the footnote button, and voil\`{a}---one footnote. Marginal notes are handled in an identical manner. \section{Figures and tables} Figures and tables can be inserted either ``here'' or as floats. You appear to have to choose at the time these are created, you don't seem to be able to change your mind later. Inserting a table causes it to appear on the screen centred under the ``current'' sentence. Choosing a table float opens up a red table box into which the table can be inserted and a caption added to the \bfseries Table: \mdseries prompt. The box can then be collapsed in a same way as for footnotes. \subsection{The Table Editor} Creating a table (actually a \ttfamily tabular \rmfamily environment) is achieved using a \em table editor\em . The first stage is to select the number of rows and columns. Sliders are provided for this, defaulting to 5x5. Once the size is set, an empty table is inserted into the document, with the cursor positioned in the top left cell. The table's initial layout assumes the first row will be used as a heading and it is separated from the rest of the table by two horizontal lines (\ttfamily \(\backslash\)hline\rmfamily s). Rows and columns have separating rules. With the cursor positioned in a cell, entering text causes the text to appear in the cell, and all cells of the same column automatically expand to the same width---exactly as you'd expect with the \ttfamily tabular \rmfamily environment. To edit neighbouring cells, simple use the cursor arrow keys, or click the left mouse button. With the insert-cursor in a cell, clicking-right displays a table menu which allows you to change the following; \begin{itemize} \item the text alignment from \bfseries center \mdseries to \bfseries left \mdseries or \bfseries right\mdseries \item delete the column or row \item append a new column or row \item choose the rules used separate cells (select rule \bfseries left\mdseries , \bfseries top \mdseries and/or \bfseries bottom\mdseries ). If no rule is selected, a dotted-line is drawn to show the separation between rows or columns. \item combine adjacent cells into a single cell (\em multicolumn\em )\em . \em This is achieved by high-lighting the cells and choosing \bfseries multicolumn \mdseries from the table-menu. I found that in version 0.10.7, this sometimes caused problems. \end{itemize} Using the table editor, this is one of the examples from \em Lamport\em ; \vspace{0.92cm} {\centering \begin{tabular}{|l|c|r|} \hline \em type\em &\multicolumn{2}{|c|}{\em style \em }\\ \hline smart&red&short\\ \hline rather silly&puce&tall\\ \hline \end{tabular}\par} \vspace{0.92cm} In \em Lamport \em the table had a double rule at the top and bottom. This particular feature seems not to be possible with the table editor. \ttfamily \(\backslash\)cline\rmfamily 's aren't possible either. Another tabular feature which I almost always use, namely \ttfamily \(\backslash\)arraystretch\rmfamily , must be set by entering the required command directly (see below). Vertical space above and/or below the table can be added by high-lighting the entire table and then changing the paragraph settings from the \bfseries Layout/Paragraph \mdseries menu. This also permits the table alignment to be changed to left of right. \subsection{Figures} \LyX{} allows the inclusion of figures in one of three formats; \begin{description} \item [encapsulated~PostScript]which is displayed centred on the page \item [in-lined~encapsulated~PostScript]which is displayed aligned with the adjacent text \item [\LaTeX{}]which permits you to \ttfamily \(\backslash\)input \rmfamily a file and display it centred on the page \end{description} The first two formats create boxes on the screen with an \bfseries F \mdseries to signify a figure. Double-clicking-left on the box opens up a dialogue box in which the details of the figure are programmed. Apart from the obvious one of filename, the author can choose the size, rotation angle and a command which \LyX{} uses to display the image. (It defaults to using \bfseries ghostscript\mdseries .) Once the parameters have been entered and applied, \LyX{} updates the display with the image. \section{Setting Mathematics} \LyX{} has a \em maths editor \em which is much like the mathematics editor of any other GUI-based word processor. To enter maths mode you can either click the maths editor button from the tool bar, or choose \bfseries Math/Math mode \mdseries for in-line maths or \bfseries Math/Display \mdseries for displayed maths. In either case a small blue box appears on the screen and the insert cursor is positioned within. You are now in the maths editor. It is more difficult to describe how to use the editor than to use it---and even I quickly picked-up how it works. The menu option \bfseries Math/Math Panel \mdseries brings up a separate window from from which you can pick the multitude of special \LaTeX{} symbols. For simple maths, for example using Greek characters, just pick the character required from the menu in the maths panel. For more complex maths, which perhaps requires a ``two dimensional'' layout, the essential feature of the editor is the use of the arrow keys which navigate you through the equation. There are no menu options for superscripts and subscripts which greatly simplifies the maths panel. Instead, these are entered by using \sffamily \(<\)\^{}\(>\) \rmfamily and \sffamily \(<\)\_\(>\) \rmfamily respectively. So, by just using the maths panel, \^{}/\_ keys and the arrow keys, you can quickly create \[ \sum ^{\infty }_{i=0}\frac{1}{k^{2}}=\frac{\pi ^{2}}{6}\] Or, how about \[ y=\int ^{\infty }_{0}\left\{ \frac{sin^{2}\left( \alpha \sqrt{\frac{ax+b}{cx+d}}\right) }{\sqrt{\beta +\alpha x}}\right\} ^{\frac{a+b}{c+d}}dx\] The appearance of the maths on the screen is more than adequate to show the detail of what has been selected. The Greek characters and special symbols are very well drawn. The maths editor supports roots, fractions, delimiters, ``over symbols'' (called decorations), arrays and maths spacing. It does not appear to support the non-roman maths fonts, log-like functions, nor can I determine how to get numbered equations. Neither can you swap a piece of maths between `display' and `in-line'; you have to choose at the point of creation. \section{Document styles} From the \bfseries Layout/Document \mdseries menu you can choose a number of parameters which affect the whole document. These include the document class, the typeface (\LyX{} supports the common \scshape PostScript \upshape faces) body type size (\ttfamily 10pt\rmfamily , \ttfamily 11pt \rmfamily etc), paper size, paper orientation (landscape or portrait), single or two-sided, single or double column,\footnote{ though \LyX{} does not display two columns if double column is chosen } language (from which you can choose from about 20 possibilities), baseline stretch, section numbering depth and table-of-contents depth. Also from the \bfseries Layout \mdseries menu, the \bfseries Preamble \mdseries option allows you to enter a series of lines which are added verbatim to the document's preamble. There's good support for letters with \LyX{}; you can can select \bfseries letter \mdseries as the document class and the standard installation comes with a suitable template. Selecting the \bfseries letter \mdseries class also changes the \LaTeX{} formatting options available from the style drop-down. Included is \bfseries cc\mdseries , \bfseries Signature\mdseries , \bfseries Opening \mdseries and \bfseries Closing\mdseries . \section{Entering \LaTeX{} Commands} Sooner or later you will want to achieve some formatting effect which \LyX{} cannot currently handle. To do this you can enter a \TeX{} or \LaTeX{} command directly into the document. You can do this in a number of ways, the easiest of which is to use the dedicated button in the tool bar (with the \TeX{} logo). Clicking this puts \LyX{} into ``\TeX{} mode'' and what you type is shown in red. Effectively what you type is added to the file verbatim, and no interpretation is undertaken. While creating this document I have had used this feature only a few times. However, it will be clear by now that quite significant amounts of \LaTeX{} are not yet covered by \LyX{}; rules, boxes, the minipage environment and the tabbing environment, to name a few. And then there's all those packages which are available. \section{Interfacing with \LaTeX{}} One of the most frustrating features with teaching beginners \LaTeX{} is explaining how to deal with the inevitable errors which result from formatting. \LyX{} solves this difficult problem in a way which must have taken a great deal of work. Whenever \LyX{} runs \LaTeX\ for you, any errors which occur are flagged by inserting a red, \sffamily \fbox{\rmfamily Error\sffamily } \rmfamily into the document at the point where the error occurred. By clicking-left over the box, it opens to show you the description of the error. This is really neat. From the \bfseries Edit \mdseries menu, use \bfseries Goto error \mdseries to rapidly move between the different errors. Printing is possible from the \bfseries File \mdseries menu as well as from a dedicated button in the tool bar. A print dialogue allows the author to choose the name of the printer (that which would normally be appended to a \ttfamily -P \rmfamily option using an \bfseries lpr \mdseries command), the stacking order (normal or reverse) and whether to print to a file or printer. When the document is printed, \LyX{} doesn't bother to re-format the document if nothing has been changed. Because \LaTeX\ is only run once this causes problems if your document uses cross-references. The work-around is to format the document twice using \bfseries File/Run \textbf{LaTeX} \mdseries and then to use the print button. It's possible to create (to quote the menu) a ``nice'' \ttfamily .tex \rmfamily file from the ``\ttfamily .lyx\rmfamily '' file. This can be sent to someone who doesn't use \LyX{}, and will, naturally, produce an identical output, notwithstanding the usual issues of fonts and packages. This is how this document was transmitted to the editors of \em Baskerville\em . \section{Spell Checker} \LyX{} supports a spell checker by interfacing with the \scshape gnu \upshape \bfseries \mbox{ispell} \mdseries command, which must be separately installed. Using the spell checker is simplicity itself. Mis-spelled words are highlighted in the main document, while in a separate window the alternate choices are displayed, together with a number of control buttons (see Fig.~\ref{fig:spellchecker}). A progress bar is also provided.\begin{figure*} {\centering \epsfig{file=spellcheck, width=0.5\textwidth} \par} \caption{The spell checker window\label{fig:spellchecker}} \end{figure*} \section{A Final Word} There are a number of \LaTeX{} features which are supported by \LyX{} but which have not been covered in this review. These include tables-of-content, lists-of-figures and tables, cross references, bibliographic citations, verse, various commands for building title pages (title, author etc.). I'm a die-very-hard user of \bfseries vi\mdseries , but even after a couple of hours with \LyX{}, I now find myself wishing for word-wrap and point-click-type when using an xterm. There's no getting away from it, GUI applications are appealing. Its difficult for me to over-express my admiration for this program and my thanks to the authors for their effort in producing it. It's brilliant! Even the ``beta'' 0.10.7 version has proved to be extremely reliable---I regard 3~crashes as well within acceptable limits. Such an editor is, in my view, long overdue for the \LaTeX{} world and the fact that Unix has been chosen as the first delivery OS heartens me no-end. Well done Matthias and the rest of the team! \end{Article}