2

How can I configure latexmk to run a linter or two such as lacheck or chktex?

2

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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.