I'm trying to make a macro such that I give it arguments like this


such that it expands to,


I'm trying (for no special reason) doing this with \@for command, this is what I've attempted


It's perfect in every way, except that there is a little + hanging around at the end. Is there a way to solve this?

  • Also, yeah, I kinda solved it now, by inverting the position of the + and just treating the first case as special. But maybe there is still a way to solve it by really considering the last case scenario?
    – Rainb
    Commented May 16, 2021 at 7:11

1 Answer 1


With expl3:


  % make a sequence from the argument
  \seq_set_from_clist:Nn \l_tmpa_seq { #1 }
  % add ^2 to every item
  \seq_set_map:NNn \l_tmpb_seq \l_tmpa_seq { ##1^2 }
  % deliver the sequence with + between items
  \sqrt{\seq_use:Nn \l_tmpb_seq { + }}




enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .