Skip to content

Commit

Permalink
Allow math in newcommand definition
Browse files Browse the repository at this point in the history
  • Loading branch information
PHPirates committed Mar 30, 2024
1 parent ae20fb0 commit df18225
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
5 changes: 0 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,6 @@ Thanks to @jojo2357 and @MisterDeenis for contributing to this release!
* Other small bug fixes and improvements. ([#2776](https://github.com/Hannah-Sten/TeXiFy-IDEA/issues/2776), [#2774](https://github.com/Hannah-Sten/TeXiFy-IDEA/issues/2774), [#2765](https://github.com/Hannah-Sten/TeXiFy-IDEA/issues/2765)-[#2773](https://github.com/Hannah-Sten/TeXiFy-IDEA/issues/2773))

[Unreleased]: https://github.com/Hannah-Sten/TeXiFy-IDEA/compare/v0.9.5-alpha.6...HEAD
[0.9.5-alpha.2]: https://github.com/Hannah-Sten/TeXiFy-IDEA/compare/v0.9.5-alpha.1...v0.9.5-alpha.2
[0.9.5-alpha.1]: https://github.com/Hannah-Sten/TeXiFy-IDEA/compare/v0.9.4...v0.9.5-alpha.1
[0.9.5-alpha.3]: https://github.com/Hannah-Sten/TeXiFy-IDEA/compare/v0.9.5-alpha.2...v0.9.5-alpha.3
[0.9.5-alpha.4]: https://github.com/Hannah-Sten/TeXiFy-IDEA/compare/v0.9.5-alpha.3...v0.9.5-alpha.4
[0.9.5-alpha.6]: https://github.com/Hannah-Sten/TeXiFy-IDEA/compare/v0.9.5-alpha.4...v0.9.5-alpha.6
[0.9.4]: https://github.com/Hannah-Sten/TeXiFy-IDEA/compare/v0.9.3...v0.9.4
[0.9.3]: https://github.com/Hannah-Sten/TeXiFy-IDEA/compare/v0.9.3...v0.9.2
[0.9.2]: https://github.com/Hannah-Sten/TeXiFy-IDEA/compare/v0.9.1...v0.9.2
Expand Down
2 changes: 1 addition & 1 deletion src/nl/hannahsten/texifyidea/grammar/LatexLexer.flex
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ END_PSEUDOCODE_BLOCK="\\EndFor" | "\\EndIf" | "\\EndWhile" | "\\Until" | "\\EndL

// We have to explicitly specify in which states the $ starts an inline math,
// because definitely not in all states this should be the case (like inline math)
<YYINITIAL,DISPLAY_MATH,PSEUDOCODE> {
<YYINITIAL,DISPLAY_MATH,PSEUDOCODE,NEW_COMMAND_DEFINITION_PARAM2> {
"$" { yypushState(INLINE_MATH); return INLINE_MATH_START; }
{ROBUST_INLINE_MATH_START} { yypushState(INLINE_MATH_LATEX); return INLINE_MATH_START; }
}
Expand Down
2 changes: 1 addition & 1 deletion test/nl/hannahsten/texifyidea/psi/LatexParserTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ class LatexParserTest : BasePlatformTestCase() {
\insertedObject
\begin{multicols}{2}
}
\newcommand{\cmd}{${'$'}x\$}
\newcommand{\cmd}{${'$'}x${'$'}}
""".trimIndent()
)
myFixture.checkHighlighting()
Expand Down

0 comments on commit df18225

Please sign in to comment.