Skip to content

Latex Beamer Bibliography New Block Undefined Fraction

TeXstudio : User manual

Contents:


1. Configuring TeXstudio

Before using TeXstudio, you should configure the editor and latex related commands via the "Configure TeXstudio" command in the "Options" menu ("Preferences" under Mac OS X). Note that there are two levels of detail. More advanced or less often used options are only visible if you toggle "Show advanced options" in the lower left corner.

1.1 Configuring the editor

You may change the default encoding for new files ("Configure TeXstudio" -> "Editor" -> "Editor Font Encoding") if you don't want utf8 as encoding. Don't forget to set the same encoding in the preamble of your documents. (e.g. \usepackage[utf8]{inputenc}, if you use utf-8).
TeXstudio can auto detect utf-8 and latin1 encoded files, but if you use a different encoding in your existing documents you have to specify it in the configuration dialog before opening them. (and then you also have to disable the auto detection)

  • "Folding" toggles the editors code-folding capability (hide sections of the text).
  • The selection box "Indentation mode" lets you select, wether indented lines are followed by lines of the same indentation after pressing Enter or letting TeXstudio do automatic indentation.

1.2 Configuring the latex related commands

LaTeX comes with a number of command line tools to compile and manipulate LaTeX documents. The commands section defines there location and arguments.

The default settings should work with the recent and standard LaTeX distributions, but you could have to modify them ("Configure TeXstudio" -> "Commands"). To change a command, just click on the button at the end of the corresponding line and select the command in the file browser : TeXstudio will automatically adapt the syntax of the command.

You can use a number of special characters / character sequences to address the context of the current document. They are expanded at runtime:

Special CharacterExpands to
filename of the root document for of current document without extension
current line number
followed by further charactersSee the instruction at the bottom of the configuration dialog.
Location of the TeXstudio executable (useful for portable settings)
Location of the settings file (texstudio.ini)

The section Forward/Inverse search gives some example commands for common viewers.

You can always restore the original settings using the revert button to the right.

1.3 Configuring the build system

TeXstudio provides general commands for translating latex.
The default settings use "pdflatex" and the internal pdf viewer. Other commands and viewer can be selected as well as a different bibliography translator.
The "embedded pdf viewer" does not open a new window for viewing the pdf document but presents it directly next to the text in the editor.
A useful alternative might be using the "latexmk" as compile command (if the command is installed on your system), as it handles dependencies with biblatex and index very well.
The advanced options allows finer customization which is in general not necessary.

User commands can be defined here by "adding" them. Each user command has a name with a pattern , e.g. . The command id has to be unique and must not contain spaces. In advanced mode, you can reference it using . The display name will be shown in the tools menu. The user commands can be activated either by short cut (alt+shift+F%n) or by the tools menu (Tools/User).
User commands can either consist of a combination of known commands by selecting them from a list of available commands. This is triggered by clicking the spanner-symbol.
Alternatively a command can be directly selected through the file system.

1.3.1 Advanced configuration of the build system

If you enable the advanced options, you can configure the build system in more detail.

Every txs-command is a list of external programs/latex-commands and other txs-commands to call. An external program can be called with its usual command line, while a txs-command with id "foobar" is called by txs:///foobar.
The commands in the list are separated by |, which is just a separator (i.e. it will not pass the stdout from one program to the stdin of the next).

Note: Use command lists only for the meta and user commands listed at . Do not use then at . The latter should just be single commands (i.e. do not use | there). While it's currently working in some cases, generally we do not guarantee this behavior. It can have surprising side effects such abortion of compilation in some cases. Also, the use of | at may be prohibited completely without further notice in the future.

Each of these txs-command has a unique id, which is shown as tooltip of the displayed name for "normal" commands and in the edit box for user commands. Some important commands are usual: txs:///quick (Build & View, the old quickbuild), txs:///compile (Default compiler), txs:///view (Default viewer), txs:///latex (latex), txs:///pdflatex (pdflatex), txs:///view-pdf (Default Pdf Viewer), txs:///view-pdf-external (External pdf viewer).

For example, in a typical build configuration you might call txs:///quick by pressing F1, which calls txs:///compile, which first calls txs:///pdflatex that calls the actual pdflatey, and then calls txs:///view, which calls txs:///view-pdf, which calls txs:///view-pdf-internal, which displays the pdf.

There is no difference between commands defined as command on the command config page, commands defined as build on the build config page, or commands defined as user commands. They are just separated in the GUI to simplify the interface.
This also means that you can change every command as you want, ignoring its old definition (you could even change its id, when editing the ini file.).

There are however three always defined internal commands, which can only be called and not modified:

txs:///internal-pdf-viewerOpens the internal viewer for the current document
txs:///view-logViews the log file for the current document
txs:///conditionally-recompile-bibliographyChecks if the bib files have been modified, and calls txs:///recompile-bibliography, iff that is the case

The internal pdf viewer also accepts the following options (txs:///internal-pdf-viewer) to modify its behaviour:

--embeddedOpens the viewer embedded
--windowedOpens the viewer windowed (default if no option is given)
--close-(all|windowed|embedded)Close all open viewers, or just viewers of a specific kind
--preserve-existingDoes not change any existing viewers (i.e. always opens a new one)
--preserve-(embedded|windowed)Does not change any existing embedded/windowed viewers
--preserve-duplicatesOnly opens the pdf in the first opened viewer
--(no-)auto-closeDetermines whether the viewer should be closed, when the corresponding tex file is closed (default: auto-close iff embedded)
--(no-)focusDetermines whether the viewer should be focused (default: focus iff windowed)
--(no-)foregroundDetermines whether the viewer should be brought to front (default: foreground)
filenameDetermines the file to open. Like in other commands, file patterns are supported. If this parameter is not provided, TXS uses , i.e. the absolute path of the main file. If the parameter is not an absolute filename, it is searched for in the directory of the main file as well as in

It is also possible to modify the arguments of called subcommands with argument modifiers or by adding a new argument . These modifiers are passed through called lists, so it will always change the arguments of the finally called program, even if the directly called subcommand is just a wrapper around another command:

txs:///foobar --xyzThis will add the xyz option
txs:///foobar[--xyz=123]This will change the value of the xyz option to 123 (i.e. removing any xyz option defined in foobar)
txs:///foobar{--xyz=123}This will remove --xyz=123 from the foobar command line, ignoring xyz options with other values
txs:///foobar{--xyz}This will remove any --xyz option from the foobar command line, regardless of its value
txs:///foobar{}This will remove all options from the foobar command line, leaving only the name of the executable

Finally, there are also hidden options, which can only be changed by modifing the ini-file: Tools/Kind/LaTeX, Tools/Kind/Rerunnable, Tools/Kind/Pdf, Tools/Kind/Stdout, Tools/Kind/Viewer, which give a list of commands that are treated as latex compiler (e.g. show the log afterwards), rerunnable (repeat command call, if there are warnings), pdf generators (e.g. pdflatex), commands that prints to stdout (e.g. bibtex), and viewers (e.g. only open once).

1.3.2 Details of the execution environment

Environment Variables

The environment variables available within the execution are the same as the ones that are available in the context in which TeXstudio was started. In particular this is true for the PATH. On Linux/OS X the PATH may depend on the way you started TeXstudio. Programs started from the GUI may have a different PATH setting than programs started from a shell (because some variables may only defined in the context of a shell (e.g. via ~/.bashrc).

By default, TeXstudio parses environment variables in your commands. The syntax is adapted to the according operating system. A variable MYVAR would be written as on Windows and on Linux and OS X. Windows environment variables are case-insensitive, whereas they are case-sensitive on Linux and OS X. Parsing of environment variables can be deactivated in the Build section of the options.

Working Directory

The working directory is set to the path of root document.

Shell Functionality

All commands specified in the configuration (i.e. Commands and User Commands) are executed directly. There is no shell involved. So most shell functionality does not work.

Output Redirection

TeXstudio provides limited output redirection capabilities. You can only output to the message panel () or suppress output (). The default setting depends on the command. The same targets are allowed for stderr: , . Additionally, you can redirect to the same target as stdout by using .

A typical usecase would be to suppress all output of a command:

Note: Instead of the Linux/Unix notation , you may alternatively use the Windows notation . Because these commands are directly interpreted by TXS, both variants work on all operating systems.

Using other shell functionality

If you need shell functionality, you have to explicitly run a shell. You can either do this directly in the user command:

sh -c "/path/to/testscript foo > bar"

or on Windows:

cmd /C "/path/to/testscript.bat foo > bar"

Alternatively, you can call a wrapper script in the user command

/path/to/wrapperscript foo bar

and do the actual work inside the wrapper script:

#!/bin/sh # I am wrapperscript /path/to/testscript $1 > $2

1.4 Configuring some general issues

This panel allows the setting of some general aspects.

  • The "style" and "color scheme" of TeXstudio can be selected. The modern variant is closer to texmaker 1.9.
  • The symbol list can either appear "tabbed" (old behaviour, tabbed activated) or can have small symbol tabs besides the symbol lists which leaves more room for the symbols.
  • Also the log viewer can appear tabbed which allows faster change between error table, log view and previewer ...
  • The language of the menus can be changed directly to ignore system settings.

1.4.1 Configuring the spell checker

TeXstudio offers an integrated spellchecker which can be used either via a dialog or dirctly while typing. All text outside of LaTeX commands is checked. Additionally, text in options of LaTeX commands is also checked. TeXstudio determines if an option contains natural text and thus should be spell checked by looking up its definition in the completion word lists. For more information on completion word lists see the section on completion and the description of the cwl format.

The spell checker uses the Hunspell dictionary format, which is widely used, e.g. in OpenOffice, LibreOffice and Firefox. The each dictionary consists of two files ( and ). French, British and German dictionaries are distributed with TeXstudio. You can add additional dictionaries yourself by placting them in the dictionary path. A particularly convenient way to get additional dictionaries is downloading a dictionary extension of http://wiki.services.openoffice.org/wiki/Dictionaries or LibreOffice and importing them using the button Import Dictionary in the options.

You can specify one or more search paths for the dictionaries in the options. Multiple paths need to be separated by semicolon. With the paths you can use the special strings and . These are expanded to the path of the executable and the config file () respectively. This expansion is particularly useful if you use a portable version on a USB stick in which the actual location of the program may depend on the computer you are using.

To make life easy TeXstudio lets you choose a preferred language for the spell checker. However, if you frequently work with files in different languages you may want to override the default behavior. This can be done in two ways. First you can specify the language of the file via the language menu in the status line. This setting will be lost as soon as the file is closed. To permanently save the language of the file TeXstudio supports a special "magic comment" . If this comment is present in a file, its language is automatically set when the file is loaded.

Please note: spell checking with Ctrl+Shift+F7 starts at the cursor position and not at the beginning of the document.

If the interactive spell checker is enabled (default), any incorrectly spelled word is underlined with a red wave. Right-click on the word to open a menu with a list of possible corrections. In this context menu you can also add the word to the ignore list. If your dictionary is very large (> 5MB), opening the context menu and showing possible suggestions can take some seconds. If you don't need the suggestion, you can press shift while right clicking and don't have to wait.

Since the internal structure of the dictionaries is complex (e.g. contains rules how to generate a word with in different inflections) it is not possible to simply add words to the dictionary. Instead if a word is missing in the dictionary, you can add it to an ignore list, so that the spell checker won't complain about it. The ignore list is normally saved in the same directory as the dictionary. It's a plain text file with the extension .ign. If this isn't possible (e.g. missing access rights) the list is stored in the user configuration directory.

1.4.2 Configuring the thesaurus

The thesaurus uses OpenOffice.org 2.x databases. Only GPL French and US-English and German databases are distributed with TeXstudio.
Users can download others databases here : http://wiki.services.openoffice.org/wiki/Dictionaries

1.4.3 Configuring the latex syntax checker

The latex syntax checker takes the list of possible completion commands to determine if a command is correct. Furthermore the completion list contains partially additional information to determine in which context a command is valid, whether it is valid only in math-mode or only in tabular-mode.

1.4.4 Configuring the grammar checker

The grammar checker is based on the standard http API of LanguageTool, and requires a separate installation of LanguageTool and java.

Once LanguageTool is installed, you can try it by starting the LanguageTool standalone application, and start TeXstudio afterward. LanguageTool then creates a locally running server at the address http://localhost:8081/ and TeXstudio automatically connects to it at startup. When the connection is established, all typed paragraphs are send to LT and after a short delay the possible grammar errors are highlighted.

To automatically start LanguageTool with TeXstudio, you need to enter the path to LT jar in the grammar page of the config dialog. If the java executable is not in the default PATH, you also need to set the path to it there.

In the advanced config mode, you can also mark certain LT rules as "special" whose matches will then be highlighted in a different/customizable way. This can be useful to do a stylistic analysis, e.g. by creating a own rule in LT highlighting all verbs or all adverbs.

Independent from LanguageTool, TeXstudio also checks for repeated and bad (imprecise/slang) words. The repetition check looks several words behind and marks repetition of short words in the immediate surrounding and repetition of long words up to 10 words before. These distances and lengths can be changed on the advanced grammar config page.

1.5 Configuring the autocompletion

TeXstudio has taken up completion word lists from kile which extended the number of known commands for completion considerably. TeXstudio understands the use of \documentclass and \usepackage in order to select valid lists of commands for completion as well as syntax checking. However TeXstudio allows one to select the additional word lists under "Configure TeXstudio" -> "Editor" -> "". The names of the word lists corresponds to the package for which they are made. The list latex.cwl contains the standard latex commands.
Concerning auto completion, TeXstudio allows one to adapt the behaviour to your liking. Following options are available:

  • Completion enabled: self explanatory
  • Case sensitive: let's you complete e.g. \Large from \la ...
  • in first character: ?
  • Auto Complete Common Prefix: if only one item is in the list or all items in the completion list share common starting characters, the common characters are directly inserted, like pressing the key Tab.
  • Complete selected text when non-word character is pressed: when in completion mode, pressing a non-word character like space, leads to accepting the selected word. This may speed up typing.
  • Enable ToolTip-Help: show tool tips on selected latex commands in the completion list.
  • Use Placeholders: if the completed commands have options which need to be filled out, "place holder" are put at this positions and they can be jumped to by using Ctrl+Right/Ctrl+Left.

If your favorite package is not yet present for completion (and then as well not for syntax check), you can provide a list of your own by placing a file "packagename.cwl" in the config directory. This directory is placed in ~/.config/texstudio under linux and usually "c:\Documents and Settings/User/AppData/Roaming/texstudio" under windows. Basically the file contains a list of valid commands. A Description of the exact format and an example are given in the appendix.

1.6 Configuring shortcuts

Shortcuts can be changed by double clicking on "Current Shortcut" or "Additional Shortcut". A shortcut can be selected from the drop down list or put in as text directly. If a shortcut should be set to default value or removed completely, the items "<default>" or "<none>" at the top of the list can be selected.

1.7 Configuring the Latex/Math-Menu (Advanced option)

The Math/Latex-Menu can be adapted to user likings. For this menu items can be renamed and a new Latex-Code can be placed. The apropriate item can be be directly edited by doubleclicking on them.

1.8 Configuring the Custom Toolbar (Advanced option)

One Custom Toolbar is present in TMX. This toolbar can be filled with actions from the Latex-, Math- and User-Menu. Since many of those item don't have icons, user icons can be loaded as well. This is achieved by applying "load other icon" from the context menu on a item in the custom toolbar list in the configure dialog.

1.9 Configuring SVN support

To supports SVN (subversion) for document versioning. To make use of it, the SVN commandline tools need to be installed. Linux and Mac OSX normally provide already svn tools, for Windows, the installation of "SlikSVN" is recommended.

The complete path to the command "svn" and "svnadmin" need to be adjusted in the aprioriate field of the Commands page in the options. On the SVN page you can can choose the degree of automation (see below) WSVN, see below.

Note: You cannot checkout a repository via TeXstudio. Just use the normal tools for this (either svn checkout on the commmand line or the GUI of your choice). Once you have a working copy, TeXstudio can operate on it.

"Automatically check in after save" allows TeXstudio to perform an svn check in after every save of a document, thus providing a very complete history of the creation of a document. Since text documents are rather small compared to disk spaces, size of the svn database should not be a problem. In addition newly saved files (save as) are automatically added to svn control,provided that the directory is alredy under svn control. If that is not the case, TeXstudio searches in "SVN Directory Search Depth" directory above the current diorectory for a svn controlled directory to which the subdirectories and the TeX-Document will be added. If no appropriate directory is found, a repository is automatically generated in a directory called "./repo" and the document is added. Thus the user does not need to look up the necessary commands to set up a repository. This functionality is only activated when "Auto checkin in" is enabled !

With "User SVN revisions to undo before last save" TeXstudio will perform undo as usually, but if there are no further undoable commands in the internal storage, the document will be changed to the previous version in svn history. Further undo commands allows one to back further to older revisions, whereas a redo goes forward to more recent versions. This is a more interactive approach than choosing svn revisions directly via a menu command, see section 4.3

2. Editing a TeX document

2.1 Usual commands

The standard commands (cut, copy, find...) can be launched via the "Edit" menu and the "Edit" tool bar.

2.2 Creating a new document

There are two different ways to create a new document that are described in the following subsections:

2.2.1 Setting the preamble of a TeX document

To define the preamble of your document, you can use the "Quick start" wizard ("Wizard" menu).

This dialog allows you to set the main features of your document (class, paper size, encoding...).
Note : You can add other options by clicking the "+" buttons. All your settings are recorded.

You can also type your own preamble model in the editor : with the "Copy/paste" or "Save As" commands, you can use it for a new document.

2.2.2 Using Templates to start a new document

For new documents, templates can be used by using the command "File/New from template". A dialogue gives a selection of templates.

You can either create a new editor document from the template or create it as file(s) on disk and open these in the editor. The former option is not available for multi-file templates.

New templates can be created by using the command "File/Make Template" on a opened document which you like to have has a template. Note that this dialog currently does not support the full capabilities of the template system. In particular you cannot supply a preview image or create a multi-file template with it. You'll have to do this manually (see the template format).

User added templates can be edited or deleted by using the context menu in the template selection dialogue. Built-in templates can not be changed.

User templates are saved in the subdirectory of the config directory.

2.2.2.1 The Template Format

In its simplest form, a template is only a .tex file. Multi-file templates can be created by packaging all .tex files in a zip achive. Optionally, meta data can be stored in JSON format in a separate file with the same name, but extension ".json" instead of ".tex" or ".zip". Currently the following entries are supported in the meta data:

{ "Name" : "Book", "Author" : "TXS built-in", "Date" : "04.01.2013", "Version" : "1.1", "Description" : "Default LaTeX class for books using separate files for each chapter.", "License" : "Public Domain", "FilesToOpen" : "./TeX_files/chapter01.tex;main.tex" }

FilesToOpen only has an effect for mutli-file documents. You may add a preview image next to the template file. Again, it must have the same name, but extension ".png".

2.3 Structure of a document

To define a new part (section,subsection...) in your document with TeXstudio, just use this combo box button in the tool bar :

2.4 Browsing your document

The "Structure View" (left panel) lets you quickly reach any part of your document. All you need to do is to click on any item (label, section...) and you will be taken to the beginning of the corresponding area in the editor. The mechanism for jumping to a line does not anymore only consider line numbers but really remembers text lines. Thus adding and removing lines will not lead to jumps to wrong locations.

A grey background shows the present cursor position in the text in the structure view as well. A greenish background denotes sections which are in the appendix.

The "Structure View" is automatically updated as you type. You can also use the "Refresh Structure" (menu "Idefix") command at any moment.

The structure view shows labels, sections, includes and beamer blocks and todos.

There are two kind of todos that will be listed a) todos from a todo-like command, e.g. \todo{} from the package todonotes. b) todo-like comments: This is a comment with a capitalized first word, e.g. "% TODO", "%FIXME", "%ASK".

The structure view also offers a context menu which allows one to copy/cut all text which belongs to a section (including subsection) and paste it before or after a section. Section can be indented/unindented which means that the hierarchy level is changed by one, i.e. \section is changed to \subsection, and all subsections are treated accordingly

For each file, three bookmarks can be used to speed up navigation : just click on a line number to add or remove a bookmark. When you have already defined three bookmarks, you must remove one of them to add a new bookmark. To jump to the line corresponding to a bookmark in the editor, just click on the buttons in the status bar.

2.5 Formatting your text

You can quickly set the format of a part of your text with this tool bar :

Additional option: a selected text can be directly framed by certain environments. Example: while clicking on the button "Bold" after having selected the word "Hello" , you will obtain the code: \textbf{Hello}.
This option is available for all the environments indicated by "[selection]" in the "LaTeX" menu.

Capitalisation

The menu "Edit" -> "Text Operations" contains a few methods for changing the capitalization of selected text:

  • To Lowercase
  • To Uppercase
  • To Titlecase (strict)
  • To Titlecase (smart)

Both variants of "To Titlecase" leave small words like a, the, of etc. in lowercase. Additionally, "To Titlecase (smart)" does not convert any words containing capital letters, assuming they are acronymes which require a fixed capitalization (e.g. "TeXstudio").

Escaping reserved characters

If you have text containing reserved TeX characters and want the text to appear literally in your document, you have to escape the reserved charaters to prevent LaTeX from interpreting them. The following functions take care of that (Menu: Idefix)

  • Paste to LaTeX: Takes the text from the clipboard and escapes reserved characters prior to pasting into the editor.
  • Convert to LaTeX: Escapes the reserved characters in the current selection.

For example: "Less than 10% of computer users know the meaning of $PATH." will be converted to "Less than 10\% of computer users know the meaning of \$PATH."

2.6 Spacings

The usual "spacing" commands are available in the "LaTeX" and "Math" menus.

2.7 Inserting a list

The usual list environments code can be insert quickly via the "LaTeX-List" menu.
Note : the shortcut for the \item command is Ctrl+Shift+I.

2.8 Inserting a table

With the "Tabular" wizard ("Wizard" menu), t he LaTeX code for a tabular environment can be quickly inserted :

You can set the main features of your table.
Note : this dialog allows you to type directly the code in the cells.
The corresponding LaTeX code is automatically inserted in the editor.

2.8.1 Manipulating tables

TeXstudio provides some commands to ease handling of tables. The commands are located at LaTeX → Manipulate Table and in the Table toolbar. Please be aware that some unexpected results may arise, if the table constructing commands get too complex. Following commands are offered:

  • Add Row after the current row
  • Remove Row: removes the table row in which the cursor
  • Add Column: add a column in the complete table after current cursor position. If the cursor is positioned at start of line,first column, the column is added as new first column.
  • Remove Column: remove current column
  • Add/Remove \hline: add/remove \hline in all rows following the current row. If already a command \hline is present, no second command is placed.
  • Align Columns: Aligns the column separators (ampersand) by introducing whitespace. The text in the cells is aligned according to the specification in the table header. This helps reading the table source.
  • Remodel the table after a template. This allows one to force uniform table set-up in a document. Some templates are predefined, more can be added though it needs some programming in java script. This command is only present in the menu (math/tables)

TeXstudio also allows block cursors. Press <Ctrl>+<Alt>+<Shift> and drag the cursor with the mouse. The block cursor works like a set of normal cursors. You can copy and paste text as usual. Also you can type in new text, which will be added in every row.

2.9 Inserting a "tabbing" environment

To help you to insert a "tabbing" code, you can use the "Tabbing" wizard ("Wizard" menu) :

2.10 Inserting a picture

To insert a picture in your document, just use the "\includegraphics" command in the "LaTeX" menu. Then, click on the "browser" button in the dialog to select the graphic file.
Note : you can insert a "figure" LaTeX environment ("LaTeX - Environments" menu) before inserting the picture.

2.10.1 Inserting a picture using a "wizard"

Properly inserting figures is a challenge for LaTeX beginners and still quite a bit of text to type for the expert. Therefore TeXstudio offers a wizard for handling graphics insertion code in your document. "Graphics options" defines the optional parameter of . While the most used width/height attributes can be easily set, alternatively you have full control with the user defined setting.
Place the graphic inside a environment if it does not have to be at an exact position in the text. Then LaTeX will determine an optimal position on the page.
By pressing the "Save as default" button the current settings (except file, caption and label) are stored and will hence be used as default when you open the wizard.
The wizard also comes into play when you drag drop an image file to your document or use copy in explorer and paste in TeXstudio. Together with the adjustable default parameters this makes insertion of new pictures very fast. Furthermore, if you start the wizard while the cursor is on picture code, the wizard is used to manipulate the existing picture settings.

2.11 Cross References and notes

This toolbox in the toolbar allows you to insert quickly the label, cite, ref, footnote... code.
Note : the labels used in your documents are displayed in the "Structure View".

Additional option:for the \ref command, a dialog box allows you to select directly the label.

2.12 Inserting math formula

You can toggle in the "in-line math" environment with the "f(x)" button in the toolbar (shortcut : Ctrl+Alt+M) or with the "Math" menu. The shortcut for the "display math" environment is : Alt+Shift+M.
The "Math" toolbar allows you to insert the most currents mathematical forms (frac, sqrt...) like the \left and \right tags.

With the "symbols panels" in the structure view, you can insert the code of 400 mathematical symbols.

You can also define the format of your mathematical text via the "Math" menu.
For the "array" environments, a wizard (like the "Tabular" wizard) is available in the "Wizard" menu. With this wizard, you can select the environment : array, matrix, pmatrix.... The cells can be directly completed.

2.13 Auto Completion

Whenever you press \ followed by a letter, a list of possible LaTex tags is shown where you select the right one. If you write additional letters the list is filtered, so that only the tags starting with the already written text are shown. If the list contains words which all start with the same letter combination, you can press Tab to complete all common letters. If only one element is present in the list, Tab selects this one to do the completion, like Enter. This behaviour is similar to tab completion in bash shells. You can also press Ctrl+Space to open this list whenever you want.
If a tag has different options, a short descriptive text is inserted into your text, telling you the meaning of each option. You can press Ctrl+Left, Ctrl+Right to select all positions.
Furthermore normal text can be completed by starting to type a word and pressing Ctrl+Space. All apropriate words in the current document are used as possible suggestions.
If a enviroment is to be inserted, typing in the beginning of the environment name and pressing Ctrl+Alt+Space gives suggestions for adequate enviroments which are inserted completely with \begin{env}..\end{env}
And finally user tags can be assigned a abbreviation which can also be used with completion. Just type in the start of the abbreviation and start the completion with Ctrl+Space. The abbreviation should show up in the completion list, especially marked with “abbreviation (template)”.
If you change a command by completing a new command, only the command name is substituted. The same is true for environments, where the environment is changed in the \begin- and \end-command.

2.14 Thesaurus

TeXstudio has integrated a simple thesaurus. OpenOffice 2.x databases are used for this. By placing the cursor on a word and activating the thesaurus (Ctrl+Shift+F8 or Edit/Thesaurus), it tries to find synonyms for this word. Please be patient if you start the thesaurus at first time since loading the database just occurs then and can take a few moments.

The first line to the left contains the word, for which a synonym is searched for. The list below gives a list of word classes. The can be chosen to reduce the number of suggestions. The column to the right contains the list of suggested synonyms. A selected word from this list apears in the first line to the right as proposition for replacement of the text. This word can be changed manually. It is also used to do further investigations for words and their synonyms which "start with" or "contain" that word. With "lookup" it can be directly used to look for a synonym for that word.

2.15 Special Commands

Delete word/command/environment

With the shortcut Alt+Del, the word under the cursor is deleted. If it is a command, the command is deleted including opening and closing braces. E.g. "\textbf{text}" leave "text". If it is an environment, the enclosing bengin/end are removed.

Rename environment

If you place the cursor on an environment name or the corresponding begin- or end-command, after a moment a mirror-cursor is activated on the environment name which allows synchronous change of the environment name in the begin- and end-command. So if you want to change a "\begin{tabular}...\end{tabular}" construction to "\begin{tabularx}...\end{tabularx}", place the text cursor on "tabular", wait for a second and then, after the mirror-cursor appears, change "tabular" to "tabularx".

Cut Buffer

If you select something and then start to type in a command and complete it, the selection is put in as first argument. E.g. you have a "text", select it and start typing "\textbf", command which is completed. The resulting text is "\textbf{text}"

3. Compiling a document

3.1 Compiling

The easiest way to compile a document is to use the "Compile" command or the "Build&View" command ("Compile" button - shortcut : F6). You can select the default command via the "Configure TeXstudio" dialog.
(You can also launch each command one by one in the "Tools" menu).
Note : the "Clean" command in the "Tools menu" allows you to erase the files (dvi, toc, aux...) generated by a LaTeX compilation (except the ps and pdf files).

Warning : all your files must have an extension and you can't compile an "untitled" file or a file with a space in his name.

3.2 The log files

With the "Quick Build" command, the log file is automatically displayed in the "Messages / Log file" pannel. While clicking on a number in the "Line" column, the cursor is placed on the corresponding line in the editor and the error is displayed.
Remark : a summary of the latex errors and warnings is displayed before the full log file.

The "Next Latex Error"and "Previous LaTeX Error" commands allow to get to the errors detected during compilation.

Lines with errors, warnings, bad boxes will be highlighted with red, yellow or blue background and you can jump between them using Ctrl+Up/Down. (Ctrl+Shift for errors only, Ctrl+Alt for warnings only, Alt+Shift for bad boxes only)
A tool tip will show more details of the mistake if you jump to a line (it is also shown if you move the mouse over the mark left from the line numbers).

4. Other features

4.1 About documents separated in several files

LaTeX documents may be spread over multiple files. TeXstudio automatically understands parent/child relations of loaded documents. This includes the detection of the root document and knowledge on defined labels and commands.

4.1.1 Root Document

The root document is the top-most file in a multi-file document. For a single-file document this is the file itself. By default, all calls to LaTeX will be performed on the root document.

TeXstudio automatically detects the root document. If that does not work, you can place a magic comment at the top of your included files.

As a last resort, you may set an explicit root document via . This setting takes absolute precence. All the commands of the "Tools" menu will be called on this document (to be more precise the build system will expland the placeholder to the root document), no matter which document is active in the editor. Additionally, labels and usercommands which are defined in any open document, can be used for completion in any open document.

In earlier versions, the explicit root document was somewhat misleadingly called master document.

4.1.2 Loaded Documents

Obviously, TeXstudio can only use information (defined commands, labels, document hirachy, etc.) that it is aware of. We use the information in all opened files, but if a label in a multi-file document is defined in a not-loaded files, TeXstudio does not know about it and will mark it as missing in references. To remedy this, you can just open the corresponding file as well.

More recent versions of TeXstudio have an advanced option . It's disabled by default for performance reasons with older systems. When you enable this option, TeXstudio will automatically load and parse all files of multi-file-documents as soon as one of the files is opened. You may have to set the magic comment if you do not have the root document open. With this option enabled TeXstudio will allways know about your complete document and act accordingly when performing highlighting or completion.

4.2 Syntax Check

The latex syntax checker takes the list of possible completion commands to determine if a command is correct. The completion list contains partially additional information to determine in which context a command is valid, whether it is valid only in math-mode or only in tabular-mode.
Furthermore the correctness of tabulars is checked in a little more detail. The number of columns is analyzed and checked in the subsequent rows. If more or less columns are given in a row, a warning maker is shown.

4.3 Bibliography

For the "bib" files , the "Bibliography" menu enables you to directly insert the entries corresponding to the standard types of document.
Note: the optional fields can be automatically deleted with the "Clean" command of the "Bibliography" menu.

4.4 SVN Support

Apart from the supported svn features already describes in section 1.8, TeXstudio supports two more commands.

"File/chekin" performs an explicit save and check in, with a input dialog which asks for an checkin in message which is stored in the svn history.

"File/Show old Revisions" pops up a dialog, which shows all alvailable revisions. A selection of an older revision leads to instatanious change of the current document to that older revision. You can can select and copy old parts to transfer them to the most recent version of your document, by copying the parts and then going back to most recent version. If you start editing that document directly, the dialog is closed and the present text is your new most recent version though yet unsaved.

4.5 Personal macros

TeXstudio allows you to insert your own macros (shortcuts : Shift+F1...Shift+F10). These macros are defined with the "Macros - Edit Macros" menu. Macros can consist of simple text which is directly placed into txs. It can also be an "environment" which are automatically extended by begin/end and it can be a java script. The needed functionality can be selected by checkbox.
The "abbreviation" is a pseudo-command for the latex completer. If the pseudo-command is completed, the macro will be inserted instead. Note that the pseudo-command needs to start with a backslash ("\").
"Trigger" is a regular expression which triggers the inclusion of the macro: When the last written characters match this expression, they are removed and the macro is inserted/executed. (see below for more details).

4.5.1 Text macros

Apart from normal text, some special codes are recognized and replaced on insertion.
  • If you write %| somewhere the cursor will be placed at that place in the inserted text. (A second %| will select everything between them).
  • Write %<something%> to mark it as placeholder which is highlighted in the text and can be selected by Ctrl+Left/Right.
    Additional properties of the placeholder can be set after a %:, e.g. %<something%:persistent,id:123,mirror%>. The available properties are:
    • select: The placeholder will be selected (similar to %|)
    • multiline: The placeholder is used for multiline text. If a macro insertion replaces an existing text, the replaced text is again inserted into a placeholder in the macro. If the original text spans more than one line, it will be inserted into a placeholder with the multiline property. Otherwise in a placeholder with the select-property.
    • persistent: The placeholder is not automatically removed, when its text is changed in the editor
    • mirror: The placeholder is a mirror of another placeholder in the macro and thus will always have the same content as the original placeholder. You should set an id, so it knows which placeholders are connected
    • id:123: The id of the placeholder
    • columnShift:-12: The placeholder is not placed where the %< markers are, but some columns to the left of it
    • translatable: The text of the placeholder should be added to translations (only applicable to macros that are known during the compilation of texstudio).
  • The option %(filefilter%) will be replaced by a filename which is asked for in a file dialog. The file filter is the standard Qt-Filefilterformat. For example "Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)", see also Qt-Doc

4.5.2 Environment macros

The text will be used as environment-name, thus "%environment" will be inserted as:
\begin{environment }

\end{environment }

Note: texstudio needs that the env-name starts with "%", though that character is not placed on insertion.

4.5.3 Javascript macros

Instead of using code snippets, you can also make use of javascript. To do so, put "%SCRIPT" in the first line. The following code will be interpreted as javascript. The language is based on ECMAScript. To access the document these objects are introduced:
  • "editor" allows some top level operations like searching/save/load. in the current document
  • "cursor" gives access to cursor operations like moving, inserting and deleting texts.
  • "fileChooser" gives access to the filechooser dialog, a very simple file selection dialog
  • "app" to access application wide things like the clipboard or the menus

The following table gives an overview on the possible commands.

CommandDescription
Global scope
alert(str), information(str), warning(str) or critical(str) shows str in a messagebox with a certain icon
confirm(str) or confirmWarning(str) shows str as a yes/no question in a messagebox
debug(str) prints str to stdout
writeFile(name, value) Writes value to file name (requires write privileges)
readFile(name) Reads the entire file name (requires read privileges)
system(cmd, workingDirectory="") Calls cmd and returns a ProcessX object which has this methodes:
  • waitForFinished: Wait until the process is finished
  • readAllStandardOutputStr: Returns the stdout
  • readAllStandardErrorStr: Returns the stderr
  • exitCode: The exit code
  • exitStatus: The qt exit status
  • terminate or kill: Stops the process
If workingDirectory is not set, the working directory will be inherited from the TeXstudio executable.
setGlobal(name, value) Sets a temporary, global variable
getGlobal(name) Reads a global variable
hasGlobal(name) Checks for the existence of a global variable
setPersistent(name, value) Sets a global configuration variable. (can change the values of the ini file, requires write privileges)
getPersistent(name) Reads a global configuration variable. (can read all values of the ini file, requires read privileges)
hasPersistent(name) Checks if a global configuration variable exists. (requires read privileges)
hasReadPrivileges() Checks if the script has read privileges
hasWritePrivileges() Checks if the script has write privileges
registerAsBackgroundScript([id]) Allows the script to run in the background (necessary iff the script should handle events/signals)
triggerMatches Matches of the regular trigger expression, if the script was called by an editor trigger.
triggerId Numeric id of the trigger, if the script was called by an event trigger.
include(script) Includes another script. Can be a filename or the name of a macro.
pdfs List of all open, internal pdf viewers .
Editor object
editor.search(searchFor, [options], [scope], [callback]) Searchs something in the editor.
  • searchFor is the text which is searched. It can be either a string (e.g. "..") or a regexp (e.g. /[.]{2}/).
  • options is a string and a combination of "i", "g", "w" to specify a case-insensitive search, a global search (continue after the first match) or a whole-word-only search.
  • scope is a cursor constraining the search scope (see editor.document().cursor).
  • callback is a function which is called for every match. A cursor describing the position of the match is passed as first argument.
All arguments except searchFor are optional, and the order may be changed (which may not be future compatible). The function returns the number of found matches.
editor.replace(searchFor, [options], [scope], [replaceWith]) This function searches and replaces something in the editor. It behaves like editor.search apart from the replaceWith argument which can be a simple string or a callback function. If it is a function the return value of replaceWith is used to replace the match described by the cursor passed to replaceWith.
editor.replaceSelectedText(newText, [options]) This function replaces the current selections with newText or inserts newText, if nothing is selected.
If newText is a function, it will be called with the selected text and corresponding cursor, and the return value will be the newText.
It is recommended to use this function for all text replacements/insertions, since it is the easiest way to handle multiple cursors/block selections correctly. Though it is only available in txs >= 2.8.5.

Options is an object that can have the following properties:
  • only replaces; does not insert anything if the selection is empty
  • only inserts at the cursor position; does not change non empty selected text
  • appends newText to the current selection, does not remove the old text
  • prepends newText to the current selection, does not remove the old text
  • Treats newText as normal macro text, e.g. inserting %< %> placeholders

Examples:
Appends "world" to the current selections.
Converts the current selection to uppercase.
editor.insertSnippet(text); Inserts a text snippet into the editor. For a list of extended features and syntax see Text Macros.
editor.undo();undo last command in editor
editor.redo(); redo last command in editor
editor.cut(); cut selection to clipboard
editor.copy(); copy selection to clipboard
editor.paste(); paste clipboard contents
editor.selectAll(); select all
editor.selectNothing(); select nothing (clear selections)
editor.cutBuffer If a macro was triggered by a key press and there was a selection previous to the key press, the content of the selection is stored in the cutBuffer. The selection and its content is removed before the macro is entered.
editor.find(); activate "find panel"
editor.find(QString text, bool highlight, bool regex, bool word=false, bool caseSensitive=false); activate "find panel" with predefined values
editor.find(QString text, bool highlight, bool regex, bool word, bool caseSensitive, bool fromCursor, bool selection); activate "find panel" with predefined values
editor.findNext(); find next
editor.replacePanel(); replace (if find panel open and something is selected)
editor.gotoLine(); activate "goto line panel"
editor.indentSelection(); indent selection
editor.unindentSelection(); unindent selection
editor.commentSelection(); comment selection
editor.uncommentSelection(); uncomment selection
editor.clearPlaceHolders(); clear place holders
editor.nextPlaceHolder(); jump to next place holder
editor.previousPlaceHolder() jump to previous place holder
editor.setPlaceHolder(int i, bool selectCursors=true); set Placeholder
editor.setFileName(f); set filename to f
editor.write(str) inserts str at the current cursors position (if there are cursor mirrors, str will be inserted by all of them)
editor.insertText(str) inserts str at the current cursor position (cursor mirrors are ignored, so it is preferable to use replaceSelectedText or write instead)
editor.setText(text) replace the whole text of the current document by text
editor.text() return the text of the complete document
editor.text(int line) return text of line
Document object
editor.document().lineCount() Returns the number of lines
editor.document().visualLineCount() Returns the number of visual lines (counting wrapped lines)
editor.document().cursor(line, [column = 0], [lineTo = -1], [columnTo = length of lineTo]) Returns a cursor object. If lineTo is given the cursor has a selection from line:column to lineTo:columnTo, otherwise not.
editor.document().text([removeTrailing = false], [preserveIndent = true]) Returns the complete text of the document
editor.document().textLines() Returns an array of all text lines
editor.document().lineEndingString() Returns a string containing the ending of a line (\n or \n\r)
editor.document().canUndo() Returns true if undo is possible
editor.document().canRedo() Returns true if redo is possible
editor.document().expand(lineNr) Expands the line
editor.document().collapse(lineNr) Collapse the line
editor.document().expandParents(lineNr) Expand all parents of the line until it is visible
editor.document().foldBlockAt(bool unFold, lineNr); Collapses or expands the first block before lineNr
editor.document().getMasterDocument(); Returns the open document which directly includes this document
Deprecated: Use getRootDocument() instead
editor.document().getRootDocument(); Returns the open document which indireclty includes this document and is not itself included by any other document
editor.document().getMagicComment(name); Returns the content of a magic comment, if it exists
editor.document().updateMagicComment(name, value, [create = false]); Changes a magic comment
editor.document().labelItems/refItems/bibItems Returns the ids of all labels/references or included bibliography files.
editor.document().getLastEnvName(lineNr) Returns the name of the current enviroment (at the end of the line).
Document Manager object
documentManager.currentDocument Current document (usually the same as editor.document(), unless the script is running in background mode)
documents.masterDocument Master document
[documentManager.]documents Array of all open documents
documentManager.findDocument(fileName) Returns the open document with a certain file name
documentManager.singleMode() Returns if there is no explicit master document
Deprecated: Use getRootDocumentForDoc(document) instead
documentManager.getRootDocumentForDoc(document) Returns the open document (possibly indirectly) including the given document
documentManager.findFileFromBibId(id) Returns the file name of the bib file containing an entry with the given id
Cursor object
cursor.atEnd() returns whether the cursor is at the end of the document
cursor.atStart() returns whether the cursor is at the start of the document
cursor.atBlockEnd() returns whether the cursor is at the end of a block
cursor.atBlockStart() returns whether the cursor is at the start of a block
cursor.atLineEnd() returns whether the cursor is at the end of a line
cursor.atLineStart() returns whether the cursor is at the start of a line
cursor.hasSelection() return whether the cursor has a selection
cursor.lineNumber() returns the line number of the cursor
cursor.columnNumber() returns the column of the cursor
cursor.anchorLineNumber() returns the line number of the anchor.
cursor.anchorColumnNumber() returns the column of the anchor.
cursor.shift(int offset) Shift cursor position (text column) by a number of columns (characters)
cursor.setPosition(int pos, MoveMode m = MoveAnchor) set the cursor position after pos-characters counted from document start (very slow)
cursor.movePosition(int offset, MoveOperation op = NextCharacter, MoveMode m = MoveAnchor); move cursor offset times. MoveOperations may be:
  • cursorEnums.NoMove
  • cursorEnums.Up
  • cursorEnums.Down
  • cursorEnums.Left
  • cursorEnums.PreviousCharacter = Left
  • cursorEnums.Right
  • cursorEnums.NextCharacter = Right
  • cursorEnums.Start
  • cursorEnums.StartOfLine
  • cursorEnums.StartOfBlock = StartOfLine
  • cursorEnums.StartOfWord
  • cursorEnums.StartOfWordOrCommand
  • cursorEnums.PreviousBlock
  • cursorEnums.PreviousLine = PreviousBlock
  • cursorEnums.PreviousWord
  • cursorEnums.WordLeft
  • cursorEnums.WordRight
  • cursorEnums.End
  • cursorEnums.EndOfLine
  • cursorEnums.EndOfBlock = EndOfLine
  • cursorEnums.EndOfWord
  • cursorEnums.EndOfWordOrCommand
  • cursorEnums.NextWord
  • cursorEnums.NextBlock
  • cursorEnums.NextLine = NextBlock
Options for MoveMode are:
  • cursorEnums.MoveAnchor
  • cursorEnums.KeepAnchor
  • cursorEnums.ThroughWrap
cursor.moveTo(int line, int column); move cursor to line and column
cursor.eraseLine(); remove current line
cursor.insertLine(bool keepAnchor = false); insert empty line
cursor.insertText(text, bool keepAnchor = false) insert text text at cursor (this function will ignore indentations and mirrors, see editor.write and editor.insertText)
cursor.selectedText() return the selected text
cursor.clearSelection(); clears selection
cursor.removeSelectedText(); removes selected text
cursor.replaceSelectedText(text); replace selected text with text
cursor.deleteChar(); removes char right to the cursor
cursor.deletePreviousChar(); removes char left to the cursor
cursor.beginEditBlock(); begins a new edit block. All cursor operations encapsulated in an edit block are undone/redone at once.
cursor.endEditBlock(); ends an edit block
App object
app.getVersion()Current version (0xMMmm00)
app.clipboardProperty to read/write to the clipboard
app.getCurrentFileName()File name of currently edited file
app.getAbsoluteFilePath(rel, ext = "")Converts a relative filename to an absolute one
app.load(file)Loads an file
app.fileOpen/Save/Close/.../editUndo/.../QuickBuild/... All menu commands (i.e. all slots in the texmaker.h file). You can view a list of all currently existing slots on the "menu" page of the config dialog.
app.newManagedMenu([parent menu,] id, caption)Creates a new menu and returns it
app.getManagedMenu(id)Returns a QMenu with a certain id
app.newManagedAction(menu, id, caption)Creates a new action and returns it
  • menu: Parent menu
  • id: Id of the new action (the final, unique id will be menu id/action id)
  • caption: Visible text
qt signal/slot documentation).
app.getManagedAction([id])Returns an QAction with a certain id (all ids have the form main/menu1/menu2/.../menuN/action, with usually one menu, e.g. "main/edit/undo", see texmaker.cpp)
app.createUI(file, [parent])Loads a certain ui file and creates a QWidget* from it
app.createUIFromString(string, [parent])Creates a QWidget* described in the string
app.slowOperationStarted()/slowOperationEnded()Notify txs about the start/end of a slow operation to temporary disable the endless loop detection.
app.simulateKeyPress(shortcut)Trigger a KeyPress event for the given shortcut, e.g. . Note: this is mainly intended for shortcuts and navigation. Currently, it does not support all functions of a KeyPress event. In particular, you cannot type any text.
UniversalInputDialog class
new UniversalInputDialog()Creates a new dialog
dialog.add(defaultValue, [description, [id]])Adds a new variable with the given default value, optional description and id to the dialog; and returns the corresponding qt component.
A string default value becomes a QLineEdit, a number a QSpinBox and an array a QComboBox.
dialog.get(nr/id)Returns the current value of the nr-th added variable or the variable with a certain id.
dialog.getAll()Returns the value of all variables as combined numerical/associative array. You can use returnvalue[i] to get the i-th variable, and returnvalue.id to get the variable with a certain id.
dialog.exec()Displays the dialog. Returns 1 if the user accepted the dialog, 0 if it was canceled.
dialog.show()Displays the dialog asynchronously.
UniversalInputDialog([[defaultValue_0, description_0, id_0], [defaultValue_1, description_1, id_1], ...])Short form: Creates a new dialog, adds all variables of the array and call exec on it.
FileChooser object
fileChooser.exec() show dialog and wait until it is closed again
fileChooser.setDir(dir) set directory in the dialog to dir
fileChooser.setFilter(filter) set file filter to filter, using the QT-format, see above
fileChooser.fileName() return selected filename (after exec)


Some examples:

  • Copy current file name to clipboard: %SCRIPT app.clipboard = editor.fileName();
  • Execution of editor text: %SCRIPT eval(editor.text());
  • Show all properties of an object: %SCRIPT function write_properties(obj) { app.fileNew(); newEditor = documentManager.currentDocument.editorView.editor; //access the newly created document newEditor.setText(Object.getOwnPropertyNames(obj).join("\n")); //print the properties } obj = editor; //object to show (e.g. the current editor) write_properties(obj)
  • Additional action in the edit menu
  • Asynchronous dialog: The dialog is described in an ui file which can be created with the Qt Designer.

More examples can be found in the Wiki.

4.5.4 Triggers

4.5.4.1 Regular Expressions

In its simplest form, the trigger is simply a text, which is replaced by the macro. E.g. trigger="eg" macro="example given", "eg" in "the leg" is replaced on pressing "g" by "example given"
As the trigger is a regular expression, more elaborate triggers can be created. TXS makes use of look-behind searching: "(?<=\s)%" is used to replace a "%" if the previous character is a space. More help on regular expressions can be found on the internet.

You can access the matched expression in the script via the global variable . is an array. It's zero-th component is the match to the complete regexp. The following elements are matches to groups (if groups are defined).

Example:

Trigger: #([a-z]) Typed text: #a triggerMatches[0] == '#a' triggerMatches[1] == 'a'

Note: Triggers are inactive while the completer is active. For example you cannot trigger on if the completer is open suggesting to complete .

4.5.4.2 Limitation of Scope

To the scope in which a macro will be active, you can prepend an expression of the pattern .

Scope Limiting ExpressionMeaning
The macro is only active if the highlighting of the document matches the given language.
Example:
Restrict the macro to certain highlighted environments. The possible values correspond to the list on the syntax highlighting config page.
Example:
Similar to , but the macro is deactivated in the given environments.

You may combine and expressions. However, combing and does not make sense logically and has undefined behavior.

Note that you still need the regular expression of the trigger itself. Here's a full complex example: . This trigger responds to typing "FIXME", but only in comments and todo-notes of latex documents.

4.5.4.3 Event Triggers

Additionally the following special trigger terms (without parentheses) can be used to execute the script when the corresponding event occurs:

Special TriggerExecuted on Event
?txs-startTeXstudio is started.
?new-fileA new file is created
?new-from-templateA new file is created from a template
?load-fileA file is loaded
?load-this-fileThe file containing the macro is loaded (only makes sense, if the script is defined as magic comment)
?save-fileA file is saved
?close-fileA file is closed
?master-changedA document is un/defined as master document
?after-typesetA latex-like command has ended
?after-command-runA command run has ended (e.g. a compile command that calls latex twice and opens the viewer, will trigger this event once, but after-typeset twice)

Multiple of these special triggers can be combined by | symbols.

4.6 Pstricks support

The main pstricks commands can be inserted with the "Pstricks" panel in the "Structure View".

4.7 Metapost support

The metapost keywords can be inserted with the "Metapost" panel in the "Structure View" and the "mpost" command can be launched via the "Tools" menu.

4.8 The "Convert to Html" command

This command (from the "Tools" menu ) produces a set of html pages from a LaTeX source file with one image for each html page. Each page in the slide presentation corresponds to one of the postscript pages you would obtain running LaTeX.
The command also produces an index page corresponding to the table of contents you would obtain with LaTeX. Each item of the index page includes a link to the corresponding html page.

You can create links in the html pages by using the \ttwplink{}{} command in the tex file.
Synopsis :
\ttwplink{http://www.mylink.com}{my text} (external link)
\ttwplink{page3.html}{my text} (internal link)
\ttwplink{name_of_a_label}{my text} (internal link)
Warning : You can't use this command with the hyperref package (and some others packages). This command can only be used with the "Convert to html" tool.

4.9 "Forward/Inverse search" with TeXstudio

Integrated pdf-viewer

TeXstudio provides an integarted pdf-viewer which offers forward- and inverse-search. Make sure that synctex is activated in the pdflatex command (option -synctex=1 needs to be added), though TeXstudio will ask you if it can correct the command itself if it is not set correctly.
Forward search is automatically done every time the pdf-viewer is opened. TeXstudio will jump to the position where your cursor is currently positioned. Additionally you can CTRL+left click on a word in the text editor to jump to the pdf or use the context menu and select "Go To PDF".
Inverse can be activated by clicking in the pdf with CTRL+left mouse button or by slecting "jump to source" in the context menu, which is activated with a right mouse button click. Furthermore it is possible to enable "Scrolling follows Cursor" in pdf-viewer/configure. This will keep the pdf-viewer position synchronous to your cursor oposition in the editor. Likewise "Cursor follows Scrolling" keeps the editor position synchronous to pdf-viewer position.

General Set-up for external viewers

Some (dvi) viewers can jump to (and visually highlight) a position in the DVI file that corresponds to a certain line number in the (La)TeX source file.
To enable this forward search, you can enter the command line of the corresponding viewer either as command line for an user tool in the User menu (User/User Commands/Edit...) or in the viewer command line in the config dialog ("Options/Configure TeXstudio" -> "Commands"). When the viewer is launched, the @-placeholder will be replaced by the current line number and ?c:ame by the complete absolute filename of the current file.

On Windows, you can execute DDE commands by inserting a command of the form: dde:///service/control/[commands...] or (since TeXstudio 1.9.9) also dde:///programpath:service/control/[commands...] to start the program if necessary.

Below you can find a list of commands for some common viewers. Of course, you have to replace (your program path) with the path of the program on your computer, if you want to use a command.

Sumatra

Launch Sumatra from TeXstudio and configure Sumatra for inverse search: "(your sumatra path)" -reuse-instance -inverse-search "\"(your TeXstudio path)\" \"%%f\" -line %%l" "?am.pdf"

Jump to a line in a running Sumatra (Windows only): dde:///SUMATRA/control/[ForwardSearch("?am.pdf","?c:am.tex",@,0,0,1)]

Launch Sumatra if it is not running and jump to a line in it (Windows only): dde:///(your sumatra path):SUMATRA/control/[ForwardSearch("?am.pdf","?c:am.tex",@,0,0,1)]

Launch TeXstudio from Sumatra: "(your TeXstudio path)" "%f" -line %l

A possible value for (your Sumatra path) is C:/Program Files/SumatraPDF/SumatraPDF.exe

Foxit Reader

Launch Foxit Reader from TeXstudio: "(your Reader path)" "?am.pdf"

Acrobat Reader

Launch Acrobat Reader from TeXstudio: "(your Reader path)" "?am.pdf"

Naviation and closing are achieved via DDE commands. Since version 10 of the adobe products the DDE service name contains a letter for the Product and the version number.

ProductService name
Adobe Reader 9acroview
Adobe Acrobat 9acroview
Adobe Reader 10acroviewR10
Adobe Acrobat 10acroviewA10
Adobe Reader 11acroviewR11
Adobe Acrobat 11acroviewA11
Adobe Reader DCacroviewR15
Adobe Acrobat DCacroviewA15

The following example is for Adobe Reader DC:
Jump to a position in a running Adobe Reader (Windows only): dde:///acroviewR15/control/[DocOpen("?am.pdf")][FileOpen("?am.pdf")][DocGotoNameDest("?am.pdf","jump-position")]         jump-position can be defined with the hyperref package
If you have the problem that Adobe Reader does not open, you have to add the program path like this: dde:///"C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe":acroviewR15/control/[DocOpen("?am.pdf")][FileOpen("?am.pdf")][DocGotoNameDest("?am.pdf","jump-position")]

Close the document in a running Adobe Reader (Windows only): dde:///acroviewR15/control/[DocOpen("?am.pdf")][FileOpen("?am.pdf")][DocClose("?am.pdf")]

Note: Since Adobe Reader blocks writing to PDFs which are open in the Reader, you have to close the PDF before recompiling. You can define a User Command for the above DDE-command and call it at the beginning of your build chain. This ensures that the file will be closed and thus is writable when compiling.

Yap (Yet Another Previewer)

Launch Yap from TeXstudio: "(your Yap path)" -1 -s @?c:m.tex %.dvi

Launch TeXstudio from Yap: "(your TeXstudio path)" "%f" -line %l

A possible value for (your Yap path) is C:\Program Files\MiKTeX 2.7\miktex\bin\yap.exe

xdvi

Launch xdvi from TeXstudio: xdvi %.dvi -sourceposition @:?c:m.tex

Launch xdvi from TeXstudio and enable inverse search: xdvi -editor "texstudio %f -line" %.dvi -sourceposition @:%.tex

kdvi

Launch kdvi from TeXstudio: kdvi "file:%.dvi#src:@ ?c:m.tex"

Okular

Launch okular from TeXstudio: okular --unique %.dvi#src:@?c:m.tex

Launch TeXstudio from Okular: texstudio %f -line %l

Skim

Launch Skim from TeXstudio: (your Skim path)/Contents/SharedSupport/displayline @ ?am.pdf ?c:ame

Launch TeXstudio from skim: Command: /applications/texstudio.app/contents/macos/texstudio with arguments: "%file" -line %line

A possible value for (your Skim path) is /Applications/Skim.app

qpdfview

Launch qpdfview from TeXstudio: qpdfview --unique ?am.pdf#src:?c:am.tex:@:0 2> /dev/null

Launch TeXstudio from qpdfview: texstudio "%1" -line %2

4.10 Advanced header usage

So called "magic comments" are a way to adapt the options of the editor on a per-document level. The concept was originally introduced in TeXshop and has been adopted in a number of editors since. TeXstudio supports the following magic comments:

4.11 Synopsis of the TeXstudio command



use the specified settings directory.
deprecated:use instead.
defines the document as explicit root document (formerly called master document).
deprecated:use instead.
position the cursor at line LINE and column COL, e.g. "--line 2:5" will jump to column 5 in line 2.
pushes a bibtex key to TeXstudio, that will be inserted at the cursor position. This is intended as an interface for external bibliography managers to push citations to TeXstudio. You may either pass an (also custom) command like \mycite{key} or just the key. In the latter case, it is expanded to \cite{key}. Also comma separated keylists are supported. TeXstudio recognizes, if the cursor is already within a citation macro. If so, only the key is inserted at an appropriate position, otherwise the full citation command is inserted.
start a new instance, even if TXS is already running. This allows using of multiple instances.
run as a standalone pdf viewer without an editor
display a certain page in the pdf viewer
do not load/save the session at startup/close

Additional options only available in debug versions of texstudio:

Prevent running any tests.
Force running the most common tests.
Force running all tests.
Note: The most common tests are run automatically, if there were changes to the executable (i.e. TXS has been compiled since the last run). Furthermore all tests are run once a week.

4.12 Keyboard shortcuts

The keyboard shortcuts can be modified at Options -> Shortcuts.

The following list is a rough overview of the defaults keyboard shortcuts. Depending on the operating system, there may be some deviations to adapt for OS-specific shortcut conventions.

  • "File" menu :
    • New : Ctrl+N
    • Open : Ctrl+O
    • Save : Ctrl+S
    • Save as: Ctrl+Alt+S
    • Save all: Ctrl+Shift+Alt+S
    • Close : Ctrl+W
    • Print Source Code : Ctrl+P
    • Exit : Ctrl+Q
  • "Edit" menu :
    • Undo : Ctrl+Z
    • Redo : Ctrl+Y
    • Copy : Ctrl+C
    • Cut : Ctrl+X
    • Paste : Ctrl+V
    • Select All : Ctrl+A
    • Expand Selection to Word : Ctrl+D
    • Expand Selection to Line : Ctrl+L
    • Delete Line : Ctrl+K
    • Delete to End of Line : Alt+K
    • Find : Ctrl+F
    • Find next : F3 / Ctrl+G
    • Find prev : Shift+F3 / Ctrl+Shift+G
    • Replace : CTrl+R
    • Go to line : Ctrl+G
    • Go to previous change: Ctrl+H
    • Go to to next change: Ctrl+Shift+H
    • Go to Bookmark 0..9: Ctrl+0..9
    • Set Bookmark 0..9: Ctrl+Shift+0..9
    • Set Unnamed Bookmark: Ctrl+Shift+B
    • Next Marker: Ctrl+Down
    • Previous Marker: Ctrl+Up
    • Go Back : Alt+Left
    • Go Forward : Alt+Right
    • Insert Unicode Character : Ctrl+Alt+U
  • "Idefix" menu :
    • Erase Word/Cmd/Env: Alt+Del
    • Paste as LaTeX: Ctrl+Shift+V
    • Show preview : Alt+P
    • Comment : Ctrl+T
    • Uncomment : Ctrl+U
    • Next Latex Error: Ctrl+Shift+Down
    • Previous Latex Error: Ctrl+Shift+Up
    • Next Latex Bad Box: Shift+Alt+Down
    • Previous Latex Bad Box: Shift+Alt+Up
    • Go to definition: Ctrl+Alt+F
    • Normal Completion: Ctrl+Space
    • \begin Completion: Ctrl+Alt+Space
    • Normal Text Completion: Alt+Shift+Space
    • Close Last Open Environment: Alt+Return
    • Remove Placeholders: Ctrl+Shift+K
  • "Tools" menu :
    • Build & View : F5
    • Compile : F6
    • View : F7
    • Bibliography : F8
    • Glossary : F9
    • Check spelling : Ctrl+:
    • Thesaurus : Ctrl+Shift+F8
  • "LaTeX" menu :
    • item : Ctrl+Shift+I
    • Italic : Ctrl+I
    • Slanted : Ctrl+Shift+S
    • Bold : Ctrl+B
    • Typewriter : Ctrl+Shift+T
    • Small caps : Ctrl+Shift+C
    • Emphasis : Ctrl+Shift+E
    • New line : Ctrl+Return
    • begin{environment} : Ctrl+E
    • Insert reference to next label : Ctrl+Alt+R
  • "Math" menu :
    • Inline math mode : Ctrl+Shift+M
    • Display math mode : Alt+Shift+M
    • Numbered equations : Ctrl+Shift+N
    • Subscript : Ctrl+Shift+D
    • Superscript : CTrl+Shift+U
    • Frac : Alt+Shift+F
    • Dfrac : Ctrl+Shift+F
    • Sqrt : Ctrl+Shift+Q
    • Left : Ctrl+Shift+L
    • Right : Ctrl+Shift+R
  • "User" menu :
    • User tags : Shift+F1...Shift+F10
    • User commands : Shift+Alt+F1...Shift+Alt+F10
  • "View" menu :
    • Previous Document : Ctrl+PgDown
    • Next Document : Ctrl+PgUp
    • Focus Editor : Ctrl+Alt+Left
    • Focus Viewer : Ctrl+Alt+Right
    • Close Something : Esc
    • Editor Zoom In : Ctrl++
    • Editor Zoom Out : Ctrl+-
    • Fullscreeen Mode : F11

4.13 Description of the cwl format

cwl stands for completion word list and is a file format originally used in Kile to define the commands listed in the completer. TeXstudio uses an extended format of cwls to include additional semantic information and allow for cursor and placeholder placement. It uses them for the following purposes:

  • Populating the autocompletion
  • Knowledge on the valid commands in the current document (depending on \usepackage statements)
  • Semantic information that provide additional context in the editor; e.g. a \ref-like command will check for the existence of the referenced label

4.13.1 cwl file format

Each line of a cwl file defines a command. Comment lines are possible and start with . The command syntax is


If no classification is given, the command is considered valid at any position in a LaTeX document. The char cannot be used inside a , as it has special meaning:

  • (at start of line): also load packagename.cwl. This should be used to indicate that a package depends on other packages.
  • (at start of line): define a letter replacement, e.g. "a -> ä for German. Only used for letter replacement in spell checking (babel)
  • (at start of line): start definition of keyvals for , see graphicx.cwl in source code. To specify possible values for keys, add them after # e.g.
The l2h help pages © Leon van Dommelen 
The latest version of this document is online at eng.famu.fsu.edu or at dommelen.net.

Errors while processing latex files

Preface

This web page tries to give some help with error messages that may pop up while processing your latex file index.tex.

Now don't get scared. I cannot remember ever seeing most of these errors and I have been using TeX and LaTeX for all my documents a quarter century or so. (Then again, my memory definitely does not extend over a quarter century. More like a quarter hour nowadays.) And almost all the complicated errors are self-inflicted. Or professor-inflicted. If you do not make your own problems, the problems will probably be typos and forgotten {, }, or $ characters. Or often you forget a \ before a special character that needs one. (At least, I do this often.)

However, if your admirable professor tells you that he or she would like the page numbers in Egyptian hieroglyphs in the middle of the page, go for it! Ask your beloved professor to help you get this just perfectly right. Don't leave the professor\rq{}s office until it is done. (Visit early in the morning, of course.)

Other than that very important observation, this web page needs work. However, some of it may already be useful. On first use, be sure to read the first two entries of the contents below (excluding this preface).

If you have any errors that would be good to include here, please e-mail them to me. You will be helping other LaTeX users, even those that do not use l2h. If you can paste them directly from the log file, (so that the log file reader can recognize them), it would be even better. And so it would if you can also give a solution to the problem.

Contents





General notes on errors

When your latex file, index.tex, is processed, errors may be found. On a serious error, processing stops. An error message will be printed, preceded by a !. The line number in your latex file at which the error is discovered is printed before the message, following an l.

To be sure, the error might not be in your own index.tex file. It may be in a package you load. Then the filename of that package will have been printed earlier following a "(", one that is not yet closed by a ")". Now packages by themselves do not have errors. I hope. But when you load several different packages, and you will, they might conflict. Then there is not much you can do except try to change the order in which the packages are loaded. If that does not help, you will need to live without one of the packages. Fortunately, such problems are rare, and mostly restricted to recently developed packages. So the discussion here assumes that the error is in your index.tex file.

The first thing to do is to read the error message. Then read the line number at which it was found. Look in your tex file at and maybe before that line number and try to find an error. (See the next entry for some general rules in doing so.)

After you have found the error, you can correct it in your tex file. But do not save. Processing can get really weird if the file changes while it is still being processed. Also, if you make changes, note that this may change the line numbers. The processing will still print the line numbers of the original file.

After hopefully identifying and correcting each error, hit Enter in the processing window. Note that one error often causes more than one error message. The additional error messages should disappear too the next time you process the file.

If there are countless error messages, the best thing may be to enter a "q" or "x" at the ? prompt. Then after having saved your corrections so far, reprocess. Hopefully there will not be that many problems anymore.

Also, processing can get very nasty if latex tries to open some file and cannot find it. If you get stuck, try hitting "c" or "d" while holding down Ctrl. Or try to specify a junk file name like "/dev/null" or "nul".

See also http://www.tex.ac.uk/cgi-bin/texfaq2html?label=erroradvice


General tricks to try

There are some general tricks to identify errors.

Use the "a" key to get a list of all errors. Maybe another error message can clarify the problem.

Remember the special characters. To get an actual %, you need \%. (That is a mistake even experienced latex users still make regularly.) For an & you need \&, for a # you need \#, for a \ you need \backslash, (\\ is new line), for a printed { you need \{, and for } you need \}. However, [ and ] are normal, while \[ and \] surround math.

Except in mathematics, the characters ^ and _ are illegal too, and < and > will not do what you think they should. A * or [ immediately behind \\ will cause problems. The trick is then to enclose that following stuff between { and }.

Look carefully for typos. A 1 may resemble an l, a ) a }, etcetera. Carefully identify for each { the corresponding } that closes it. Check that \begin{something} is closed by \end{something}, not \end{somethingelse}.

Try to find the error message on this web page and see whether that gives a useful hint. (But there are almost infinitely many possible problems for a single error message; this page cannot list them all. Using you intuition is often the best guide to what is wrong.)

Try to temporarily remove the apparently problematic command or environment. Does the problem disappear? If so, you know where the problem is.

But it is not uncommon for even experienced latex users to get stumped by an error. In that case, a divide and conquer approach may be your best bet.

Try enclosing the general problem area between \begin{comment} and \end{comment} lines. The enclosed area will no longer be processed. So if your error is indeed in the selected area, the processing error should disappear. (If it does not disappear, select a bigger area).

After you have identified the problem area, move roughly half of it outside the comment block. (Of course, select complete units. Do not break groupings, or you create additional errors.) If the error reappears, it is in that half. If not, it is in the other half. Either way, you have narrowed down the problem area by a factor 2.

Move everything out of the comment block. Then put about half of the now identified smaller problem area back inside. If the error is in that half, it will not show up. In the other half it will. That allows you to narrow the problem area even more closely. And so on until the problem area is so small that there is only one possible cause to the error left.

Of course, then you will notice that the problem was trivial, and you should have seen it in a second. No need for all this chopping into pieces. When you know the answer, the problem is always simple.


List of error descriptions



No error message. Just shows a * and sits there

Latex did not see an \end{document} line. It is patiently waiting for whatever other exciting stuff you have planned for it.

  1. Check that you have a correctly spelled \end{document}.
  2. Check that \end{document} is not hidden behind something like an \endinput line.
  3. Check that you are indeed processing the index.tex file that you think you are processing. (Create an error right at the start of the file if you have to.)
  4. If stumped, try the general tricks.

No error message. But bad links in the pdf side bar.

Sometimes the pdf has bad links in the sidebar even though no rerun is requested in the log file.

  1. Run latex once more. L2h will complain, but just hit "c" to continue. Then run "p" as needed. That fixed it for me.
  2. Sometimes the link of an \addcontentline command goes to the end of the previous chapter instead of the start of the new chapter (which is an unnumbered \chapter*{...} chapter). In that case, make sure the thing is formatted as follows: \clearpage \phantomsection \addcontentsline{toc}{chapter}{Title of whatever} \chapter*{TITLE OF WHATEVER} The additional first two commands will hopefully fix things.

==> Fatal error occurred, the output PDF file is not finished!

This just tells you the pdf was not made.

  1. Look for the earlier error message that gives the reason.
  2. If stumped, try the general tricks.

! ==> Fatal error occurred, no output PDF file produced!

This just tells you the pdf was not made.

  1. Look for the earlier error message that gives the reason.
  2. If stumped, try the general tricks.

(end occurred inside a group at level nnn)

Something was not properly closed when the end of the file was reached.

  1. Look for a { bracket that has never been closed by a }.
  2. Look for other things that may not have been closed, like environments, math, etc.
  3. If a pdf was created, or can be created, look at the end of the document in the pdf for clues. If, say, an {\it was not closed, things will be in italics.
  4. If stumped, try the general tricks.

(end occurred when if... on line nnn was incomplete)

Unless you write your own latex code, you did not close something or put something in a place latex cannot accommodate it.

  1. Look for missing } brackets.
  2. Look for other things that may not have been closed, like environments, math, etc.
  3. If stumped, try the general tricks.

(Fatal format file error; I'm stymied)

From the TeX FAQ:

The commonest cause of the message, is that a new binary has been installed in the system: no two TeX binaries on the same machine can understand each other’s formats. So the new version of TeX you have just installed, won’t understand the format generated by the one you installed last year.

Resolve the problem by regenerating the format; of course, this depends on which system you are using.

  • On a teTeX-based system, run fmtutil --all or fmtutil --byfmt=[format name] to build only the format that you are interested in.
  • On a MiKTeX system, click Start-> Programs-> MiKTeX version-> MiKTeX Options, and in the options window, click Update now.

From the web:

I first tried the fmtutil command as root [administrator] again and it still didn't work. Then I ran the command as normal user and now everything works.


Please type a command or say `\end'

TeX has nothing to do and asks you what it should do. You will get this error, for example, if you run latex interactively on an empty latex source file. Since in the l2h shell you do not run latex interactively, you should not get this error there. (Just an "emergency stop" one.)

  1. Say `\end'? (Actually, I got an "TeX capacity exceeded, sorry" error on that. But it did end the program.)

! A <box> was supposed to be here

In LaTeX, boxes are created by \newsavebox, given content by \savebox, and used by \usebox. Plain TeX uses \newbox, \setbox, \copy, etcetera.

  1. Check that your \savebox or \usebox has a box in its first argument.
  2. If stumped, try the general tricks.

! Ambiguous; you need another { and }

Compare the items on double subscripts and superscripts.

  1. Try adding a couple of brackets, I guess.
  2. If stumped, try the general tricks.

! Argument of ... has an extra }
  1. Did you use a fragile command, like \footnote or \parbox, in a place it should not be? Like in a \caption? If you really need it there, try putting \protect right in front of it.
  2. A misused \frac command, like \frac{1,2} can cause this.
  3. Apparently, some commands inside fragile commands can cause this. Try temporarily removing the content and see whether the error disappears.
  4. If stumped, try the general tricks.

! Arithmetic overflow

Something went wrong deep inside the processing program.

  1. Check for unusual constructs.
  2. If stumped, try the general tricks.

! Bad character code

The character code of a normal character was specified outside the valid range from 0 to 127.

  1. Check for \lccode or \uccode commands.
  2. If stumped, try the general tricks.

! Bad delimiter code

A numeric delimiter code must be between 0 and 2^{24}-1, (\delcode) or 2^{27}-1 including the class number (\delimiter).

  1. If stumped, try the general tricks.

! Bad math code (...).

A numeric math code was specified outside the valid range from 0 to 32767.

  1. Check for \mathchardef commands.
  2. If stumped, try the general tricks.

! Bad mathchar

A math character with a code outside the valid range from 0 to 32767 was encountered.

  1. If stumped, try the general tricks.

! Bad node name: `...'.

An error in the pstricks package. A node name must only contain letters and digits and start with a number.

  1. Change the name.
  2. If stumped, try the general tricks.

! Bad number ...

Latex expected a number, but did not get a valid one.

  1. Careful examination of the correct form of the command listed will usually show up the problem.
  2. If stumped, try the general tricks.

! Bad register code

Gee.

  1. If stumped, try the general tricks.

! Bad space factor

Gee.

  1. Something wrong with a \hfil[l] or \vfil[l]?
  2. If stumped, try the general tricks.

! Counter too large

One counter that is fairly likely to run out is the footnote one. There are only so many footnote marks, after all. (9 symbolic ones, to be precise.)

  1. Too many footnotes?
  2. Too many \thanks commands?
  3. Converting a counter > 26 to a letter a-z can also cause this error.
  4. If stumped, try the general tricks.

! Dimension too large

I think this means a length is specified that is larger than possible.

  1. If stumped, try the general tricks.

! Discretionary list is too long

A \discretionary line break has 3 parameters: text before the line break, text after the line break, and text if there is no line break in the first place.

  1. Check that it hhas three {...} parameters of reasonable size.
  2. If stumped, try the general tricks.

! Display math should end with $$.

Actually, in latex you should use \[ and \] instead of $$ and $$. Or better, use \begin{displaymath} and \end{displaymath}.

  1. Change to one of the correct forms. Then you know what begins math and what ends it.
  2. Math may not contain blank lines. If you leave a single blank line in an equation, it will generate the error message ! Missing $ inserted, followed by ! Display math should end with $$. followed by ! LaTeX Error: Bad math environment delimiter. Remove the blank line and all three error messages should disappear.
  3. Now latex2html has a nasty habit of leaving blank lines when it removes the labels from equations. These errors will then show up in its math images processing. In particular, they will show up in images.log. To fix this, put the \label{...} in equations at the end, followed by a %. Furthermore, leave some mathematics on the same line, before the \label{...}%.
  4. Use of $$ inside equation mode can cause this, I hear.
  5. If stumped, try the general tricks.

! Double subscript

If you think about it, {a_b}_c is not the same as a_{b_c}. In the first case, c is a subscript to the complete expression a_b. In the second case, it is a subscript to the subscript b only. So in the second case, c should be a lot smaller than b. In the first case, it must be at least as big as b. TeX needs to know which case it is.

  1. Add the brackets already.
  2. If stumped, try the general tricks.

! Double superscript

If you think about it, {a^b}^c is not the same as a^{b^c}. In the first case, c is a superscript to the complete expression a^b. In the second case, it is a superscript to the superscript b only. So in the second case, c should be a lot smaller than b. In the first case, it must be at least as big as b. TeX needs to know which case it is.

  1. Add the brackets already.
  2. Note that in math, ' is a superscript too. (It is really the same as ^\prime.)
  3. If stumped, try the general tricks.

! Duplicate pattern

I assume this refers to hyphenation patterns. In that case, you should never see it unless you are an expert.

  1. If stumped, try the general tricks.

! Emergency stop

Tex got in trouble. The actual error may be much earlier.

  1. You will see this error when LaTeX cannot find a file in an \input or \include type statement.
  2. You will see this error when LaTeX cannot find the \end{document} line. Check its presence and spelling.
  3. If stumped, try the general tricks.

! Extra \right

A \right, which must precede some bracket or a point, must match an earlier \left.

  1. I tend to get my \left and \right mixed up.
  2. Missing/misspelled \end{array}?
  3. If stumped, try the general tricks.

! Extra alignment tab has been changed to \cr

You put in too many & characters in a single row in your table or array or matrix. Each & should separate two columns. (Note that what TeX calls \cr is what LaTeX calls \\. TeX has started a new row to fix things up.)

  1. Is the & count right?
  2. Did you mean \& somewhere?
  3. Did you forget or mistype \\ at the end of the previous row?
  4. Did you use an invalid range in a \cline?
  5. Too large a count in a \multicolumn?
  6. Is there something wrong in the column specifications? Check p and @ commands for correctness.
  7. If stumped, try the general tricks.

! Extra \....

There is something not matching something else, like maybe a \fi, \or, or \else not matching an earlier \if. Unless you write your own TeX code, that would probably mean that something has been put in the wrong place.

  1. Check for unusual constructs.
  2. If stumped, try the general tricks.

! Extra }, or forgotten $

There is some problem with figuring out what begins or ends what.

  1. Unlike what it says, check not only that there is a { for each }, and a $ for each $, but also a \[ for each \] and a \( for each \). And that they are properly nested: {\small $a}=b$ is wrong. You must close the math before closing the { with }.
  2. If stumped, try the general tricks.

! File ended while scanning use of \end.

You did not close something properly. May be just a forgotten }. LaTeX has now reached end of file without finding the closing bracket.

  1. Check the indicated problem area for { that may have forgotten }.
  2. If stumped, try the general tricks.

! File ended within ...

You did not close something properly. May be just a forgotten } or \end{...}.

  1. If stumped, try the general tricks.

! Font ... not loadable: Bad metric (TFM) file.

A needed font seems to be corrupt.

  1. Error in the font specification?
  2. Try to reinstall the font?
  3. Try to use a different font?

! Font ... at ... not loadable: Metric (TFM) file not found.

A needed font is not found.

  1. Error in the font specification?
  2. Try to install the font?
  3. Try to use a different font?
  4. You get this error if you try to use plain latex to process a template set up for xelatex. Check the value of \pdfengine or \webengine.

! Font ... not loadable: Metric (TFM) file not found.

A needed font is not found.

  1. Error in the font specification?
  2. Try to install the font?
  3. Try to use a different font?
  4. Are you using plain latex where xelatex is needed? Check the value of \pdfengine or \webengine.

! Font ... not loadable: Metric (TFM) file or installed font not found.

A needed font is not found.

  1. Error in the font specification?
  2. Try to install the font?
  3. Try to use a different font?
  4. Are you using plain latex where xelatex is needed? Check the value of \pdfengine or \webengine.

! Font ... not loaded; Not enough room left

I do not think that should happen with an up-to-date version of LaTeX.

  1. Do you really need all these fonts?
  2. There are ways to process a document in parts. That is described in Lamport's LaTeX User's guide & Reference Manual.

! fontspec error: "font-not-found"

The fontspec package cannot find the specified font.

  1. Did you mistype the font name?
  2. Does the font exist? Use the "Character Map" program to check. If it does not, maybe you can install it.

! Forbidden control sequence found
  1. Try removing it?
  2. If stumped, try the general tricks.

! Huge page cannot be shipped out

Never seen this one in my life. Doubt that it would happen with a modern latex version. Unless there is something really, really, wrong.

  1. If stumped, try the general tricks.

! I can't find file `...'

When interactive, typing in the correct file name, or correct package name, is the best way to proceed. However, latex in the l2h menu is not interactive and all processing aborts.

  1. Interactively, LaTeX will be happy as long as it gets any valid file name.
  2. Interactively, the way to get LaTeX to stop asking depends on your operating system and TeX version. Try entering x a couple of times. Or nul or /dev/null. Or try hitting c while holding down Ctrl.
  3. Interactive or not, you either have to provide a valid link to an existing, readable file, or remove the command trying to read it.
  4. If stumped, try the general tricks.

! I can't go on meeting you like this

Because LaTeX loves you, it feels really bad about all the problems resulting from your error.

  1. Fix the problems you have figured out so far and try processing the latex again.
  2. If stumped, try the general tricks.

! I can't write on file `...'

Latex wants to create a file, but it cannot do so.

  1. You may get this error if you have an old version of index.pdf open in Adobe Acrobat and postcript or pdflatex is trying to create a new one. You will need to exit Acrobat and then try the "l" or "p" key again.
  2. No more disk space?
  3. Are you in a location where you have no privileges to write the file?
  4. Does someone else, like system, own the file that is to be replaced?
  5. If stumped, try the general tricks.

! Illegal magnification has been changed to 1000 (...).

You are not supposed to use \magnification in latex.

  1. Check that "scaled" font scalings use valid numbers.
  2. If stumped, try the general tricks.

! Illegal math

TeX is being helpful here. You can do thousands of things wrong in TeX, and TeX actually reduced the possible problems for you to look for by a factor 2 or so!

  1. If stumped, try the general tricks.

! Illegal parameter number in definition of ...

There is a problem with a # parameter while defining something.

  1. If you mistype \newcommand{\mycommand}[2]{...} as \newcommand{\mycommand}[1]{...}, references #2 to argument 2 will be invalid.
  2. To get an actual #, use \#.
  3. For a \[re]newenvironment{name}[n]{begin stuff}{end stuff}, the n parameters cannot be used in end stuff.
  4. There may be some #1, #2, ... mistyped in a \[re]newcommand or \[re]newenvironment. (Or in a plain tex \def statement).
  5. Check that you are not defining something inside defining something. (Like a \newcommand inside a \renewenvironment, say.)
  6. If stumped, try the general tricks.

! Illegal unit of measure (pt inserted)

Note that you cannot abbreviate 0in (0 inch), or 0pt (0 points, i.e. 0/72 inch) as 0. You still need to add "in" or "pt" even if the length is zero. (Which one of the two obviously does not make a difference.)

  1. Like above.
  2. This one is likely to follow an "Missing number, treated as zero" error. The missing number is really a missing length.
  3. Check the proper format of the command you are using.
  4. If stumped, try the general tricks.

! Improper \hyphenation will be flushed.

Improper parameter to \hyphenation

  1. Words should be letters and hyphens and separated by spaces.
  2. If stumped, try the general tricks.

! Improper `at' size (
  1. If stumped, try the general tricks.

! Improper alphabetic constant
  1. If stumped, try the general tricks.

! Improper discretionary list
  1. If stumped, try the general tricks.

! Incompatible glue units
  1. If stumped, try the general tricks.

! Incompatible list can't be unboxed
  1. If stumped, try the general tricks.

! Incompatible magnification (
  1. If stumped, try the general tricks.

! Incomplete \if...; all text was ignored after line nnn.

Unless you write your own LaTeX code, this is propably caused by something in the wrong place.

  1. Look for unusual constructs.
  2. If stumped, try the general tricks.

! Infinite glue shrinkage found in ...
  1. If stumped, try the general tricks.

! Infinite glue shrinkage inserted from
  1. If stumped, try the general tricks.

! Insertions can only be added to a vbox
  1. If stumped, try the general tricks.

! Interruption
  1. If stumped, try the general tricks.

! Invalid code (
  1. If stumped, try the general tricks.

! LaTeX Error: Bad \line or \vector argument.

You put something invalid behind \line or \vector inside a picture environment

  1. Try looking at http://en.wikibooks.org/wiki/LaTeX/Picture.
  2. If stumped, try the general tricks.

! LaTeX Error: Bad math environment delimiter.

Are your { and } braces matched? Is \[ or \( closed by \] or \)? Are you entering math mode while already in it?

  1. Check properly opening and closing of math environments.
  2. Math may not contain blank lines. If you leave a single blank line in an equation, it will generate the error message ! Missing $ inserted, followed by ! Display math should end with $$. followed by ! LaTeX Error: Bad math environment delimiter. Remove the blank line and all three error messages should disappear.
  3. Now latex2html has a nasty habit of leaving blank lines when it removes the labels from equations. These errors will then show up in its math images processing. In particular, they will show up in images.log. To fix this, put the \label{...} in equations at the end, followed by a %. Furthermore, leave some mathematics on the same line, before the \label{...}%.
  4. A missing \right after an array can cause this error.
  5. If stumped, try the general tricks.

! LaTeX Error: Bad use of \\

A \\ new line command is in an unallowed position.

  1. Remove the \\?
  2. If stumped, try the general tricks.

! LaTeX Error: \begin{...} ended by \end{...}
  1. Check for typos in ... Check that you did not forget a \begin{..} or \end{...}.
  2. If stumped, try the general tricks.

! LaTeX Error: Can be used only in preamble.

Things like \usepackage can only be used before the \begin{document} line. In particular, \documentclass must be the first line, way before \begin{document}.

  1. Make sure you do not have two \begin{document} lines.
  2. If stumped, try the general tricks.

! LaTeX Error: \caption outside float

A \caption must inside a "float" like a figure or a table.

  1. Is the \begin{figure) or \begin{table} of the caption environment properly spelled?
  2. If stumped, try the general tricks.

! LaTeX Error: Command ... already defined

A new command being defined already exists.

  1. If you are defining a new command here, the name is already used for something else. Change it. Remember that LaTeX is case sensitive, so simply changing the case will fix things.
  2. Or to overwrite the old command, use \renewcommand. Warning: this will get you into big trouble if the overwritten command is an important one.
  3. If this occurs during the loading of a package, the package conflicts with another one. (Not at all unusual.) Try changing the order of package loading, or forget about one of the two.
  4. If stumped, try the general tricks.

! LaTeX Error: Command \circle invalid in math mode.
  1. Like it says? However, you can put a picture environment inside a mathematics environment. Then you can put the \circle inside that picture. (As far as the surrounding math mode is concerned, the entire picture will be just some very big "letter".)
  2. If stumped, try the general tricks.

! LaTeX Error: Command \end{itemize} invalid in math mode

If you use math mode inside an itemize and forget the closing $, this will happen.

  1. Check properly closing of math mode.
  2. If stumped, try the general tricks.

! LaTeX Error: Counter too large.
  1. Unless you are defining a very long list, you probably brought this upon yourself somehow. (Who else is readily available to be blamed?)
  2. If you are really defining a long list, make sure it is a top level list, which is enumerated by arabic numbers. (Or learn how to define your own lists.)
  3. If stumped, try the general tricks.

! LaTeX Error: Environment ... undefined.

An attempt to use an environment that has never been defined.

  1. Check for typos in the \begin{environment} line.
  2. If it is part of a package, check the corresponding \usepackage command.
  3. If stumped, try the general tricks.

! LaTeX Error: File `...' not found

This error is serious because latex will terminate without finishing the document. The missing file may be a personal file that you are trying to \input. Or it may be a package you are trying to load with \usepackage that you do not have installed. If latex is trying to find a .sty, .cls, or .def file, it is a missing package.

  1. If latex is missing a personal file, put it in the same folder as index.tex. Then do not use a path in the \input statement.
  2. If latex is missing a package, try finding the file on the web and put it inside the "texinputs" folder inside "l2h". Note that you may have to run latex on any .ins or .dtx file you find to get the sty file.
  3. If you are running latex though an editor like TeXstudio instead of through l2h, you may need to copy the files inside the "texinputs" folder inside "l2h" to the same folder as your document index.tex.
  4. If your latex is very old, the package might not work. Try to do without the package. Or upgrade latex to a more recent version. Rerun install_l2h after that.
  5. The missing file error is somewhat tricky when making web pages. While making web pages, latex might be looking for the file in the wrong folder. In general, make sure that you put your pictures in the same folder as index.tex. Not somewhere else. Or give latex a complete, (so-called absolute), path to the file. A "./", "../", or "subfolder/" path will not work.
  6. If stumped, try the general tricks.

! LaTeX Error: Float(s) lost.

Like it says; one or more figures, tables, etc., or marginpars have not been typeset. The actual error may be well before the point where the problem is recognized.

  1. You cannot put pictures or tables in minipages or parboxes. Or in footnotes, or anything like that.
  2. Putting something that has a floating location (figures, footnotes, ...) into something that also has a floating location causes this error. After all, where should LaTeX put, say, a footnote to a footnote? That does not make sense.
  3. Is a picture or table in the wrong place?
  4. If stumped, try the general tricks.

! LaTeX Error: Illegal character in array arg.

For "array" read "array" or "tabular" or "multicolumn" or whatever. The argument in which you define the format of the columns seems to be messed up. The normal letters are r, l, and c. Howver, there is also @{} and p{}.

  1. Read up on arrays, tables (tabular), or whatever on http://en.wikibooks.org/wiki/LaTeX/. Then check for typos in the array/, tabular/, multicolumn/, whatever, environment parameters.
  2. If stumped, try the general tricks.

! LaTeX Error: Lonely \item--perhaps a missing list environment.

An item command was found. Latex cannot figure out what list it belongs to.

  1. Like it says? Cut and pasted something inside a list to outside it?
  2. Check the \begin{...} statement of the list for typos.
  3. If stumped, try the general tricks.

! LaTeX Error: Missing \begin{document}

When this happens to me, I have put something printable before the \begin{document} line. Usually I misspelled some nonprintable command, turning it into printable text. But you could actually forget the \begin{document} line itself, I guess.

  1. Do not put any printable text before \begin{document}. Just packages, definitions, and such.
  2. Check everything before \begin{document} for typos or other errors.
  3. Apparently, misuse of \marginsize can also cause this error.
  4. If stumped, try the general tricks.

! LaTeX Error: Missing p-arg in array arg

For "array" read "array" or "tabular" or "multicolumn" or whatever.

  1. While defining columns, there is a p not followed by {width} argument.
  2. Read up on arrays, tables (tabular), or whatever on http://en.wikibooks.org/wiki/LaTeX/. Then check for typos in the array, tabular, multicolumn, whatever, environment parameters.
  3. If stumped, try the general tricks.

! LaTeX Error: Missing @-exp in array arg

For "array" read "array" or "tabular" or "multicolumn" or whatever.

  1. Read up on arrays, tables (tabular), or whatever on http://en.wikibooks.org/wiki/LaTeX/. Then check for typos in the array/, tabular/, multicolumn/, whatever, environment parameters.
  2. If stumped, try the general tricks.

! LaTeX Error: No such counter

A counter is undefined

  1. Do not use \newcounter after \begin{document}.
  2. If you use a special style file, (like one provided by your target journal), some standard counter may have been disabled by the journal style.
  3. If stumped, try the general tricks.

! LaTeX Error: Not in outer par mode.

You put something, (figure, table, marginpar, ...), in the wrong place. They cannot be inside secondary environments.

  1. A figure or table inside a parbox or minipage will not work.
  2. If stumped, try the general tricks.

! LaTeX Error: Option clash for package ...

Your guess is better than mine.

  1. Options to a package conflict with each other.
  2. If stumped, try the general tricks.

! LaTeX Error: \pushtabs and \poptabs don't match.

I think I have used the tabbing environment once, but I cannot remember when. Otherwise I use the tabular environment inside tables.

  1. Check that every \pushtabs is closed by a corresponding \poptabs. You cannot close one \pushtabs by two \poptabs.
  2. If stumped, try the general tricks.

! LaTeX Error: \RequirePackage or \LoadClass in Options Section.

Should not be there.

  1. Ahem! RequirePackage may not be used with \DeclareOption
  2. If stumped, try the general tricks.

! LaTeX Error: Something's wrong--perhaps a missing \item

One thing that is obviously wrong is the supply of meaningful error messages.

  1. Like it says? Did you leave out the starting \item in an enumerate or other list environment?
  2. Apparently, leaving the arguments away in a thebibliography environment can also trigger the above nugget of wisdom.
  3. If stumped, try the general tricks.

! LaTeX Error: Suggested extra height (...) dangerously large.

Gee. You only live once. So live dangerously.

  1. Too big a number in \enlargethispage.
  2. If stumped, try the general tricks.

! LaTeX Error: Tab overflow.

There are only so many tab stops possible. Don't ask how many.

  1. Too many \= in a tabbing environment?
  2. If stumped, try the general tricks.

! LaTeX Error: There's no line here to end

Rather than trying to create more blank space using \\ \\, use \\[25pt]. Been there, done that. If there is no previous \\, use \vspace{12pt}.

  1. If you really need the \\ try putting in a \strut before it.
  2. If stumped, try the general tricks.

! LaTeX Error: This may be a LaTeX bug

Two balloonists got hopelessly lost over California. They lowered their balloon enough that they got within shouting distance of a tall building. That was the headquarters of the Digital Equipment Company. They shouted: "Hello! Hello! Where are we?" A mathematician on one of the top floors answered; "You are in a balloon," he shouted back. That mathematician was Dr. Leslie Lamport, the author of LaTeX.

  1. Yes, this may be a LaTeX bug. Or a lady bug. But it is probably a consequence of an earlier error in your index.tex file.
  2. If stumped, try the general tricks.

! LaTeX Error: This NFSS system isn't set up properly.

Well, set it up properly! Do I have to do everything here myself?

  1. Invalid font used in \DeclareErrorFont.
  2. If stumped, try the general tricks.

! LaTeX Error: Too deeply nested.

You cannot just keep putting list inside list inside list ...

  1. The maximum depth is 4.
  2. If stumped, try the general tricks.

! LaTeX Error: Too many columns in eqnarray environment.
  1. You can only have three (i.e. no more than two &).
  2. Forgot a \\?
  3. If stumped, try the general tricks.

! LaTeX Error: Too many unprocessed floats

LaTeX has been hoarding your figures and tables for a rainy day. However, there is no more room in its small apartment.

  1. The first table or figure that is being hoarded may be a bottle neck. Change it placement options to [htbp] to make it easier to place. Reduce its size. Or use the H placement option of the float package to put it down whether latex likes it or not.
  2. A well placed \clearpage may be an option.
  3. Did you really use that many \marginpar commands? Shame on you!
  4. If stumped, try the general tricks.

! LaTeX Error: Two \LoadClass commands.

That is definitely too much.

  1. If stumped, try the general tricks.

! LaTeX Error: Two \documentclass or \documentstyle commands.

Too much. Too much. Try make do with only one. At the start of index.tex, preferably.

  1. Kill off the second.
  2. If stumped, try the general tricks.

! LaTeX Error: Undefined tab position.

Latex is asked to tab to a column that is not defined.

  1. Did you miscounted the number of tabs, or forgot to start a new line?
  2. If stumped, try the general tricks.

! LaTeX Error: Unknown option ... for package ...

Check for typos and the package documentation.

  1. What options are available may depend on context.
  2. If stumped, try the general tricks.

! LaTeX Error: \usepackage before \documentclass.

\documentclass must come before anything else nontrivial.

  1. Check for typos in the \documentclass command.
  2. Put the \documentclass before anything else besides comments and blank space.
  3. If stumped, try the general tricks.

! LaTeX Error: \verb ended by end of line
  1. A \verb must be of the form \verb!...! where ! can be almost any character not inside ... However, there may be no line breaks inside ...
  2. Make sure that the start character, ! or whatever, is indeed the same as the end character.
  3. If stumped, try the general tricks.

! LaTeX Error: \< in mid line

\< (reduce tab start) should be at the start of a tabbed line.

  1. To get an actual < in the middle of the text, go into math mode. Like $<$.
  2. If stumped, try the general tricks.

! LaTeX Error: ... undefined

Something that you treat as defined (say the command in a \renewcommand) is not defined.

  1. Check for typos in the command, both here and where it was supposedly defined.
  2. Is the definition inside a comment block?
  3. If stumped, try the general tricks.

! Leaders not followed by proper glue

If you use leaders, you probably can figure this out.

  1. If stumped, try the general tricks.

! Limit controls must follow a math operator
  1. If stumped, try the general tricks.

! Math formula deleted: Insufficient ... fonts
  1. If stumped, try the general tricks.

! Misplaced alignment tab character &.

By itself, an & can only be used in tables and the like to separate columns.

  1. If you want a printed &, use \&. Example: Proctor \& Gamble.
  2. A missing/misspelled \begin{tabular} or similar can cause this.
  3. If stumped, try the general tricks.

! Misplaced \omit

The \omit command overrides column formatting in tables and arrays and such.

  1. A \multicolumn statement has an implied \omit. Check its validity. In particular, whether it does not use more columns than there are defined.
  2. A \newcommand within a tabular environment can cause this, I hear.
  3. If stumped, try the general tricks.

! Missing # inserted in alignment preamble
  1. If stumped, try the general tricks.

! Missing $ inserted

Usually, this happens to me if for some arcane reason I try to use a character like _ in the text. That can only be used in math mode (unless preceded by \). So Tex puts a dollar sign in front of it. Needless to say, that misplaced dollar sign will produce further errors. After all, the subsequent text is believed to be math, and the math following the next dollar sign to be text. (So a perfectly valid _ or ^ in that math produces the same error once again.)

  1. Use \_ for an actual underscore and \^{} for a lone caret.
  2. Is something used in the text that can only be used in math mode? If so, enclose it between $ and $. Example: water is H$_2$O (superscripts and subscripts can only be used in math mode).
  3. Is a $ really missing from previous math?
  4. Math may not contain blank lines. If you leave a single blank line in an equation, it will generate the error message ! Missing $ inserted, followed by ! Display math should end with $$. followed by ! LaTeX Error: Bad math environment delimiter. Remove the blank line and all three error messages should disappear.
  5. Now latex2html has a nasty habit of leaving blank lines when it removes the labels from equations. These errors will then show up in its math images processing. In particular, they will show up in images.log. To fix this, put the \label{...} in equations at the end, followed by a %. Furthermore, leave some mathematics on the same line, before the \label{...}%.
  6. Remember that the inside of an \mbox or \hbox is not in math mode unless you enclose it between $ and $. Example: $\alpha\beta=0\mbox{ if $\beta$ is zero}$ needs the $ signs around the second \beta as shown.
  7. If stumped, try the general tricks.

! Missing $$ inserted

TeX has found that it should no longer be in display math mode. Note that in LaTeX you should be using \[ and \], or \begin{displaymath} and \end{displaymath}, not $$ and $$.

  1. Blank lines are not allowed in math mode.
  2. If stumped, try the general tricks.

! Missing = inserted for ...

TBA

  1. If stumped, try the general tricks.

! Missing { inserted

LaTeX decided it really needed a { and inserted one.

  1. This is likely due to some earlier error.
  2. And the insertion is likely to introduce subsequent errors.
  3. Incorrect integral bounds can cause this error.
  4. If stumped, try the general tricks.

! Missing } inserted

LaTeX decided it really needed a } and inserted one.

  1. This is likely due to some earlier error.
  2. And the insertion is likely to introduce subsequent errors.
  3. Check for still-open opening brackets.
  4. If stumped, try the general tricks.

! Missing control sequence inserted

A control sequence means a LaTeX command, like \backslash.

  1. It is \[re]newcommand{\name}... but \[re]newenvironment{name}... Note the backslash. In plain TeX, you have \def\name{...}.
  2. If stumped, try the general tricks.

! Missing delimiter inserted
  1. If stumped, try the general tricks.

! Missing \endcsname inserted

Typically, this occurs when you put a \ in front of an environment name.

  1. Check for the above problem. For example, \begin{\itemize} should be \begin{itemize}.
  2. If stumped, try the general tricks.

! Missing font identifier
  1. Check your
  2. If stumped, try the general tricks.

! Missing number, treated as zero

Missing "number" might actually be a length.

  1. Like it says? Check for presence and correctness of lengths and coordinates behind \parbox, \line, \circle, \put, ....
  2. Remember that 0 is not a valid length. You must say 0in (inch) or 0pt (point) or something like it.
  3. A [..] may have been mistaken for an optional argument. If so, try enclosing it in brackets like {[...]}. Like change \\[text] into \\{[text]}.
  4. A misplaced \protect (before something like a length or a number) can also produce this error.
  5. If stumped, try the general tricks.

! Missing `to' inserted

The "to" is not really used in LaTeX. It uses {} brackets for parameters.

  1. A mispelled command?
  2. If stumped, try the general tricks.

! Not a letter

Hyphenation words must consist of letters and hyphens.

  1. Using discretionary \- hyphens in the actual word is probably the best way to keep LaTeX from nagging you.
  2. If stumped, try the general tricks.

! Number too big

Probably an indication that LaTeX is lost due to some error.

  1. If stumped, try the general tricks.

! OK

OK.

  1. If stumped, try the general tricks.

! Only one # is allowed per tab
  1. If stumped, try the general tricks.

! Output loop---

This should be very nasty, but I have never seen it.

  1. If stumped, try the general tricks.

! Output routine didn't use all of ...

Well, get the unused portion back.

  1. If stumped, try the general tricks.

! Paragraph ended before ... was complete

Parameters of commands, unless defined specially, cannot contain blank lines.

  1. Check for a missing }.
  2. Check for blank lines inside parameters of commands.
  3. If stumped, try the general tricks.

! Parameters must be numbered consecutively

If you have this error, you probably know why.

  1. In latex, you do not normally use plain tex \def definitions. If possible use \[re]newcommand.
  2. If stumped, try the general tricks.

! Patterns can be loaded only by INITEX

I cannot imagine why any new user would want to load abstract hyphenation patterns.

  1. If stumped, try the general tricks.

! Please use ...
  1. Because you ask so nicely?
  2. If stumped, try the general tricks.

! Runaway argument

TeX has noted that an argument of a command does not seem properly closed by a }.

  1. Check that each { has a proper closing }. Watch for mistaking ) for }.
  2. You cannot use a verbatim-line environment (like verbatim, rawhtml, comment, ...) inside something else. They need to stand alone. (Although I have used rawhtml inside a command definition. Nothing is absolute.)

! \script...font ... is undefined (character ...)

In math mode, a special font is needed. It is not loaded

  1. Load it. Like \load{\footnotesize}{\sc} to load the sc (small caps) font in footnote size.
  2. If your installation has only limited fonts, you can probably do without.
  3. If stumped, try the general tricks.

! TeX capacity exceeded, sorry [...]

Nowadays, this is likely to be something wrong with your document.

  1. Line excessively long? Various MS Windows-type software insists to put an entire paragraph of output on a single line in the input file. That can exceed the TeX input line buffer. In TeX, you should break up these long lines. To get a paragraph break, in TeX you use a blank line. Not just a line break.
  2. A missing } makes a parameter size explode?
  3. A circular definition? (Something defined in terms of itself?)
  4. Apparently, using some commands inside a fragile command can cause this. Try temporarily removing the contents.
  5. If stumped, try the general tricks.

! \textfont ... is undefined (character ...)

In math mode, a special font is needed. It is not loaded

  1. Load it. Like \load{\textsize}{\sc}.
  2. If stumped, try the general tricks.

! Text line contains an invalid character
  1. Like it says? Check for weird characters in index.tex. Use a different editor if needed.
  2. If stumped, try the general tricks.

! This can't happen (
  1. If stumped, try the general tricks.

! Too late for ...
  1. If stumped, try the general tricks.

! Too many }'s

Sometimes they are hard to count. Or you may have missed a {.

  1. Missing a \begin{...} statement can cause this.
  2. If stumped, try the general tricks.

! Unbalanced output routine
  1. If stumped, try the general tricks.

! Unbalanced write command
  1. If stumped, try the general tricks.

! Undefined control sequence

A command you are using is not defined by you, or the system.

  1. Did you misspell the command?
  2. Is whatever is supposed to define the command missing or misspelled? (Like the \documentclass command, the \usepackage{...}, the \input{...}, or whatever?)
  3. Is the command used out of context? (Like an \item not in a list?)
  4. Interestingly, a footnote inside a footnote can apparently cause this error.
  5. If stumped, try the general tricks.

! Use of ... does not match its definition

You are using a valid command in the wrong way. In particular, the stuff immediately following the command is not in the right format. (A "command" might really be an environment.)

  1. Did you misspell the command?
  2. Check the proper command format in a LaTeX manual.
  3. Are you using the command itself right, but is something in its parameters not right? Like \put(10,10){\line...} where the \line... is invalid?
  4. Try using {} brackets around command parameters.
  5. If stumped, try the general tricks.

! You already have nine parameters

TeX macro definitions have a maximum of 9 arguments. (Being #1 to #9.) But you are unlikely to hit that limit as a new LaTeX user.

  1. Watch for potential problems with a # character.
  2. If stumped, try the general tricks.

! You can't dump inside a group
  1. Use the toilet already!
  2. If stumped, try the general tricks.

! You can't use `macro parameter character #' in ... mode

A # character is where it should not be.

  1. An actual # must be written as \#.
  2. If stumped, try the general tricks.

! You can't use a prefix with `...'
  1. Who says I can't? I just did, didn't I?
  2. If stumped, try the general tricks.

References:
  • Leslie Lamport's "LaTex User's guide & Reference Manual". Addison-Wesley 1986.
  • http://www.cs.utexas.edu/~witchel/errorclasses.html
  • Personal experiences.