Posted by: sureshamrita | September 15, 2010

## Eclipse: editing LaTeX files

I have been using emacs for a long time but finally moved to eclipse for almost all my routine editing purposes (tex, C, C++ etc). I find eclipse very comfortable to use with latex files. You must do the following to use eclipse with latex files.

1. Install TeXlipse Plugin in eclipse. Installing a plugin in is very easy in eclipse. This is how. start eclipse. Click on the eclipse menu, Help->Install New Software. Enter this URL in the add site menu. ﻿﻿http://texlipse.sourceforge.net/ If you follow the instructions, it will add TeXlipse and it will restart eclipse.
2. How to check whether TeXlipse is installed: Click on Eclipse Menu, File->New->Other. You should be able to see LaTex Project.
3. It is nice to see that TeXlipse will provide templates for beamer, article etc document classes.
4. You  have to give a project name, select a location to store the tex files ( I usually select my own directory related to the project instead of choosing the  default ‘workspace’ option given by eclipse.
5. I usually choose pdf as the output format and it will automatically select pdflatex as the builder.
6. Clicking ‘next’ and ‘finish’ will finally create a document.
7. Automatic Compilation of latex files: I am very very happy to use this option in eclipse. If you select the eclipse menu: Project->Build Automatically, every time  you save your latex file, it will run pdflatex required number of times. Wow !!!
8. Configuring the pdf viewer: Eclipse will automatically launch your favorite pdf viewer on clicking the “Launch the Previewer” Icon as shown in the picture below, after you configure your viewers properly. To configure the viewer,  you need to provide 2 different information to eclipse. One is the viewer that you want eclipse to launch and the other is the argument to the viewer – which in general is the name of the pdf/dvi file you need to view. Select your current LaTeX project in the left pane, Click on eclipse menu: Window->Preferences->TeXlipse->Viewer Settings. You can add your preferred viewer. Once you have added or moved up the preferred viewer, click on that viewer entry and click edit. You get a form to fill the viewer name, viewer command and viewer arguments. In most cases viewer argument is %file which means that the corresponding pdf or dvi file will be given as the viewer argument when you lauch it.
9. My topmost entry (entries are written with descending priority) is acroread(/usr/bin/acroread). You may note that Cntrl-R reloads a pdf document in acroread and just a mouse click in evince. (This is one reason to prefer evince to acroread when developing a pdf document using latex. You just need to click on the evince window only after compilation, which in a properly configured eclipse takes place on simply saving the file!).
10. Enjoy latex editing in eclipse.

## Responses

1. how do i insert label without me having to keep track of the eq no:

2. When the document gets larger, you just cannot remember all those references anymore (and you have to search the for the references, which just wastes time) — this is where TeXlipse steps in: just type “\ref{” and hit ctrl + space (or what content assist is bound to on your system) and you see the list of available references (or if you remember the beginning of the reference, just type it in too to narrow down the shown references.) The command \pageref{} works in the same way.

If Highlight selected references and … is turned on in the preferences, TeXlipse also highlights the label and all references of the currently selected reference or label in the current file.

But that’s not all. If the cursor is on a reference you can use the magic F3 key (or use Open Declaration from the main or context menu) to jump to the correspondig label! How funky is that?

3. Lyx also seems to be a good “WYSIWYG” LaTeX editor which I am using for a more than a year. Quite good for “rapid protyping” or simply put “rapid typing” for initial versions. If needed, after exporting the lyx document to latex file, it can be cleaned up.

It even has its own commands for math macro expansions. Commands not implemented in Lyx can be inserted as LaTeX commands in the LyX document. A devotee of LaTeX typesetting system should certainly check this software at least once.

Ganesh
Amritapuri.