LATEX is a little plugin to improve LATEX support in Geany. It implements a couple of hopefully useful functions:
Please note: This section of documentation is only valid with standalone distribution of LATEX. If you are planning to use the common geany-plugins project, please check documentation over there as there are some specialties you might like to know.
For compiling the plugin yourself, you will need the GTK (>= 2.8.0) libraries and header files. You will also need its dependency libraries and header files, such as Pango, Glib and ATK. All these files are available at http://www.gtk.org.
And obviously, you will need to have Geany with its header files installed (in case you are compiling the plugin on your own). If you installed Geany from the sources, you should be ready to go. If you used a prepared package, e.g. from your distribution, you probably need to install an additional package, probably called geany-dev or geany-devel. Please note that in order to compile and use this plugin, you need Geany 0.21 or later (Geany Plugin API v199 or higher).
Furthermore you need, of course, a C compiler and python installed. The GNU version of the C compiler is recommended. Furthermore, there should be a working LATEX-environment on your System.
There is no special need in RAM or CPU, so the plugin should compile and run on all systems Geany is able to run.
For documentation how to compile the plugin, please check the documentation of the geany-plugins combined release.
Sources of this documentation are available throught doc/latex.tex inside source tree. To compile the sources, usage of pdflatex (should be delivered with your favorite LATEX distribution) is recommended. For compiling into HTML format you might like to use htlatex. The HTML version of this documentation shipped with source tarball has been compiled with:
htlatex most likely can be found in a package called tex4ht – At least it’s called like that on Debian based operating systems.
After LATEX has been installed successful the plugin can be loaded through Geany’s plugin manager. Depending on configuration a new menu inside Geany’s main menu will appear, an menu entry for the LATEX-wizard will appear inside the Tools menu as well as new key bindings will be available inside Geany’s key binding interface. Inside the new menu you will find entries for functions supported by this version of the plugin. The main menu entry will be called something like LaTeX, depending on your locale.
Also if the option for showing the toolbar is activated on configuration dialog, the toolbar with common used format functions appears on at top of editor widget. This feature is turned off by default.
Let’s go into more detail on some features.
The LATEX-Wizard is implementing a easy way creating a number of default documents.
The wizard is offering a chance to choose from a couple of templates with the possibility of adding customer templates. This can be chosen from Templates pulldown on top of dialog.
This can be set by choosing the needed entry form Documentclass pulldown menu.
Encoding is configuring the packages inputenc to for example \usepackage[utf8]{inputenc} in case of the document encoding should be UTF-8. Also it sets the encoding Geany is using for the newly created document.
Font size as well as Paper size will set class option for font/paper size of the new created document. Author, Date, Title will be also passed to the corresponding command inside the file header.
Option Use draft mode will add draft to list of document options which allows some help during debugging of document.
Since KOMA script is quiet popular the option Use KOMA script if possible allows to activate the usage of KOMA script. If this options is activated instead of book, scrbook will be used as document class. Default is activated here. This option is deactivated by default and can be set through LATEX’s configuration dialog mentioned earlier in this document.
This wizard can also be called by a shortcut. Please have a look onto Section 2, page 40.
Document types that are currently supported by the wizard are:
LATEX is offering a way for extending the wizard by user defined templates. This templates will be stored inside the plugin configuration dir with file extension glt. For creating a customized template you will need to create a normal *.tex file and store it inside the directory. On most Linux systems this should be ~/.config/geany/LaTeX/.
Inside your template you can refer to wizard’s field by using some special strings which are:
| Symbol | Usage |
| {CLASSOPTION} | Will be replaced by the classoptions set on the wizard as for example font size or paper size. |
| {DOCUMENTCLASS} | Will be replaced by the choosen document class based on the pulldown of wizard and whether option for KOMA script has been set. |
| {DATE} | Will be replaced by the input given on the date field of wizard. |
| {TITLE} | Will be replaced by the input given on the title field of wizard. |
| {AUTHOR} | Will be replaced by the input given on the author field of wizard. |
| {ENCODING} | Will be replace by choosen encoding from pulldown of wizard |
| {OPENING} | Will be replaced by ≫Dear Sir or Madame≪ in local LATEX is running with. If you like to overwrite it, please don’t use the symbol and hardcode the phrase instead. |
| {CLOSING} | Will be replaced by ≫With kind regards≪ in local LATEX is running with. If you like to overwrite it, please don’t use the symbol and hardcode the phrase instead. |
If you have other than the default templates defined they will be add to templates pulldown. So when creating a template, please keep care to set up a good name for the file, as the filename will be the identifier you can choose from on pulldown.
In future a number of templates should be available also online at http://frank.uvena.de/files/geany/data/geanyLaTeX/. Please feel also free to publish templates in case of you have some useful one.
If you need more general templates, you may have a look onto Geany’s build in template feature – briefly introduced on Chapter 11.2, page 49.
An often used feature on writing of documents is adding and referring to labels. LATEX is adding some support here for more comfortable adding new labels and reference offering a GUI.
After an label was added LATEX is offering a dialog for inserting normal references and page references to a label.
The suggestions inside the pull down are based on the aux files creating by processing of *.tex file located inside directory of current TEX-file. When first step was successful the files are parsed for \newlabel{}{}{} and outcome is tried to interpret them properly. The found entries will be inserted into pull down sorted by alphabet.
Both, the inserting labels as well as the inserting reference dialog can be accessed by key binding also. See Chapter 2 here.
LATEX is offering a number of often used templates for BibTeX catalogue entries. They can be access by the plugin submenu in Geany’s tools menu:
When choosing an entry from list on menu a templace with common used fields will be generated and inserted into the document. The template will be inserted on position of cursor which will no be moved during the process. As an example for a book, this will be inserted to the document:
LATEX is searching here for *.bib-files inside the directory of current active file. Its filtering for all references inside these files and putting it sorted and cleared from duplicated entries into the pulldown of the dialog.
With selecting one of the entries inside the pull down or by typing in your own reference name, pushing enter or hitting OK will insert a \cite{} into your document with your given reference.
LATEX is able to replace special characters to their there TEX substitute. This can be done in two different ways:
For both functions there are also shortcuts available.
The plugin is offering a number of special characters with their TEX substitutes to be inserted on easy accessing through the plugin menu.
LATEX is offering a feature for inserting environments into your documents. It can be chosen from a pulldown menu and will be inserted at current position of cursor. If there is a selection activ, the selection will be included into environment.
In case of an empty (= no selection) an empty environment with
will be inserted to the document.
LATEX is able to help on formation of text. For doing this its offering you to insert often use format patterns to your document. Patterns that are currently supported are:
LATEX will add the correct format pattern to the document. If there is an selection active, that pattern will be placed around so the selected text will be formatted with this chosen style.
Following items are also accessible using the LATEX toolbar:
Since version 0.5 LaTeX is supporting autocompletion for closing \end and \endgroup for begin commands. Before Geany 0.19 this has been part of the Geany core but has been moved out as it is something LATEX specific.
After the feature has been enabled (Please check 7.1.5, page 38 here for more detailed information), in every case you enter a \begin{} or \begingroup{} the plugin will automatically add the fitting \end{} or \endgroup{} if its not finding a closing tag within the definded context length – by default this means inside following 5 lines. If you like to change this size, please check Chapter 7.3.4, page 43.
This feature is by default file type depending, so it will only work on TEX-like file types as well its turned on by default.
From time you need to insert a new package into header of a document, but don’t want to change to top of document and scroll back to where you were.
Since version 0.5 LATEX is offering an easy to use dialog which is taking over the package name and possible package options to insert them into header of document. Right now, its placed direct in top of the \begin{document} statement if there is any.
With this feature, converting a normal text to LATEX is getting a bit easier. If you start a document as plain text, with abbreviations in it like ABC. You import it into LATEX, and want the abbreviations in small caps. LATEX converts the selection to just use lower case letters. So ABC is becoming \textsc{abc} and later abc. This can be configured via the plugin configuration dialog and default value is turned off.
LaTeX can be configured in three major ways:
With version 0.4 the configuration dialog is offering two options which can be changed:
KOMA script bei Markus Kohm is a very popular set of document classes mainly used in Europe. With this option the default setting for e.g. LATEX-Wizard can be configured1 . Option is turned off by default.
Decides whether toolbar with some format icons should appear in the top of editor widget. Option is turned off by default. Just give it a try.
If this option is enabled, LATEX will look for ., ! or ? followed by a space. The next letter will be inserted in capital letters. Currenty this is not working for multichar letters as German Umlauts as well as the overwriting is not supported very well at this point. In case of you don’t want to have the capital version of a letter in a particular case, just hit undo (Ctrl + z in most cases).
This adds an icon for LATEX wizard to Geany’s main toolbar so its easy to access via mouse even the toolbar of LATEX is not active and the tools menu is a way to far away.
Here you can choose, whether the LATEX should do some autocompletion or not. Values are either
Keybindings which are available:
| Shortcut | Description |
| Run LaTeX-Wizard | Starts the LaTeX-Wizard for creating a new document |
| Insert \label | Runs the dialog for inserting a new label into your document. |
| Insert \ref | Starts an dialog for easy inserting \ref and\pageref into your document. The dialog is supporting easy parsing of aux files so it can suggest a couple of already set labels. |
| Insert linebreak \\ | Inserts a a newline \\ into the document. |
| Turn input replacement on/off | A shortcut for turning input replacement on or off. When input replacement is activated special characters like ě are replaced by there TEX substitute like \v{e} |
| Replacement of special characters | A selected text will be parsed and all known special characters will be replaced by their TEX substitute. This can be very useful on importing a large amount of text into your document including characters like รถ or ≫. |
| Run insert environment dialog | Runs a dialog for easy inserting an environment. If there is some text selected, the environment will be placed around. |
| Insert \item | This shortcut will add an simple \item to the document. This can be very useful during writing of lists with a huge number of items. |
| Format selection in bold font face | Format a selection with bold font face. This is done be adding \textbf{...} around selection. |
| Format selection in italic font face | Format a selection with italic font face. This is done be adding \textit{...} around selection. |
| Format selection in typewriter font face | Format a selection with typewriter font face. This is done be adding \texttt{...} around selection. |
| Format selection centered | Formats selected text centered on page (uses \centering |
| Format selection left-aligned | Formats selected text left-aligned on page (uses \raggedleft |
| Format selection right-alignedm | Formats selected text right-aligned on page (uses \raggedright |
| Insert description list | Inserts an description environment as well as a 1st \item element. |
| Insert itemize list | Inserts an itemize environment as well as a 1st \item element. |
| Insert enumerate list | Inserts an enumerate environment as well as a 1st \item element. |
| Insert BibTeX reference dialog | Opens up a dialog which is supporting insertion of BibTeX-references based on bib-files inside current directory. |
Toggle autocompletion for _ and | Controlls whether braces should be inserted after _
and |
As not all users need to configure everything on there plugin, LATEX has some hidden preferences which can be set through command line.
By default, LATEX is deactivating buttons inside toolbar, which don’t make much sense to be applied on non-TEX file types. As this is not always wished, its possible to turn this feature off via a hidden preferences.
If you want to do so, just add a new section called toolbar into your general.conf file of LATEX plugin which stats glatex_deactivate_toolbaritems_with_non_latex=false. As a result, your config file could look similar to this:
Setting this option back to true will go back to default behaviour.
Please ensure, you reload the plugin once this option has been changed.
LATEX is enabling a separate menu inside Geany’s main menu. On default, its getting activated and deactivated based on the file type of the current document. However, from time to time its annying to have the menu entry switched maybe each time on switching between two documents it can be set to keep even there is no LaTeX document activ.
This option might make sense in combination with deactivation of toolbar items on changing to a non-TEX document at 7.3.1, page 41 set to false.
In case of you want to see always the LATEX-menu independent of you have a LATEX document open. To add the menu direct at startup time you might set glatex_add_menu_on_startup inside menu section of configuration file to true.
This options makes only sense in combination with glatex_deactivate_menubarentry_with_non_latex as described in chapter 7.3.2, page 42.
Inside configuration file you can add a value to adjust the size of context, which is being searched for autocompletion of \end and \endgroup. The default value is 5. If you want to reset it, just add a new line to your configuration file with glatex_set_autocompletion_contextsize followed by an integer value. An example could look like this:
With this option, you can force LATEX to apply all autocompletion functions also to non-TEX file types as for example an C-source code file. As this is only in a very low number of cases a really good idea, the option is by default turned on.
LATEX is able to insert references to a label where its using some default value. As this value is not always optimal, it can be changed using a hidden preference by setting glatex_reference_page, glatex_reference_chapter or glatex_reference_all inside configuration file as shown inside the example configuration snippet.
Please take care in this case {{reference}} will be replace by label name.
Also \t, \r, \n will be handled as known from C so you will need to add a second \ in front of in such cases. Even this seems to be annyoing on the first hand, it allows you to insert some more complicated constructs over here which might require a new line inside.
LATEX is able to autocomplete {} after typing _ and ˆ. This might by useful on typing mathematic text and formula. However, as this option is turn on by default and it might get annoying you can deactivate it by setting glatex_set_autobraces inside [autocompletion] section of configuration file. An example which is turning off the feature might can look like this:
Note: The feature in general is only working, if glatex_set_autocompletion=true is also set to true.
The plugin can autoadd a pair of braces {} on hitting return after typing a command. The function will search for a \ and will stop once it founds a space, some {} or a second \ as on \\. This can be configured also by using the hidden preference glatex_set_autobraces described in chapter 7.3.7, page 44.
If you like the plugin, there are a number of ways, how to contribute to the development of the plugin.
Currently the plugin is available in English and German language but we are always looking for other translations to. There are two major topics in translation:
New features are always highly welcome. The TODO file inside source code archive gives a good idea of current wished features and which are being worked on. Also you can have a look onto the feature request tracker of geany-plugins project at