Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gather to removable environments #231

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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