-
Hi, Been exploring jinx for latex documents (auctex), but jinx flags most of the \usepackage{XYZ}, \cite{XYZ} and \label{XYZ} commands as containing a typo. I believe the BA |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
If I recall correctly one has to write a custom predicate (as a function) to ignore these fields. cc @gusbrs |
Beta Was this translation helpful? Give feedback.
-
I think @minad is referring to #25 (comment) . It is one way of doing it, and it is more or less what I've been doing since then. You could say it is a "custom predicate", but the idea there is to extend However, for LaTeX documents, I think it is fair to say of Jinx that: the face based exclusion rules are efficient and work well in most cases, but the current out-of-the-box structure is (very) hard to tweak for such cases as specific macros or macro arguments. For why, see #40. (The |
Beta Was this translation helpful? Give feedback.
-
Regarding the case of ;; Customize fontification of footnotes.
;; See (info "(auctex) Fontification of macros")
(with-eval-after-load 'font-latex
;; Remove them from "reference-keywords".
(setq-default font-latex-match-reference-keywords-local
(assoc-delete-all "footnote"
font-latex-match-reference-keywords-local))
(setq-default font-latex-match-reference-keywords-local
(assoc-delete-all "footnotetext"
font-latex-match-reference-keywords-local))
(setq-default font-latex-match-reference-keywords-local
(assoc-delete-all "marginpar"
font-latex-match-reference-keywords-local)))
(defface my/font-latex-footnote-face
'((t :inherit font-lock-constant-face))
"A dedicated face for footnotes in `latex-mode'.")
;; 'font-latex-user-keyword-classes' should be set before the loading of
;; 'font-latex.el', because the later runs '(font-latex-make-user-keywords)'
;; to properly populate the variables it needs. This also means we have to
;; "set it" rather than "add to it".
(setopt font-latex-user-keyword-classes
'(("footnote"
(("footnote" "[{")
("footnotetext" "[{")
("marginpar" "[{"))
my/font-latex-footnote-face command))) With that in hand, you can, in principle do: (with-eval-after-load 'jinx
;; Exclude some more faces from spell checking in LaTeX.
;; I'm setting the value directly instead of adding to the list since I took
;; the trouble of verifying and adjusting most cases of interest, so I don't
;; want this value changing without me being aware.
(setf (alist-get 'tex-mode jinx-exclude-faces)
'(tex-mode
;; default ones
tex-math font-latex-math-face font-latex-sedate-face
font-latex-verbatim-face font-lock-function-name-face
font-lock-keyword-face font-lock-variable-name-face
;; added ones
;; 'font-lock-constant-face' is used for types 'biblatex' and
;; 'reference', the latter includes '\footnote', '\marginpar'.
font-lock-constant-face))) This solves the tight spot regarding (You should probably check the style files of packages which are relevant to you though, to make sure you are not excluding something you don't want to). This procedure is general and could be used to tweak other macros, of course. How much this bending of However, not everything can be sorted this way: all mandatory arguments of a given macro are bound together and are either all included, or all excluded; there is no way (with this technique) to do anything about optional arguments, since the face for all of them is not configurable and is a single one for all macros. |
Beta Was this translation helpful? Give feedback.
I think @minad is referring to #25 (comment) . It is one way of doing it, and it is more or less what I've been doing since then. You could say it is a "custom predicate", but the idea there is to extend
font-latex
to include spell-checking information which can than be leveraged in such predicate. Of course, other predicates could be thought of, regexp based ones, for example (what would the performance impact of that, I don't know).However, for LaTeX documents, I think it is fair to say of Jinx that: the face based exclusion rules are efficient and work well in most cases, but the current out-of-the-box structure is (very) hard to tweak for such cases as specific macros or macro argume…