================================================================================ Command without arguments ================================================================================ \foo bar -------------------------------------------------------------------------------- (source_file (generic_command (command_name)) (text (word))) ================================================================================ Command with one curly argument ================================================================================ \foo{bar} -------------------------------------------------------------------------------- (source_file (generic_command (command_name) (curly_group (text (word))))) ================================================================================ Command with one curly argument and brackets ================================================================================ \foo{bar}[baz] -------------------------------------------------------------------------------- (source_file (generic_command (command_name) (curly_group (text (word)))) (text (word))) ================================================================================ Command with incomplete argument ================================================================================ \foo{ \begin{document} \end{document} -------------------------------------------------------------------------------- (source_file (ERROR (command_name) (generic_environment (begin (curly_group_text (text (word)))) (end (curly_group_text (text (word))))))) ================================================================================ Acroynm definition ================================================================================ \newacronym[foo={bar}]{gcd}{GCD}{Greatest Common Divisor} -------------------------------------------------------------------------------- (source_file (acronym_definition (brack_group_key_value (key_value_pair (text (word)) (value (curly_group (text (word)))))) (curly_group_text (text (word))) (curly_group (text (word))) (curly_group (text (word) (word) (word))))) ================================================================================ Command definition without default arg ================================================================================ \newcommand{\foo}[1]{#1} -------------------------------------------------------------------------------- (source_file (new_command_definition (curly_group_command_name (command_name)) (brack_group_argc (argc)) (curly_group (text (placeholder))))) ================================================================================ Command definition with default arg ================================================================================ \newcommand{\foo}[1][bar]{#1} -------------------------------------------------------------------------------- (source_file (new_command_definition (curly_group_command_name (command_name)) (brack_group_argc (argc)) (brack_group (text (word))) (curly_group (text (placeholder))))) ================================================================================ Command definition without curly braces ================================================================================ \newcommand\foo[1]{#1} -------------------------------------------------------------------------------- (source_file (new_command_definition (command_name) (brack_group_argc (argc)) (curly_group (text (placeholder))))) ================================================================================ Command definition (xparse) ================================================================================ \NewDocumentCommand{\foo}{m}{#1} -------------------------------------------------------------------------------- (source_file (new_command_definition (curly_group_command_name (command_name)) (curly_group_spec (text (word))) (curly_group (text (placeholder))))) ================================================================================ Command definition with optional argument (xparse) ================================================================================ \NewDocumentCommand{\foo}{o{default} m}{#1 #2} -------------------------------------------------------------------------------- (source_file (new_command_definition (curly_group_command_name (command_name)) (curly_group_spec (text (word)) (curly_group (text (word))) (text (word))) (curly_group (text (placeholder) (placeholder))))) ================================================================================ Author command ================================================================================ \author{John Doe \and Foo Bar} -------------------------------------------------------------------------------- (source_file (author_declaration (curly_group_author_list (author (text (word) (word))) (command_name) (author (text (word) (word)))))) ================================================================================ Text commands ================================================================================ \intertext{John Doe } \text{Foo Bar} -------------------------------------------------------------------------------- (source_file (text_mode (curly_group (text (word) (word)))) (text_mode (curly_group (text (word) (word))))) ================================================================================ Hyperlinks ================================================================================ \url{https://github.com/latex-lsp/tree-sitter-latex} \href{https://github.com/latex-lsp/tree-sitter-latex}{tree-sitter-latex} \href{https://github.com/latex-lsp/tree-sitter-latex/issues?q=hyperlink} {search ``hyperlink''} \href{file:///path/to/file_containing spaces, and also commas}{file URI} -------------------------------------------------------------------------------- (source_file (hyperlink (curly_group_uri (uri))) (hyperlink (curly_group_uri (uri)) (curly_group (text (word) (operator) (word) (operator) (word)))) (hyperlink (curly_group_uri (uri)) (curly_group (text (word) (word)))) (hyperlink (curly_group_uri (uri)) (curly_group (text (word) (word)))))