Creando documentos LaTeX con Kyle
TeX y LaTeX son herramientas de software que producen impecables documentos, y son las única forma práctica de mostrar algunas ecuaciones matemáticas. Una interfaz gráfica (GUI) actúa como un “ambiente integrado de desarrollo” sobre el software de línea de comandos.
El manejo de estilos es parte de la razón de ser de Tex y LaTeX para que los documentos luzcan impecalbes. Ahora existen aplicaciones que corren bajo Linux y BSD que brindan control sobre los compiladores y los utilitarios relacionados a travez de una interfaz gráfica fácil de entender. Los autores y los editores que usen Kile pueden ver incrementada su productividad para la creación de documentación. Este artículo presenta algunas de las funcionalidades más interesantes de Kile que serán bienvenidas por los recién llegados a LaTeX.
Empezando por el principio
Escribir en LaTeX lleva al usuario a por un camino de varias etapas hasta el documento final. Primero, el usuario prepara uno o más archivos LaTeX usando un editor de texto, revisa la sintaxis y los comandos y palabras reservadas del LaTeX. El siguiente paso es compilar el documento LaTeX que se ha preparado, revisar los posibles mensajes de error y tomar las necesarias acciones para su corrección, y después compilar el documento nuevamente. Cuando no hayan más mensajes, se revisa el documento visualmente y, si es necesario se ajusta el archivo original de nuevo. Por ejemplo, se edita el archivo para cambiar la configuración de una imagen o el formato de una tabla, y se compila el LaTeX una vez más.
Luego de hacer y re-hacer varias veces este camino, finalmente se llega a lo que se desea, el documento puede ser impreso o guardado en formatos electrónicos como el “formato independiente” (DVI), Postscript, PDF o HTML. Estas trasnformaciones a distintos formatos se hace mediante programas incluidos como dvi2ps, dvi2pdf y latex2html.
LaTeX es un sistema para preparar documentación basado en el lenguaje TeX. TeX, LaTeX y las herramientas relacionadas están integradas dentro de un paquete llamado teTeX, mantenido por Thomas Esser. Pero a pesar de que las herramientas son fáciles de instalar y están disponibles para la mayoría de las distribuciones de Linux, el proceso puede ser desmotivador para los nuevos usuarios de LaTeX. Por suerte, los documentos que resultan al final, bien vale el esfuerzo.
Yet, the exceptional typographical quality of the created documents is well worth the effort. But that is not to say that the TeX and LaTeX community should be deprived of the benefits offered by the graphical working environments. Under Linux and BSD, a quest for increased productivity in typesetting with LaTeX has led to several popular programs that integrate the features of the compilers with numerous stand-alone utilities from the teTeX distribution.
Competition among LaTeX front ends, a Software Darwinism theory, could explain why Kile (KDE Integrated LaTeX Editor, latest stable version 1.9.3) is a number one choice for many existing users. It is fair to say that the term “LaTeX editor” does not do all the justice to Kile in view of its distinctive set of features. Instead, we could refer to it as a complex, yet easy to use, working environment that, among other things, centralizes access to LaTeX and related tools, including Postscript and PDF translators.
Kile is published under GPL, and source code can be downloaded from the Kile home page. Debian GNU/Linux users can, of course, most readily fetch Kile with:
sudo apt-get install kile
Kile is also packages for Ubuntu and for RPM-based distributions including OpenSUSE, Mandriva, and Fedora. Check your distribution's package manager, or search rpmfind.net.
Interface Impressions
With the complete suite of teTeX applications already installed, KILE takes the user for a ride in the fastest lane immediately after the first run. With the exhibited level of integration, it is easy to forget that it is an external front-end to teTeX and not a native part. Of course, the largest portion of Kile's work space is occupied by the text editor where the input files are displayed. Below the text editor is the area reserved for the stream of information provided by various external applications, and there is also a shell console for the quick communication with the operating system.
Figure 1: The main Kile edit window includes a pane for managing files within a project, a text editing area and a display for messages from external programs.
Vertically aligned next to the text editing area are the icons that change contents of the multi-functional panel farther on the left side of the main Kile window. With the basic view on, the panel lists all open files constituting a current LaTeX project. When writing lengthy publications it is always better to split the text into several smaller chapter/section files which are easier to manipulate. At the same time, the text encoding of choice can be selected for the cases when the writing and displaying of texts in non-English languages is on the agenda.
Apart from the last one, all other views for this panel are related to the hundreds of supported mathematical symbols for which Kile will insert the right LaTeX reserved word into the editor. TeX and LaTeX are all about math, and a whole branch of the Kile's menu supports the mathematical environments and symbols defined by the American Mathematical Society (AMS). This should provide all the coverage that the majority of users may ever need when typesetting technical texts. In rare circumstances when that may not be the case, one can always consult Scott Pakin's work “The Comprehensive LaTeX Symbol List” with references to the corresponding LaTeX packages containing more than three thousand symbols.
Figure 2: Kile offers easy access to the American Mathematical Society's mathematical symbols.
The last icon with MP (Metapost) label presents another gem: a complete list of Metapost commands. According to the its creator John Hobby, Metapost is a language for creating technical figures based on professor Knuth's earlier Metafont. Metapost, as the name suggests, produces the output in Postscript and facilitates access to specialized features including the integration of graphics and text. Speaking of Postscript, a higher-level approach to its integration with LaTeX is undertaken with the most interesting package called PSTricks. PSTricks allows you to include code snippets for Postscript drawings directly into a document.
In the meantime we continue the tour of the Kile's user interface. The mission critical toolbar controls are there to invoke programs, external to Kile, that will perform a certain action on the active LaTeX document. With almost everything in the interface being configurable, the controls can be easily customized through a set of options accessed from the main menu “Settings/Configure Shortcuts/Toolbars/Kile”.
Behind the dialog “Configure Kile” is the true connection with the underlying compilers and the DVI drivers/translators/previewers. The user can choose the default compiler (pdftex, pdflatex) or the DVI tool for a particular task and they will become available through the designated icon on the Kile toolbar. Apart from the toolbar, all mandatory tasks like the compilation of the current document, translation from DVI into Postscript or PDF and the preview of created documents are represented individually in the menu “Build”. The “QuickBuild” includes the entire process from compilation to the document preview stage, releasing the user from obligation of running each one separately. “Selection Build” is an option that is especially useful when a lot of editing is done over a large document. In order to save the compilation time over the entire project, it will only compile and display the selected part of the input file where the last changes were made.
Click to see: Figure 3: Behind the scenes, Kile lets you set the options that you pass to external format conversion, spell checking, and other tools.
Yet another conversion utility available through Kile is latex2html, which will generate interlinked HTML pages from the LaTeX project, ready for publication on line. Latex2html is installed separately and, although it is not part of the teTeX distribution, it is indispensable when the technical writings need to be presented quickly on the Web, as the HTML version of the LaTeX document is obtained effortlessly in the same way as Postscript or PDF files. The most important feature is the conversion of mathematical formulas into static image files for inclusion with the web page sources. A trade off in typesetting is inevitable at this point but even the most complex formulas will be displayed with satisfactory enough quality.
When checking the accuracy of the user's input, Kile can also help with tracing LaTeX command syntax errors and can point to the documents segments where the so-called bad boxes are detected in the LaTeX input files. Bad boxes are areas where the compiler thinks that the text has not be typeset to its high standards. Whenever these messages occur, Kile jumps to the incriminated lines with the forward/backward navigation toolbar buttons.
You can check that all the necessary external tools are installed, using the menu item “Settings/System Check”. Its purpose is to test-run the TeX/LaTeX compilers, the DVI translators and graphical previewers. Once the test is completed, you'll see a full trouble-shooting report about the current configuration.
As stated earlier, the menu “Settings/Configure Kile” leads to the main configuration window. A set of items found on the “Build” tab reveals the actual shell command and the name of the console application executed when some action is performed within Kile. Where possible (and practical), the predefined programs can be substituted with other applications. For example, the preview of DVI, Postscript and PDF files is done by default with the external programs KDVI, KGhostview or KPDF (for this purpose, Kile temporarily switches from the basic “text editing” into “preview” mode; for return, the “Editor View” button becomes available).
But, for those preferring non-KDE previewers (or in the situation when they are not available with the KDE bundle) programs such as Xdvi, Xpdf, gv or Adobe Acrobat Reader can be used instead. Depending on the type of these applications, the “Advanced” tab can offer a clue about the extra settings which need to be adjusted when you change the default programs.
Click to see: Figure 4: Preview mode shows pages as they will be printed.
Kile as a Text Editor
If it has not been developed with TeX and LaTeX in mind, the KILE editor would be ranked among the best general purpose text editors available today on Unix/BSD and Linux platforms. Kile's editing functionality beats lightweight editors such as Kate or Gedit. The official syntax of the TeX and LaTeX compilers will be traditionally shown in color over the regular text contents but not only typesetting language is supported. A visit to the menu “Tools/Highlights” will bring forth a list of more than 100 supported programming and symbolic languages, including C, Perl, Python, Matlab, Octave, and R. Source code highlighting will come to rescue when preparing publications containing lengthy source code listings.
Every entry in the menus “Edit” and “View”, no matter how ordinary the task it performs, is well thought out and implemented and many of these will appeal to programmers. For generic text editing settings, the dialog behind “Settings/Configure Editor” will offer plenty of options designed to provide comfort during the work.
However, it is Kile's numerous editing features specifically for LaTeX typesetting that had attracted its large army of fans in the first place. These include help for quick navigation around the current LaTeX document, indexing, cross-referencing, adding graphics and working with bibliography entries. To spoil the users (and save them from laborious typing) every time when the beginning of a new command is recognized in the input file, Kile's editor will bring a list of all matching LaTeX commands for auto-completion. Needless to say, the entire list of all standard reserved keywords can be accessed from the menu branches “LaTeX”. And the menu “Wizard” will offer a time-efficient way of including the environmental block commands which define tables, mathematical equations or graphics which abound in complex technical publication.
For any new publication, Kile can kick-off the works with a comprehensive document setup dialog accessed from the menu “Wizard/Quickstart”. Here, the document class (article, book, report) and basic properties (encoding, font size, default aligning for formulas, number of text columns etc.) are established, and you can choose additional packages that will be used for creating the publication. The list of supported LaTeX packages is not exhaustive in this dialog, but it will nevertheless quickly form the basic structure of the document and allow you to focus directly on creative writing. The structure of the document can be modified later at any stage to suit the final project by manually adding any other LaTeX package available from the Comprehensive TeX Archive Network (CTAN).
Click to see: Figure 5: The Quick Start wizard lets you start a new document with consistent layout options.
As an editor, Kile scores a high mark, too, when it comes to the spell checking tasks. Typically for its philosophy, it integrates external programs of which the best known in Unix/BSD/Linux world is GNU Aspell. When installed, GNU Aspell can be used as a stand-alone application. But, to deal with the LaTeX input files inside Kile, it should be set as the default program with the desired encoding and language options on the “Spelling” tab of the “Configure Kile” dialog. As for performance when working with very long documents, GNU Aspell is sufficiently fast on modern machines and, given the large dictionary behind, it serves even he most demanding writers.
Because of the complexity of the Tex and LaTeX system, the demand for constant learning is always there regardless of the level of someone's experience. Besides being able to insert LaTeX commands and reserved words from the extensive menu system, Kile also gives easy access to the documentation. Kile offers a hyperlinked index of all LaTeX environments and commands, and includes short template-style blocks of code which can be copied into the input file. Some of the help menu entries are links to local help files in /usr/share/texmf/doc, while others, such as the CTAN search engine, will be external links. To ensure that the help system is fully functional within Kile, the administrators should check after the installation that the links configuration for the help files (“Settings/Configure Kile/Help” dialog) is up to date. Thus, the help system is one of the best parts of Kile and the time spent for the familiarization with its options will certainly be rewarding.
Click to see: Figure 6: If you don't find what you need in the menus, the TeX and LaTeX documentation is available and searchable.
Conclusion
Kile is an amazing piece of programming work. Its feature-rich user interface will boost everyone's typesetting productivity by providing quick access to all Tex and LaTeX programs. Kile can help anyone improve his or her productivity with LaTeX typesetting, but it is no substitute for a good written tutorial. Among the electronically available free titles, Tobias Oetiker's book, The Not So Short Introduction Guide to LaTeX2e is a good companion to Kile.
The road to the beautifully typeset publications is paved with many hours and days of learning the subtleties of TeX and LaTeX. compilers. Discovering numerous secrets of the language, plus learning about Postscript and Metapost along the way, is nowadays much faster with Kile and, some may find, more entertaining. Through extensive exploitation and the good work of the programmers, this program has reached an exceptional level of maturity and stability. The integration with the teTeX collection of compilers and utilities is so well done that the laborious ways of working separately with each one of them is now history.
The original author Pascal Brachet and the members of the Kile development team can be proud of their work given the number of users who benefit from it.