For several years now, I have been using TeXnicCenter for editing my LaTeX files and most of the time Sumatra PDF for viewing them. The big benefit of Sumatra PDF is its excellent support for forward and inverse search. Double-clicking a line in TeXnicCenter highlights the according line in Sumatra PDF (forward search) and double-clicking a line in Sumatra PDF moves the curser to the according line in TeXnicCenter (inverse search).
I am a Java programmer with my favourite IDE being Eclipse and it would be great to not only write the code but also other documents in the IDE which I am so familiar with. There is an Eclipse plugin, TeXlipse, for the purpose of editing LaTeX. I once tried it, but was not convinced to use it. Anyway, I decided to give it a new try. So far, the syntax highlighting looks far superior and also the additional functions seem to be more mature and comfortable, i.e. auto-compilation, auto-completion and display of warnings and errors works like a charm, but I am still gathering experience with it.
My first step was to configure forward and inverse search with Sumatra PDF for TeXlipse. I know there is a built in PDF viewer provided by the TeXlipse team, but at the time of writing its functionality seems quite limited, when compared to Sumatra PDF. Of course, that might change in a few months. Configuring Sumatra PDF with TeXlipse was not really trivial which is why I am writing this post. There are several blog posts on this subject, but none of the ones I found was up to date, so one more post might do no harm. Currently I use Eclipse Indigo, TeXlipse 1.5.0 and Sumatra PDF 1.9.
(EDIT 07.11.2012: Just verified this with Eclipse Juno 4.2.1, TeXlipse 1.5.0 and SumatraPDF v2.1.1. The tutorial still works, with adjusted file paths of course.)
After installing everything, you need to configure both, TeXlipse and Sumatra PDF to support forward and inverse search. The first step is pdflatex in TeXlipse.
In Eclipse, go to Window->Preferences->Texlipse->Builder Settings, select PDfLatex program and click “Edit…”. The following dialog appears:
The crucial aspect here is the argument configuration where you need to change the default argument
-synctex=1 %input to
-synctex=-1 %input, i.e. 1 to -1.
Next, you need to go to the “Viewer Settings” and modify the existing sumatra PDF entry or create a new one. The dialog looks as follows:
In this dialog, first select your Sumatra PDF executable. To ensure that only a single instance of Sumatra PDF is opened per document, set the viewer arguments to
-reuse-instance %fullfile. The default settings here are set to just
%file which does not work. To enable forward search, put the following into the “DDE message to send on view” Command:
[ForwardSearch("%fullfile","%texfile",%line, 0,0,1)] which also deviates from the default setting. Server and topic options are correct in the default configuration, but you need to set the Inverse search support option to “Viewer runs external command” and enable the “Viewer supports forward search” checkbox.
So much for TeXlipse, now also Sumatra PDF needs some configuration. Since Sumatra PDF 1.8, it is possible to configure inverse search via the Settings->Options menu. Here is the dialog:
In this dialog, you need to set the command that is executed when activating inverse search. In my sample environment, this command reads as follows:
javaw -classpath "C:\Users\joerg\Desktop\eclipse-3.7.1\eclipse\plugins\net.sourceforge.texlipse_1.5.0\texlipse.jar" net.sourceforge.texlipse.viewer.util.FileLocationClient -p 55000 -f %f -l %l
The command executes TeXlipse with appropriate options. For the command to work, you need to set the classpath to the directory of your Eclipse/TeXlipse distribution. -p marks the port over which TeXlipse and Summatra PDF communicate, the default is 55000. -f marks the file and -l the line for which inverse search was activated.
EDIT 08.08.2016: And even after many years, the tutorial still seems to work. I’d like to make one amendment based on an anonymous comment below: If the file you are using includes something in its path with which Windows might have problems (say, a space character), you should enclose the parameter in double quotes, e.g.:
javaw -classpath “C:\Users\joerg\Desktop\eclipse-3.7.1\eclipse\plugins\net.sourceforge.texlipse_1.5.0\texlipse.jar” net.sourceforge.texlipse.viewer.util.FileLocationClient -p 55000 -f “%f” -l %l