-
Notifications
You must be signed in to change notification settings - Fork 17
feat: Add more demacros #39
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
Conversation
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 |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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__": |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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}"), |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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
vEnhance
left a comment
There was a problem hiding this 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.
Add more de-macros
Here is the description that I wrote in the mail.
\NNto{\mathbb N}conversion. My script converts\NNto\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.derv_demacrowhich convert commands like\dd[n]{y}{x}to\frac{\mathrm{d}^{n} y}{\mathrm{d} x^{n}}. I have noticed thatevan.stydoes 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).oper_demacroconverts\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 calledoper_macros. The additional conversions (based on evan.sty) can be removed without breaking the working of the function.\n\nto\nsince 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.