Tuesday, January 20, 2015

Getting latexmk working within LyX

If you would like to add latexmk as an export option in Lyx, here are the two basic steps to do in Tools -> Options.
1) In File Handling -> File Format, hit "New" and then put in these options, then "Apply".
2) Then in File Handling -> Converter, click on any existing converter, change the options to the below, and then click "Add", then "Save".

Now you should be able to File->Export->PDF (Latexmk). Hope that works for you.

If you are on Windows, then you might have problems with Perl versions (Lyx has one, MiKTeK another). Initially, I was getting that perl couldn't find File::Glob in @INC when latexmk was run. Turns out that Lyx was running it's own version of perl 5.18.2 and had @INC set to just the Lyx/lib (which oddly did have File/Glob.pm). I installed Strawberry Perl same version (needed that!) then set the PERL5LIB to the Strawberry perl folder.  Then it works fine.

This was on LyX 2.1.2, updated MiKTeX, and Windows 8.


gkjghkhgjhghjghjgkj said...

I'm using Lyx 2.2.2 . Sorry, but I'm not able to find pdf (latexmk) option under the file convertor menu. Please help me here.

bequw said...

Check that the option was created correctly in the File Handling section. If it is, the option might be hidden under File -> Export -> "More Formats & Options".