Il 26/06/24 22:25, Stefan Monnier ha scritto: > Note that "test if a parenthesis in LaTeX (latex-mode) starts a balanced > expression" is a kind of weird request, because it will only return nil > if there's a missing close-paren but not if there are too many > close-parens, i.e. it only detects one half of the imbalances. > > > Stefan For my purposes it is enough. I need to write a function to interactively resize mathematical parentheses based on their content, such as "\left( ... \right)". So far, I have successfully used `sexp-at-point`, but this function does not recognize balanced expressions that contain ";" and only works with "(" and "[" but not with < etc.. The `forward-sexp` function does not necessarily give an error if the parenthesis does not start a balanced expression. E.g. $( x + y ]$ here "(" does not start a balanced expression but `forward-sexp` does not return an error. Gabriele