texlive[60785] Master: tikz-bagua (17oct21)

commits+karl at tug.org commits+karl at tug.org
Sun Oct 17 22:46:17 CEST 2021


Revision: 60785
          http://tug.org/svn/texlive?view=revision&revision=60785
Author:   karl
Date:     2021-10-17 22:46:17 +0200 (Sun, 17 Oct 2021)
Log Message:
-----------
tikz-bagua (17oct21)

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/tikz-bagua/
    trunk/Master/texmf-dist/doc/latex/tikz-bagua/README.md
    trunk/Master/texmf-dist/doc/latex/tikz-bagua/tikz-bagua.pdf
    trunk/Master/texmf-dist/doc/latex/tikz-bagua/tikz-bagua.tex
    trunk/Master/texmf-dist/tex/latex/tikz-bagua/
    trunk/Master/texmf-dist/tex/latex/tikz-bagua/tikz-bagua.sty
    trunk/Master/tlpkg/tlpsrc/tikz-bagua.tlpsrc

Added: trunk/Master/texmf-dist/doc/latex/tikz-bagua/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tikz-bagua/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/tikz-bagua/README.md	2021-10-17 20:46:17 UTC (rev 60785)
@@ -0,0 +1,52 @@
+tikz-bagua
+========
+
+The `tikz-bagua` package provides commands to drawing symbols in Yijing (I Ching) or Zhouyi. And there is not need extra special fonts for showing those symbols. 
+
+Basic Usage
+-----------
+The package provides the following macros:
+
+    \Bagua{<binary-number>}
+
+Convert `<binary-number>` to a corresponding symbol in Yijing (I Ching) or Zhouyi.
+
+    \Bagua*{<decimal-number>}
+
+Similar to `\Bagua{<binary-number>}`, but option must be a decimal number.
+
+Taiji (Yinyang), Liangyi ans Sixiang symbols are considered too.
+
+You can read the package manual (in Chinese) for more detailed explanations.
+
+Contributing
+------------
+
+This package is on [TikZ-Bugua](https://github.com/duplli/tikz-bagua).
+
+Issues and pull requests are welcome.
+
+Copyright and Licence
+---------------------
+
+    Copyright (C) 2012, 2014-2020 by WANG Xu <duplli at aliyun.com>
+    ----------------------------------------------------------------------
+
+    This work may be distributed and/or modified under the
+    conditions of the LaTeX Project Public License, either
+    version 1.3c of this license or (at your option) any later
+    version. This version of this license is in
+       http://www.latex-project.org/lppl/lppl-1-3c.txt
+    and the latest version of this license is in
+       http://www.latex-project.org/lppl.txt
+    and version 1.3 or later is part of all distributions of
+    LaTeX version 2005/12/01 or later.
+
+    This work has the LPPL maintenance status "maintained".
+
+    The Current Maintainer of this work is WANG Xu.
+
+    This package consists of the file  tikz-bagua.sty,
+                                       tikz-bagua.pdf,
+                                       tikz-bagua.tex,
+                                       README.md (this file).


Property changes on: trunk/Master/texmf-dist/doc/latex/tikz-bagua/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/tikz-bagua/tikz-bagua.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/tikz-bagua/tikz-bagua.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tikz-bagua/tikz-bagua.pdf	2021-10-17 20:44:49 UTC (rev 60784)
+++ trunk/Master/texmf-dist/doc/latex/tikz-bagua/tikz-bagua.pdf	2021-10-17 20:46:17 UTC (rev 60785)

Property changes on: trunk/Master/texmf-dist/doc/latex/tikz-bagua/tikz-bagua.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/tikz-bagua/tikz-bagua.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tikz-bagua/tikz-bagua.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/tikz-bagua/tikz-bagua.tex	2021-10-17 20:46:17 UTC (rev 60785)
@@ -0,0 +1,100 @@
+\documentclass{article}
+
+\usepackage[margin=3cm]{geometry}
+
+\usepackage{tikz-bagua}
+\usetikzlibrary{math}
+\usepackage[fontset=kefonts]{ctex}
+
+\input{binhex}
+
+\usepackage{makeidx}   %创建索引
+
+\makeindex   %创建索引开始命令,有很多可选参数, 文中需要显示索引的地方 \printindex 即可
+
+\title{TikZ-Bagua 宏包}
+\author{王旭 (WANG Xu) \\ duplli at aliyun.com}
+\date{\zhtoday~v1.0}
+
+\begin{document}
+
+\maketitle
+
+\section{简介}
+
+\verb+TikZ-Bagua+ 宏包使用 \verb+TikZ+ 宏包, 借助于 \verb+xparse+, \verb+xstring+, \verb+bitset+ 以及 \verb+xintexpr+, 定义了 \verb+\taiji+, \verb+\liangyi+, \verb+\sixiang+, 三爻 \verb+\bagua+ 和六爻 \verb+\Bagua+,  画出《周易》中所用的的太极阴阳, 两仪四象八卦和六十四卦符号, 对字体没有要求.
+
+\section{使用方法}
+
+所定义的上述五个命令中最后一个可选参数均为放缩参数, 除了 \verb+\taiji+ 中的缺省值为 $0.816$ 之外, 其他四个的均为 $1$.
+
+\subsection{太极阴阳}
+\verb+\taiji [<scale>]+\index{taiji@\verb+\taiji+}.
+
+\verb+\taiji+ 直接得到 符号 \taiji{}.
+
+\subsection{两仪}
+\verb+\liangyi {<bin>} [<scale>]+\index{liangyi@\verb+\liangyi+}.
+
+\verb+\liangyi{<bin>}+ 通过接受参数 $1$ 或 $0$ 得到两仪符号 \liangyi{1} 或 \liangyi{0}.
+
+\subsection{四象}
+\verb+\sixiang {<bin>} [<scale>]+\index{sixiang@\verb+\sixiang+}, \verb+\sixiang* {<dec>} [<scale>]+\index{sixiang*@\verb+\sixiang*+}.
+
+\verb+\sixiang{<bin>}+ 通过接受参数 $3,2,1,0$ 的二进制数得到四象符号, 而 \verb+\sixiang*{<dec>}+ 接收十进制数.
+
+\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{三爻八卦}
+\verb+\bagua {<bin>} [<scale>]+\index{bagua@\verb+\bagua+}, \verb+\bagua* {<dec>} [<scale>]+\index{bagua*@\verb+\bagua*+}.
+
+\verb+\bagua{<bin>}+ 通过接受参数 $7,6,\dots,0$ 的二进制数得到三爻八卦符号, 而 \verb+\bagua*{<dec>}+ 接收十进制数.
+
+\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{六爻八卦}
+\verb+\Bagua [<2,8>]{<bin,oct>} [<scale>]+\index{Bagua@\verb+\Bagua+}, \verb+\Bagua* {<dec>} [<scale>]+\index{Bagua*@\verb+\Bagua*+}.
+
+\verb+\Bagua{<bin>}+ 通过接受参数 $63,62,\dots,0$ 的二进制数得到六爻八卦符号, \verb+\Bagua[8]{<oct>}+ 接收的为$63,62,\dots,0$ 的八进制数, 而 \verb+\Bagua*{<dec>}+ 接收十进制数.
+
+列出所有的六十四卦, 其中每卦上一行六位数为对应的二进制数, 下一行左右两边分别为对应的十进制和八进制数.
+
+\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}
+
+\printindex
+
+\end{document}
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/doc/latex/tikz-bagua/tikz-bagua.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/tikz-bagua/tikz-bagua.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tikz-bagua/tikz-bagua.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/tikz-bagua/tikz-bagua.sty	2021-10-17 20:46:17 UTC (rev 60785)
@@ -0,0 +1,165 @@
+%% This is file 'tikz-bagua.sty'
+%%
+%% Developed by Xu Wang
+%% Copyright (C) 2021 by Xu Wang <cwangx at 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]
+
+\RequirePackage{tikz}
+\RequirePackage{xstring}
+\RequirePackage{bitset}
+\RequirePackage{xparse}
+\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}%
+}
+
+%%\drawliangyi[<yshift>]{<0 or 1>}
+\newcommand\drawliangyi[2][0]{%
+	\ifnum #2=0 \draw (0,#1) -- (1em/3,#1) (2em/3,#1) -- (1em,#1)%;%
+	\else%
+		\ifnum #2=1 \draw (0,#1) -- (1em,#1)%;%
+		\else \node {Error!}%
+		\fi%
+	\fi%
+}
+
+%%\liangyi{<0 or 1>}[<scale>]
+\NewDocumentCommand\liangyi{mO{1}}{%
+	\IfInteger{#1}{%
+		\xintifboolexpr{#1 = 0 || #1 = 1}{%
+			\begin{tikzpicture}[baseline=-0.3em,scale=#2]%
+				\drawliangyi{#1};%
+		\end{tikzpicture}}{\@latex at error{Error! Please check whether \#1 is 0 or 1.}{}}%
+	}{\@latex at error{Error! Please check whether \#1 is integer.}{}}%
+}
+
+%%\sixiang{<binary>}[<scale>]
+%%\sixiang*{<decimal>}[<scale>]
+\NewDocumentCommand\sixiang{smO{1}}{% \sixiang{11}=\sixiang*{3}
+	\IfInteger{#2}{% begin of if #2 is an integer
+		\IfBooleanTF#1%
+		{\xintifboolexpr{#2 >= 0 && #2 < 4}% begin of If a star is seen
+			{\bitsetSetDec{sixiangdec}{#2}%
+				\begin{tikzpicture}[baseline=-0.5em,scale=#3]%[baseline=-0.225em] 
+					\foreach \j in {1,0}
+					{
+						\drawliangyi[-\j*0.408em]{\bitsetGet{sixiangdec}{\j}};
+					}
+			\end{tikzpicture}}{\@latex at error{Error! Please check whether 0<=\#1<4.}{}}%
+		}% end of If a star is seen
+		{\StrLen{#2}[\lengthforbinary]%begin of binary
+			\xintifboolexpr{\lengthforbinary=1 || \lengthforbinary=2}{%
+				\bitsetSetBin{sixiangbin}{#2}%
+				\begin{tikzpicture}[baseline=-0.5em,scale=#3]%[baseline=-0.225em]
+					\foreach \j in {1,0}
+					{
+						\drawliangyi[-\j*0.408em]{\bitsetGet{sixiangbin}{\j}};
+					}
+				\end{tikzpicture}%
+			}{\@latex at error{Error! Please check whether 0<=\#1<=11.}{}}%end of binary
+		}%     If no star is seen
+	}% end of if #2 is an integer
+	{\@latex at error{Error! Please check whether \#1 is integer.}{}}% else #2 is not an integer
+}
+
+%%\bagua{<binary>}[<scale>]
+%%\bagua*{<decimal>}[<scale>]
+\NewDocumentCommand\bagua{smO{1}}{% \bagua{101}=\bagua*{5}
+	\IfInteger{#2}{% begin of if #2 is an integer
+		\IfBooleanTF#1%
+		{%% begin of If a star is seen
+			\bitsetSetDec{baguadec}{#2}%
+			\xintifboolexpr {#2 >= 0 && #2 <8}
+			{%
+				\begin{tikzpicture}[baseline=-0.714em,scale=#3]
+					\foreach \j in {2,1,0}
+					{
+						\drawliangyi[-\j*0.408em]{\bitsetGet{baguadec}{\j}};
+					}
+				\end{tikzpicture}%
+			}%
+			{\@latex at error{Error! Please check whether 0<=\#1<8.}{}}%
+		}%% end of If a star is seen
+		{%% begin of If no star is seen
+			\bitsetSetBin{baguabin}{#2}%
+			\StrLen{#2}[\lengthforbinary]%
+			\xintifboolexpr{\lengthforbinary > 0 && \lengthforbinary <4}%
+			{%
+				\begin{tikzpicture}[baseline=-0.714em,scale=#3]
+					\foreach \j in {2,1,0}
+					{
+						\drawliangyi[-\j*0.408em]{\bitsetGet{baguabin}{\j}};
+					}
+				\end{tikzpicture}%
+			}%
+			{\@latex at error{Error! Please check whether 0<=\#1<1000.}{}}%
+		}%% end of If no star is seen
+	}% end of if #2 is an integer
+	{\@latex at error{Error! Please check whether \#1 is integer.}{}}% else #2 is not an integer
+}
+
+%%\Bagua[<2 default, 8>]{<binary, octal>}[<scale>]
+%%\Bagua*{<decimal>}[<scale>]
+\NewDocumentCommand\Bagua{sO{2}mO{1}}{% \bagua{101110}=\bagua[8]{56}=\bagua*{46}
+	\IfInteger{#3}{% begin of if #3 is an integer
+		\IfBooleanTF#1%
+		{%% begin of If a star is seen
+			\bitsetSetDec{baguadec}{#3}%
+			\xintifboolexpr {#3 >= 1 && #3 <64}%
+			{%
+				\begin{tikzpicture}[baseline=-0.714em,scale=#4]
+					\foreach \j in {5,4,...,0}
+					{
+						\drawliangyi[-\j*0.1632em]{\bitsetGet{baguadec}{\j}};
+					}
+				\end{tikzpicture}%
+			}{\@latex at error{Error! Please check whether 0<=\#2<64.}{}}%
+		}%% end of If a star is seen
+		{%% begin of If no star is seen
+			\ifnum#2=2%
+			\bitsetSetBin{baguabin}{#3}%
+			\StrLen{#3}[\lengthforbinary]%
+			\xintifboolexpr{\lengthforbinary >= 1 && \lengthforbinary <7}%
+			{%
+				\begin{tikzpicture}[baseline=-0.714em,scale=#4]
+					\foreach \j in {5,4,...,0}
+					{
+						\drawliangyi[-\j*0.1632em]{\bitsetGet{baguabin}{\j}};
+					}
+				\end{tikzpicture}%
+			}{\@latex at error{Error! Please check whether 0<=\#2<1000000.}{}}%
+			\else%
+			\ifnum#2=8%
+			\bitsetSetOct{baguaoct}{#3}%
+			\StrLen{#3}[\lengthforoct]%
+			\xintifboolexpr{\lengthforoct =1 || \lengthforoct =2}%
+			{%
+				\begin{tikzpicture}[baseline=-0.714em,scale=#4]
+					\foreach \j in {5,4,...,0}
+					{
+						\drawliangyi[-\j*0.1632em]{\bitsetGet{baguaoct}{\j}};
+					}%
+				\end{tikzpicture}%
+			}{\@latex at error{Error! Please check whether 0<=\#2<100.}{}}%
+			\else{\@latex at error{Error! Please check whether \#1 is default (2) or 8.}{}}\fi%
+			\fi%
+		}%% end of If no star is seen
+	}% end of if #3 is an integer
+	{\@latex at error{Error! Please check whether \#2 is integer.}{}}% else #3 is not an integer
+}
+
+\endinput
+%%
+%% End of file 'tikz-bagua.sty'
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/tex/latex/tikz-bagua/tikz-bagua.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2021-10-17 20:44:49 UTC (rev 60784)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2021-10-17 20:46:17 UTC (rev 60785)
@@ -769,7 +769,7 @@
     threadcol threeddice threeparttable threeparttablex
     thuaslogos thubeamer thucoursework thumb thumbpdf thumbs thumby thuthesis
     ticket ticollege
-    tikz-3dplot tikz-among-us tikz-bayesnet tikz-bbox
+    tikz-3dplot tikz-among-us tikz-bagua tikz-bayesnet tikz-bbox
     tikz-cd tikz-dependency tikz-dimline
     tikz-feynhand tikz-feynman tikz-imagelabels tikz-inet
     tikz-kalender tikz-karnaugh tikz-ladder tikz-lake-fig tikz-layers

Modified: trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc	2021-10-17 20:44:49 UTC (rev 60784)
+++ trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc	2021-10-17 20:46:17 UTC (rev 60785)
@@ -155,6 +155,7 @@
 depend ticollege
 depend tikz-3dplot
 depend tikz-among-us
+depend tikz-bagua
 depend tikz-bayesnet
 depend tikz-bbox
 depend tikz-cd

Added: trunk/Master/tlpkg/tlpsrc/tikz-bagua.tlpsrc
===================================================================


More information about the tex-live-commits mailing list.