# Math or text symbols of Bagua 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):

Are there already available in LaTex?

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

• 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}{...}. Jul 18 at 1:54

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}


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

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}


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