Skip to content

Conversation

@EasonBz
Copy link

@EasonBz EasonBz commented Mar 27, 2025

Added a prompt to ensure that the LaTeX code generated by o3-mini correctly wraps mathematical expressions with escape characters.

Added correction logic after line 41 in TheoremExplainAgent/task_generator/prompts_raw/prompt_code_generation.txt:
LaTeX Special Character Handling: Ensure that all special characters in LaTeX text (such as underscores _, percent signs %, hash symbols #, dollar signs $, etc.) are properly escaped. For example, add_intro should be written as add_intro. For mathematical expressions (like O(n^2)), make sure they are enclosed in math mode using $O(n^2)$ or (O(n^2)).

Added correction logic after line 30 in task_generator/prompts_raw/prompt_scene_technical_implementation.txt:
LaTeX Text Handling Error: When generating text that includes LaTeX, ensure that all special characters are properly escaped. For mathematical expressions (such as O(n^2)), make sure they are enclosed in math mode using $O(n^2)$. This is because LaTeX interprets unescaped underscores and superscript symbols as the beginning of math mode, which can lead to compilation errors.

…ctly wraps mathematical expressions with escape characters.
@vinesmsuic
Copy link
Member

vinesmsuic commented Mar 30, 2025

Hi, have you tested with this prompt actually help the compilation error? Note that you need to run parse_prompt.py to update the stored prompts into __init__.py. Since I looked into the PR, only files in prompt_raw folder is changed, that wont directly impact the behavior of THA.

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.

3 participants