LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Monospaced Font
Show HTML Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Mon, 29 Aug 2011 10:10:39 -0400
Reply-To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Subject:
MIME-Version:
1.0
Message-ID:
In-Reply-To:
Content-Type:
text/plain; charset=ISO-8859-1
From:
Bruno Le Floch <[log in to unmask]>
Parts/Attachments:
text/plain (34 lines)
> The is no pre-build 'strip_braces' function at present. You don't say if
> we are talking one set of braces or multiple sets. For the former case,
> a simple 'do nothing' loops would be easiest:
>
>   \tl_set:Nx \l_temp_tl
>     { \tl_map_function:NN \l_temp_tl \exp_not:n }

Agreed with Joseph. If you need to recursively remove braces, and
don't care about speed, the following should work (unless I screwed
up), and it doesn't remove spaces, although it easily could.

\cs_new:Npn \tl_ungroup_all:n
  {
    \tex_romannumeral:D
    \tl_act_aux:NNNnn
      \tl_act_ungroup_normal:nN
      \tl_act_ungroup_group:nn
      \tl_act_ungroup_space:n
      { }
  }
\cs_new:Npn \tl_act_ungroup_space:n #1
  { \tl_act_output:n {~} }
\cs_new:Npn \tl_act_ungroup_normal:nN #1 #2
  { \tl_act_output:n {#2} }
\cs_new:Npn \tl_act_ungroup_group:nn #1
  {
    \tl_act_group_recurse:Nnn
      \tl_act_output:n
      { \tl_ungroup_all:n }
  }

Cheers,
Bruno

ATOM RSS1 RSS2