[Tex/LaTex] Where should I put a latexmkrc file (using TeXLive 2011 and Windows 7) so that it is available to all the document files

installinglatexmkwindows

I spent most of yesterday trying to get LaTeX to create a list of abbreviations using the {nomencl} package , and after a lot of research managed to succeed using latexmk and creating a customised rule in a latexmkrc file. (This was by copying examples, I have no idea what I'm actually doing!). However, it only works if I put the latexmkrc file in the current document folder. The code in the latexmkrc file, which was cloned from a post on another board by John Collins, is as follows:

add_cus_dep('nlo', 'nls', 0, 'makenlo2nls');
sub makenlo2nls {
my $cwd = cwd();
my $base = $_[0];
# Normalize the filenames to use / to separate the directory
# components, since both \ and / are allowed under MSWin:
$base =~ s(\\)(/)g;
$cwd =~ s(\\)(/)g;
# Remove any initial string equal to the name of current
# working directory (and the following separator):
$base =~ s(^$cwd/)();
# Normalize the filename back to standard MSWin:
$base =~ s(/)(\\)g;
# Quote the filenames in the command line
# (to give safety against special characters):
system("makeindex \"$base.nlo\" -s nomencl.ist -o \"$base.nls\"");
}

Is there a central location where I can put the latexmkrc file so that it is available to all my documents? I have tried the obvious locations such as C:\Users\*username*.

Best Answer

Try to name the file LatexMK and put it in C:\latexmk.

EDIT: Quoting the latexmk manual, section "Configuration/initialization (RC) files", p. 9--10:

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 MS-WINDOWS system it looks for "C:\latexmk\LatexMk".

[...]

2) The user’s RC file, "$HOME/.latexmkrc", if it exists. Here $HOME is the value of the environment variable HOME. [...] [O]n MS-Windows, the user may choose to set 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.