4

I'm using ConTeXt MKIV (if that makes a difference here). The problem is I'm writing my ConTeXt in vim, and a I have a syntax/style checker plugin called syntastic. The thing is it's using chktex for tex files, which spits out tons of warnings for perfectly reasonable ConTeXt, like

\starttext
\startsection[title={Testing ConTeXt}]
This is a little test for \CONTEXT.
\stopsection
\stoptext

And chktex gives me:

> Warning 1 in test.tex line 1: Command terminated with space. \starttext
^ Warning 13 in test.tex line 3: Intersentence spacing (`\@') should perhaps be used. This is a little test for \CONTEXT.
^ Warning 1 in test.tex line 4: Command terminated with space. \stopsection
^ Warning 1 in test.tex line 5: Command terminated with space. \stoptext
^ No errors printed; 4 warnings printed; No user suppressed warnings; No line suppressed warnings.

Now it'd be easy to just ignore these warnings, but getting style warnings is actually pretty useful. Just much less so when you get into the habit of ignoring them, which is what getting wrong warnings all the time does for you.

So the question is: Is there something like this for ConTeXt yet? Or is there perhaps some option I could pass to chktex to make it behave more agreeable here?

5

I'm the current maintainer of ChkTeX. Unfortunately, I have never used ConTeXt, so I don't know what would be required for good ConTeXt support. I would love to support ConTeXt though, so if you have any specific problems, feel free to report them as bugs. Patches are also welcome. The code base is pretty small (C for what that's worth).

You can turn off any of the different warnings (and turn on some others that aren't on by default) from the commandline, or in your chktexrc file. So for the specific problems you mentioned, you can simply turn off warning 1 (command terminated with space). Personally, I do this since I find that particular warning more trouble than it's worth (it's not a problem I usually have). If you wish to keep that warning on, but just want some more macros to be valid, you can add those commands to the Silent section of chktexrc. In fact, because of bug 36945, you can do this with regular expressions (assuming that was ChkTeX was compiled with regular expression support). Based on your feedback, I plan to add \\start.* and \\stop.* by default, but if you open a bug I'll be sure to remember (and you can tell me about other macros that should be added).

As for for warning 13, it seems like it's probably a bug, since LaTeX does produce the correct output in that case (though adding \@ doesn't hurt). Please open a bug if it's important to you, and I'll see what I can do.

  • I have released 1.7.3 with \start \stop checking and several other fixes. – Ivan Andrus Apr 10 '15 at 3:59
1

You can get basic style checking (matching start and stop tags, etc) using concheck. Simply run

mtxrun concheck filename
  • Unfortunately that fails with 'provide proper filename' for me. I've checked out the source and found nothing wrong with the part where that error comes from when I call it manually, so I don't even know what's going on there. – Cubic May 6 '14 at 8:22
  • @Cubic: Which version of ConTeXt are using? concheck is a ruby script, so you need Ruby to run it. The filename in the above command is a placeholder and you need to replace it by the name of your file. – Aditya May 9 '14 at 17:12
  • I figured me pointing out that I've read the source would be a tell that I know it's a ruby script.. Anyways: It appears to be some problem with the script itself. I've tried to run it with a variety of ruby versions, didn't work with any of them though. – Cubic May 9 '14 at 23:08

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.