Currenty I am on LaTeX-mode-hook using flycheck.

(setq LaTeX-item-indent 0)
(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)
(add-hook 'LaTeX-mode-hook 'hl-todo-mode)
(require 'tex)

(add-hook 'LaTeX-mode-hook (lambda ()
  (TeX-global-PDF-mode t)

(setq flyspell-issue-message-flag nil
      ispell-local-dictionary "en_US"
      ispell-program-name "aspell"
      ispell-extra-args '("--sug-mode=ultra"))

(dolist (hook '(text-mode-hook))
     (add-hook hook (lambda () (flyspell-mode 1))))
    (dolist (hook '(change-log-mode-hook log-edit-mode-hook))
      (add-hook hook (lambda () (flyspell-mode -1))))

For example I am getting following flycheck-warning message when I write function() into my .tex file:

You should put a space in front of parenthesis. [36]

[Q] Is there any way to ignore specific flycheck-warning messages?


You don't disable warning messages at the flycheck level; you disable them using the underlying checker, which in your case for latex-mode is chktex. One can find the underlying checker by running M-x flycheck-describe-checker RET.

The chktex manual explains how to do per line suppression by adding a case-insensitive comment to the end your line % chktex ## where ## is the error number. In your case you would add % chktex 36.

  • Should I add % chktex 36 into each line I don't want flyspell activated? – alper Jun 3 '20 at 12:38
  • Not quite. The error code 36 is specific to neglecting to put a space in front of the parenthesis. Not all lines will have an error code of 36, because chktex might warn you about other things. Generally the idea behind linters like chktex is they tell you "hey, you might be doing something wrong" and you adding that comment tells chktex "thanks for the warning, but I'm doing this intentionally." You can disable a particular code for the whole file using % chktex-file 36 or in a chktexrc configuration file as explained in the manual linked above. – Pariksheet Nanda Jun 4 '20 at 13:12
  • Cool adding % chktex-file 36 actually suppress all the warning messages in the complete latex file – alper Jul 6 '20 at 17:56

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.