2

Previously, we had obtained great answers to get math or text symbols of Bagua.

Is it possible to make math or text symbols of these forms of Bagua (as 90 degree rotations of the previous ones):

enter image description here

Are there already available in LaTex?

These are from Bagua for your reference: https://en.wikipedia.org/wiki/Bagua

Thank you in advance!

1
  • A general approach is to use \rotatebox from the graphicx package. You can take any answer from the last question and wrap it in \rotatebox{90}{...}.
    – L. F.
    Jul 18 at 1:54
4

This is almost the same solution as my prevoius one. I added a second parameter to the macro that takes values 0/1 for not rotating/rotating (90 degrees). I changed slightly the dimensions too.

\documentclass{article}
\usepackage   {tikz}

\newcommand{\bagua}[2] % symbol number, rotation: 0 horizontal / 1 vertical
{%
  \begin{tikzpicture}[rotate=90*#2,x=1ex,y=1ex,line width=0.15ex]
    \def\d{1.345}
    \pgfmathtruncatemacro\number{#1}
    \useasboundingbox (0,0) rectangle (1,1);
    \foreach\i in {1,2,3}
    {%
      \pgfmathtruncatemacro\digit{Mod(div(\number,pow(10,\i-1)),10)}
      \ifnum\digit = 0
        \draw (0  ,\d-0.425*\i) --++ (0.4,0);
        \draw (0.6,\d-0.425*\i) --++ (0.4,0);
      \else
        \draw (0  ,\d-0.425*\i) --++ (1,0);
      \fi
    }
  \end{tikzpicture}% <-- This prevents more space
}

\begin{document}
\huge 

a
\bagua{111}{0}
\bagua{110}{0}
\bagua{101}{0}
\bagua{100}{0}
\bagua{011}{0}
\bagua{010}{0}
\bagua{001}{0}
\bagua{000}{0}

a
\bagua{111}{1}
\bagua{110}{1}
\bagua{101}{1}
\bagua{100}{1}
\bagua{011}{1}
\bagua{010}{1}
\bagua{001}{1}
\bagua{000}{1}

\end{document}

enter image description here

1
  • Yes, thanks I just wanted to thank you and reward your genius on this. +1
    – wonderich
    Jul 17 at 18:44
5

How about the following quick modification from the tikz-based solution of your previous question:

\documentclass{article}
\usepackage   {tikz}

\newcommand{\bagua}[1]
{%
  \begin{tikzpicture}[x=0.4ex,y=0.4ex,line width=0.15ex]
    \pgfmathtruncatemacro\number{#1}
    \foreach\i in {1,2,3}
    {%
      \pgfmathtruncatemacro\digit{Mod(div(\number,pow(10,\i-1)),10)}
      \ifnum\digit = 0
        \draw (3-\i,  0) --++ (0,1);
        \draw (3-\i,1.5) --++ (0,1);
      \else
        \draw (3-\i,  0) --++ (0,2.5);
      \fi
    }
  \end{tikzpicture}% <-- This prevents more space
}
\begin{document}

a
\bagua{111}
\bagua{110}
\bagua{101}
\bagua{100}
\bagua{011}
\bagua{010}
\bagua{001}
\bagua{000}

\end{document}

enter image description here

2
  • many thanks +1, I awarded the person who did the earlier job.
    – wonderich
    Jul 17 at 18:45
  • @wonderich, sure. good choice!!
    – citsahcots
    Jul 17 at 18:48

Your Answer

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

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