3

I use the following code for custom theorems, as I like slanted text in thereoms better than italicized, using amsthm.

\newtheoremstyle{thm-sl}
{}{}
{\slshape}  % slanted text instead of italicized
{}
{\bfseries}
{.}
{.5em}
{}

I get a warning from chktex:

Warning 6 in doc.tex line 21: No italic correction (`\/') found.
{\slshape}  % slanted text instead of italicized  
         ^

I understand, that italic correction (\/) should be used, to insert some space between italicized/slanted characters and upright characters, appearing directly after another. Though in my case, there should be no characters after the slanted text.

So is this just an overreaction of chktex or is there a more "correct" to use newtheoremstyle?

Funnily, using {\slshape\/} mutes chktex, but will not compile, due to the error

! You can't use `\/' in vertical mode.
3
  • 1
    I guess in that case you just don't want to keep chktex happy. These automatic tools can't always get everything right.
    – moewe
    Commented Jan 13, 2019 at 12:14
  • 1
    Apparently you should be able to silence the warning by adding % chktex 6 after the {\slshape} (haven't tested that).
    – moewe
    Commented Jan 13, 2019 at 12:40
  • I'm not even sure why chktex examines things in the preamble.
    – egreg
    Commented Jan 13, 2019 at 14:23

1 Answer 1

4

Automatic syntax checkers or linters don't (and maybe can't) always get everything right.

In this case there is no need for italic correction with \slshape since the following text will start in a new line and not directly after the slanted text in the same line. Anyway, it would certainly be inappropriate to add \/ directly after \slshape here since the correction needs to be added at the end of the slanted/italic text ({\slhape lorem ipsumf\/} dolor not {\slshape\/ lorem ipsumf} dolor). Here the {\slshape} is not a group that prints anything, it is the argument of a command that determines the formatting of the theorem later.

You can disable the warning by adding a comment with checktex 6 in the offending line

\newtheoremstyle{thm-sl}
{}{}
{\slshape}% chktex 6
{}
{\bfseries}
{.}
{.5em}
{}

See §6.1.4 of the ChkTeX documentation.

Since you are probably going to use only the \text...{...} macros instead of their switches (\textit\itshape etc.) in the document you could probably disable the entire warning 6 altogether. The documentation has more hints on that (-n6 command line option or chktexrc config file).

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .