<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\documentclass[full]{l3doc}
\usepackage[scheme=plain]{ctex}
\usepackage{enumitem}
\usepackage{indentfirst}
\usepackage{titling}
\usepackage{geometry}
\usepackage{fancyvrb-ex}
\usepackage{pascaltriangle}

\IndexPrologue
  {
    \section*{Index}
    \markboth{Index}{Index}
    \addcontentsline{toc}{section}{Index}
    The~italic~numbers~denote~the~pages~where~the~
    corresponding~entry~is~described,~
    numbers~underlined~point~to~the~definition,~
    all~others~indicate~the~places~where~it~is~used.
  }

\newcommand\tikzmark[1]{\tikz \coordinate[overlay, remember picture] (#1);}

\geometry{
  left=4.5cm,
  right=2cm,
  top=2cm,
  bottom=2cm,
}
\hypersetup {
  CJKbookmarks,
  bookmarksopen,
  bookmarksopenlevel=3,
  pdfstartview=FitH,
  pdfinfo = {
   Title = The package pascaltriangle ,
   Subject = A LaTeX3 package ,
   Author = Geng Nan
 }
}

\DoNotIndex{\begin, \end}
\setlength{\parskip}{\medskipamount}
\DeclareDocumentEnvironment { noteen } { +b } {
  \par\textbf{\textsf{NOTE:~}}#1\par
} {}
\DeclareDocumentEnvironment { notezh } { +b } {
  \par\textbf{\textsf{æ³¨æ„:~}}#1\par
} {}

\AtEndDocument{
  \newgeometry{
    left=2cm,
    right=2cm,
    top=2cm,
    bottom=2cm
  }
  \PrintIndex
}

\ExplSyntaxOn
\dim_new:N \l__my_syntax_dim
\box_new:N \g__my_syntax_box
\NewDocumentEnvironment { Syntax } { s }
  {
    \dim_set:Nn \l__my_syntax_dim
      { \textwidth }
    \hbox_gset:Nw \g__my_syntax_box
      \small \ttfamily
      \begin{minipage}[t]{\l__my_syntax_dim}
        \raggedright\obeyspaces\obeylines
  }
  {
      \end{minipage}
    \hbox_gset_end:
    \IfValueF { #1 } { \smallskip }
    \box_use_drop:N \g__my_syntax_box
    \smallskip
  }

\DeclareDocumentEnvironment { Description } { o +b } {
  \hbox_set:Nn \l_tmpa_box { #1 }
  \dim_set:Nn \l_tmpa_dim { \box_wd:N \l_tmpa_box }
  \begin{itemize}[labelwidth=\l_tmpa_dim, align=left]
    #2
  \end{itemize}
} {  }

\keys_define:nn { pascal/doc } {
  opt .tl_set:N = \l_opt_tl,
  desc .tl_set:N = \l_desc_tl,
  init .tl_set:N = \l_init_tl,
  init .initial:n = init-none,
}

\box_new:N \l__option_box
\NewDocumentEnvironment { option } { m +b } {
  \keys_set:nn { pascal/doc } { #1 }
  \hbox_set:Nw \l__option_box
    \small \ttfamily
    \begin{minipage}[t]{\textwidth}
      \obeyspaces\obeylines
      \textcolor{red}{
        \l_opt_tl
        \exp_args:Nx\SpecialOptionIndex{\l_opt_tl}
      }
      {~}\l_desc_tl
      \hfill(
      \tl_if_eq:NnTF \l_init_tl { init-none } { no~value }
        { initially~\texttt{\l_init_tl} }
      )
    \end{minipage}
  \hbox_gset_end:
  \box_use_drop:N \l__option_box
  #2
  \medskip
} {  }

\DeclareDocumentCommand \opt { O{} m }
  { \__codedoc_cmd:no {#1} { #2 } }
\ExplSyntaxOff

\def\vers{\texttt{v1.0.1}
\thanks{\url{https://github.com/registor/pascaltriangle}}
\thanks{\url{https://gitee.com/nwafu_nan/pascaltriangle}}
}

\begin{document}
\title{
  \pkg{pascaltriangle} å®åŒ…
  \rlap{\makebox[4cm][r]{
    \normalsize $\Longrightarrow$ \color{red}
    \protect\hyperlink{en}{English Version}
    \protect\hypertarget{zh}{}
  }}
}
\author{\textit{è€¿æ¥&nbsp;} \texttt{&lt;nangeng@nwafu.edu.cn&gt;}}
\date{\the\year å¹´\the\month æœˆ\the\day æ—¥\qquad \vers
}
\maketitle

{\small
\tableofcontents
}
\newpage

\begin{documentation}

\section{å¼•è¨€}
\pkg{pascaltriangle}æ˜¯ä¸€ä¸ªåŸºäºŽ\pkg{TikZ}ç”¨\pkg{expl3}å¼€å‘çš„
Pascalä¸‰è§’å½¢(æ¨è¾‰ä¸‰è§’å½¢)ç”Ÿæˆå®åŒ…ï¼Œå®ƒæä¾›äº†ä¸€ä¸ªå”¯ä¸€çš„ç»˜å›¾å‘½ä»¤
\tn{pascal}ï¼Œå¹¶å¯ä»¥é€šè¿‡ä¸åŒå‘½ä»¤çš„å‘½ä»¤é€‰é¡¹æˆ–\tn{pascalset}å‘½ä»¤
è®¾ç½®ç”Ÿæˆä¸åŒå¤–è§‚çš„ç­‰è…°æˆ–ç›´è§’Pascalä¸‰è§’å½¢ã€‚

\section{ç”¨æˆ·æŽ¥å£}

\subsection{\cs{pascal}ç»˜å›¾å‘½ä»¤}

\begin{function}{\pascal}
  \begin{syntax}
    \cs{pascal} \oarg{å¤–è§‚é€‰é¡¹} \marg{å±‚æ•°}
  \end{syntax}

\end{function}

  ç”¨äºŽç»˜åˆ¶ä¸€ä¸ªPascalä¸‰è§’å½¢ã€‚

  è¯¥å‘½ä»¤ä»…æœ‰ä¸€ä¸ªå¿…é€‰å‚æ•°\marg{å±‚æ•°}ï¼Œç”¨äºŽæŒ‡å®šPascalä¸‰è§’å½¢çš„å±‚æ•°ã€‚

  åœ¨\oarg{å¤–è§‚é€‰é¡¹}ä¸­å¯ä»¥é€šè¿‡key-valueæ–¹å¼è®¾ç½®ä¸‰è§’å½¢å½¢çŠ¶ã€å¤§å°ç­‰å¤–è§‚ã€‚

  ä¸‰è§’å½¢çš„å¤–è§‚ä¹Ÿå¯ä»¥é€šè¿‡\cs{pascalset}å‘½ä»¤çš„é€—å·åˆ†éš”key-valueåˆ—è¡¨è¿›è¡Œè®¾ç½®

\subsection{\cs{pascalset}}
\begin{function}{\pascalset}
  \begin{syntax}
    \cs{pascalset} \marg{å¤–è§‚é€‰é¡¹}
  \end{syntax}

\end{function}

  ç”¨äºŽè®¾ç½®ä¸€ä¸ªPascalä¸‰è§’å½¢çš„å¤–è§‚ã€‚

  åœ¨\marg{å¤–è§‚é€‰é¡¹}ä¸­å¯ä»¥é€šè¿‡key-valueæ–¹å¼è®¾ç½®ä¸‰è§’å½¢å½¢çŠ¶ã€å¤§å°ç­‰å¤–è§‚ã€‚

\section{å¤–è§‚é€‰é¡¹}

\begin{option}{ opt = shape, desc = {= \meta{å½¢çŠ¶}}, init=iso }
  è®¾ç½®Pascalä¸‰è§’å½¢çš„å½¢çŠ¶ï¼Œç›®å‰æ”¯æŒ|iso|---ç­‰è…°ä¸‰è§’å½¢å’Œ
  |rt|---ç›´è§’ä¸‰è§’å½¢ã€‚
\end{option}\\
\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.65\linewidth,gobble=2]
  \centering
  \pascal{5}\qquad
  \pascal[shape=rt]{5}
\end{SideBySideExample}

\bigskip

\begin{option}{ opt = radius, desc = {= \meta{åŠå¾„}}, init=0.5cm }
  è®¾ç½®ä¸‰è§’å½¢æ¯ä¸ªå•å…ƒå¤–æŽ¥åœ†åŠå¾„ï¼Œæ³¨æ„éœ€è¦å¸¦æœ‰å•ä½ã€‚
\end{option}\\
\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.65\linewidth,gobble=2]
  \centering
  \pascal[radius=0.8cm]{5}
\end{SideBySideExample}

\bigskip

\begin{option}{ opt = fontsize, desc = {= \meta{å­—å·å‘½ä»¤}}, init=\cs{small} }
  è®¾ç½®ä¸‰è§’å½¢æ¯ä¸ªå•å…ƒä¸­æ•°å­—æ–‡æœ¬å¤§å°ã€‚
\end{option}\\
\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.65\linewidth,gobble=2]
  \centering
  \pascal[radius=0.8cm,
    fontsize=\Huge]{5}
\end{SideBySideExample}

\bigskip

\begin{option}{opt=withnum, desc={= \meta{å¸ƒå°”å€¼}}, init=false}
    è®¾ç½®æ˜¯å¦æ˜¾ç¤ºPascalä¸‰è§’å½¢çš„è¡Œåˆ—ç¼–å·ã€‚
\end{option}\\
\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.63\linewidth,gobble=2]
  \centering
  \pascal[withnum]{4}
  \pascal[withnum,shape=rt]{4}
\end{SideBySideExample}

\bigskip

\begin{option}{opt = binom, desc = {= \meta{å¸ƒå°”å€¼}}, init=false}
  è®¾ç½®æ˜¯å¦æ˜¾ç¤ºç”¨äºŒé¡¹å¼è¡¨è¾¾å¼æ˜¾ç¤ºå„å…ƒç´&nbsp;å€¼ã€‚
\end{option}\\
\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.63\linewidth,gobble=2]
  \centering
  \pascal[binom]{5}
  \pascal[binom,shape=rt]{5}
\end{SideBySideExample}

\bigskip

\begin{option}{ opt = fillr, desc = {= \meta{æ•´æ•°}}, init=1 }
  è®¾ç½®éœ€è¦è¡¨ç¤ºå‰åˆ—ç´¯åŠ&nbsp;çš„å•å…ƒæ&nbsp;¼è¡Œå·ï¼Œæ³¨æ„è¡Œå·æ˜¯å½“å‰åˆ—è‡ªé¡¶å‘ä¸‹ä»Ž0å¼€å§‹è®¡æ•°ã€‚
\end{option}

\begin{option}{ opt = fillc, desc = {= \meta{æ•´æ•°}}, init=1 }
  è®¾ç½®éœ€è¦è¡¨ç¤ºå‰åˆ—ç´¯åŠ&nbsp;çš„å•å…ƒæ&nbsp;¼åˆ—å·ï¼Œæ³¨æ„åˆ—å·æ˜¯è‡ªå·¦å‘å³ä»Ž0å¼€å§‹è®¡æ•°ã€‚
\end{option}\\
\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.64\linewidth,gobble=2]
  \centering
  \pascalset{fillr=2,fillc=6,
             radius=0.4cm}
  \pascal{10}\\
  \pascal[shape=rt]{10}
\end{SideBySideExample}

\bigskip

\title{
  Package \pkg{pascaltriangle}
  \rlap{\makebox[4cm][r]{
    \normalsize $\Longrightarrow$ \color{red}
    \protect\hyperlink{zh}{ä¸­æ–‡ç‰ˆæœ¬}
    \protect\hypertarget{en}{}
  }}
}
\author{Nan Geng \texttt{&lt;nangeng@nwafu.edu.cn&gt;}}
\date{\today\qquad \vers}
\maketitle

\section{Introduction}

\pkg{pascaltriangle} is a Pascal triangle(Yanghui triangle) generation package
based on TikZ developed in expl3, which provides a unique drawing command \cs{pascal},
and can be set by different options or \cs{pascalset} macro to
generates isosceles or right-angle Pascal triangles with different appearances.

\section{Interfaces}

\subsection{\cs{pascal} macro}

\begin{function}{\pascal}
  \begin{syntax}
    \cs{pascal} \oarg{options} \marg{order}
  \end{syntax}
\end{function}
Used to draw a Pascal triangle.

This macro has only one mandatory parameter \marg{order},
which specifies the number of layers of the Pascal triangle.

In \oarg{options} you can set the appearance of the triangle shape,
size, etc. by key-value method.

The appearance of the triangle can also be set via the comma-separated
key-value list of the \cs{pascalset} macro

\subsection{\cs{pascalset} macro}

\begin{function}{\pascalset}
  \begin{syntax}
    \cs{pascalset} \marg{options}
  \end{syntax}
\end{function}

Used to set the appearance of Pascal triangle.

In \oarg{options} you can set the appearance of the triangle shape,
size, etc. by key-value method.

\section{options}

\begin{option}{ opt = shape, desc = {= \meta{shape}}, init=iso }
  Sets the shape of Pascal triangle
  currently supporting |iso|---isosceles triangles and |rt|---right-angle triangles.
\end{option}\\
\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.65\linewidth,gobble=2]
  \centering
  \pascal{5}\qquad
  \pascal[shape=rt]{5}
\end{SideBySideExample}

\bigskip

\begin{option}{ opt = radius, desc = {= \meta{radius}}, init=0.5cm }
  Set the radius of the outer circle of each cell of the triangle,
  note that it needs to have units.
\end{option}\\
\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.65\linewidth,gobble=2]
  \centering
  \pascal[radius=0.8cm]{5}
\end{SideBySideExample}

\bigskip

\begin{option}{ opt = fontsize, desc = {= \meta{fontsize}}, init=\cs{small} }
  Sets the fontsize of each cell of the triangle.
\end{option}\\
\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.65\linewidth,gobble=2]
  \centering
  \pascal[radius=0.8cm,
    fontsize=\Huge]{5}
\end{SideBySideExample}

\bigskip

\begin{option}{opt=withnum, desc={= \meta{bool}}, init=false}
  Sets whether to show the Pascal triangle row/col numbers or not.
\end{option}\\
\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.63\linewidth,gobble=2]
  \centering
  \pascal[withnum]{4}
  \pascal[withnum,shape=rt]{4}
\end{SideBySideExample}

\bigskip

\begin{option}{opt = binom, desc = {= \meta{bool}}, init=false}
  Sets whether to show each element value with binomial expressions or not.
\end{option}\\
\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.63\linewidth,gobble=2]
  \centering
  \pascal[binom]{5}
  \pascal[binom,shape=rt]{5}
\end{SideBySideExample}

\bigskip

\begin{option}{ opt = fillr, desc = {= \meta{integer}}, init=1 }
  Set the row number of the cell that needs to indicate the sum of the pre-column,
  note that the row number is in the current column counted from the top down based 0.
\end{option}

\begin{option}{ opt = fillc, desc = {= \meta{integer}}, init=1 }
  Set the col number of the cell that needs to indicate the sum of the pre-column,
  note that the col number is counted from the left to right based 0.
\end{option}\\
\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.64\linewidth,gobble=2]
  \centering
  \pascalset{fillr=2,fillc=6,
             radius=0.4cm}
  \pascal{10}\\
  \pascal[shape=rt]{10}
\end{SideBySideExample}

\end{documentation}


\end{document}
</pre></body></html>