what is a better way to generate iching 64 hexagrams?












3















If I have list for iching (bagua) trigrams as follows, what is the best way to generate 64 hexagrams as in shown in the image attached? I can use the use the binary code (e.g.{1,1,1}) for either color coding or draw the trigrams inspired from here, or use the unicode here. Is nested for-loop the right approach? This is probably too much to ask.



{1,1,1}; 乾; 8;  ☰
{1,1,0}; 兌; 7; ☱
{1,0,1}; 離; 6; ☲
{1,0,0}; 震; 5; ☳
{0,0,0}; 坤; 1; ☷
{0,0,1}; 艮; 2; ☶
{0,1,0}; 坎; 3; ☵
{0,1,1}; 巽; 4; ☴


enter image description here










share|improve this question





























    3















    If I have list for iching (bagua) trigrams as follows, what is the best way to generate 64 hexagrams as in shown in the image attached? I can use the use the binary code (e.g.{1,1,1}) for either color coding or draw the trigrams inspired from here, or use the unicode here. Is nested for-loop the right approach? This is probably too much to ask.



    {1,1,1}; 乾; 8;  ☰
    {1,1,0}; 兌; 7; ☱
    {1,0,1}; 離; 6; ☲
    {1,0,0}; 震; 5; ☳
    {0,0,0}; 坤; 1; ☷
    {0,0,1}; 艮; 2; ☶
    {0,1,0}; 坎; 3; ☵
    {0,1,1}; 巽; 4; ☴


    enter image description here










    share|improve this question



























      3












      3








      3








      If I have list for iching (bagua) trigrams as follows, what is the best way to generate 64 hexagrams as in shown in the image attached? I can use the use the binary code (e.g.{1,1,1}) for either color coding or draw the trigrams inspired from here, or use the unicode here. Is nested for-loop the right approach? This is probably too much to ask.



      {1,1,1}; 乾; 8;  ☰
      {1,1,0}; 兌; 7; ☱
      {1,0,1}; 離; 6; ☲
      {1,0,0}; 震; 5; ☳
      {0,0,0}; 坤; 1; ☷
      {0,0,1}; 艮; 2; ☶
      {0,1,0}; 坎; 3; ☵
      {0,1,1}; 巽; 4; ☴


      enter image description here










      share|improve this question
















      If I have list for iching (bagua) trigrams as follows, what is the best way to generate 64 hexagrams as in shown in the image attached? I can use the use the binary code (e.g.{1,1,1}) for either color coding or draw the trigrams inspired from here, or use the unicode here. Is nested for-loop the right approach? This is probably too much to ask.



      {1,1,1}; 乾; 8;  ☰
      {1,1,0}; 兌; 7; ☱
      {1,0,1}; 離; 6; ☲
      {1,0,0}; 震; 5; ☳
      {0,0,0}; 坤; 1; ☷
      {0,0,1}; 艮; 2; ☶
      {0,1,0}; 坎; 3; ☵
      {0,1,1}; 巽; 4; ☴


      enter image description here







      tikz-pgf xetex loops






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 30 at 19:17







      Tony Tan

















      asked Jan 30 at 19:10









      Tony TanTony Tan

      1237




      1237






















          1 Answer
          1






          active

          oldest

          votes


















          5














          I apologize in advance that I am not able to use these characters. So I am assuming that you know how to use them (and what they mean). This answer just creates an array of Latin characters and Arabic numbers. You may thus want to redefine lstchar to your needs.



          documentclass[tikz,border=3.14mm]{standalone}
          begin{document}
          begin{tikzpicture}[font=sffamily]
          deflstchar{{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
          "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
          "u", "v", "w", "x", "y", "z", "A", "B", "C", "D",
          "E", "F", "G", "H", "I", "J", "K", "L", "M", "N",
          "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X",
          "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7",
          "8", "9", "+", "-"}}
          foreach Z [evaluate=Z as Y using {int(Z/8)},
          evaluate=Z as X using {int(mod(Z,8))}]
          in {0,1,2,...,63}
          {
          pgfmathtruncatemacro{x}{mod(Z,4)*255/3}
          pgfmathtruncatemacro{y}{mod(int(Z/4),4)*255/3}
          pgfmathtruncatemacro{z}{mod(int(Z/16),4)*255/3}
          pgfmathsetmacro{char}{lstchar[Z]}
          definecolor{mycolorZ}{RGB}{z,y,x}
          node[color=mycolorZ,rotate={Z*(360/64)-90},scale=1.5] at ({Z*(360/64)}:7) {char};
          node[color=mycolorZ,scale=1.5] at (X-4+0.5,4-Y-0.5) {char};
          }
          end{tikzpicture}
          end{document}


          enter image description here






          share|improve this answer
























          • Thank you very much for your effort, @marmot. Your solution explains the placement elegantly. I will explore how to stack the 8 trigrams to generate 64 hexagrams.

            – Tony Tan
            Jan 30 at 22:27






          • 1





            @TonyTan You can put tabulars in the nodes. Just replace the node commands in my code by node[color=mycolorZ,rotate={Z*(360/64)-90},scale=1.5] at ({Z*(360/64)}:7) {begin{tabular}{c} char\[-2mm] char\[-2mm] char end{tabular}}; node[color=mycolorZ,scale=1.5] at (X-4+0.5,4-Y-0.5) { begin{tabular}{c} char\[-2mm] char\[-2mm] char end{tabular}};. Of course you can define more lists and thus get different characters.

            – marmot
            Jan 30 at 22:32













          • If you want to display the hexagrams, one font that contains them is DejaVu Sans, and they have Unicode code points U+4DC0 to U+4DFF.

            – Davislor
            Jan 31 at 4:24











          • @Davislor Thanks! However, I hesitate to produce texts that I do not understand. But of course you could write an answer, I am curious how that looks.

            – marmot
            Jan 31 at 4:36











          • @marmot Yes, good point. Especially since the symbols apparently have some kind of religious significance, of which I’m wholly ignorant.

            – Davislor
            Jan 31 at 5:24











          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%2f472617%2fwhat-is-a-better-way-to-generate-iching-64-hexagrams%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          5














          I apologize in advance that I am not able to use these characters. So I am assuming that you know how to use them (and what they mean). This answer just creates an array of Latin characters and Arabic numbers. You may thus want to redefine lstchar to your needs.



          documentclass[tikz,border=3.14mm]{standalone}
          begin{document}
          begin{tikzpicture}[font=sffamily]
          deflstchar{{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
          "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
          "u", "v", "w", "x", "y", "z", "A", "B", "C", "D",
          "E", "F", "G", "H", "I", "J", "K", "L", "M", "N",
          "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X",
          "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7",
          "8", "9", "+", "-"}}
          foreach Z [evaluate=Z as Y using {int(Z/8)},
          evaluate=Z as X using {int(mod(Z,8))}]
          in {0,1,2,...,63}
          {
          pgfmathtruncatemacro{x}{mod(Z,4)*255/3}
          pgfmathtruncatemacro{y}{mod(int(Z/4),4)*255/3}
          pgfmathtruncatemacro{z}{mod(int(Z/16),4)*255/3}
          pgfmathsetmacro{char}{lstchar[Z]}
          definecolor{mycolorZ}{RGB}{z,y,x}
          node[color=mycolorZ,rotate={Z*(360/64)-90},scale=1.5] at ({Z*(360/64)}:7) {char};
          node[color=mycolorZ,scale=1.5] at (X-4+0.5,4-Y-0.5) {char};
          }
          end{tikzpicture}
          end{document}


          enter image description here






          share|improve this answer
























          • Thank you very much for your effort, @marmot. Your solution explains the placement elegantly. I will explore how to stack the 8 trigrams to generate 64 hexagrams.

            – Tony Tan
            Jan 30 at 22:27






          • 1





            @TonyTan You can put tabulars in the nodes. Just replace the node commands in my code by node[color=mycolorZ,rotate={Z*(360/64)-90},scale=1.5] at ({Z*(360/64)}:7) {begin{tabular}{c} char\[-2mm] char\[-2mm] char end{tabular}}; node[color=mycolorZ,scale=1.5] at (X-4+0.5,4-Y-0.5) { begin{tabular}{c} char\[-2mm] char\[-2mm] char end{tabular}};. Of course you can define more lists and thus get different characters.

            – marmot
            Jan 30 at 22:32













          • If you want to display the hexagrams, one font that contains them is DejaVu Sans, and they have Unicode code points U+4DC0 to U+4DFF.

            – Davislor
            Jan 31 at 4:24











          • @Davislor Thanks! However, I hesitate to produce texts that I do not understand. But of course you could write an answer, I am curious how that looks.

            – marmot
            Jan 31 at 4:36











          • @marmot Yes, good point. Especially since the symbols apparently have some kind of religious significance, of which I’m wholly ignorant.

            – Davislor
            Jan 31 at 5:24
















          5














          I apologize in advance that I am not able to use these characters. So I am assuming that you know how to use them (and what they mean). This answer just creates an array of Latin characters and Arabic numbers. You may thus want to redefine lstchar to your needs.



          documentclass[tikz,border=3.14mm]{standalone}
          begin{document}
          begin{tikzpicture}[font=sffamily]
          deflstchar{{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
          "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
          "u", "v", "w", "x", "y", "z", "A", "B", "C", "D",
          "E", "F", "G", "H", "I", "J", "K", "L", "M", "N",
          "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X",
          "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7",
          "8", "9", "+", "-"}}
          foreach Z [evaluate=Z as Y using {int(Z/8)},
          evaluate=Z as X using {int(mod(Z,8))}]
          in {0,1,2,...,63}
          {
          pgfmathtruncatemacro{x}{mod(Z,4)*255/3}
          pgfmathtruncatemacro{y}{mod(int(Z/4),4)*255/3}
          pgfmathtruncatemacro{z}{mod(int(Z/16),4)*255/3}
          pgfmathsetmacro{char}{lstchar[Z]}
          definecolor{mycolorZ}{RGB}{z,y,x}
          node[color=mycolorZ,rotate={Z*(360/64)-90},scale=1.5] at ({Z*(360/64)}:7) {char};
          node[color=mycolorZ,scale=1.5] at (X-4+0.5,4-Y-0.5) {char};
          }
          end{tikzpicture}
          end{document}


          enter image description here






          share|improve this answer
























          • Thank you very much for your effort, @marmot. Your solution explains the placement elegantly. I will explore how to stack the 8 trigrams to generate 64 hexagrams.

            – Tony Tan
            Jan 30 at 22:27






          • 1





            @TonyTan You can put tabulars in the nodes. Just replace the node commands in my code by node[color=mycolorZ,rotate={Z*(360/64)-90},scale=1.5] at ({Z*(360/64)}:7) {begin{tabular}{c} char\[-2mm] char\[-2mm] char end{tabular}}; node[color=mycolorZ,scale=1.5] at (X-4+0.5,4-Y-0.5) { begin{tabular}{c} char\[-2mm] char\[-2mm] char end{tabular}};. Of course you can define more lists and thus get different characters.

            – marmot
            Jan 30 at 22:32













          • If you want to display the hexagrams, one font that contains them is DejaVu Sans, and they have Unicode code points U+4DC0 to U+4DFF.

            – Davislor
            Jan 31 at 4:24











          • @Davislor Thanks! However, I hesitate to produce texts that I do not understand. But of course you could write an answer, I am curious how that looks.

            – marmot
            Jan 31 at 4:36











          • @marmot Yes, good point. Especially since the symbols apparently have some kind of religious significance, of which I’m wholly ignorant.

            – Davislor
            Jan 31 at 5:24














          5












          5








          5







          I apologize in advance that I am not able to use these characters. So I am assuming that you know how to use them (and what they mean). This answer just creates an array of Latin characters and Arabic numbers. You may thus want to redefine lstchar to your needs.



          documentclass[tikz,border=3.14mm]{standalone}
          begin{document}
          begin{tikzpicture}[font=sffamily]
          deflstchar{{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
          "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
          "u", "v", "w", "x", "y", "z", "A", "B", "C", "D",
          "E", "F", "G", "H", "I", "J", "K", "L", "M", "N",
          "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X",
          "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7",
          "8", "9", "+", "-"}}
          foreach Z [evaluate=Z as Y using {int(Z/8)},
          evaluate=Z as X using {int(mod(Z,8))}]
          in {0,1,2,...,63}
          {
          pgfmathtruncatemacro{x}{mod(Z,4)*255/3}
          pgfmathtruncatemacro{y}{mod(int(Z/4),4)*255/3}
          pgfmathtruncatemacro{z}{mod(int(Z/16),4)*255/3}
          pgfmathsetmacro{char}{lstchar[Z]}
          definecolor{mycolorZ}{RGB}{z,y,x}
          node[color=mycolorZ,rotate={Z*(360/64)-90},scale=1.5] at ({Z*(360/64)}:7) {char};
          node[color=mycolorZ,scale=1.5] at (X-4+0.5,4-Y-0.5) {char};
          }
          end{tikzpicture}
          end{document}


          enter image description here






          share|improve this answer













          I apologize in advance that I am not able to use these characters. So I am assuming that you know how to use them (and what they mean). This answer just creates an array of Latin characters and Arabic numbers. You may thus want to redefine lstchar to your needs.



          documentclass[tikz,border=3.14mm]{standalone}
          begin{document}
          begin{tikzpicture}[font=sffamily]
          deflstchar{{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
          "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
          "u", "v", "w", "x", "y", "z", "A", "B", "C", "D",
          "E", "F", "G", "H", "I", "J", "K", "L", "M", "N",
          "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X",
          "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7",
          "8", "9", "+", "-"}}
          foreach Z [evaluate=Z as Y using {int(Z/8)},
          evaluate=Z as X using {int(mod(Z,8))}]
          in {0,1,2,...,63}
          {
          pgfmathtruncatemacro{x}{mod(Z,4)*255/3}
          pgfmathtruncatemacro{y}{mod(int(Z/4),4)*255/3}
          pgfmathtruncatemacro{z}{mod(int(Z/16),4)*255/3}
          pgfmathsetmacro{char}{lstchar[Z]}
          definecolor{mycolorZ}{RGB}{z,y,x}
          node[color=mycolorZ,rotate={Z*(360/64)-90},scale=1.5] at ({Z*(360/64)}:7) {char};
          node[color=mycolorZ,scale=1.5] at (X-4+0.5,4-Y-0.5) {char};
          }
          end{tikzpicture}
          end{document}


          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 30 at 20:59









          marmotmarmot

          98.2k4113218




          98.2k4113218













          • Thank you very much for your effort, @marmot. Your solution explains the placement elegantly. I will explore how to stack the 8 trigrams to generate 64 hexagrams.

            – Tony Tan
            Jan 30 at 22:27






          • 1





            @TonyTan You can put tabulars in the nodes. Just replace the node commands in my code by node[color=mycolorZ,rotate={Z*(360/64)-90},scale=1.5] at ({Z*(360/64)}:7) {begin{tabular}{c} char\[-2mm] char\[-2mm] char end{tabular}}; node[color=mycolorZ,scale=1.5] at (X-4+0.5,4-Y-0.5) { begin{tabular}{c} char\[-2mm] char\[-2mm] char end{tabular}};. Of course you can define more lists and thus get different characters.

            – marmot
            Jan 30 at 22:32













          • If you want to display the hexagrams, one font that contains them is DejaVu Sans, and they have Unicode code points U+4DC0 to U+4DFF.

            – Davislor
            Jan 31 at 4:24











          • @Davislor Thanks! However, I hesitate to produce texts that I do not understand. But of course you could write an answer, I am curious how that looks.

            – marmot
            Jan 31 at 4:36











          • @marmot Yes, good point. Especially since the symbols apparently have some kind of religious significance, of which I’m wholly ignorant.

            – Davislor
            Jan 31 at 5:24



















          • Thank you very much for your effort, @marmot. Your solution explains the placement elegantly. I will explore how to stack the 8 trigrams to generate 64 hexagrams.

            – Tony Tan
            Jan 30 at 22:27






          • 1





            @TonyTan You can put tabulars in the nodes. Just replace the node commands in my code by node[color=mycolorZ,rotate={Z*(360/64)-90},scale=1.5] at ({Z*(360/64)}:7) {begin{tabular}{c} char\[-2mm] char\[-2mm] char end{tabular}}; node[color=mycolorZ,scale=1.5] at (X-4+0.5,4-Y-0.5) { begin{tabular}{c} char\[-2mm] char\[-2mm] char end{tabular}};. Of course you can define more lists and thus get different characters.

            – marmot
            Jan 30 at 22:32













          • If you want to display the hexagrams, one font that contains them is DejaVu Sans, and they have Unicode code points U+4DC0 to U+4DFF.

            – Davislor
            Jan 31 at 4:24











          • @Davislor Thanks! However, I hesitate to produce texts that I do not understand. But of course you could write an answer, I am curious how that looks.

            – marmot
            Jan 31 at 4:36











          • @marmot Yes, good point. Especially since the symbols apparently have some kind of religious significance, of which I’m wholly ignorant.

            – Davislor
            Jan 31 at 5:24

















          Thank you very much for your effort, @marmot. Your solution explains the placement elegantly. I will explore how to stack the 8 trigrams to generate 64 hexagrams.

          – Tony Tan
          Jan 30 at 22:27





          Thank you very much for your effort, @marmot. Your solution explains the placement elegantly. I will explore how to stack the 8 trigrams to generate 64 hexagrams.

          – Tony Tan
          Jan 30 at 22:27




          1




          1





          @TonyTan You can put tabulars in the nodes. Just replace the node commands in my code by node[color=mycolorZ,rotate={Z*(360/64)-90},scale=1.5] at ({Z*(360/64)}:7) {begin{tabular}{c} char\[-2mm] char\[-2mm] char end{tabular}}; node[color=mycolorZ,scale=1.5] at (X-4+0.5,4-Y-0.5) { begin{tabular}{c} char\[-2mm] char\[-2mm] char end{tabular}};. Of course you can define more lists and thus get different characters.

          – marmot
          Jan 30 at 22:32







          @TonyTan You can put tabulars in the nodes. Just replace the node commands in my code by node[color=mycolorZ,rotate={Z*(360/64)-90},scale=1.5] at ({Z*(360/64)}:7) {begin{tabular}{c} char\[-2mm] char\[-2mm] char end{tabular}}; node[color=mycolorZ,scale=1.5] at (X-4+0.5,4-Y-0.5) { begin{tabular}{c} char\[-2mm] char\[-2mm] char end{tabular}};. Of course you can define more lists and thus get different characters.

          – marmot
          Jan 30 at 22:32















          If you want to display the hexagrams, one font that contains them is DejaVu Sans, and they have Unicode code points U+4DC0 to U+4DFF.

          – Davislor
          Jan 31 at 4:24





          If you want to display the hexagrams, one font that contains them is DejaVu Sans, and they have Unicode code points U+4DC0 to U+4DFF.

          – Davislor
          Jan 31 at 4:24













          @Davislor Thanks! However, I hesitate to produce texts that I do not understand. But of course you could write an answer, I am curious how that looks.

          – marmot
          Jan 31 at 4:36





          @Davislor Thanks! However, I hesitate to produce texts that I do not understand. But of course you could write an answer, I am curious how that looks.

          – marmot
          Jan 31 at 4:36













          @marmot Yes, good point. Especially since the symbols apparently have some kind of religious significance, of which I’m wholly ignorant.

          – Davislor
          Jan 31 at 5:24





          @marmot Yes, good point. Especially since the symbols apparently have some kind of religious significance, of which I’m wholly ignorant.

          – Davislor
          Jan 31 at 5:24


















          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%2f472617%2fwhat-is-a-better-way-to-generate-iching-64-hexagrams%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

          mysqli_query(): Empty query in /home/lucindabrummitt/public_html/blog/wp-includes/wp-db.php on line 1924

          How to change which sound is reproduced for terminal bell?

          Can I use Tabulator js library in my java Spring + Thymeleaf project?