How can I configure latexmk to run a linter or two such as lacheck or chktex?
Asked
Active
Viewed 862 times
1 Answers
5
Add this to the end your .latexmkrc to cause latexmk to run your linters first and then your regularly-specified $pdflatex:
sub run_chktex {
my $name = shift;
if ( $silent ) {
system "chktex -q -v0 $name";
}
else {
system "chktex $name";
};
}
sub run_lacheck {
my $name = shift;
system "lacheck $name";
}
sub lint {
my $fname = shift;
# lint
run_chktex $fname;
run_lacheck $fname;
return system(@_);
}
$pdflatex = "internal lint %S $pdflatex";
We use John Collins’ answer here for the bulk of the lint routine and mhp’s question on makeglossaries (answer validated by Collins) for the run_chktex routine (lacheck has no such options).
9999years
- 433
- 2
- 12