Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is there a way of adding a glossary using the glossaries package in Texlipse?

%%% GLOSSARIES
\usepackage[xindy]{glossaries}
\makeglossaries

\begin{document}

\newglossaryentry{A}{name=area,description={Area}}
\glsaddall
\printglossaries

\section{Section Header}
Text Text Text

\end{document}

(I have installed Perl as I am on a windows system (as per the documentation) but that doesn't seem to have changed anything...unless I missed some key part!)

share|improve this question
    
You have to run the makeglossaries script after the LaTeX run and run LaTeX again. This can be conveniently done via latexmk or simply by a shell command. –  egreg Mar 4 '12 at 16:27

2 Answers 2

I spent some time fiddling with this, and finally made it work. The instructions should be platform-independent, but for reference, this is on Eclipse 3.7.2/Texlipse 1.5.0/Win7 x64/MikTeX 2.9. I opted out of using the makeglossaries script since Perl is not usually found on Windows systems, and I had some issues with the script when the directories of the input and output files were not the same. makeindex should work well enough.


  1. Specify a place for the temporary/auxiliary files created by glossaries

    • In Eclipse, go to Window->Preferences->Texlipse->Builder Settings->Latex Temp Files

    • Add the following glossaries-specific extensions: .ist, .gls, .glg and .glo

    This will move the temp files to the tmp directory after each build so they don't get in the way. This is kind of optional and you can make do without it, but it keeps your source directory clean.

  2. Create a new make glossaries external tool configuration:

    • Go to Run->External Tools->External Tools Configurations... and create a new configuration. Name it any way you want.

    • In "Location" field, use the path to the makeindex command.

    • In "Working directory", use ${project_loc}\tmp. This is project-independent, so you won't have to update it for each new project.

    • In "Arguments", use the following:

      -q -s ${project_name}.ist -t ${project_name}.glg -o ${project_name}.gls ${project_name}.glo

    Add any relevant makeindex customizations as necessary. I used the -q flag to suppress printing the log messages to the console in Eclipse, but you can take it out for debugging purposes.

  3. Run the glossaries after every build:

    • Open your project and go to Project->Properties->Builders

    • Choose Import... and select the builder we just made.

    • Go to Edit... for the builder and then go to Build Options.

    • Check Launch in background, During manual builds and During auto builds.

    • Uncheck After a "Clean" and During a "Clean".

    • Leave the rest as they are.

    If your main .tex file is named differently from your project, then replace all references to ${project_name} in the "Arguments" section appropriately (do this for the imported builder, not for the external tool, naturally). Don't bother creating a new variables, this will only apply to your current project anyway so just hard-code them and call it a day.

You might have to build twice for the references to appear, since the tool is only executed after each build, and you'd need another one for them to appear. This is similar to the way you do this manually -- you'd need another call to {pdf}latex after you have executed makeindex.

share|improve this answer
    
There's a possibility that I might have missed a step since I tried a lot of things until I made it work. If so, please let me know and I'll edit in what's missing. –  Martin Tapankov Apr 19 '12 at 10:28
    
Perhaps you can add a comment about running multiple times the pdflatex command. –  CSchulz Aug 27 '12 at 8:51
    
Did you find a way to make this building automatic while maintaining auto-refresh of the PDF using PDF4Eclipse? –  Trefex Mar 9 at 22:08
    
Worked great for me but ${project_loc}\tmp as a working directory did not work for me. I'm using Ubuntu. Had to change it by clicking on "Browse workplace". Is there a better way? –  mtanti Mar 26 at 6:36

I found a solution using makeglossaries and keeping the PDF synced with PDF4Eclipse.

This solution is based on this post

  1. Install Perl
  2. Make sure you have the makeglossaries.exe in your your tex distribution bin folder
  3. Make sure that you can call makeglossaries from the command line directly.

    $> makeglossaries    
    makeglossaries: Need exactly one file argument.   
    Use `makeglossaries --help' for help.
    
  4. Next create a .bat file (gloss.bat) in your project folder in Eclipse and put the following content

    @echo off 
    cd "%~dp1"
    set texSource=%~n1
    pdflatex  -synctex=1 -interaction=nonstopmode --src-specials "%texSource%.tex"
    makeglossaries "%texSource%"
    pdflatex  -synctex=1 -interaction=nonstopmode --src-specials "%texSource%.tex"
    pdflatex  -synctex=1 -interaction=nonstopmode --src-specials "%texSource%.tex"
    pdflatex  -synctex=1 -interaction=nonstopmode --src-specials "%texSource%.tex"
    
  5. Now in Eclipse, under Window --> Preferences --> Texlipse --> Builder Settings you should edit the Pdflatex command to the following:

    Program File: <pathtoprojectfolder>\gloss.bat
    Arguments: %input
    
  6. Add the following extensions to the list of temporary files in Window-->Preferences-->Texlipse-->Builder Settings-->Latex Temp Files:

    • .ist, .glo, .gls, .glg, .acn, .acr, .alg
share|improve this answer
1  
I upped the answer because it worked. However, this method makes incremental builds very slow (especially when there were no changes to the glossaries. –  shailenTJ Sep 8 at 9:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.