7

For the string: 100K100-873 I am getting the following warning message in my emacs editor from ChkTeX check:

Wrong length of dash may have been used. [8]

How can I prevent this warning message?

Could be related to How to ignore "Wrong length of dash may have been used." inside \cite and \newcite but I am not drawing any line, it was just string in a text.

4
  • chktex is probably worrying that you should use an n-dash for number ranges so 1–4 not a hyphen 1-4, but that isn't a number range I assume. You can configure it to ignore each check, as given by number, but if you spend too long configuring the checker to give correct results, simpler just not to run it. Apr 17, 2022 at 11:06
  • How can I configure to ignore each check I believe I have to ignore number: 8
    – alper
    Apr 17, 2022 at 11:40
  • I never use chktex but I think you just want -n8 on the command line , see tex.stackexchange.com/a/594370/1090 also see tex.stackexchange.com/questions/583501/… Apr 17, 2022 at 11:45
  • @DavidCarlisle Thank you. I will add alias chktex="chktex -n8" as a alias and try to make it work in emacs as well.
    – alper
    Apr 17, 2022 at 22:19

3 Answers 3

4

There are a number of ways to "fix" this depending on what you care about:

  • If you don't care about being warned any dash "problems," then you can turn it off on the command line (as mentioned by others). You can also do this in the CmdLine section of your chktexrc file and then you don't have to worry about updating other tools.
  • If you would like to be warned of dash "problems", but not a hyphen between two numbers, you can update the NumDash section of your chktexrc file to include 1 (as well as 2).
  • If you want to be warned of dash "problems" in all files except this one, then you can add a % chktex-file 8 comment to the file.
  • If you want to be warned of all dash "problems" except this line, then you can add a % chktex 8 comment to that line.
  • You can also "hide" it from ChkTeX in some way, like putting it inside a macro with WipeArg set in chktexrc for that macro, or adding {} like 100K100-{}873. I don't necessarily suggest these ways since I think a comment is a better way to signal to collaborators (including future you) what's going on. But the macro option might be useful if it's already in a macro or adding one makes sense for some other reason.
0

In addition David Charlisle advice guide me to fix by using following command:

alias chktex="chktex -n8"


Which guide me search this approach in emacs, where NickD's answer (How can I ignore chktex warnings based on their number?) help me to fix this issue:

(setf (cadr (assoc "ChkTeX" TeX-command-list)) "chktex -v6 -n8 %s")

0

So, I found three ways of getting rid of the warning (all producing different outputs):

100K100$-$873 - for a minus symbol

100K100~-~73 - for space-dash-space

100K100{-}873 - for just a normal dash

Probably the third is what you were aiming for... as it displays the same text as 100K100-873

~ is the inline space symbol, which means "here should be one (and only one) space"

2
  • 2
    Welcome to TeX.SE!
    – Mensch
    Jun 4, 2023 at 18:25
  • Thanks! (^-^) @Mensch Jun 4, 2023 at 18:42

You must log in to answer this question.

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