Skip to content

Negative values in TextBlock #369

@lukzapo

Description

@lukzapo

Encountered an issue where I wanted to pass a negative value for vertical_pos while calling TextBlock class.

TextBlock(width, horizontal_pos, vertical_pos)

Once a negative value was passed, dumps() would show that negative value as {-}123 instead -123
I found issue #144 and #276 which suggested to use NoEscape() however that not solved my issue at all. After digging into the code I found the issue in utils.py file.

While joining strings for TeX dumping in escape_latex() the function checks for specific LaTeX escape characters in _latex_special_chars' dictionary. Here the code finds that if '-' is encountered, it is supposed to be rendered as '{-}'. After removing this item from the dictionary all my code compiles just fine. I don't know exactly in what cases '-' has to be rendered with curly brackets, but so far I had no issues (and I use plenty of '-' for other functions etc.)

Could this bugfix be potentially further tested and implemented if it passes checks?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions