Go to page:

Search:   Help

Navigation

Groups

LyX documentation

Edit

Shared groups

Links

LyX /

LinguistLyX

<< InstantPreview | Page list | HumanitiesLyX >>

Using LyX for Linguistic Papers

by Maria Gouskova, Stacia Hartleben and Jürgen Spitzmüller

LyX and Linguistics

Linguists, as opposed to, say mathematicians, have pretty specific typographic and formatting needs, such as:

  • a numbered paragraph environment, in parentheses, with numbering sequential throughout the document
  • table editing: double lines, dashed lines, shaded table cells (for Optimality Theory)
  • pointy hand symbol (for Optimality Theory)
  • phonetic notation (IPA fonts)
  • trees, syntactic and autosegmental/prosodic
  • aligned glosses
  • specific notation for conversation analysis
  • math symbols intermingled with phonetic symbols
  • switching from one language's orthography to another in the same document/paragraph/line

LyX isn't suited very well for some of these aims, but some base functionality is there, although it is not obvious to find and use. This site aims at documenting LyX's undocumented features for linguists, shows some workarounds and feature requests for future LyX versions.

For general information about using LyX in humanities, which covers a lot of linguists' needs as well, consult the site HumanitiesLyX.

For general information on LaTeX for linguists please see Doug Arnold's LaTeX for linguists page, the UPenn LaTeX page, and Ling-TeX.

Linguistics Module [new in 1.6]

Forthcoming LyX 1.6 will introduce the feature of modules that add specific features to your document. It ships a Linguistics module that adds some native support for numbered examples, glosses, OT tableaux and some semantic markup. You can load the module in Document→Settings→Document Class.

Instructions for this module can be found throughout this site. Additionally, LyX 1.6 also includes an example file linguistics.lyx that demonstrated the features.

If you have suggestions for features that could be added to this module, don't hesitate to contact the LyX developers list.

Phonology/Phonetics

Using LyX to Display Phonetic Characters (IPA)

LaTeX has good support for the International Phonetic Alphabet (IPA), namely the TIPA package. It includes two font families. One has been designed to be used with LaTeX's computer modern family of fonts, the other with times (i.e. mathptmx.sty). Please read the voluminous TIPA manual for details.

The following sections describe how to use TIPA in LyX. There are two ways to use TIPA in LyX. The first method is via ERT, and the second is via Math Mode. The difference is what you see on the screen in the editor. Math Mode presents what you've typed in Instant Preview, and thus is close to WYSIWYG. Both methods are described below.

a.) Loading the TIPA package

To use the ERT method, the tipa package must be loaded in the preamble of the document: enter \usepackage{tipa}. Skip down to f.) below.

To use the Math Mode method (described in b.), c.) and d.)), you don't need to load the package. As of version 1.4.2, LyX loads the package automatically. Only if you use ERT instead (cf. sec. f.), you have to load the package yourself.

b.) Inserting IPA Symbols in Math Mode

TIPA has been integrated in LyX's math editor (hear, hear!) and hence you have to switch to math mode to insert phonetic characters. This is done by the keyboard shortcut C-M (or Insert→Math→Inline formula). Since we need to enter math's text mode, we have to hit C-M twice. Now we find ourselves inside the so called math_textinset:

Now to switch to TIPA mode, we have to insert \textipa into this math inset and hit the space key. The \textipa will disappear and everything looks as before, but LyX is now in TIPA mode nonetheless. We can now enter text, using the shortcut characters that TIPA provides (see the appendix of the TIPA manual for a list of all symbols and the corresponding shortcuts):

That's all. If the TIPA package has been installed correctly, this text will come out as phonetic notation in the DVI or PDF output. However, since we are in math mode, we can also use LyX's Instant Preview feature, which will display us the phonetic text inside LyX as soon as we leave the math inset with the cursor. Voilà:

c.) Using a Shortcut/the Menu

LyX 1.4.3 introduces a menu entry Insert→Special Characters→Phonetic Symbols, which will bring you to the TIPA mode immediately. For older versions, you can define a menu entry yourself:

As described here, you have to modify a copy of the file stdmenus.ui (or default.ui previous to LyX 1.4) and add, for instance in the section Menu "insert_formatting", the following line:

Item "Phonetic Symbols|y" "command-sequence math-mode on; math-insert \text\textipa ; char-forward ;"

Using the same combination of commands, you can also define a shortcut to switch to TIPA mode after just one key press. To do so, create your own bind-file as described on this page and insert the following line (instead of C-M-p, which binds the switch to Ctrl+Meta[Alt]+p, you can use any other free key combination):

\bind C-M-p "command-sequence math-mode on; math-insert \text\textipa ; char-forward ;"

d.) Converting from text to math mode

You can also insert it this way: write \text{\textipa{Ekspl@"neIs@n}} in LyX (outside math), select this text, and then hit C-M. It will be converted automatically to math mode.

e.) Unicode: IPA symbols in normal text

With version 1.5.0, LyX switched to unicode. Thus, IPA symbols in normal text are supported as well. If you are used to enter TIPA in math mode there is no reason to switch (the more so as the kerning in math mode is better), but IPA in normal text enables you to paste text from other sources into LyX, and it might also be convenient if you are used to a helper program to enter IPA symbols anyway. For now, see XeTeX.

[new in 1.6] Note that LyX 1.6.0 will introduce a general symbols dialog (Insert→Special Characters→Symbols...) from which you can directly insert IPA characters (cf. http://wiki.lyx.org/LyX/NewInLyX16#symbolsdialog)

Not all IPA symbols are known by LyX yet. If you need one that is missing, find out the UCS4 code point, look up the command name in the TIPA manual, and add a line to the file unicodesymbols that you will find in your LyX installation directory. Please send the newly added symbols to the developer list, so that they can be included in the next release. The newest version of this file can always be found at http://www.lyx.org/trac/browser/lyx-devel/trunk/lib/unicodesymbols. The syntax is explained at the beginning of this file.

f.) If everything else fails: Using ERT

Finally, of course, you are free to use LyX's LaTeX mode (ERT) to enter any TIPA command. This might be necessary sometimes to use things that are currently not yet supported. Of course, you'll lose all the nice features of the native support, most notably Instant Preview.

Tables and Optimality-Theoretic Tableaux

Unlike some LaTeX editors, LyX allows you to edit tables visually, though its table formatting capabilities are somewhat limited. The most important OT-specific table formatting need is dashed vertical lines--the typical way of showing that two constraints cannot be ranked with respect to each other based on available evidence. Dashed lines are created using the package arydshln. Another need, which is formally somewhat superfluous, is table cell shading--the way to show the violations that are irrelevant to the fate of a candidate. See the LyX wiki page Tables for dashed lines and shading.

Here are some examples of tableaux: comparative_tableau_example.lyx

data_tableau_example.lyx

Tableaux Floats and List of Tableaux: [new in 1.6] The Linguistics Module provides a separate float for Tableaux as well as a List of Tableaux (with a separate counter). You can find and use both the same way as table and figure floats. Note that the captions are always below the tableau by default, no matter where you put them in the LyX view. To get captions on top, put in preamble

\floatstyle{plaintop}
\restylefloat{tableau}

If your using a KOMA class and the option "tablecaptionsabove", use the following instead for better spacing:

\floatstyle{komaabove}
\restylefloat{tableau}

For LyX < 1.6, you have to create such a float yourself. The procedure is explained in this message to lyx-users.

Feature Matrices/Stuff in Brackets

For SPE-style feature representations in brackets, go to the Math Panel (Insert→Math→Math Panel) and click on the button to open the delimitor and bracket dialog. Select square brackets from the many available options, and then click on the "insert matrix" button to insert a matrix (basically, a mini-table without grid marks) inside the brackets. You can specify the number of rows and columns inside the matrix in the emerging dialog box.

If you need to use the pound sign, #, inside math mode, you must type it in as \#, otherwise LyX will not recognize it as a valid character. If you want the text inside the matrix to not appear in italics, select the line and change it to text mode (see above).

Other Special Characters and Diacritics

The Comprehensive LaTeX symbol list by Scott Pakin covers many of the symbols that can be produced with LaTeX. You can insert them in LyX by means of ERT or in math-text mode as described above. Furthermore, LyX supports the direct input of unicode characters as of version 1.5.0 and automatically translates these glyphs to the according LaTeX macro on output (almost the complete list of Pakin and more should be supported).

For example, an acute accent on an "a" can be entered

  • as character á (if the keyboard supports it, maybe via a dead key or a key combination),
  • via cut and paste from external sources,
  • with the accent-acute lfun (M-x accent-acute a),
  • via the lfun unicode-insert 0x00e1 (where 0x00e1 is the unicode code point of the glyph á),
  • as ERT (Ctrl-l \'a).

[new in 1.6] LyX 1.6.0 will introduce a general symbols dialog (Insert→Special Characters→Symbols...) from which you can directly insert all supported characters (cf. http://wiki.lyx.org/LyX/NewInLyX16#symbolsdialog)

Symbols such as arrows, zero, relations of domination, relative harmony, and so on can be found in the Math Panel. If you need to place a primary/secondary stress (grave/acute accent) or an unstressed/short mark on top of a Greek letter, the easiest way is the Math Panel/Frame Decorations.

If you need a pointy hand to mark the winner in your OT tableau, there are several options available in various packages. The bbding package has a nice pointy hand with a cuff, which in ERT is entered as \HandRight. See The Comprehensive LaTeX symbol list for more. The pointy hand is supported in Instant Preview.

Using LyX to Draw Trees

Packages

One of the following packages is needed to draw trees in LyX:

  1. The qTree package (location on CTAN). Take care that you have a recent version of qtree that supports the pict2e package.
  2. The pst-qtree package is a frontend for the PS-Tricks tree package pst-tree. It uses a similar syntax as qTree. Compared to qTree, the package can do more complex things (such as traces and dotted branches); however, it does not work with pdflatex out of the box (look here for details), and you need to have PS-Tricks installed.
  3. Ralf Vogel's xyling package, which is based on xypic.
  4. For extra power, you may have to resort to xypic.

The choice of the package depends on your needs and taste. Here are some pros and cons for Qtree and XYLing:

  • Qtree:
    • PRO: the user interface is much more intuitive as xyling's (unless you are already familiar with the xypic syntax).
    • PRO: works with pdflatex out of the box
    • PRO: works with Instant Preview for a WYSIWYG experience (however, for more complicated trees it is advisible to put trees in an ERT snippet).
    • recommended for drawing simple trees
  • XYLing:
    • PRO: much more features for complex trees, traces and other nifty things
    • PRO: better control over the alignment of nodes
    • CON: the interface is less intuitive (however, the package comes with an excellent step-by-step manual)
    • CON: for pdflatex, the package must be modified (see comment in xyling.sty)
    • CON: no Instant Preview.
    • recommended for drawing complex trees and if all nodes have to be aligned

Category: Trees

Simple Trees

Install the qTree package and then put \usepackage{qtree} into your preamble. Make sure that Instant Preview is activated. Then hit C-M twice to switch to math-text mode, and type the following text for example (the blanks are important):

\Tree[.S [.N This ] [.V is ] [.NP [.Det a ] [.N test ] ] ]

After the cursor has left the inset, the tree should be displayed inside LyX:

Alternatively, you can again write the text outside math mode, select it, and hit C-M to convert it to math (see here).

If the branches of the tree vanish in your preview, you are facing a bug in dvipng, the converter used by Instant Preview to generate the preview images for LyX. The bug has been reported to the dvipng developer and he has fixed it for the upcoming version 2.0 of dvipng. So watch out for dvipng >= 2.0 and upgrade to that.

Roofs

Roofs (for complex phrases) can be inserted with the \qroof command. In LyX, you can insert this by typing \qroof{ at the appropriate place in the formula. As soon as you have typed the curly bracket, a new subinset is created:

There you can type the phrase inside this subinset, which is then marked as follows.

Here's the Instant Preview display after the cursor left the inset:

Glosses

To put glosses under the nodes of a tree, you have to fool the Math Editor. In qtree, this can be done with the linebreak command \\, but the math editor does not accept that. So put in the preamble:

\renewcommand{\breaknode}{\\}

Then you can do:

\Tree[.S [.N Das\breaknode This ] [.V ist\breaknode is ] [.NP [.Det ein\breaknode a ] [.N Versuch\breaknode test ] ] ]

This also works inside qroofs.

Prosodic Structure Trees/Greek Symbols in Trees

If you want to include greek letters such as sigma for syllable nodes or mu for morae, you have to enter math-math mode while keeping the tree in math-text mode. The greek symbols must then be entered in LaTeX code, which requires putting them between dollar signs, as in:

\Tree [.$\sigma$ $\mu$ $\mu$ ]

Instead of manually inserting the dollar signs, you can also switch to math-math mode before entering the Greek letters by pressing again C-M. Then you can enter just, for instance, \sigma, which will be converted to the symbol (after you hit <space>). Don't forget to return to text mode again after the Greek letter by leaving the subinset (in math mode, spaces are impossible).

This will produce a simple syllable (sigma) branching into two moras (mu), viewable via Instant Preview inside LyX.

Autosegmental trees

For simple feature-sharing trees, qtree is again recommended, as it can handle multiply branching trees and does not require you to define the position of the nodes for the branches to connect them correctly. If, however, you need to write a spreading rule with a dashed line, you need something more powerful, such as xyling. Unfortunately, as noted, the package does not seem to be supported in Instant Preview, so you have to use ERT. Here are a couple of examples and the trees they produce:

\Tree {\K{[back]} \B{d}\Bdash{dr} \\ \K{V} & \K{V}}
\Tree{\K{[back]} \D\Bdash{dr}\Bdash{drr} \\ \K{V} & \K{V} & \K{V}\B{d} \\ & & \K{[-low]}}

To do autosegmental delinking, you need xypic (which is the basis for xyling). Here is an example, along with the code that produced it. See XY-pic for more.

example file

"Right-side-up" trees, lattices, OT Hasse trees (ranking diagrams)

You need XY-pic.

Using LyX to display numbered examples with Covington

The package Covington does several useful things, but one of its most convenient functions is that it provides a sequentially numbered environment that can span several sections. Your numbered examples will look as follows:

The package provides the environments example (for single examples) and examples (for multiple, subsequent examples). These can be used by means of ERT.

Setting LyX up to include a Covington environment

If you use numbered examples a lot, you can also make the Covington numbered environment available in your document as a separate paragraph environment similar to Enumerate, Itemize, and others.

[new in 1.6] As of LyX 1.6, doing this is easy. Just load the Linguistics Module and you will find styles for Numbered Examples (multiline) (covington's example environment), Numbered Examples (consecutive) (covington's examples environment) and for Subexamples (additionally defined by LyX) in the paragraph style combo box.

For versions older than 1.6, there are two ways to achieve the same (the first one is easier):

  1. Grab the file linguistics.inc, which contains two environments Example for a single example and Examples for multiple subsequent examples plus an environment Subexample).
    Place this file in your .lyx/layouts directory and include it in the layout file of your choice by inserting the line
    Input linguistics.inc
    there.
  2. Create a new LyX doc class layout yourself. First, go to Steve Litt's page to get a general idea of what this involves. Then create a .layout file with the following text in it:
    
    #% Do not delete the line below; configure depends on this
    #  \DeclareLaTeXClass[article]{article (+Numbered)}
    # Article textclass definition file. Taken from initial LyX source code
    # Author : Matthias Ettrich <ettrich@informatik.uni-tuebingen.de>
    # Transposed by Pascal Andre <andre@via.ecp.fr>
    # Heavily modifed and enhanced by several developers.
    
    # Input general definitions
    Input stdclass.inc
    
    # There are no chapters in an article.
    NoStyle Chapter
    NoStyle Chapter*
    
    MaxCounter              Counter_Section
    SecNumDepth             3
    TocDepth                3
    
    Style Numbered
           LatexType       Environment
           LatexName       example
           Align           Left
           AlignPossible   Left
    
           Font
           Color           Blue
           EndFont
           Preamble
               \usepackage{covington}
           EndPreamble
    End
    

All these methods will make every Covington-numbered example display in blue font but without a number; the document will typeset in a normal way and you can cross-reference Covington-numbered examples in the text as usual (by inserting label). This is how your screen will look for the Covington example above:

If you want to change the label of the subexample, place [(whatever)] in ERT at the very beginning of thesubexample.

You can also define your own counter in LaTeX.

Aligned Glosses (Covington)

Often linguists need to have a list of examples which are glossed word by word. A great package for this is, again, Covington.

[new in 1.6] The Linguistics Module shipped with LyX 1.6 provides some native support for covington glosses, even though you still need some LaTeX syntax. After you have loaded the module, you will find two insets "Glosse" and "Tri-Glosse" in Insert→Custom Insets. The following screenshot shows how a sentence and its glossed translation are input into the inset, just as two consecutive lines (for Tri-Glosse, that would obviously be three). The last line is the (mandatory) (grammatically well-formed) translation which must be preceded by \glt (not in ERT, just verbatim):

The PDF output of the example looks as follows:

In LyX 1.5 and earlier, you will have to stick to ERT snippets. The above example would have to be inserted in TeX mode as follows:

\begin{examples}
\item This is an example in English.
\item \gll Dit is een voorbeeldje     in het Nederlands.
     	   This is a {little example} in {}  Dutch.
      \glt `This is a little example in Dutch.'
      \glend
\end{examples}

If you have set up LyX to support covington examples natively (as described here), you do not need the \begin{examples} and \item parts. Simply insert an ERT with everything between \gll and \glend to an Example paragraph:

Also note that up to LyX version 1.3 you will have to separate the lines inside the ERT with a linebreak (C-Return). Using the return key will lead to wrong output. As of LyX 1.4, you will not have to bother about this anymore. Just use Return.

Semantics

Markup

[new in 1.6] The Linguistics Module that ships with LyX 1.6 provides some semantic markup for "expression" (emphasized by default), "concept" (small caps by default) and "meaning" (enquoted by single quotes by default). The definitions can be changed in the preamble.

Logical Semantics

Fortunately, the logical semantics notation is pretty much covered by LyX's math mode. So if you want to insert logical semantic notation, do as if you would want to insert a math formula. You'll find most of the required symbols in the Math Panel (Insert→Math→Math Panel). If you are a bit familiar with the LaTeX notation of that symbols, you can enter them directly into the formula. LyX will convert them for you. With Instant Preview enabled, you'll even get a WYSIWYG display in LyX.

Other stuff

There are packages available for other semantic needs.

  • Discourse Representation Structures can be noted with Covington or with the sdrt package.
  • (please fill in...:-)

Conversation Analysis

In Conversation Analysis, turns need to be aligned to mark overlaps, turn takings, etc. LyX does not allow multiple blanks and does not have a tabulator, but with LaTeX's tabbing environment, the alignment can be managed quite well. Unfortunately, LyX does not yet support tabbing natively, so we are stuck with ERT.

Consider the following simple example:

\begin{tabbing}
1 \=Peter: \=Do you know [=LyX=] \=the the document\\
2 \>Mary:\>\>yeah I know
\end{tabbing}

With \= you save a position, at which \> will push the text. Note that <Return> does not work inside tabbing; you have to use linebreaks (\\). To adjust the vertical space, you can also use the optional argument of the linebreak, e.g. \\[\baselineskip].

Caveats:

  • Inside tabbing, the lines are not broken automatically. You have to do it manually to prevent the lines go into the margin.
  • The tabbing environment redefines the LaTeX's accent commands. If you use accents, you'd better try the package Tabbing which does not touch the accent commands and provides another tabbing syntax instead.

If you need arrows and other symbols for your notation, you'll most likely find them in the Math Panel. If not, read this.

Switching between Languages

To switch between English and Greek, go to Edit→Text Style→Language and select "Greek". This will mark all following text (or the selected text) Greek.

Note that in older (< 1.5) versions, only one kind of writing system will be displayed inside LyX (i.e. Latin letters instead of Greek ones if the main language is English). In the PDF output, however, the correct writing systems (Roman alphabet for English, Greek alphabet for Greek) are used. Since version 1.5, LyX uses unicode internally, so it can to display Latin and Greek (and Cyrillic ...) letters in parallel -- however this is only done if the letter is keyed in as a Greek one (e.g. via a character picker, drag-and-drop from a unicode encoded source or a matching keyboard mapping).

You can switch to another language or chose "reset" to go back to the document's main language (as set in Document→Settings→Language). If you use Aspell as spell checking backend and if the dictionaries are installed, LyX will spellcheck the Greek part as Greek. Foreign languages (i.e. those differing from the document's main language) are marked by a blue underline.

To switch between English and Russian, go to Document→Settings→Language and set the document's language to Russian. Switch to the Cyrillic keyboard layout of your OS when you need to type in Russian, and switch back when you need English. Both Russian and English will be displayed in LyX (on Mac OS, at least--someone please verify this on Windows/*nix).

Bibliographies

LyX has native BibTeX support for bibliographies. By default, LyX is configured to use the bibliography style plain, which is used in other sciences and which cites references in text by number rather than by name and date. Most linguists will probably not find it useful. If you need to use a bibliography style similar to that of Linguistic Inquiry or Language, you should use the natbib or the jurabib package (see this page for information on the differences of those two packages). To find out more about using BibTeX in LyX, see the BibTeX Group on this wiki and LaTeX for Linguists/Bibliographies. A bare-bones guide which should suit linguists' basic needs is included in the LyX for Humanities page.

A bibliography style popular among linguists is linquiry2.bst. It's designed for natbib.

List of Publications

You can generate a list of your own publications semi-automatically, using BibTeX. See this page for details.

Acknowledgment footnote

It is common in linguistics articles to label the acknowledgment footnote (usually the first footnote) with an asterisk rather than with a regular number. To accomplish this in LaTeX, put the following in ERT: \thanks{text of your acknowledgment footnote}. Note that in the title environment, LyX automatically outputs footnote insets as \thanks, so you can just insert a footnote as usual.

Table Symbol Tree Numbering Footnotes Humanities

Edit - History - Print - Recent Changes - All Recent Changes - Search
Page last modified on 2008-09-14 17:34 CEST