Search code examples
parsinglatexuser-defined-data-types

Does latex have a data type checking function?


Does latex provide any functions like typeof or instanceof that would allow it to discern between different types of objects? How do I define variables to begin with?

I'm trying to write a latex macro that takes a string, like 1, -2, \frac{2}{3} and it returns a point notation as in \bigg(1, -2, \frac{2}{3}\bigg), meaning that I need the ability to parse text for delimiters, like commas, and to be able to figure the difference between rational fractions and decimal numbers or integers, so that it knows when to use small or big parenthesis.


Solution

  • Instead of reinventing the wheel, let latex do the resizing:

    \documentclass{article}
    
    \begin{document}
    
    \[
    \left(1, -2, \frac{2}{3}\right)
    \]
    
    \end{document}
    

    enter image description here