[OS X TeX] Re: ChkTeX Engine for TeXShop

Ralph Martin Ralph.Martin at cs.cardiff.ac.uk
Mon May 24 16:25:19 CEST 2010

On 24 May 2010, at 12:34:38PM, Ramón Figueroa-Centeno wrote:
> I tried to get TeXShop to recognize the ChkTeX output as errors. I thought
> that getting it to output the ChkTeX errors in the file-line-error format
> would be enough (see below); but, although that might be necessary, it is
> not sufficient :(
> Hopefully someone will read this and provide us with a solution.

OK, I delved into this a bit more, and seem to have come up with a 
first-cut solution which basically makes this work. It is not perfect:
very long  paragraphs which have no line break characters within them
strangely cause the GoTo Error mechanism to skip over earlier warnings.
Hopefully, someone who understands this all better than me can 
go the extra mile to provide a more robust solution.

(1) Edit the OutFormat section in the /usr/local/etc/chktexrc file.
Look for these two lines:
# -v5; no line number, ease auto-test
"%k %n in %f: %m!n%r%s%t!n%u!n"
and put after them these two lines:
# -v6; for TeXShop GoTo Error mechanism
"./%f:%l: %m!nl.%l %r!n?!n"

(2) Change Ramón's ChkTeX.engine to contain:

name=$(basename "$1" .tex)

/usr/local/bin/chktex -v6 "$1"

console="tell application \"TeXShop\" to set the index of (the window named \"$name console\") to 1"
/usr/bin/osascript  -e "$console"

One further comment for anyone following on:
using -f instead of -v6 above also seems not to work as, unexpectedly, 
"!n" comes out literally instead of as a newline.

Best wishes

Prof Ralph Martin                          Phone: +44(0)29 2087 5536
Computer Science & Informatics             Fax:   +44(0)29 2087 4598
Cardiff University                   Email: mailto:ralph at cs.cf.ac.uk
5 The Parade, Roath                  WWW:  http://ralph.cs.cf.ac.uk/
Cardiff, CF24 3AA, UK     VOIP: sip:17476235487 at proxy01.sipphone.com

More information about the macostex-archives mailing list