Skip to content

Multiline \boxed{} used in math mode breaks highlighting #4331

@muzimuzhi

Description

@muzimuzhi

Environment

  • TeXstudio: 4.9.2
  • Qt: 6.10.2
  • OS: macOS 15.7.3
  • TeX distribution: BasicTeX 2025 (irrelevant)

Expected behavior

Multiline \boxed{} used in math mode doesn't break highlighting.

Actual behavior

It breaks highlighting for some closing delimiters.

\documentclass{article}
\usepackage{amsmath}

\begin{document}
% ok
\[
  \boxed{}
\]

% "\]" raises "Unrecognized command"
\[
  \boxed{
  }
\]
\end{document}
Image
\documentclass{article}
\usepackage{amsmath}

\begin{document}
% ok
$
  \boxed{}
$

% "\end{document}" raises "closing environment which has not been opened"
$
  \boxed{
  }
$
\end{document}
Image

More info

\boxed from amsmath package has cwl entry

\boxed{formula}

Other commands having formula arguments share the same issue, for example the \ch from chemformula package. So this is caused by handling of cwl command arguments named formula or ending with %formula.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions