[Tex/LaTex] How to create the .latexmkrc file

compilinglatexmktexshop

I only started with latexmk & I feel ridiculous because I can't create the .latexmkrc fileā€¦ I'm using TeXShop on OSX 10.9 & when I try to create the file, Mac says : "It is impossible to use a name starting with a dot "." Because these names are reserved for system use. Please choose another one." So, I create a latexmkrc.tex but I understand it's not the good way.

Ok, I think it may be easy, but I'm going crazy not to get there.

So, I just want to use latexmk for this Terminal work :

xelatex <doc>.tex
makeglossaries <doc>
xelatex -shell-escape <doc>.tex
xelatex <doc>.tex

I'm using in my main document with glossaries :

% !TEX encoding = UTF-8 Unicode
% !TEX TS-program = xelatexmk-shell

in the beginning, & after in the preamble some lines like :

\usepackage[xindy={language=french, codepage=utf8}, style=altlist]{glossaries}
\usepackage[xindy, splitindex]{imakeidx}
\usepackage[itemlayout=singlepar]{idxlayout}
\makeglossaries
\def\xindylangopt{-M lang/french/utf8-lang -M style1.xdy}
\makeindex[name=can, title=Index des dates, options=\xindylangopt, intoc]

Using xelatex, xindy, splitindex & glossaries, thats my .latexmkrc content project :

$pdf_mode = "1";
$pdflatex = "xelatex";
$makeindex = 'texindy -M lang/french/utf8-lang -M style1.xdy;splitindex';
add_cus_dep('glo', 'gls', 0, 'makeglo2gls');
sub makeglo2gls {system("makeindex -s '$_[0]'.ist -t '$_[0]'.glg -o '$_[0]'.gls '$_[0]'.glo");}
push @generated_exts, 'glo', 'gls', 'glg';
push @generated_exts, 'acn', 'acr', 'alg';
$clean_ext .= ' %R.ist %R.xdy';

Thanks

Best Answer

TeXShop is a bit tricky about this. The file you edit for custom configurations is ~/Library/TeXShop/bin/latexmkrcedit. If this file does not already exist, you need to create it as a copy of the file ~Library/TeXShop/bin/tslatexmk/latexmkrcDONTedit. The following terminal commands will make the copy and then open it up in a terminal-based text editor:

cd ~/Library/TeXShop/bin
cp tslatexmk/latexmkrcDONTedit ./latexmkrcedit
nano latexmkrcedit

When you run TeXShop with a latexmk engine, it will automatically copy your changes to the correct configuration file.

Incidentally, if all you are trying to do is to save a file that starts with a period, editing from the command line using nano is a solution that works without having to install anything, although something like Aquamacs is better overall (e.g., for copy and paste abilities).

Related Question