Skip to content

Fix: implement LaTeX character escaping for game labels and player names#51

Open
tanav8570 wants to merge 1 commit intogambitproject:mainfrom
tanav8570:fix/latex-label-encoding
Open

Fix: implement LaTeX character escaping for game labels and player names#51
tanav8570 wants to merge 1 commit intogambitproject:mainfrom
tanav8570:fix/latex-label-encoding

Conversation

@tanav8570
Copy link

Description:
This PR resolves a RuntimeError during PDF generation caused by unescaped LaTeX reserved characters in game labels, player names, and titles. For examples special characters like #,_ , $, %, { , }, etc.

Key Changes:

  1. Implemented latex_special_char() to handle encoding of _, $, #, , and other reserved characters.
  2. Updated gambit_layout_to_ef to pass all user-defined strings through this encoding layer.
  3. Handled backslash replacement separately to prevent double-escaping issues.

Testing:
Verified with a test script using labels like ACTION_!1 and Testing$100. The PDF now compiles successfully where it previously failed.

@tanav8570
Copy link
Author

Hi! I'm Tanav, a student at IIT Delhi. I'm very interested in the GSoC project for draw_tree (Idea-3) and wanted to start by fixing this LaTeX encoding issue I discovered while testing the library. Looking forward to your feedback!

@edwardchalstrey1
Copy link
Member

edwardchalstrey1 commented Mar 9, 2026

Hi! I'm Tanav, a student at IIT Delhi. I'm very interested in the GSoC project for draw_tree (Idea-3) and wanted to start by fixing this LaTeX encoding issue I discovered while testing the library. Looking forward to your feedback!

Hi Tanav, thanks for your enthusiasm. Please before going further have a read of the contribution guidelines for GSoC: https://www.gambit-project.org/gsoc_2026/#contributor-guidance

Edit: If this is Tanav Gupta, we have seen your email reaching out and will respond as soon as we can, though please be advised we have a high volume of applications to get through :)

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