Home Download Buy Blog Forum Support

Build-Command for latexmk and glossaries

Build-Command for latexmk and glossaries

Postby SunBob on Fri Oct 19, 2012 1:56 pm


first I have to admit, that Sublime is the best software I've seen in a while. :)

After studying several tutorials I tried to adjust my Sublime for my preferences, e.g. Latex.
Without doing anything it worked quite good for me. Only one problem i ran into.

For my thesis I was using the glossaries package, which isn't supported with the default build command (latexmk).
After a little research I found some code-snippet how to edit the latexmk command to run with the glossaries package. My problem is, that I don't know how to edit the build command in a proper way. I have to admit, that I'm not familiar with json.

Here is the code snippet, how the default build-command (json) looks like:

Code: Select all
         "path": "/Users/.../Thesis",
             "tab_size": 4
           "name": "Latex with Glossaries",
            "cmd": ["latexmk", "-cd", "-e",
            "\\$pdflatex = 'pdflatex %O -interaction=nonstopmode -synctex=1 %S}",
         "-f", "-pdf"]

The line with "$pdflatex %0....-synctex=1 %S" is the code which latexmk executes.

To run it with the glossaries-package I found this code, written as a Latexmkrc-file (I think it is Perl :S), which is a file containing the code for Latexmk. At the beginning you can see the pdflatex command, then some additional things and at the end there you will find the part which is important for the glossaries-package.

Code: Select all
# Use xelatex instead of pdflatex
$pdflatex = 'xelatex -synctex=1 -interaction=nonstopmode --shell-escape %O %S';

# Always create PDFs
$pdf_mode = 1;

# Use Skim.app to preview generated PDFs
$pdf_previewer = 'open -a Skim.app %S';

# Use continous mode by default
#$preview_continuous_mode = 1;

# output to the directory called output in the current directory
#$out_dir = './output';

# file extensions to remove when cleaning
$clean_ext = 'acn acr alg aux bbl bcf blg brf fdb_latexmk glg glo gls idx ilg ind ist lof log lot out run.xml toc dvi';

# make latexmk run makeglossaries automatically
add_cus_dep('glo', 'gls', 0, 'makeglossaries');
add_cus_dep('acn', 'acr', 0, 'makeglossaries');

sub makeglossaries {
    system "makeglossaries $_[0]";
    if ( -z "$_[0].glo" ) {
        open GLS, ">$_[0].gls";
        close GLS;
    return 0;

I hope somebody, which is more familiar with coding, can help me.

Best regards


EDIT: Could an admin please shift this thread to the technical discussion forum? thx
Posts: 3
Joined: Fri Oct 19, 2012 1:37 pm

Return to General Discussion

Who is online

Users browsing this forum: Google [Bot], Liquidmantis and 47 guests