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

                              Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

                              Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

                              What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company