Skip to content

Commit

Permalink
Distinguish inline from display
Browse files Browse the repository at this point in the history
  • Loading branch information
jojo2357 committed Jan 10, 2024
1 parent 4294532 commit dd05dc3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/nl/hannahsten/texifyidea/util/parser/LatexPsiUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fun LatexEndCommand.beginCommand(): LatexBeginCommand? = previousSiblingOfType(L
/**
* Checks if the latex content objects is a display math environment.
*/
fun LatexNoMathContent.isDisplayMath() = children.firstOrNull() is LatexMathEnvironment
fun LatexNoMathContent.isDisplayMath() = children.firstOrNull() is LatexMathEnvironment && children.first().firstChild is LatexDisplayMath

/*
* Technically it's impossible to determine for all cases whether a users wants to compile with biber or biblatex.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,33 @@ class LatexGatherEquationsInspectionTest : TexifyInspectionTestBase(LatexGatherE
myFixture.checkHighlighting()
}

fun `test two consecutive inline math environments`() {
myFixture.configureByText(
LatexFileType,
"""
${"$"}a=b$
${"$"}b=a$
""".trimIndent()
)
myFixture.checkHighlighting()
}

fun `test display math seperated by inline math environments`() {
myFixture.configureByText(
LatexFileType,
"""
\[
a=b
\]
${"$"}c=d$
\[
e=f
\]
""".trimIndent()
)
myFixture.checkHighlighting()
}

fun `test two consecutive (non-display) math environments`() {
myFixture.configureByText(
LatexFileType,
Expand Down

0 comments on commit dd05dc3

Please sign in to comment.