Better selection tools to pick elements from groups (Feature #187)
Description
\copygroup[n]{groupA}{groupB} copies the first n elements from groupA to groupB
I needed a command \pickgroup[n]{groupA}{groupB} very similar which would pick the n^th element from groupA and place to groupB.
Also I needed a command \rangegroup[n][m]{groupA}{groupB} to get the elements from 'n' to 'm' from groupA and place to groupB.
I wrote myself such commands by "rewording" \copygroup, but since I never programmed LaTeX before, maybe some of you guys could check it up.
Cheers,
Andrea
----------------
\newcommand{\pickgroup}[3][1]{ \AMCtok@max=#1\relax \ifnum\the\AMCtok@max<1 \AMCtok@max=\csname #2@k\endcsname \fi \AMCtok@ik=\z@ {\loop \advance\AMCtok@ik\@ne\relax% \ifnum\the\AMCtok@ik<#1\relax% \else \AMC@prepare@element{#3}% \global\csname #3@\romannumeral\AMCtok@k\endcsname=\csname #2@\romannumeral\AMCtok@ik\endcsname% \fi \ifnum\AMCtok@ik<\AMCtok@max\repeat}% } \newcommand{\rangegroup}[4][1]{ \AMCtok@max=#2\relax% \ifnum\the\AMCtok@max<1% \AMCtok@max=\csname #3@k\endcsname% \fi% \AMCtok@ik=\z@% {\loop% \advance\AMCtok@ik\@ne\relax% \ifnum\the\AMCtok@ik<#1\relax% \else \AMC@prepare@element{#4}% \global\csname #4@\romannumeral\AMCtok@k\endcsname=\csname #3@\romannumeral\AMCtok@ik\endcsname% \fi \ifnum\AMCtok@ik<\AMCtok@max\repeat}% }
History
Updated by Alexis Bienvenüe over 11 years ago
- Tracker changed from Bug to Feature
Updated by Alexis Bienvenüe over 11 years ago
- Target version set to 1.3.0
- Description changed from \copygroup[n]{groupA}{groupB} copies the first n elements from groupA to ... to \copygroup[n]{groupA}{groupB} copies the first n elements from groupA to g... More
Updated by Alexis Bienvenüe about 9 years ago
Starting from revision hg:725e121ab255, you can use \copygroupfrom[n]{group-from}{group-to}{starting-index}
.
Updated by Alexis Bienvenüe almost 9 years ago
- % Done changed from 0 to 100
- Status changed from New to Closed