summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/tikz-bagua
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/pgf/contrib/tikz-bagua')
-rw-r--r--graphics/pgf/contrib/tikz-bagua/README.md4
-rw-r--r--graphics/pgf/contrib/tikz-bagua/tikz-bagua-en.pdfbin0 -> 118841 bytes
-rw-r--r--graphics/pgf/contrib/tikz-bagua/tikz-bagua-en.tex117
-rw-r--r--graphics/pgf/contrib/tikz-bagua/tikz-bagua.pdfbin51454 -> 59767 bytes
-rw-r--r--graphics/pgf/contrib/tikz-bagua/tikz-bagua.sty67
-rw-r--r--graphics/pgf/contrib/tikz-bagua/tikz-bagua.tex26
6 files changed, 190 insertions, 24 deletions
diff --git a/graphics/pgf/contrib/tikz-bagua/README.md b/graphics/pgf/contrib/tikz-bagua/README.md
index 5a608c339e..cc14d9ff43 100644
--- a/graphics/pgf/contrib/tikz-bagua/README.md
+++ b/graphics/pgf/contrib/tikz-bagua/README.md
@@ -29,7 +29,7 @@ Issues and pull requests are welcome.
Copyright and Licence
---------------------
- Copyright (C) 2012, 2014-2020 by WANG Xu <duplli@aliyun.com>
+ Copyright (C) 2021--2022 by WANG Xu <cwangx@hotmail.com>
----------------------------------------------------------------------
This work may be distributed and/or modified under the
@@ -49,4 +49,6 @@ Copyright and Licence
This package consists of the file tikz-bagua.sty,
tikz-bagua.pdf,
tikz-bagua.tex,
+ tikz-bagua-en.pdf,
+ tikz-bagua-en.tex,
README.md (this file).
diff --git a/graphics/pgf/contrib/tikz-bagua/tikz-bagua-en.pdf b/graphics/pgf/contrib/tikz-bagua/tikz-bagua-en.pdf
new file mode 100644
index 0000000000..ed4949002b
--- /dev/null
+++ b/graphics/pgf/contrib/tikz-bagua/tikz-bagua-en.pdf
Binary files differ
diff --git a/graphics/pgf/contrib/tikz-bagua/tikz-bagua-en.tex b/graphics/pgf/contrib/tikz-bagua/tikz-bagua-en.tex
new file mode 100644
index 0000000000..63b3583d35
--- /dev/null
+++ b/graphics/pgf/contrib/tikz-bagua/tikz-bagua-en.tex
@@ -0,0 +1,117 @@
+\documentclass{article}
+
+\usepackage[margin=3cm]{geometry}
+
+\usepackage{tikz-bagua}
+\usetikzlibrary{math}
+
+\input{binhex}
+
+\usepackage{makeidx}
+
+\makeindex
+
+\title{TikZ-Bagua Package}
+\author{WANG Xu \\ cwangx@hotmail.com}
+\date{\today~v1.01}
+
+\begin{document}
+
+\maketitle
+
+\section{Introduction}
+
+The \verb+TikZ-Bagua+ package mainly using \verb+TikZ+, by \verb+xparse+, \verb+xstring+, \verb+bitset+ and \verb+xintexpr+, defines the Grand Terminus \cite{Legge} \verb+\taiji+ and \verb+\xtaiji+ for newer method, \verb+\liangyi+ for the Two Elementary Forms, \verb+\sixiang+ for the Four Emblematic Symbols, \verb+\bagua+ for the Eight Trigrams and \verb+\Bagua+ for Sixty-four Hexagrams, in \emph{The I Ching}, without require special fonts.
+
+\section{Usage methods}
+
+The last argument of all defined macros is optional \verb|scale|, and default $1$.
+
+\subsection{The Grand Terminus (the \emph{Taiji})}
+
+Thanks to netizens, the default is same as in ancient books without \emph{the Fish Eyes}, show its by macro with star.
+For reason that there are some formed by semi-circles, so add \verb+\xtaiji+ for it, with (or without) star.
+
+\verb+\taiji [<scale>]+\index{taiji@\verb+\taiji+}, \verb+\taiji* [<scale>]+\index{xtaiji@\verb+\xtaiji+}.
+
+\verb+\xtaiji [<scale>]+\index{taiji@\verb+\taiji+}, \verb+\xtaiji* [<scale>]+\index{xtaiji@\verb+\xtaiji+}.
+
+The four above macros show \taiji \taiji* \xtaiji \xtaiji*.
+
+\subsection{The Two Elementary Forms (the \emph{Liangyi})}
+\verb+\liangyi {<bin>} [<scale>]+\index{liangyi@\verb+\liangyi+}.
+
+We can obtain \liangyi{1} and \liangyi{0} by \verb+\liangyi{<bin>}+ getting $1$ and $0$, respectively.
+
+
+\subsection{The Four Emblematic Symbols (the \emph{Sixiang})}
+\verb+\sixiang {<bin>} [<scale>]+\index{sixiang@\verb+\sixiang+}, \verb+\sixiang* {<dec>} [<scale>]+\index{sixiang*@\verb+\sixiang*+}.
+
+The Four Emblematic Symbols obtained from \verb+\sixiang{<bin>}+ by getting the binary number of $3,2,1,0$, and \verb+\sixiang*{<dec>}+ for decimal.
+
+\begin{center}
+ \begin{tikzpicture}
+ \foreach \j in {3,2,1,0}
+ {
+ \node at (3-\j,-0.5) {$\j$};
+ \node at (3-\j,0.5) {\nbinary{2}{\j}};
+ \node at (3-\j,0) {\sixiang*{\j}};
+ }
+ \end{tikzpicture}
+\end{center}
+
+\subsection{The Eight Trigrams (the \emph{Bagua} with three lines)}
+\verb+\bagua {<bin>} [<scale>]+\index{bagua@\verb+\bagua+}, \verb+\bagua* {<dec>} [<scale>]+\index{bagua*@\verb+\bagua*+}.
+
+The Eight Trigrams obtained from \verb+\bagua{<bin>}+ by getting the binary number of $7,6,\dots,0$, and \verb+\bagua*{<dec>}+ for decimal.
+
+\begin{center}
+ \begin{tikzpicture}
+ \foreach \j in {7,6,...,0}
+ {
+ \node at (7-\j,-0.5) {$\j$};
+ \node at (7-\j,0.5) {\nbinary{3}{\j}};
+ \node at (7-\j,0) {\bagua*{\j}};
+ }
+ \end{tikzpicture}
+\end{center}
+
+\subsection{The Sixty-four Hexagrams (the \emph{Bagua} with six lines)}
+\verb+\Bagua [<2,8>]{<bin,oct>} [<scale>]+\index{Bagua@\verb+\Bagua+}, \verb+\Bagua* {<dec>} [<scale>]+\index{Bagua*@\verb+\Bagua*+}.
+
+The Sixty-four Hexagrams obtained from \verb+\Bagua{<bin>}+ by getting the binary number of $63,62,\dots,0$, \verb+\Bagua[8]{<oct>}+ for octal number $77,76,\dots,0$, and \verb+\bagua*{<dec>}+ for decimal.
+
+We list all the Sixty-four Hexagrams here, in which the above number is binary, the below is decimal and octal.
+
+\begin{center}
+ \begin{tikzpicture}
+ \foreach \j in {7,6,...,0}
+ {
+ \foreach \k in {7,6,...,0}
+ {
+ \node at (7*1.25-1.25*\k-0.3,1.5*\j-0.5) {\pgfmathparse{int(8*\j+\k)}\pgfmathresult};
+ \node at (7*1.25-1.25*\k+0.3,1.5*\j-0.5) {\j\k};
+ \node at (7*1.25-1.25*\k,1.5*\j+0.5) {\nbinary{3}{\j}\nbinary{3}{\k}};
+ \node at (7*1.25-1.25*\k,1.5*\j) {\Bagua[8]{\j\k}[1.5]};
+ }
+% \node at (7-\j,0) {$\j$};
+% \node at (7-\j,-0.5) {\nbinary{3}{\j}};
+% \node at (7-\j,-1) {\bagua*{\j}};
+ }
+ \end{tikzpicture}
+\end{center}
+
+\section{Versions}
+\subsection*{v1.01~2022.08.04}
+Revise \verb+\taiji+ to show the Grand Terminus in ancient books, add \verb+\xtaiji+ for later, fix some bugs.
+
+\subsection*{v1.0~2021.10.17}
+Release \verb+TikZ-Bugua+ v1.0.
+
+\begin{thebibliography}{9}
+ \bibitem {Legge} James Legge (Trans.). The I Ching, Second Edition. Dover Publications, Inc.
+\end{thebibliography}
+
+\printindex
+
+\end{document} \ No newline at end of file
diff --git a/graphics/pgf/contrib/tikz-bagua/tikz-bagua.pdf b/graphics/pgf/contrib/tikz-bagua/tikz-bagua.pdf
index 78b2fbdc58..1713a7cdcf 100644
--- a/graphics/pgf/contrib/tikz-bagua/tikz-bagua.pdf
+++ b/graphics/pgf/contrib/tikz-bagua/tikz-bagua.pdf
Binary files differ
diff --git a/graphics/pgf/contrib/tikz-bagua/tikz-bagua.sty b/graphics/pgf/contrib/tikz-bagua/tikz-bagua.sty
index d87ac26f41..7938bdcf05 100644
--- a/graphics/pgf/contrib/tikz-bagua/tikz-bagua.sty
+++ b/graphics/pgf/contrib/tikz-bagua/tikz-bagua.sty
@@ -1,13 +1,13 @@
%% This is file 'tikz-bagua.sty'
%%
-%% Developed by Xu Wang
-%% Copyright (C) 2021 by Xu Wang <cwangx@hotmail.com>
+%% Developed by WANG Xu
+%% Copyright (C) 2021 by WANG Xu <cwangx@hotmail.com>
%%
%% It may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License (LPPL).
%%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{bagua}[2021/10/17 v1.0 draw Bagua in Yijing via tikz package]
+\ProvidesPackage{tikz-bagua}[2022/08/04 v1.01 draw Bagua in Yijing via tikz package]
\RequirePackage{tikz}
\RequirePackage{xstring}
@@ -16,20 +16,55 @@
\RequirePackage{xintexpr}
%%\taiji[<scale>]
-\newcommand\taiji[1][0.816]{% taiji yinyang
- \begin{tikzpicture}[baseline=-0.3em,scale=#1]
- \draw (0,0) circle (0.5em);
- \fill (0,-0.5em) arc (270:90:0.25em) arc (-90:90:0.25em) arc (90:270:0.5em);
- \fill (0,-0.25em) circle (0.05em);
- \fill [fill=white] (0,0.25em) circle (0.05em);
- \end{tikzpicture}%
+\NewDocumentCommand\taiji{sO{1}}{% taiji yinyang
+ \IfDecimal{#2}{% % check whether #2 is decimal number
+ \IfBooleanTF#1% %check whether a star is exist
+ {% begin of a star seen
+ \begin{tikzpicture}[baseline=1.9074,scale=0.17646*#2]
+ \fill plot [domain=0:180,smooth] ({\x*1/180*cos(\x-90)},{\x*1/180*sin(\x-90)+1}) -- (0,2) arc (90:-90:1) plot [domain=0:180,smooth] ({\x*1/180*cos(\x+90)},{\x*1/180*sin(\x+90)+1});
+ \draw (0,1) circle (1);
+
+ \fill (0.25,0.25/pi+1) circle ({0.25/exp(1)});
+ \fill [fill=white] (-0.25,-0.25/pi+1) circle ({0.25/exp(1)});
+ \end{tikzpicture}
+ }% end of a star seen
+ {%
+ \begin{tikzpicture}[baseline=1.9074,scale=0.17646*#2]
+ \fill plot [domain=0:180,smooth] ({\x*1/180*cos(\x-90)},{\x*1/180*sin(\x-90)+1}) -- (0,2) arc (90:-90:1) plot [domain=0:180,smooth] ({\x*1/180*cos(\x+90)},{\x*1/180*sin(\x+90)+1});
+ \draw (0,1) circle (1);
+ \end{tikzpicture}
+ }%
+ }{\@latex@error{Error! Please check whether \#1 is decimal number.}{}}%
}
+%%\xtaiji[<scale>]
+\NewDocumentCommand\xtaiji{sO{1}}{% taiji yinyang
+ \IfDecimal{#2}{% % check whether #2 is decimal number
+ \IfBooleanTF#1% %check whether a star is exist
+ {% begin of a star seen
+ \begin{tikzpicture}[baseline=1.9074,scale=0.17646*#2]
+ \fill (0,0) arc (270:90:0.5) arc (-90:90:0.5) arc (90:-90:1);
+ \draw (0,1) circle (1);
+
+ \fill [fill=white] (0,0.5) circle ({0.25/exp(1)});
+ \fill (0,1.5) circle ({0.25/exp(1)});
+ \end{tikzpicture}
+ }% end of a star seen
+ {%
+ \begin{tikzpicture}[baseline=1.9074,scale=0.17646*#2]
+ \fill (0,0) arc (270:90:0.5) arc (-90:90:0.5) arc (90:-90:1);
+ \draw (0,1) circle (1);
+ \end{tikzpicture}
+ }%
+ }{\@latex@error{Error! Please check whether \#1 is decimal number.}{}}%
+}
+
+
%%\drawliangyi[<yshift>]{<0 or 1>}
\newcommand\drawliangyi[2][0]{%
- \ifnum #2=0 \draw (0,#1) -- (1em/3,#1) (2em/3,#1) -- (1em,#1)%;%
+ \ifnum #2=0 \draw [line width=0.0816em] (0,#1) -- (1em/3,#1) (2em/3,#1) -- (1em,#1)%;%
\else%
- \ifnum #2=1 \draw (0,#1) -- (1em,#1)%;%
+ \ifnum #2=1 \draw [line width=0.0816em] (0,#1) -- (1em,#1)%;%
\else \node {Error!}%
\fi%
\fi%
@@ -38,7 +73,7 @@
%%\liangyi{<0 or 1>}[<scale>]
\NewDocumentCommand\liangyi{mO{1}}{%
\IfInteger{#1}{%
- \xintifboolexpr{#1 = 0 || #1 = 1}{%
+ \xintifboolexpr{#1 == 0 || #1 == 1}{%
\begin{tikzpicture}[baseline=-0.3em,scale=#2]%
\drawliangyi{#1};%
\end{tikzpicture}}{\@latex@error{Error! Please check whether \#1 is 0 or 1.}{}}%
@@ -117,7 +152,7 @@
\IfBooleanTF#1%
{%% begin of If a star is seen
\bitsetSetDec{baguadec}{#3}%
- \xintifboolexpr {#3 >= 1 && #3 <64}%
+ \xintifboolexpr {#3 >= 1 && #3 < 64}%
{%
\begin{tikzpicture}[baseline=-0.714em,scale=#4]
\foreach \j in {5,4,...,0}
@@ -131,7 +166,7 @@
\ifnum#2=2%
\bitsetSetBin{baguabin}{#3}%
\StrLen{#3}[\lengthforbinary]%
- \xintifboolexpr{\lengthforbinary >= 1 && \lengthforbinary <7}%
+ \xintifboolexpr{\lengthforbinary >= 1 && \lengthforbinary < 7}%
{%
\begin{tikzpicture}[baseline=-0.714em,scale=#4]
\foreach \j in {5,4,...,0}
@@ -144,7 +179,7 @@
\ifnum#2=8%
\bitsetSetOct{baguaoct}{#3}%
\StrLen{#3}[\lengthforoct]%
- \xintifboolexpr{\lengthforoct =1 || \lengthforoct =2}%
+ \xintifboolexpr{\lengthforoct == 1 || \lengthforoct == 2}%
{%
\begin{tikzpicture}[baseline=-0.714em,scale=#4]
\foreach \j in {5,4,...,0}
diff --git a/graphics/pgf/contrib/tikz-bagua/tikz-bagua.tex b/graphics/pgf/contrib/tikz-bagua/tikz-bagua.tex
index ed50dee4a6..c2ef45e981 100644
--- a/graphics/pgf/contrib/tikz-bagua/tikz-bagua.tex
+++ b/graphics/pgf/contrib/tikz-bagua/tikz-bagua.tex
@@ -4,17 +4,17 @@
\usepackage{tikz-bagua}
\usetikzlibrary{math}
-\usepackage[fontset=kefonts]{ctex}
+\usepackage{ctex}%[fontset=kefonts]
\input{binhex}
\usepackage{makeidx} %创建索引
-\makeindex %创建索引开始命令,有很多可选参数, 文中需要显示索引的地方 \printindex 即可
+\makeindex
\title{TikZ-Bagua 宏包}
-\author{王旭 (WANG Xu) \\ duplli@aliyun.com}
-\date{\zhtoday~v1.0}
+\author{WANG Xu \\ cwangx@hotmail.com}
+\date{\zhtoday~v1.01}
\begin{document}
@@ -26,12 +26,17 @@
\section{使用方法}
-所定义的上述五个命令中最后一个可选参数均为放缩参数, 除了 \verb+\taiji+ 中的缺省值为 $0.816$ 之外, 其他四个的均为 $1$.
+所定义的上述五个命令中最后一个可选参数均为放缩参数 \verb|scale|, 缺省值均为 $1$.
\subsection{太极阴阳}
-\verb+\taiji [<scale>]+\index{taiji@\verb+\taiji+}.
-\verb+\taiji+ 直接得到 符号 \taiji{}.
+感谢热心网友的指出, 默认是古籍中的太极图, 且没有鱼眼, 加星则显示鱼眼. 鉴于现在常见到的半圆构造的也不少, 故新增命令以显示之, 显示鱼眼规则同上.
+
+\verb+\taiji [<scale>]+\index{taiji@\verb+\taiji+}, \verb+\taiji* [<scale>]+\index{xtaiji@\verb+\xtaiji+}.
+
+\verb+\xtaiji [<scale>]+\index{taiji@\verb+\taiji+}, \verb+\xtaiji* [<scale>]+\index{xtaiji@\verb+\xtaiji+}.
+
+四个命令默认直接对应得到 符号 \taiji \taiji* \xtaiji \xtaiji*.
\subsection{两仪}
\verb+\liangyi {<bin>} [<scale>]+\index{liangyi@\verb+\liangyi+}.
@@ -95,6 +100,13 @@
\end{tikzpicture}
\end{center}
+\section{版本记录}
+\subsection*{v1.01~2022.08.04}
+修改默认 \verb+\taiji+ 为无鱼眼的古籍上的太极, 为现在常见的半圆构造新增 \verb+\xtaiji+, 修复了已发现的 bug.
+
+\subsection*{v1.0~2021.10.17}
+发布 \verb+TikZ-Bugua+ 宏包.
+
\printindex
\end{document} \ No newline at end of file