Skip to content

Conversation

@Bubu-Droid
Copy link
Contributor

@Bubu-Droid Bubu-Droid commented Aug 16, 2025

Add more de-macros

Here is the description that I wrote in the mail.

  1. My pull request is a superset of the functionalities in the current script except for the \NN to {\mathbb N} conversion. My script converts \NN to \mathbb{N}. I don't understand the significance of the curly braces around \mathbb N. Thus I have commented out the lines from 102–107. Moreover, the additional command demacros (dedicated for my sty file) have been placed after a comment saying # Bubu additions. This block may be removed.
  2. I've additional functions like derv_demacro which convert commands like \dd[n]{y}{x} to \frac{\mathrm{d}^{n} y}{\mathrm{d} x^{n}}. I have noticed that evan.sty does not have this command. So this function may be removed as it is independent from the rest of the code (except the part where the function is being called).
  3. The function oper_demacro converts \floor{\ceil{x}} to \left\lfloor \left\lceil x \right\rceil \right\rfloor. This also converts other commands like "\\anbr": (" \\left\\langle ", " \\right\\rangle "),. All these tuples definitions are placed in a dictionary called oper_macros. The additional conversions (based on evan.sty) can be removed without breaking the working of the function.
  4. I have commented out the block of code which converts \n\n to \n since this essentially joins the paragraph together which defeats the sense of creating paragraphs in the TeX document. This code can be uncommented to get back the previous functionality.

von/strparse.py Outdated
text = re.sub(r"\\textbf{([^}]*)}", r"[b]\1[/b]", text)
text = re.sub(
r"\\paragraph{([^}]*)}", DIVIDER + r"[color=blue][b]\1[/b][/color]", text
r"\\paragraph{([^}]*)}", DIVIDER + r"[color=blue][b]\1[/b][/solor]", text
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this here?

von/strparse.py Outdated
return charpos


def derv_demacro(text: str) -> str:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we can take out derv_demacro for the public von

von/strparse.py Outdated
# return "\n".join(paragraphs)


if __name__ == "__main__":
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think in the public version we should have additional pyperclip dependency or this block

von/strparse.py Outdated
# " ".join([line.strip() for line in paragraph.splitlines()]).strip()
# for paragraph in text.split("\n\n")
# ]
# return "\n".join(paragraphs)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should revert, this was intentional. aops wraps newlines differently

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which converts \n\n to \n since this essentially joins the paragraph together which defeats the sense of creating paragraphs in the TeX document.

that's not true. What this does is so that a paragraph that looks like

Lorem ipsum
dolor sit
amet.

Consecutur
adisciping elit.

gets rewritten to

Lorem ipsum dolor sit amet.
Consecutur adisciping elit.

which is necessary for AOPS. Otherwise the wrapping on AoPS will be weird.

You could argue that it should be

Lorem ipsum dolor sit amet.

Consecutur adisciping elit.

I think I thought about this a long time ago and decided I preferred the more compact one, but I don't remember why. Either way, though, deleting this block is definitely wrong for AOPS.

von/strparse.py Outdated
(r"\RR", r"{\mathbb R}"),
(r"\QQ", r"{\mathbb Q}"),
(r"\FF", r"{\mathbb F}"),
# (r"\NN", r"{\mathbb N}"),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't comment out, just delete

von/strparse.py Outdated
return text


def comm_demacro(text: str) -> str:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this one should just be called demacro because it's used by other components

Copy link
Owner

@vEnhance vEnhance left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, we can try this out, thanks.

@vEnhance vEnhance merged commit da15cc1 into vEnhance:main Aug 23, 2025
3 checks passed
@vEnhance
Copy link
Owner

vEnhance commented Aug 23, 2025

v3.4.0 was just published with #38 and #39

https://github.com/vEnhance/von/releases/tag/v3.4.0

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