Trying to keep this simple. Given that the following, what is wrong with the commented out code (neither one works unfortunately), and what is an alternative way to do that? "That" being access a property list via a key which needs to be expanded.



\tl_new:N \templist
\prop_new:N \tablestart
    \prop_put:Nnn \tablestart {u}{tablestart 1}
    \prop_put:Nnn \tablestart {u}{tablestart 2}
    \prop_put:Nnn \tablestart {u}{tablestart 3}
\tl_new:N \tablebody
\seq_new:N \entryuvw
    \seq_put_right:Nn \entryuvw {u}
    \seq_put_right:Nn \entryuvw {v}
    \seq_put_right:Nn \entryuvw {w}

\cs_new_protected:Nn \make_entry:n {
    \int_step_inline:nnnn { 1 } { 1 } { 3 } {
        \tl_set:Nx \templist {\seq_item:Nn \entryuvw {##1}}
        %\prop_get:NxN \tablestart {\tl_use:N \templist} \tablebody
        %\prop_get:NVN \tablestart \templist \tablebody

\make_entry:n {}


needs an output line
  • First of all \cs_generate_variant:Nn \prop_get:NnN { Nx }. – Manuel Feb 18 '16 at 21:00
  • I dont understand, what does that do exactly? – Bob Feb 18 '16 at 21:39
  • I meant that it wasn't defined. You need to generate \prop_get:NxN if it is not defined. – Manuel Feb 18 '16 at 23:40

You should use

\prop_get:NVN \tablestart \templist \tablebody

which is equivalent to

\prop_get:NnN \tablestart {<contents of \templist>} \tablebody

Your naming of variables is wrong, I'm afraid: please adhere to the expl3 conventions in this regard.



\tl_new:N \l_bob_templist_tl
\tl_new:N \l_bob_tablebody_tl
\prop_new:N \l_bob_tablestart_prop
\seq_new:N \l_bob_entryuvw_seq

\prop_put:Nnn \l_bob_tablestart_prop {u}{tablestart 1}
\prop_put:Nnn \l_bob_tablestart_prop {v}{tablestart 2}
\prop_put:Nnn \l_bob_tablestart_prop {w}{tablestart 3}

\seq_put_right:Nn \l_bob_entryuvw_seq {u}
\seq_put_right:Nn \l_bob_entryuvw_seq {v}
\seq_put_right:Nn \l_bob_entryuvw_seq {w}

\cs_new_protected:Nn \make_entry:
  \int_step_inline:nnnn { 1 } { 1 } { 3 }
    \tl_set:Nx \l_bob_templist_tl {\seq_item:Nn \l_bob_entryuvw_seq {##1}}
    \prop_get:NVN \l_bob_tablestart_prop \l_bob_templist_tl \l_bob_tablebody_tl





I've made the macro to print the contents of the two token list variables for checking that the result is what's expected.

enter image description here

| improve this answer | |
  • Darn it I even tried that, but not until I had made this minimum working example, in which I made a typo in line 10,11, and 12, in which I accidentally assigned all three property values to the same key. Anyways thanks for the help egreg. As for the naming thing I am confused. When I first asked about this and did some research I was led to believe that the names didnt actually have an effect? Does adding the variable type and local/global actually change the way it works? – Bob Feb 18 '16 at 22:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.