Gedit LaTeX Plugin
This plugin turns the editor gedit into a productive environment for editing LaTeX documents and managing BibTeX bibliographies.
Gedit is a lightweight text editor coming with the GNOME desktop environment. It provides a feasible plugin API in the Python programming language.
I’m a big fan of the LaTeX type setting system and as it’s quite complex I appreciate an editor supporting me. There already exist some LaTeX editors but I don’t want to have one editor for each purpose and there are some features that I really missed like syntax checking and validation. So I started to write this plugin with the intension to have a LaTeX editing environment that integrates well with the Gnome desktop.
This plugin assumes that you have a basic understanding of what LaTeX is. See here for a nice introduction.
Code Completion
Propably the most valuable feature is the code completion for LaTeX and BibTeX source. If you type a prefix like \beg it shows you all matching commands and the structure and meaning of their arguments, like e.g. \begin{Environment}. If possible it shows options for the argument the cursor is in. So if you type \begin{ you get a list of all environments you could begin.
Some commands or options may require additional packages to be included. This is indicated and the according \usepackage statement is inserted if you select that command or option.
Some proposals are dynamic. That means that e.g. all .tex files in the working directory are proposed as arguments of the \include command.
Syntax Checking and Validation
The plugin is able to check the language syntax of LaTeX and BibTeX files while you’re editing them. Furthermore, LaTeX documents are validated checking if
- environments are closed correctly
- referenced labels have been defined
- referenced files (images, fragments, bibliographies) are present
The BibTeX validator* checks for
- duplicate entry keys
- duplicate field definitions
- probably missing fields
- probably unused fields
Outlines
LaTeX or BibTeX files often become very large, so the plugin creates an outline view for both of them. It can be used to quickly navigate through the file. You may also decide which elements are shown in the outline (graphics, tables etc.).
Assistents
There are several assistents for frequent tasks like
- creating the body of a new LaTeX file
- inserting a graphics
- inserting a table or a matrix
- using a bibliography
- building an image from the LaTeX document
BibTeX Integration
The plugin creates an outline view for BibTeX files which can be grouped by types, authors and years. Furthermore, new entries may be created using an assistant.
When editing a LaTeX document that includes a BibTeX file per \bibliography, the entries are proposed by the code completion when typing a \cite command.
There is also a rudimentary completion for BibTeX. If you type an @ and press Ctrl + Space you get a list of entry types you could insert. If you choose one, a template with the mandatory fields for this type is inserted.
Template Editing Concept
The template editing concept enables you to jump between placeholders and makes editing faster. It is used in the LaTeX code completion and for the user-defined snippets.
The templates support multi-placeholders. That means if there are multiple placeholders with the same name and you fill one of them, the text is copied to its duplicates. You can see this at the environment LaTeX snippet.*
User-Defined Snippets
You may define snippets like
\begin{equation}
$_
\label{ ${Label} }
\end{equation}
where ${Label} represents a placeholder and $_ marks the desired position of the cursor after the template has been left.
If you now call this snippet equation you may access it by typing e.g. eq and pressing Ctrl + Space.
Tools
The build system consists of tools like “LaTeX → PDF” or “LaTeX → DVI”. Each tool consists of one or more jobs that are run when the document is to be built. The log of a job is interpreted by a post-processor and converted to useful messages. Per default the plugin uses Emmanuel Beffara’s rubber for automated document compiling. But you may create your own tools invoking the LaTeX command chain directly.
Requirements
To run the plugin you need
- Python 2.5 or newer
- gedit 2.15.2 or newer
- PyGTK 2.12 or newer
- Python GnomeVFS bindings
- Python Enchant bindings (optional, needed for spell checking)
Development
The project is hosted on SourceForge. You may post bug reports, feature requests and patches there.
The most recent code of the plugin is available on SourceForge SVN.
Visit the wiki pages at gnome.org
*) you may have to grab the latest SVN version for this feature


