6

I've got myself seriously confused with latexmk. I have been using latexmk on TeX Live 2011 and I have loved it for making my document with a ToC and references with Biber. I am trying to make it work with the glossaries package (makeglossaries) and I've hit a brick wall.

I've already looked at How to make Latexmk use makeglossaries? and have seen the suggestions of code to add but I can't find the latexmkrc file to save my life. I've searched in all the places that the latexmk manual suggests and I'm positive I'm viewing hidden files.

It would make my live much easier if the config file was in the directory with the document because I'm using a couple of different machines to do my writing.

In the end I would like latexmk to run pdfLaTeX, Biber and makeglossaries enough times to make my ToC, List of Tables, List of Figures, references and List of Abbreviations.

I'm running TeX Live 2011, which is fully updated. I'm using latexmk through TeXworks (it came ready configured).

  • To use a configuration file per working directory you have to create one and place it in the working directory. The file must be named "latexmkrc" or ".latexmkrc". – N.N. Jan 14 '12 at 18:46
  • 1
    I have already done that and copied the answer from the above link into it and it wouldn't run. I thought their might be a latexmkrc file elsewhere. – Darling Jan 14 '12 at 18:49
  • 1
    Biber worked fine. Getting makeglossaries to work is my problem. A latexmkrc file in the document directory with code from the linked answer doesn't work. I was confused about it for over a day and thought help is needed :) – Darling Jan 14 '12 at 18:59
  • 1
    It is named latexmkrc without any extension. I've tried all three answers from the link in my above post. The document compiles but the list of acronyms is not updated with any of the three answers. If after latexmk I run makeglossary and pdflatex it works. – Darling Jan 14 '12 at 19:20
  • 1
    I'm using that answer now and it is not working. If I add a new acronym and use it, it appears in the text but the list of acronyms is not updated. – Darling Jan 15 '12 at 11:27
10

First, let's make sure your latexmkrc file is working. If you're not sure if the glossaries part is working, you could try something simple, e.g. changing $pdf_previewer (see the "List of configuration variables…" section of the latexmk documentation). You can put the file in the following locations:

Latexmk can be customized using initialization files, which are read at startup in the following order:

  1. The system RC file, if it exists. On a UNIX system, latexmk searches for following places for its system RC file, in the following order, and reads the first it finds:

    • "/opt/local/share/latexmk/LatexMk",
    • "/usr/local/share/latexmk/LatexMk",
    • "/usr/local/lib/latexmk/LatexMk".

    On a MS-WINDOWS system it looks for "C:\latexmk\LatexMk".

    On a cygwin system (i.e., a MS-Windows system in which Perl is that of cygwin), latexmk reads for the first it finds of

    • "/cygdrive/c/latexmk/LatexMk",
    • "/opt/local/share/latexmk/LatexMk",
    • "/usr/local/share/latexmk/LatexMk",
    • "/usr/local/lib/latexmk/LatexMk".

    In addition, it then tries the same set of locations, but with the file name replaced "LatexMk" replaced by "latexmkrc".

  2. The user's RC file, if it exists. This can be in one of two places. The traditional one is ".latexmkrc" in the user's home directory. The other possibility is "latexmk/latexmkrc" in the user's XDG configuration home directory. > The actual file read is the first of "$XDG_CONFIG_HOME/latexmk/latexmkrc" or "$HOME/.latexmkrc" which exists. (See https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html for details on the XDG Base Directory Specification.)

    Here $HOME is the user's home directory. [Latexmk determines the user's home directory as follows: It is the value of the environment variable HOME, if this variable exists, which normally is the case on UNIX-like systems (including LINUX and OS-X). Otherwise the environment variable USERPROFILE is used, if it exists, which normally is the case on MS-Windows systems. Otherwise a blank string is used instead of $HOME, in which case latexmk does not look for an RC file in it.]

    $XDG_CONFIG_HOME is the value of the environment variable XDG_CONFIG_HOME if it exists. If this environment variable does not exist, but $HOME is non-blank, then $XDG_CONFIG_HOME is set to the default value of $HOME/.config. Otherwise $XDG_CONFIG_HOME is blank, and latexmk does not look for an RC file under it.

  3. The RC file in the current working directory. This file can be named either "latexmkrc" or ".latexmkrc", and the first of these to be found is used, if any.

  4. Any RC file(s) specified on the command line with the -r option.

(from the "Configuration/initialization (RC) files" section of the latexmk documentation)

So putting it in your working directory should work, just make sure there aren't any other latexmkrc files in the locations specified in 1 and 2. (On my Windows 7 machine, C:\latexmk\LatexMk works.)

Once you made sure latexmk finds your latexmkrc file, try putting the glossaries stuff back in.

  • 1
    I've had a look around for a latexmkrc file and can't see one. I've created one called latexmkrc in the directory of the document and added $pdf_previewer ="start acroread %O %S" to it. Running latexmk still causes the texworks pdf previewer to display the pdf. If I intentionally put a mistake into the line latexmk fails to work. So it is definitely reading the file but seems to be ignoring the instructions. :S – Darling Jan 15 '12 at 21:55
  • 1
    Run number 1 of rule 'cusdep acn acr Thesis v2' ------------ === Creating rule for 'cusdep acn acr Thesis v2' Latexmk: applying rule 'cusdep acn acr Thesis v2'... For rule 'cusdep acn acr Thesis v2', running '&do_cusdep( makeglo2gls )' ... makeglossaries: Need exactly one file argument. Use `makeglossaries --help' for help. C:\texlive\2011\bin\win32\runscript.tlu:577: command failed with exit code 255: cmd /c call c:/texlive/2011/texmf-dist/scripts/glossaries/makeglossaries.bat Thesis v2 Rule 'cusdep acn acr Thesis v2', function 'makeglo2gls' failed with return code = 65280 – Darling Jan 15 '12 at 22:25
  • I stumbled across this when looking through the console output. – Darling Jan 15 '12 at 22:26
  • 2
    Problem solved by removing the space from the filename of the .tex file.... Embarassed mode engaged. Thanks for your help. – Darling Jan 15 '12 at 23:13
0

LatexMk looks for a configuration file in different places. One place to put the file so that it's a systemwide install is.

/usr/local/share/LatexMk

NB: this isn't part of your home directory, which is why it just starts with a slash, rather than a tilde ~). And you'll probably have to make the directory LatexMk yourself (using sudo).

Then place the LatexMk file in there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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