Looping over charts and names simultaneouslyIncrements in foreach loop with two variables, TikZLooping and linking with TikZlooping in tabularCreate a document looping through imagesLooping over elements to change font in math modeLooping Through a Nested ListTikZ scaling graphic and adjust node position and keep font sizeLooping over stringsLooping over macro arguments with spaces and building partial commandsAlternating/looping section dividerstikzset does not work in foreach loop

How to return a security deposit to a tenant

Can U.S. Tax Forms Be Legally HTMLified?

Soft question: Examples where lack of mathematical rigour cause security breaches?

How can electric fields be used to detect cracks in metals?

Mathematically, why does mass matrix / load vector lumping work?

Do simulator games use a realistic trajectory to get into orbit?

Can tefillin be "switched"?

Did Milano or Benatar approve or comment on their namesake MCU ships?

Existence of a pointwise convergent subsequence

How can I tell the difference between unmarked sugar and stevia?

Winning Strategy for the Magician and his Apprentice

How to hide an urban landmark?

Why is only the fundamental frequency component said to give useful power?

Is using haveibeenpwned to validate password strength rational?

What is the actual quality of machine translations?

Thread Pool C++ Implementation

SOQL Not Recognizing Field?

How can I end combat quickly when the outcome is inevitable?

Someone whose aspirations exceed abilities or means

Preventing employees from either switching to competitors or opening their own business

How Often Do Health Insurance Providers Drop Coverage?

Are there any important biographies of nobodies?

Why is one of Madera Municipal's runways labelled with only "R" on both sides?

Medieval flying castle propulsion



Looping over charts and names simultaneously


Increments in foreach loop with two variables, TikZLooping and linking with TikZlooping in tabularCreate a document looping through imagesLooping over elements to change font in math modeLooping Through a Nested ListTikZ scaling graphic and adjust node position and keep font sizeLooping over stringsLooping over macro arguments with spaces and building partial commandsAlternating/looping section dividerstikzset does not work in foreach loop













5















I want to use a common index to loop over two separate comma-separated lists at once, one which is a list of abbreviations and one a list of names. I want to use the abbreviations to import charts as pdfs, and the names to label them.



This is what I have so far:



documentclass[12pt]article
usepackagetikz
usepackagegraphicx

defnamelist"New York", "Illinois","Texas"
defabrevlistNY,IL,TX

begindocument

foreach x in abrevlist %
newpage
section*x % <-- I want to use the state name here

beginfigure[h!]
includegraphics[width=.5textwidth]../charts/summary/x _compare.pdf
captionx % <-- I want to use the state name here
endfigure


enddocument


This imports the figures as I want, but does nothing with the state names. I would like to replace the section and captions with, for example, "New York" in place of "NYC".



Obviously, one could create an index i and loop over that to index the abbreviation or name as necessary. But I can't make that work. Any suggestions? Thanks!










share|improve this question


























    5















    I want to use a common index to loop over two separate comma-separated lists at once, one which is a list of abbreviations and one a list of names. I want to use the abbreviations to import charts as pdfs, and the names to label them.



    This is what I have so far:



    documentclass[12pt]article
    usepackagetikz
    usepackagegraphicx

    defnamelist"New York", "Illinois","Texas"
    defabrevlistNY,IL,TX

    begindocument

    foreach x in abrevlist %
    newpage
    section*x % <-- I want to use the state name here

    beginfigure[h!]
    includegraphics[width=.5textwidth]../charts/summary/x _compare.pdf
    captionx % <-- I want to use the state name here
    endfigure


    enddocument


    This imports the figures as I want, but does nothing with the state names. I would like to replace the section and captions with, for example, "New York" in place of "NYC".



    Obviously, one could create an index i and loop over that to index the abbreviation or name as necessary. But I can't make that work. Any suggestions? Thanks!










    share|improve this question
























      5












      5








      5








      I want to use a common index to loop over two separate comma-separated lists at once, one which is a list of abbreviations and one a list of names. I want to use the abbreviations to import charts as pdfs, and the names to label them.



      This is what I have so far:



      documentclass[12pt]article
      usepackagetikz
      usepackagegraphicx

      defnamelist"New York", "Illinois","Texas"
      defabrevlistNY,IL,TX

      begindocument

      foreach x in abrevlist %
      newpage
      section*x % <-- I want to use the state name here

      beginfigure[h!]
      includegraphics[width=.5textwidth]../charts/summary/x _compare.pdf
      captionx % <-- I want to use the state name here
      endfigure


      enddocument


      This imports the figures as I want, but does nothing with the state names. I would like to replace the section and captions with, for example, "New York" in place of "NYC".



      Obviously, one could create an index i and loop over that to index the abbreviation or name as necessary. But I can't make that work. Any suggestions? Thanks!










      share|improve this question














      I want to use a common index to loop over two separate comma-separated lists at once, one which is a list of abbreviations and one a list of names. I want to use the abbreviations to import charts as pdfs, and the names to label them.



      This is what I have so far:



      documentclass[12pt]article
      usepackagetikz
      usepackagegraphicx

      defnamelist"New York", "Illinois","Texas"
      defabrevlistNY,IL,TX

      begindocument

      foreach x in abrevlist %
      newpage
      section*x % <-- I want to use the state name here

      beginfigure[h!]
      includegraphics[width=.5textwidth]../charts/summary/x _compare.pdf
      captionx % <-- I want to use the state name here
      endfigure


      enddocument


      This imports the figures as I want, but does nothing with the state names. I would like to replace the section and captions with, for example, "New York" in place of "NYC".



      Obviously, one could create an index i and loop over that to index the abbreviation or name as necessary. But I can't make that work. Any suggestions? Thanks!







      tikz-pgf macros graphics loops






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked May 21 at 20:49









      squipbarsquipbar

      1283




      1283




















          3 Answers
          3






          active

          oldest

          votes


















          2














          If you do not need both lists elsewhere, you can just combine them in a single list:



          documentclass[12pt]article
          %usepackagetikz
          usepackagepgffor
          usepackagegraphicx

          defnamelistNew York/NY,Illinois/IL,Texas/TX


          begindocument

          foreach x/y in namelist %
          newpage
          section*x % <-- I want to use the state name here

          beginfigure[h!]
          % includegraphics[width=.5textwidth]../charts/summary/x _compare.pdf
          texttt../charts/summary/y-compare.pdf
          captionx % <-- I want to use the state name here
          endfigure


          enddocument


          (The texttt part shamelessly copied from @egreg)



          It is not necessary to load the whole tikz, pgffor is enough for this.



          enter image description here






          share|improve this answer






























            6














            documentclass[12pt]article
            usepackagetikz

            defnamelist"New York", "Illinois","Texas"
            defabrevlistNY,IL,TX

            begindocument

            foreach X [count=Y starting from 0] in abrevlist %
            newpagepgfmathsetmacromystatenamelist[Y]
            section*mystate % <-- I want to use the state name here

            beginfigure[h!]
            %includegraphics[width=.5textwidth]../charts/summary/X _compare.pdf
            captionX % <-- I want to use the state name here
            endfigure


            enddocument





            share|improve this answer

























            • Nice, but you removed the line that references the filename for the figure. Can you edit to retain that? Will your X still work ok there?

              – squipbar
              May 21 at 21:13











            • @squipbar Good catch. I removed it because I do not have your graphics files.Now it should work if you uncomment it. (There are reasons why X might be better than x, even though here it does not matter.)

              – marmot
              May 21 at 21:18











            • This still gives me an error. I get: ! Package PGF Math Error: Unknown function New' (in 'New York,Illinois,Texas[0]').`

              – squipbar
              May 21 at 21:54











            • @squipbar Do you run the precise code from above or a version in which you removed the " from namelist? The error message suggests that you are using something like defnamelistNew York,Illinois,Texas or defnamelistNew York,Illinois,Texas. Also the number of is important in pgfmathsetmacromystatenamelist[Y], i.e. pgfmathsetmacromystatenamelist[Y] won't work.

              – marmot
              May 21 at 21:57












            • Yes, I was removing the ". But only because I was getting an error when I included them! With them, I get ! Missing number, treated as zero. <to be read again> N l.18 ~. So it looks like this solution is indexing the "N" somehow, rather than the whole fist entry, "New York" (evidence: if I change the first state to Illinois, that N becomes an I).

              – squipbar
              May 22 at 14:39



















            2














            Here's my proposal.



            documentclassarticle
            usepackagexparse

            ExplSyntaxOn
            NewDocumentCommandmaketwoprongedlistm m

            prop_new:c g_squipbar_list_#1_plist
            seq_new:c g_squipbar_list_#1_seq
            clist_map_inline:nn #2

            __squipbar_list_entry:nnn #1 ##1



            cs_new_protected:Nn __squipbar_list_entry:nnn

            seq_gput_right:cn g_squipbar_list_#1_seq #2
            prop_gput:cnn g_squipbar_list_#1_plist short@#2 #2
            prop_gput:cnn g_squipbar_list_#1_plist long@#2 #3


            NewDocumentCommandusetwoprongedlistm +m

            cs_set_protected:Nn __squipbar_list_entry:nn #2
            seq_map_inline:cn g_squipbar_list_#1_seq

            __squipbar_list_entry:nn
            prop_item:cn g_squipbar_list_#1_plist short@##1
            prop_item:cn g_squipbar_list_#1_plist long@##1



            ExplSyntaxOff

            maketwoprongedliststates
            NYNew York,
            ILIllinois,
            TXTexas


            begindocument

            usetwoprongedliststates%
            newpage
            section*#2 % <-- I want to use the state name here

            beginfigure[h!]
            centering
            %includegraphics[width=.5textwidth]../charts/summary/x _compare.pdf
            texttt../charts/summary/#1-compare.pdf
            caption#2 % <-- I want to use the state name here
            endfigure


            enddocument


            enter image description here



            Since I don't have your pictures, I emulated them by just printing the file name.



            How does this work?



            First of all, I define a list giving it a name. The items are comma separated and should consist of <abbreviation><full name>. The first part is also used for indexing and so it should consist of characters only (but this might be overcome, in case of need).



            Each part is then stored as an item in a property list, indexed as short@<abbreviation> and long@<abbreviation>. Also a sequence is maintained containing the abbreviations, for later usage; the order will be that of input.



            The usetwoprongedlist command has two arguments: the first is the list to be processed; the second argument is a template, just like the main argument to foreach; the difference is that #1 and #2 are used to denote the short and long versions of the current item.



            A scratch function is defined and then the sequence indexing the list's items is mapped, calling the scratch function with arguments



            prop_item:cn <list name> short@<current item> 


            and



            prop_item:cn <list name> long@<current item> 


            respectively. Et voilà.






            share|improve this answer























              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "85"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f492002%2flooping-over-charts-and-names-simultaneously%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              2














              If you do not need both lists elsewhere, you can just combine them in a single list:



              documentclass[12pt]article
              %usepackagetikz
              usepackagepgffor
              usepackagegraphicx

              defnamelistNew York/NY,Illinois/IL,Texas/TX


              begindocument

              foreach x/y in namelist %
              newpage
              section*x % <-- I want to use the state name here

              beginfigure[h!]
              % includegraphics[width=.5textwidth]../charts/summary/x _compare.pdf
              texttt../charts/summary/y-compare.pdf
              captionx % <-- I want to use the state name here
              endfigure


              enddocument


              (The texttt part shamelessly copied from @egreg)



              It is not necessary to load the whole tikz, pgffor is enough for this.



              enter image description here






              share|improve this answer



























                2














                If you do not need both lists elsewhere, you can just combine them in a single list:



                documentclass[12pt]article
                %usepackagetikz
                usepackagepgffor
                usepackagegraphicx

                defnamelistNew York/NY,Illinois/IL,Texas/TX


                begindocument

                foreach x/y in namelist %
                newpage
                section*x % <-- I want to use the state name here

                beginfigure[h!]
                % includegraphics[width=.5textwidth]../charts/summary/x _compare.pdf
                texttt../charts/summary/y-compare.pdf
                captionx % <-- I want to use the state name here
                endfigure


                enddocument


                (The texttt part shamelessly copied from @egreg)



                It is not necessary to load the whole tikz, pgffor is enough for this.



                enter image description here






                share|improve this answer

























                  2












                  2








                  2







                  If you do not need both lists elsewhere, you can just combine them in a single list:



                  documentclass[12pt]article
                  %usepackagetikz
                  usepackagepgffor
                  usepackagegraphicx

                  defnamelistNew York/NY,Illinois/IL,Texas/TX


                  begindocument

                  foreach x/y in namelist %
                  newpage
                  section*x % <-- I want to use the state name here

                  beginfigure[h!]
                  % includegraphics[width=.5textwidth]../charts/summary/x _compare.pdf
                  texttt../charts/summary/y-compare.pdf
                  captionx % <-- I want to use the state name here
                  endfigure


                  enddocument


                  (The texttt part shamelessly copied from @egreg)



                  It is not necessary to load the whole tikz, pgffor is enough for this.



                  enter image description here






                  share|improve this answer













                  If you do not need both lists elsewhere, you can just combine them in a single list:



                  documentclass[12pt]article
                  %usepackagetikz
                  usepackagepgffor
                  usepackagegraphicx

                  defnamelistNew York/NY,Illinois/IL,Texas/TX


                  begindocument

                  foreach x/y in namelist %
                  newpage
                  section*x % <-- I want to use the state name here

                  beginfigure[h!]
                  % includegraphics[width=.5textwidth]../charts/summary/x _compare.pdf
                  texttt../charts/summary/y-compare.pdf
                  captionx % <-- I want to use the state name here
                  endfigure


                  enddocument


                  (The texttt part shamelessly copied from @egreg)



                  It is not necessary to load the whole tikz, pgffor is enough for this.



                  enter image description here







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered May 22 at 15:47









                  Raoul KesselsRaoul Kessels

                  2,021617




                  2,021617





















                      6














                      documentclass[12pt]article
                      usepackagetikz

                      defnamelist"New York", "Illinois","Texas"
                      defabrevlistNY,IL,TX

                      begindocument

                      foreach X [count=Y starting from 0] in abrevlist %
                      newpagepgfmathsetmacromystatenamelist[Y]
                      section*mystate % <-- I want to use the state name here

                      beginfigure[h!]
                      %includegraphics[width=.5textwidth]../charts/summary/X _compare.pdf
                      captionX % <-- I want to use the state name here
                      endfigure


                      enddocument





                      share|improve this answer

























                      • Nice, but you removed the line that references the filename for the figure. Can you edit to retain that? Will your X still work ok there?

                        – squipbar
                        May 21 at 21:13











                      • @squipbar Good catch. I removed it because I do not have your graphics files.Now it should work if you uncomment it. (There are reasons why X might be better than x, even though here it does not matter.)

                        – marmot
                        May 21 at 21:18











                      • This still gives me an error. I get: ! Package PGF Math Error: Unknown function New' (in 'New York,Illinois,Texas[0]').`

                        – squipbar
                        May 21 at 21:54











                      • @squipbar Do you run the precise code from above or a version in which you removed the " from namelist? The error message suggests that you are using something like defnamelistNew York,Illinois,Texas or defnamelistNew York,Illinois,Texas. Also the number of is important in pgfmathsetmacromystatenamelist[Y], i.e. pgfmathsetmacromystatenamelist[Y] won't work.

                        – marmot
                        May 21 at 21:57












                      • Yes, I was removing the ". But only because I was getting an error when I included them! With them, I get ! Missing number, treated as zero. <to be read again> N l.18 ~. So it looks like this solution is indexing the "N" somehow, rather than the whole fist entry, "New York" (evidence: if I change the first state to Illinois, that N becomes an I).

                        – squipbar
                        May 22 at 14:39
















                      6














                      documentclass[12pt]article
                      usepackagetikz

                      defnamelist"New York", "Illinois","Texas"
                      defabrevlistNY,IL,TX

                      begindocument

                      foreach X [count=Y starting from 0] in abrevlist %
                      newpagepgfmathsetmacromystatenamelist[Y]
                      section*mystate % <-- I want to use the state name here

                      beginfigure[h!]
                      %includegraphics[width=.5textwidth]../charts/summary/X _compare.pdf
                      captionX % <-- I want to use the state name here
                      endfigure


                      enddocument





                      share|improve this answer

























                      • Nice, but you removed the line that references the filename for the figure. Can you edit to retain that? Will your X still work ok there?

                        – squipbar
                        May 21 at 21:13











                      • @squipbar Good catch. I removed it because I do not have your graphics files.Now it should work if you uncomment it. (There are reasons why X might be better than x, even though here it does not matter.)

                        – marmot
                        May 21 at 21:18











                      • This still gives me an error. I get: ! Package PGF Math Error: Unknown function New' (in 'New York,Illinois,Texas[0]').`

                        – squipbar
                        May 21 at 21:54











                      • @squipbar Do you run the precise code from above or a version in which you removed the " from namelist? The error message suggests that you are using something like defnamelistNew York,Illinois,Texas or defnamelistNew York,Illinois,Texas. Also the number of is important in pgfmathsetmacromystatenamelist[Y], i.e. pgfmathsetmacromystatenamelist[Y] won't work.

                        – marmot
                        May 21 at 21:57












                      • Yes, I was removing the ". But only because I was getting an error when I included them! With them, I get ! Missing number, treated as zero. <to be read again> N l.18 ~. So it looks like this solution is indexing the "N" somehow, rather than the whole fist entry, "New York" (evidence: if I change the first state to Illinois, that N becomes an I).

                        – squipbar
                        May 22 at 14:39














                      6












                      6








                      6







                      documentclass[12pt]article
                      usepackagetikz

                      defnamelist"New York", "Illinois","Texas"
                      defabrevlistNY,IL,TX

                      begindocument

                      foreach X [count=Y starting from 0] in abrevlist %
                      newpagepgfmathsetmacromystatenamelist[Y]
                      section*mystate % <-- I want to use the state name here

                      beginfigure[h!]
                      %includegraphics[width=.5textwidth]../charts/summary/X _compare.pdf
                      captionX % <-- I want to use the state name here
                      endfigure


                      enddocument





                      share|improve this answer















                      documentclass[12pt]article
                      usepackagetikz

                      defnamelist"New York", "Illinois","Texas"
                      defabrevlistNY,IL,TX

                      begindocument

                      foreach X [count=Y starting from 0] in abrevlist %
                      newpagepgfmathsetmacromystatenamelist[Y]
                      section*mystate % <-- I want to use the state name here

                      beginfigure[h!]
                      %includegraphics[width=.5textwidth]../charts/summary/X _compare.pdf
                      captionX % <-- I want to use the state name here
                      endfigure


                      enddocument






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited May 21 at 21:16

























                      answered May 21 at 21:00









                      marmotmarmot

                      133k6169319




                      133k6169319












                      • Nice, but you removed the line that references the filename for the figure. Can you edit to retain that? Will your X still work ok there?

                        – squipbar
                        May 21 at 21:13











                      • @squipbar Good catch. I removed it because I do not have your graphics files.Now it should work if you uncomment it. (There are reasons why X might be better than x, even though here it does not matter.)

                        – marmot
                        May 21 at 21:18











                      • This still gives me an error. I get: ! Package PGF Math Error: Unknown function New' (in 'New York,Illinois,Texas[0]').`

                        – squipbar
                        May 21 at 21:54











                      • @squipbar Do you run the precise code from above or a version in which you removed the " from namelist? The error message suggests that you are using something like defnamelistNew York,Illinois,Texas or defnamelistNew York,Illinois,Texas. Also the number of is important in pgfmathsetmacromystatenamelist[Y], i.e. pgfmathsetmacromystatenamelist[Y] won't work.

                        – marmot
                        May 21 at 21:57












                      • Yes, I was removing the ". But only because I was getting an error when I included them! With them, I get ! Missing number, treated as zero. <to be read again> N l.18 ~. So it looks like this solution is indexing the "N" somehow, rather than the whole fist entry, "New York" (evidence: if I change the first state to Illinois, that N becomes an I).

                        – squipbar
                        May 22 at 14:39


















                      • Nice, but you removed the line that references the filename for the figure. Can you edit to retain that? Will your X still work ok there?

                        – squipbar
                        May 21 at 21:13











                      • @squipbar Good catch. I removed it because I do not have your graphics files.Now it should work if you uncomment it. (There are reasons why X might be better than x, even though here it does not matter.)

                        – marmot
                        May 21 at 21:18











                      • This still gives me an error. I get: ! Package PGF Math Error: Unknown function New' (in 'New York,Illinois,Texas[0]').`

                        – squipbar
                        May 21 at 21:54











                      • @squipbar Do you run the precise code from above or a version in which you removed the " from namelist? The error message suggests that you are using something like defnamelistNew York,Illinois,Texas or defnamelistNew York,Illinois,Texas. Also the number of is important in pgfmathsetmacromystatenamelist[Y], i.e. pgfmathsetmacromystatenamelist[Y] won't work.

                        – marmot
                        May 21 at 21:57












                      • Yes, I was removing the ". But only because I was getting an error when I included them! With them, I get ! Missing number, treated as zero. <to be read again> N l.18 ~. So it looks like this solution is indexing the "N" somehow, rather than the whole fist entry, "New York" (evidence: if I change the first state to Illinois, that N becomes an I).

                        – squipbar
                        May 22 at 14:39

















                      Nice, but you removed the line that references the filename for the figure. Can you edit to retain that? Will your X still work ok there?

                      – squipbar
                      May 21 at 21:13





                      Nice, but you removed the line that references the filename for the figure. Can you edit to retain that? Will your X still work ok there?

                      – squipbar
                      May 21 at 21:13













                      @squipbar Good catch. I removed it because I do not have your graphics files.Now it should work if you uncomment it. (There are reasons why X might be better than x, even though here it does not matter.)

                      – marmot
                      May 21 at 21:18





                      @squipbar Good catch. I removed it because I do not have your graphics files.Now it should work if you uncomment it. (There are reasons why X might be better than x, even though here it does not matter.)

                      – marmot
                      May 21 at 21:18













                      This still gives me an error. I get: ! Package PGF Math Error: Unknown function New' (in 'New York,Illinois,Texas[0]').`

                      – squipbar
                      May 21 at 21:54





                      This still gives me an error. I get: ! Package PGF Math Error: Unknown function New' (in 'New York,Illinois,Texas[0]').`

                      – squipbar
                      May 21 at 21:54













                      @squipbar Do you run the precise code from above or a version in which you removed the " from namelist? The error message suggests that you are using something like defnamelistNew York,Illinois,Texas or defnamelistNew York,Illinois,Texas. Also the number of is important in pgfmathsetmacromystatenamelist[Y], i.e. pgfmathsetmacromystatenamelist[Y] won't work.

                      – marmot
                      May 21 at 21:57






                      @squipbar Do you run the precise code from above or a version in which you removed the " from namelist? The error message suggests that you are using something like defnamelistNew York,Illinois,Texas or defnamelistNew York,Illinois,Texas. Also the number of is important in pgfmathsetmacromystatenamelist[Y], i.e. pgfmathsetmacromystatenamelist[Y] won't work.

                      – marmot
                      May 21 at 21:57














                      Yes, I was removing the ". But only because I was getting an error when I included them! With them, I get ! Missing number, treated as zero. <to be read again> N l.18 ~. So it looks like this solution is indexing the "N" somehow, rather than the whole fist entry, "New York" (evidence: if I change the first state to Illinois, that N becomes an I).

                      – squipbar
                      May 22 at 14:39






                      Yes, I was removing the ". But only because I was getting an error when I included them! With them, I get ! Missing number, treated as zero. <to be read again> N l.18 ~. So it looks like this solution is indexing the "N" somehow, rather than the whole fist entry, "New York" (evidence: if I change the first state to Illinois, that N becomes an I).

                      – squipbar
                      May 22 at 14:39












                      2














                      Here's my proposal.



                      documentclassarticle
                      usepackagexparse

                      ExplSyntaxOn
                      NewDocumentCommandmaketwoprongedlistm m

                      prop_new:c g_squipbar_list_#1_plist
                      seq_new:c g_squipbar_list_#1_seq
                      clist_map_inline:nn #2

                      __squipbar_list_entry:nnn #1 ##1



                      cs_new_protected:Nn __squipbar_list_entry:nnn

                      seq_gput_right:cn g_squipbar_list_#1_seq #2
                      prop_gput:cnn g_squipbar_list_#1_plist short@#2 #2
                      prop_gput:cnn g_squipbar_list_#1_plist long@#2 #3


                      NewDocumentCommandusetwoprongedlistm +m

                      cs_set_protected:Nn __squipbar_list_entry:nn #2
                      seq_map_inline:cn g_squipbar_list_#1_seq

                      __squipbar_list_entry:nn
                      prop_item:cn g_squipbar_list_#1_plist short@##1
                      prop_item:cn g_squipbar_list_#1_plist long@##1



                      ExplSyntaxOff

                      maketwoprongedliststates
                      NYNew York,
                      ILIllinois,
                      TXTexas


                      begindocument

                      usetwoprongedliststates%
                      newpage
                      section*#2 % <-- I want to use the state name here

                      beginfigure[h!]
                      centering
                      %includegraphics[width=.5textwidth]../charts/summary/x _compare.pdf
                      texttt../charts/summary/#1-compare.pdf
                      caption#2 % <-- I want to use the state name here
                      endfigure


                      enddocument


                      enter image description here



                      Since I don't have your pictures, I emulated them by just printing the file name.



                      How does this work?



                      First of all, I define a list giving it a name. The items are comma separated and should consist of <abbreviation><full name>. The first part is also used for indexing and so it should consist of characters only (but this might be overcome, in case of need).



                      Each part is then stored as an item in a property list, indexed as short@<abbreviation> and long@<abbreviation>. Also a sequence is maintained containing the abbreviations, for later usage; the order will be that of input.



                      The usetwoprongedlist command has two arguments: the first is the list to be processed; the second argument is a template, just like the main argument to foreach; the difference is that #1 and #2 are used to denote the short and long versions of the current item.



                      A scratch function is defined and then the sequence indexing the list's items is mapped, calling the scratch function with arguments



                      prop_item:cn <list name> short@<current item> 


                      and



                      prop_item:cn <list name> long@<current item> 


                      respectively. Et voilà.






                      share|improve this answer



























                        2














                        Here's my proposal.



                        documentclassarticle
                        usepackagexparse

                        ExplSyntaxOn
                        NewDocumentCommandmaketwoprongedlistm m

                        prop_new:c g_squipbar_list_#1_plist
                        seq_new:c g_squipbar_list_#1_seq
                        clist_map_inline:nn #2

                        __squipbar_list_entry:nnn #1 ##1



                        cs_new_protected:Nn __squipbar_list_entry:nnn

                        seq_gput_right:cn g_squipbar_list_#1_seq #2
                        prop_gput:cnn g_squipbar_list_#1_plist short@#2 #2
                        prop_gput:cnn g_squipbar_list_#1_plist long@#2 #3


                        NewDocumentCommandusetwoprongedlistm +m

                        cs_set_protected:Nn __squipbar_list_entry:nn #2
                        seq_map_inline:cn g_squipbar_list_#1_seq

                        __squipbar_list_entry:nn
                        prop_item:cn g_squipbar_list_#1_plist short@##1
                        prop_item:cn g_squipbar_list_#1_plist long@##1



                        ExplSyntaxOff

                        maketwoprongedliststates
                        NYNew York,
                        ILIllinois,
                        TXTexas


                        begindocument

                        usetwoprongedliststates%
                        newpage
                        section*#2 % <-- I want to use the state name here

                        beginfigure[h!]
                        centering
                        %includegraphics[width=.5textwidth]../charts/summary/x _compare.pdf
                        texttt../charts/summary/#1-compare.pdf
                        caption#2 % <-- I want to use the state name here
                        endfigure


                        enddocument


                        enter image description here



                        Since I don't have your pictures, I emulated them by just printing the file name.



                        How does this work?



                        First of all, I define a list giving it a name. The items are comma separated and should consist of <abbreviation><full name>. The first part is also used for indexing and so it should consist of characters only (but this might be overcome, in case of need).



                        Each part is then stored as an item in a property list, indexed as short@<abbreviation> and long@<abbreviation>. Also a sequence is maintained containing the abbreviations, for later usage; the order will be that of input.



                        The usetwoprongedlist command has two arguments: the first is the list to be processed; the second argument is a template, just like the main argument to foreach; the difference is that #1 and #2 are used to denote the short and long versions of the current item.



                        A scratch function is defined and then the sequence indexing the list's items is mapped, calling the scratch function with arguments



                        prop_item:cn <list name> short@<current item> 


                        and



                        prop_item:cn <list name> long@<current item> 


                        respectively. Et voilà.






                        share|improve this answer

























                          2












                          2








                          2







                          Here's my proposal.



                          documentclassarticle
                          usepackagexparse

                          ExplSyntaxOn
                          NewDocumentCommandmaketwoprongedlistm m

                          prop_new:c g_squipbar_list_#1_plist
                          seq_new:c g_squipbar_list_#1_seq
                          clist_map_inline:nn #2

                          __squipbar_list_entry:nnn #1 ##1



                          cs_new_protected:Nn __squipbar_list_entry:nnn

                          seq_gput_right:cn g_squipbar_list_#1_seq #2
                          prop_gput:cnn g_squipbar_list_#1_plist short@#2 #2
                          prop_gput:cnn g_squipbar_list_#1_plist long@#2 #3


                          NewDocumentCommandusetwoprongedlistm +m

                          cs_set_protected:Nn __squipbar_list_entry:nn #2
                          seq_map_inline:cn g_squipbar_list_#1_seq

                          __squipbar_list_entry:nn
                          prop_item:cn g_squipbar_list_#1_plist short@##1
                          prop_item:cn g_squipbar_list_#1_plist long@##1



                          ExplSyntaxOff

                          maketwoprongedliststates
                          NYNew York,
                          ILIllinois,
                          TXTexas


                          begindocument

                          usetwoprongedliststates%
                          newpage
                          section*#2 % <-- I want to use the state name here

                          beginfigure[h!]
                          centering
                          %includegraphics[width=.5textwidth]../charts/summary/x _compare.pdf
                          texttt../charts/summary/#1-compare.pdf
                          caption#2 % <-- I want to use the state name here
                          endfigure


                          enddocument


                          enter image description here



                          Since I don't have your pictures, I emulated them by just printing the file name.



                          How does this work?



                          First of all, I define a list giving it a name. The items are comma separated and should consist of <abbreviation><full name>. The first part is also used for indexing and so it should consist of characters only (but this might be overcome, in case of need).



                          Each part is then stored as an item in a property list, indexed as short@<abbreviation> and long@<abbreviation>. Also a sequence is maintained containing the abbreviations, for later usage; the order will be that of input.



                          The usetwoprongedlist command has two arguments: the first is the list to be processed; the second argument is a template, just like the main argument to foreach; the difference is that #1 and #2 are used to denote the short and long versions of the current item.



                          A scratch function is defined and then the sequence indexing the list's items is mapped, calling the scratch function with arguments



                          prop_item:cn <list name> short@<current item> 


                          and



                          prop_item:cn <list name> long@<current item> 


                          respectively. Et voilà.






                          share|improve this answer













                          Here's my proposal.



                          documentclassarticle
                          usepackagexparse

                          ExplSyntaxOn
                          NewDocumentCommandmaketwoprongedlistm m

                          prop_new:c g_squipbar_list_#1_plist
                          seq_new:c g_squipbar_list_#1_seq
                          clist_map_inline:nn #2

                          __squipbar_list_entry:nnn #1 ##1



                          cs_new_protected:Nn __squipbar_list_entry:nnn

                          seq_gput_right:cn g_squipbar_list_#1_seq #2
                          prop_gput:cnn g_squipbar_list_#1_plist short@#2 #2
                          prop_gput:cnn g_squipbar_list_#1_plist long@#2 #3


                          NewDocumentCommandusetwoprongedlistm +m

                          cs_set_protected:Nn __squipbar_list_entry:nn #2
                          seq_map_inline:cn g_squipbar_list_#1_seq

                          __squipbar_list_entry:nn
                          prop_item:cn g_squipbar_list_#1_plist short@##1
                          prop_item:cn g_squipbar_list_#1_plist long@##1



                          ExplSyntaxOff

                          maketwoprongedliststates
                          NYNew York,
                          ILIllinois,
                          TXTexas


                          begindocument

                          usetwoprongedliststates%
                          newpage
                          section*#2 % <-- I want to use the state name here

                          beginfigure[h!]
                          centering
                          %includegraphics[width=.5textwidth]../charts/summary/x _compare.pdf
                          texttt../charts/summary/#1-compare.pdf
                          caption#2 % <-- I want to use the state name here
                          endfigure


                          enddocument


                          enter image description here



                          Since I don't have your pictures, I emulated them by just printing the file name.



                          How does this work?



                          First of all, I define a list giving it a name. The items are comma separated and should consist of <abbreviation><full name>. The first part is also used for indexing and so it should consist of characters only (but this might be overcome, in case of need).



                          Each part is then stored as an item in a property list, indexed as short@<abbreviation> and long@<abbreviation>. Also a sequence is maintained containing the abbreviations, for later usage; the order will be that of input.



                          The usetwoprongedlist command has two arguments: the first is the list to be processed; the second argument is a template, just like the main argument to foreach; the difference is that #1 and #2 are used to denote the short and long versions of the current item.



                          A scratch function is defined and then the sequence indexing the list's items is mapped, calling the scratch function with arguments



                          prop_item:cn <list name> short@<current item> 


                          and



                          prop_item:cn <list name> long@<current item> 


                          respectively. Et voilà.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered May 21 at 21:48









                          egregegreg

                          746k8919543295




                          746k8919543295



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f492002%2flooping-over-charts-and-names-simultaneously%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Club Baloncesto Breogán Índice Historia | Pavillón | Nome | O Breogán na cultura popular | Xogadores | Adestradores | Presidentes | Palmarés | Historial | Líderes | Notas | Véxase tamén | Menú de navegacióncbbreogan.galCadroGuía oficial da ACB 2009-10, páxina 201Guía oficial ACB 1992, páxina 183. Editorial DB.É de 6.500 espectadores sentados axeitándose á última normativa"Estudiantes Junior, entre as mellores canteiras"o orixinalHemeroteca El Mundo Deportivo, 16 setembro de 1970, páxina 12Historia do BreogánAlfredo Pérez, o último canoneiroHistoria C.B. BreogánHemeroteca de El Mundo DeportivoJimmy Wright, norteamericano do Breogán deixará Lugo por ameazas de morteResultados de Breogán en 1986-87Resultados de Breogán en 1990-91Ficha de Velimir Perasović en acb.comResultados de Breogán en 1994-95Breogán arrasa al Barça. "El Mundo Deportivo", 27 de setembro de 1999, páxina 58CB Breogán - FC BarcelonaA FEB invita a participar nunha nova Liga EuropeaCharlie Bell na prensa estatalMáximos anotadores 2005Tempada 2005-06 : Tódolos Xogadores da Xornada""Non quero pensar nunha man negra, mais pregúntome que está a pasar""o orixinalRaúl López, orgulloso dos xogadores, presume da boa saúde económica do BreogánJulio González confirma que cesa como presidente del BreogánHomenaxe a Lisardo GómezA tempada do rexurdimento celesteEntrevista a Lisardo GómezEl COB dinamita el Pazo para forzar el quinto (69-73)Cafés Candelas, patrocinador del CB Breogán"Suso Lázare, novo presidente do Breogán"o orixinalCafés Candelas Breogán firma el mayor triunfo de la historiaEl Breogán realizará 17 homenajes por su cincuenta aniversario"O Breogán honra ao seu fundador e primeiro presidente"o orixinalMiguel Giao recibiu a homenaxe do PazoHomenaxe aos primeiros gladiadores celestesO home que nos amosa como ver o Breo co corazónTita Franco será homenaxeada polos #50anosdeBreoJulio Vila recibirá unha homenaxe in memoriam polos #50anosdeBreo"O Breogán homenaxeará aos seus aboados máis veteráns"Pechada ovación a «Capi» Sanmartín e Ricardo «Corazón de González»Homenaxe por décadas de informaciónPaco García volve ao Pazo con motivo do 50 aniversario"Resultados y clasificaciones""O Cafés Candelas Breogán, campión da Copa Princesa""O Cafés Candelas Breogán, equipo ACB"C.B. Breogán"Proxecto social"o orixinal"Centros asociados"o orixinalFicha en imdb.comMario Camus trata la recuperación del amor en 'La vieja música', su última película"Páxina web oficial""Club Baloncesto Breogán""C. B. Breogán S.A.D."eehttp://www.fegaba.com

                              Vilaño, A Laracha Índice Patrimonio | Lugares e parroquias | Véxase tamén | Menú de navegación43°14′52″N 8°36′03″O / 43.24775, -8.60070

                              Cegueira Índice Epidemioloxía | Deficiencia visual | Tipos de cegueira | Principais causas de cegueira | Tratamento | Técnicas de adaptación e axudas | Vida dos cegos | Primeiros auxilios | Crenzas respecto das persoas cegas | Crenzas das persoas cegas | O neno deficiente visual | Aspectos psicolóxicos da cegueira | Notas | Véxase tamén | Menú de navegación54.054.154.436928256blindnessDicionario da Real Academia GalegaPortal das Palabras"International Standards: Visual Standards — Aspects and Ranges of Vision Loss with Emphasis on Population Surveys.""Visual impairment and blindness""Presentan un plan para previr a cegueira"o orixinalACCDV Associació Catalana de Cecs i Disminuïts Visuals - PMFTrachoma"Effect of gene therapy on visual function in Leber's congenital amaurosis"1844137110.1056/NEJMoa0802268Cans guía - os mellores amigos dos cegosArquivadoEscola de cans guía para cegos en Mortágua, PortugalArquivado"Tecnología para ciegos y deficientes visuales. Recopilación de recursos gratuitos en la Red""Colorino""‘COL.diesis’, escuchar los sonidos del color""COL.diesis: Transforming Colour into Melody and Implementing the Result in a Colour Sensor Device"o orixinal"Sistema de desarrollo de sinestesia color-sonido para invidentes utilizando un protocolo de audio""Enseñanza táctil - geometría y color. Juegos didácticos para niños ciegos y videntes""Sistema Constanz"L'ocupació laboral dels cecs a l'Estat espanyol està pràcticament equiparada a la de les persones amb visió, entrevista amb Pedro ZuritaONCE (Organización Nacional de Cegos de España)Prevención da cegueiraDescrición de deficiencias visuais (Disc@pnet)Braillín, un boneco atractivo para calquera neno, con ou sen discapacidade, que permite familiarizarse co sistema de escritura e lectura brailleAxudas Técnicas36838ID00897494007150-90057129528256DOID:1432HP:0000618D001766C10.597.751.941.162C97109C0155020