Skip to content

Conversation

@Bubu-Droid
Copy link
Contributor

@Bubu-Droid Bubu-Droid commented Dec 18, 2025

Leading and trailing white-spaces in the copied TeX code (usually due to indentation) cause the script to fail. We use lstrip to strip the leading white-spaces. But since trailing white-spaces are more likely to be an error on the user's part, we do not remove that and let the script fail there so that the user realizes that their code has some trailing white-space and can fix it manually.

Moreover, we usually want the content inside claim to be right beside the title keyword and the QED to be at the end of the same line where the solution ends. Hence the other changes.

@Bubu-Droid
Copy link
Contributor Author

Well, since trailing white-spaces shouldn't be intended, should I add another function through which the copied text would pass through at first which would print out the lines (and probably the line numbers) which have trailing white-spaces. Then I'll ask the user to remove them before running the script again.

@vEnhance
Copy link
Owner

What does "cause the script to fail" mean?

I don't see why we want to remove leading spaces. It's important to note that strparse is not just for AoPS but other purposes too, where the leading spaces are actually intentional indentation and I think it's a regression to remove them all. But more importantly: remove_soft_newlines is never called anywhere? So I don't see what editing that function body is going to do. (I don't remember why we have a never-used function... maybe something got garbled somewhere along the PR process).

I think people should be using an editor that trims out all trailing whitespace anyway; AFAIK there is never any reason why any lines in TeX files should have trailing whitespace. I think that's not von's job.

I think the changes to \begin{proof} are not good because constructs like

\begin{proof}[Proof of lemma]
...
\end{proof}

will no longer work. So this also seems to be a regression.

@Bubu-Droid
Copy link
Contributor Author

Bubu-Droid commented Dec 26, 2025

Oof, I'm really sorry. I didn't notice that strparse.py doesn't use the remove_soft_newlines function.
This function (remove_soft_newlines) wasn't removing soft line breaks if there were indentations as in the regex

r"[a-zA-Z.,;—\"–'):$]\n[a-zA-Z$'\"]"

the second group doesn't match any white-space characters. Due to some weird reason, I had the newline joining logic (inside toAOPS function) commented out and was using this function instead in my local copy of the script.

I've added an autocmd to strip trailing white-spaces now. Sorry again, I'll close the pull request.

@Bubu-Droid Bubu-Droid closed this Dec 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants