summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/joinbox/joinbox.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/joinbox/joinbox.tex')
-rw-r--r--macros/latex/contrib/joinbox/joinbox.tex516
1 files changed, 516 insertions, 0 deletions
diff --git a/macros/latex/contrib/joinbox/joinbox.tex b/macros/latex/contrib/joinbox/joinbox.tex
new file mode 100644
index 0000000000..bb6d7916ef
--- /dev/null
+++ b/macros/latex/contrib/joinbox/joinbox.tex
@@ -0,0 +1,516 @@
+\documentclass[full]{l3doc}
+\usepackage[scheme=plain]{ctex}
+\usepackage{enumitem}
+\usepackage{indentfirst}
+\usepackage{titling}
+\usepackage{geometry}
+\usepackage{fancyvrb-ex}
+\usepackage{joinbox}
+
+\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 joinbox ,
+ 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 { joinbox/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 { joinbox/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.0}
+\thanks{\url{https://gitee.com/nwafu_nan/joinbox}}
+}
+
+\begin{document}
+\title{
+ \pkg{joinbox}盒子拼接宏包
+ \rlap{\makebox[4cm][r]{
+ \normalsize $\Longrightarrow$ \color{red}
+ \protect\hyperlink{en}{English Version}
+ \protect\hypertarget{zh}{}
+ }}
+}
+\author{\textit{耿楠} \texttt{<nangeng@nwafu.edu.cn>}}
+\date{\the\year 年\the\month 月\the\day 日\qquad \vers
+}
+\maketitle
+
+{\small
+\tableofcontents
+}
+\newpage
+
+\begin{documentation}
+
+\section{引言}
+
+\pkg{joinbox}是一个基于\pkg{l3coffins}用\pkg{expl3}开发的
+盒子拼接宏包,它用于实现盒子的垂直或水平拼接。垂直拼接
+会以各对象等宽的方式拼接,而水平拼接会以各对象等高的方式
+拼接。
+
+该宏包提供了\tn{joinbox}和\tn{joinfigs}两个命令。其中,
+\tn{joinbox}用于拼接两个独立对象,\tn{joinfigs}用于拼接
+多个图像。这两个命令的不带*(星号)版本用于垂直拼接,而带
+*(星号)的版本用于水平拼接。
+同时,该宏包还提供了\tn{joinset}命令用于对拼接方式进行设置。
+
+\section{用户接口}
+
+\subsection{\cs{joinbox}拼接两个对象命令}
+
+\begin{function}{\joinbox,\joinbox*}
+ \begin{syntax}
+ \cs{joinbox} \oarg{拼接方式} \marg{对象1} \marg{对象2}
+ \cs{joinbox*} \oarg{拼接方式} \marg{对象1} \marg{对象2}
+ \end{syntax}
+
+\end{function}
+
+ 用于拼接两个对象。 该命令需要用两个必选参数\marg{对象1}和
+ \marg{对象2}指定需要拼接的对象。拼接对象将被置于coffin中,
+ 然后按需求进行拼接。
+
+ 在可选项\oarg{拼接方式}中,可以通过key-value指定输出结果
+ 基线位置、 输出尺寸(垂直拼接是输出宽度,水平拼接是输出高度)
+ 和拼接间距。
+
+\subsection{\cs{joinfigs}拼接多个图像命令}
+
+\begin{function}{\joinfigs,\joinfigs*}
+ \begin{syntax}
+ \cs{joinfigs} \oarg{拼接方式} \marg{文件名称列表}
+ \cs{joinfigs*} \oarg{拼接方式} \marg{文件名称列表}
+ \end{syntax}
+
+\end{function}
+
+ 用于拼接多个图像。该命令需要用一个必选参数\marg{文件名称列表},
+ 用于指定需要拼接图像,文件名称中可以包含路径,不同文件名称之
+ 间用英文逗号进行分隔,最少需要有1个图像文件名称。
+
+ 在\oarg{拼接方式}可选项中,可以通过key-value指定结果基线位置、
+ 输出尺寸(垂直拼接是输出宽度,水平拼接是输出调试)、拼接间距。
+
+\subsection{\cs{joinset}}
+\begin{function}{\joinset}
+ \begin{syntax}
+ \cs{joinset} \marg{拼接方式}
+ \end{syntax}
+
+\end{function}
+
+ 用于通过key-value指定拼接结果中的基线位置、
+ 输出尺寸(垂直拼接是输出宽度,水平拼接是输出调试)、拼接间距。
+
+\section{拼接方式}
+
+\begin{option}{ opt = baseline, desc = {= \meta{t,vc,H,b}}, init=b }
+ 设置joinbox或joinfigs拼接结果的输出基线位置,目前支持:
+\end{option}\\
+\begin{Description}
+ \item |t|--- 盒子顶端水平线、
+ \item |vc|---盒子水平中心线、
+ \item |H|---盒子内容基线、
+ \item |b|---盒子底端水平线。
+\end{Description}
+
+\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2]
+ 默认基线\fbox{
+ \joinbox{\LaTeX 科技排版}
+ {\LaTeX~Typesetting}
+ }
+
+ baseline=t\fbox{
+ \joinbox[baseline=t]{\LaTeX 科技排版}
+ {\LaTeX~Typesetting}
+ }
+\end{SideBySideExample}
+
+\bigskip
+
+\begin{option}{ opt = outlen, desc = {= \meta{dim}}, init=0pt }
+ 设置joinbox或joinfigs拼接结果的输出尺寸,对于垂直拼接,设置
+ 输出宽度,对于水平拼接,设置输出高度。
+
+ 若指定的输出尺寸$\le 0$,则表示使用被拼接对象中的最小尺寸输出。
+\end{option}\\
+\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2]
+ 输出宽度\fbox{
+ \joinbox[outlen=2cm]{\LaTeX 科技排版}
+ {\LaTeX~Typesetting}
+ }
+
+ 输出高度\fbox{
+ \joinbox*[outlen=0.2cm]{\LaTeX 科技排版}
+ {\LaTeX~Typesetting}
+ }
+\end{SideBySideExample}
+
+\bigskip
+
+\begin{option}{ opt = sep, desc = {= \meta{dim}}, init=0pt }
+ 设置拼接对象之间的间距。
+\end{option}\\
+\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2]
+ 垂直间距\fbox{
+ \joinbox[sep=5pt]{\LaTeX 科技排版}
+ {\LaTeX~Typesetting}
+ }
+
+ 水平间距\fbox{
+ \joinbox*[outlen=0.2cm,sep=5pt]
+ {\LaTeX 科技排版}
+ {\LaTeX~Typesetting}
+ }
+\end{SideBySideExample}
+
+\section{嵌套拼接}
+
+可以嵌套使用\tn{joinbox}命令以实现复杂对象拼接。
+
+\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2]
+ \joinbox*[outlen=0.04\textheight,sep=-5pt]
+ {
+ \joinbox[sep=5pt]{\LaTeX 科技排版}
+ {\qquad\LaTeX~Typesetting\qquad}
+ }{
+ \includegraphics[scale=0.2]{expl3}
+ }
+\end{SideBySideExample}
+
+
+\section{图像拼接}
+
+\subsection{原始图像}
+
+\begin{center}
+ \includegraphics[scale=0.4]{latexframe}\quad
+ \includegraphics[scale=0.4]{tl-lion}\quad
+ \includegraphics[scale=0.4]{expl3}
+\end{center}
+
+\subsection{垂直拼接图像}
+
+\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2]
+ \joinfigs[outlen=3cm, sep=5pt]
+ {latexframe, tl-lion, expl3}
+\end{SideBySideExample}
+
+\subsection{水平拼接图像}
+
+\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2]
+ \joinfigs*[outlen=1.3cm, sep=5pt]
+ {latexframe, tl-lion, expl3}
+\end{SideBySideExample}
+
+\subsection{嵌套拼接图像}
+
+\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2]
+ \joinbox*[outlen=0.20\textheight, sep=5pt]
+ {
+ \joinfigs[outlen=0.25\textwidth]
+ {latexframe, tl-lion, expl3}
+ }{
+ \joinfigs[outlen=0.25\textwidth]
+ {expl3, tl-lion, latexframe}
+ }
+\end{SideBySideExample}
+
+\title{
+ \pkg{joinbox} package for Joinning Boxs or Figures
+ \rlap{\makebox[2.5cm][r]{
+ \normalsize $\Longrightarrow$ \color{red}
+ \protect\hyperlink{zh}{中文版本}
+ \protect\hypertarget{en}{}
+ }}
+}
+\author{Nan Geng \texttt{<nangeng@nwafu.edu.cn>}}
+\date{\today\qquad \vers}
+\maketitle
+
+\section{Introduction}
+
+\pkg{joinbox} is a box joinning package based on l3coffins developed with expl3,
+which provides the \cs{joinbox} and \cs{joinfigs} macros for vertical or horizontal
+joinning of boxes. Different types of joinning can be set up with the options or
+\cs{joinset} macro.
+
+Boxes can be joined vertically or horizontally. When using vertical joinning, all
+boxes to be joined will keep same width, while when using horizontal joined, all
+boxes to be joined will keep same height.
+
+The \cs{joinbox} and \cs{joinfigs} macros without star are used for vertical joinning,
+while the \cs{joinbox*} and \cs{joinfigs*} with star are used for horizontal joinning.
+
+\section{Interfaces}
+
+\subsection{\cs{joinbox} for Two Contents Joinning }
+
+\begin{function}{\joinbox,\joinbox*}
+ \begin{syntax}
+ \cs{joinbox} \oarg{options} \marg{content1} \marg{content2}
+ \cs{joinbox*} \oarg{options} \marg{content1} \marg{content2}
+ \end{syntax}
+
+\end{function}
+
+ Used to join two contents. It requires two arguments \marg{content1} and
+ \marg{content2} to specify the objects to be joined. The contents will
+ be placed in the coffin respectively and then joined.
+
+ In the \oarg{options}, the typeout baseline, typeout size
+ (vertical joinning is width, horizontal joinning is height), and
+ joinning seperate spacing can be specified with \textit{key-value}.
+
+\subsection{\cs{joinfigs} for Figure Sets Joinning}
+
+\begin{function}{\joinfigs,\joinfigs*}
+ \begin{syntax}
+ \cs{joinfigs} \oarg{options} \marg{namelist}
+ \cs{joinfigs*} \oarg{options} \marg{namelist}
+ \end{syntax}
+
+\end{function}
+
+ Used for joinning multiple images. This command requires a argument\marg{namelist}
+ to specify the image to be joined. The file name can include a path,
+ and different file names should be separated by commas.
+ At least one image file name is required.
+
+ In the \oarg{options}, the typeout baseline, typeout size
+ (vertical joinning is width, horizontal joinning is height), and
+ joinning seperate spacing can be specified with \textit{key-value}.
+
+\subsection{\cs{joinset} for Settings}
+\begin{function}{\joinset}
+ \begin{syntax}
+ \cs{joinset} \marg{options}
+ \end{syntax}
+
+\end{function}
+
+ Used to set the typeout baseline, typeout size
+ (vertical joinning is width, horizontal joinning is height), and
+ joinning seperate spacing with \textit{key-value}.
+
+\section{Options}
+
+\begin{option}{ opt = baseline, desc = {= \meta{t,vc,H,b}}, init=b }
+ Set typeout baseline, currently as follows:
+\end{option}\\
+\begin{Description}
+ \item |t|--- a pole running along the top edge of the bounding box of the coffin;
+ \item |vc|---a pole running horizontally through the centre of the coffin half-way between the
+bottom and top edges of the bounding box (i.e. the “vertical centre”);
+ \item |H|---a pole running along the baseline of the typeset material contained in the coffin;
+ \item |b|---a pole running along the bottom edge of the bounding box of the coffin.
+\end{Description}
+
+\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2]
+ baseline=b\fbox{
+ \joinbox{Hello \LaTeX}
+ {\LaTeX~Typesetting}
+ }
+
+ baseline=t\fbox{
+ \joinbox[baseline=t]{Hello \LaTeX}
+ {\LaTeX~Typesetting}
+ }
+\end{SideBySideExample}
+
+\bigskip
+
+\begin{option}{ opt = outlen, desc = {= \meta{dim}}, init=0pt }
+ Used to set typeout size, vertical joinning is width and horizontal joinning is height.
+
+ If $outlen\le 0$,then the typeout size is minimal size of all contents.
+\end{option}\\
+
+\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2]
+ width: \fbox{
+ \joinbox[outlen=2cm]{Hello \LaTeX}
+ {\LaTeX~Typesetting}
+ }
+
+ height: \fbox{
+ \joinbox*[outlen=0.2cm]{Hello \LaTeX}
+ {\LaTeX~Typesetting}
+ }
+\end{SideBySideExample}
+
+\bigskip
+
+\begin{option}{ opt = sep, desc = {= \meta{dim}}, init=0pt }
+ Used to set joinning seperate spacing.
+\end{option}\\
+\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2]
+ vertical sep: \fbox{
+ \joinbox[sep=5pt]{Hello \LaTeX}
+ {\LaTeX~Typesetting}
+ }
+
+ horizontal sep: \fbox{
+ \joinbox*[outlen=0.2cm,sep=5pt]
+ {Hello \LaTeX}
+ {\LaTeX~Typesetting}
+ }
+\end{SideBySideExample}
+
+\section{Nested Joinning}
+
+The \tn{joinbox} can be nested to get complex joinning.
+
+\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2]
+ \joinbox*[outlen=0.04\textheight,sep=-5pt]
+ {
+ \joinbox[sep=5pt]{Hello \LaTeX}
+ {\qquad\LaTeX~Typesetting\qquad}
+ }{
+ \includegraphics[scale=0.2]{expl3}
+ }
+\end{SideBySideExample}
+
+\section{Figures Joinning}
+
+\subsection{Original}
+
+\begin{center}
+ \includegraphics[scale=0.4]{latexframe}\quad
+ \includegraphics[scale=0.4]{tl-lion}\quad
+ \includegraphics[scale=0.4]{expl3}
+\end{center}
+
+\subsection{Vertical Joinning}
+
+\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2]
+ \joinfigs[outlen=3cm, sep=5pt]
+ {latexframe, tl-lion, expl3}
+\end{SideBySideExample}
+
+\subsection{Horizontal Joinning}
+
+\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2]
+ \joinfigs*[outlen=1.3cm, sep=5pt]
+ {latexframe, tl-lion, expl3}
+\end{SideBySideExample}
+
+\subsection{Nested Joinning}
+
+\begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.45\linewidth,gobble=2]
+ \joinbox*[outlen=0.20\textheight, sep=5pt]
+ {
+ \joinfigs[outlen=0.25\textwidth]
+ {latexframe, tl-lion, expl3}
+ }{
+ \joinfigs[outlen=0.25\textwidth]
+ {expl3, tl-lion, latexframe}
+ }
+\end{SideBySideExample}
+
+\end{documentation}
+
+
+\end{document}