parsed <- parseLatex("\\section[a]{b}")
macro <- find_macro(parsed, "\\section")
bracket_options(parsed, start = macro + 1)
bracket_options(parsed, start = macro + 1) <- "Short Title"
parsed
brace_options(parsed, start = macro + 1)
brace_options(parsed, start = macro + 1) <- "Long Title"
parsed
Run the code above in your browser using DataLab