# Using LaTeXmk with mylatexformat

I looked at many posts about the use of latexmk, but wasn't able to find what to write in order to satisfy my requirements. Yet I'm sure it is possible, but my skills in Perl amounts to about nothing.

What I would like to do with a file, say mymainfile.tex:

1. make a format file including the static part of the preamble, named mymainfile-xelatex.fmt if I use xelatex, and store it in the fmt/ subdirectory of the directory that contains mymainfile.tex (I can do that just with mylatexformat)

2. regenerate the format if the (static part of the) preamble has changed (loading new packages, defining new commands or modifying existing commands).

3. Compiling mymainfile.tex with the customised format file.

The difficulty for me is point 2), and possibly point 1) — that is, not having to write a first macro to make the format, and the launching latexmk, but preferably that everything be done from latexmk.

Moreover I prefer not to write the static part of the preamble in a separate file, but keep it in mymainfile.tex as usual, and use the \endofdump command from the mylatexformat package

I use MiKTeX 2.9 on WinEdt 7.

• Does the answer there (by the author of latexmk) help you? There's also tex.stackexchange.com/questions/79493/…. – krlmlr Nov 10 '13 at 21:23
• Well, not exactly. It is one of the answers I had read. I must say I didn't understand all the code given there, but I understood one thing: it supposes the static part of the preamble to be written in a separate file. What I would like to be able to do is to have it in the main document as usual, only delimited by the command \endofdump (from mylatexformat package) or \begin{document} if there is no dynamic part of the preamble. I guessed one can take advantage of LaTeXmk's ability to detect changes in the preamble to let it redo the customised format. – Bernard Nov 11 '13 at 1:16
• Hi @bernard. Are there any news here? – Johannes_B Mar 15 '15 at 16:58
• @Johannes_B: Unfortunately no. I confess I had so many things to do that I had forgotten this problem. Thanks for reminding me; as soon as I have some time, I'll look after it. – Bernard Mar 15 '15 at 18:15
• Just doing a bit of cleaning around, no need to hurry ;-) – Johannes_B Mar 15 '15 at 18:17