答案1
尺寸可以根据需要定制。 \bagwd
为字符的全宽,\baggaph
为零行上的水平空间,\baggapv
为八卦字符的行间垂直间隙,\baght
为三行黑行各自的高度。
\documentclass{article}
\usepackage{stackengine}
\newlength\bagwd
\newlength\baggaph
\newlength\baggapv
\newlength\baght
\setlength\bagwd{1ex}
\setlength\baggaph{.15ex}
\setlength\baggapv{.2ex}
\setlength\baght{.2ex}
\expandafter\def\csname bag0\endcsname{%
\rule{.5\dimexpr\bagwd-\baggaph\relax}{\baght}%
\kern\baggaph%
\rule{.5\dimexpr\bagwd-\baggaph\relax}{\baght}}
\expandafter\def\csname bag1\endcsname{%
\rule{\bagwd}{\baght}}
\newcommand\bagrow[1]{\csname bag#1\endcsname}
\newcommand\bagua[3]{\setstackgap{S}{\baggapv}%
\Shortstack{\bagrow#3 \bagrow#2 \bagrow#1}}
\begin{document}
a
\bagua111
\bagua110
\bagua101
\bagua100
\bagua011
\bagua010
\bagua001
\bagua000
\end{document}
答案2
八卦也在 Unicode 中,位于杂项符号块中。
字体随机样本:
等等字体设计师的表达的一部分。
平均能量损失
\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{fontspec}
\newcommand\bagua{☰☱☲☳☴☵☶☷ \iffontchar\font`八 八卦\fi}
\newcommand\namefbga{DejaVu Sans}
\newcommand\namefbgb{FreeMono}
\newcommand\namefbgc{FreeSerif}
\newcommand\namefbgd{Kinryu}
\newcommand\namefbge{Meiryo}
\newcommand\namefbgf{Noto Sans Symbols2}
\newcommand\namefbgg{Quivira}
\newcommand\namefbgh{Sawarabi Gothic}
\newcommand\namefbgi{Sawarabi Mincho}
\newcommand\namefbgj{UKIJ Tughra}
\newfontface\fbga{\namefbga}
\newfontface\fbgb{\namefbgb}
\newfontface\fbgc{\namefbgc}
\newfontface\fbgd{\namefbgd}
\newfontface\fbge{\namefbge}
\newfontface\fbgf{\namefbgf}
\newfontface\fbgg{\namefbgg}
\newfontface\fbgh{\namefbgh}
\newfontface\fbgi{\namefbgi}
\newfontface\fbgj{\namefbgj}
\begin{document}
\begin{tabular}{ll}
\rowcolor{blue!5}
Font & Bagua \\
\hline
\namefbga\phantom{\Large L} & \fbga\bagua \\
\namefbgb & \fbgb\bagua \\
\namefbgc & \fbgc\bagua \\
\namefbgd & \fbgd\bagua \\
\namefbge & \fbge\bagua \\
\namefbgf & \fbgf\bagua \\
\namefbgg & \fbgg\bagua \\
\namefbgh & \fbgh\bagua \\
\namefbgi & \fbgi\bagua \\
\namefbgj & \fbgj\bagua \\
\hline
\end{tabular}
\end{document}
答案3
基于Atikz
的解决方案:
\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 (0 ,3-\i) --++ (1,0);
\draw (1.5,3-\i) --++ (1,0);
\else
\draw (0 ,3-\i) --++ (2.5,0);
\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}