I usually love my .latexmkrc settings. However I am trying to play with Template Toolkit to build a LaTeX file, then compile it with latexmk (all of this inside a perl script) and thus I would like to use the default latexmk settings (i.e. no preview continuously etc).

I would like to keep my .latexmkrc for personal use, therefore I am looking for a way to tell latexmk to ignore my $HOME/.latexmkrc file (via the -r flag?). Is this possible?

2 Answers 2


A belated answer: A new version of latexmk does what was asked for. This is v. 4.27a at


Just invoke latexmk with the option -norc, and it will omit reading all its standard initialization files (system, user, and current directory). The -r option still works, so you use a customized initialization file.


This isn't possible using the -r <rcfile> option, because it doesn't override the loading of $HOME/.latexmkrc but this file is loaded in addition. Multiple -r options can be given and all of these config files are loaded in the given order.

One possibility to stop latexmk in your perl script to read $HOME/.latexmkrc is to temporary change the HOME variable and to change the current directory away from $HOME (because latexmk also looks for a .latexmkrc in the current directory.

Something like:

# Perl code:
$ENV{HOME} = '/dev/null';
system("latexmk ...");

If you need the correct HOME anywhere else after this lines simply save it away and restore it afterwards.

  • Worked beautifully, thanks. I really should have thought about that; got too focused on latexmk flags to think outside the box. Commented Feb 6, 2011 at 21:10
  • Now that I am on that track, a further idea would be to localize $ENV{'HOME'} to a block before calling latexmk. Then the home variable will be restored afterwards automatically. ...;{ local $ENV{'HOME'}; system( 'latexmk', '-pdf', $filename ); } ... Commented Feb 6, 2011 at 21:14
  • @Joel: I know that. I just wanted to keep the Perl code minimal. Commented Feb 6, 2011 at 21:16
  • No slight intended. Call it a post for the future reader. Commented Feb 6, 2011 at 21:37
  • @Joel: No problem, wasn't meant like that. Commented Feb 6, 2011 at 21:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .