Skip to content

Commit

Permalink
Add gather to removable environments (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmartinv authored Oct 19, 2023
1 parent eacdb0f commit 27011d9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ protected AnnotatedString removeEnvironments(AnnotatedString as)
*/
protected boolean isEnvironmentStart(/*@ non_null @*/ String line)
{
if (line.matches(".*\\\\begin\\s*\\{\\s*(align|displaymath|equation|table|tabular|verbatim|lstlisting|IEEEkeywords|figure|wrapfigure|eqnarray).*") || line.matches(".*\\\\\\[[^\\]]*"))
if (line.matches(".*\\\\begin\\s*\\{\\s*(align|displaymath|equation|table|tabular|verbatim|lstlisting|IEEEkeywords|figure|wrapfigure|eqnarray|gather).*") || line.matches(".*\\\\\\[[^\\]]*"))
{
return true;
}
Expand All @@ -231,7 +231,7 @@ protected boolean isEnvironmentStart(/*@ non_null @*/ String line)
*/
protected boolean isEnvironmentEnd(/*@ non_null @*/ String line)
{
if (line.matches(".*\\\\end\\s*\\{\\s*(align|equation|table|tabular|verbatim|lstlisting|IEEEkeywords|figure|wrapfigure|eqnarray).*") || line.matches(".*\\\\\\].*"))
if (line.matches(".*\\\\end\\s*\\{\\s*(align|equation|table|tabular|verbatim|lstlisting|IEEEkeywords|figure|wrapfigure|eqnarray|gather).*") || line.matches(".*\\\\\\].*"))
{
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,15 @@ public void testRemoveEquations4() throws TextCleanerException
assertEquals("12-uniform graph", as.toString());
}

@Test
public void testRemoveGather() throws TextCleanerException
{
LatexCleaner detexer = new LatexCleaner();
detexer.setIgnoreBeforeDocument(false);
AnnotatedString as = detexer.clean(AnnotatedString.read(new Scanner("\\begin{gather}x=b^2-\\sqrt(2a-b)\\end{gather}")));
assertEquals("", as.toString());
}

@Test
public void testRemoveLabels1() throws TextCleanerException
{
Expand Down

0 comments on commit 27011d9

Please sign in to comment.