diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/njuvisual/njuvisual.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/njuvisual/njuvisual.dtx | 388 |
1 files changed, 243 insertions, 145 deletions
diff --git a/Master/texmf-dist/source/latex/njuvisual/njuvisual.dtx b/Master/texmf-dist/source/latex/njuvisual/njuvisual.dtx index 143d24bd0e3..35e65b1a729 100644 --- a/Master/texmf-dist/source/latex/njuvisual/njuvisual.dtx +++ b/Master/texmf-dist/source/latex/njuvisual/njuvisual.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2021 +% Copyright (C) 2021 - 2022 % by Nanjing University Linux User Group <nju.lug@yaoge123.cn> % % It may be distributed and/or modified under the conditions of the @@ -19,6 +19,7 @@ % and the derived files njuvisual.ins, % njuvisual.sty, % njuvisual.pdf, +% njuvisual-example.tex, % and README.md. % % ----------------------------------------------------------------------- @@ -48,11 +49,11 @@ \preamble -Copyright (C) 2021 +Copyright (C) 2021 - 2022 by Nanjing University Linux User Group <nju.lug@yaoge123.cn> This file may be distributed and/or modified under the conditions of -the LaTeX Project Public License, either version 1.3 of this license +the LaTeX Project Public License, either version 1.3c of this license or (at your option) any later version. The latest version of this license is in: @@ -68,14 +69,15 @@ through XeTeX. \generate{ \usedir{tex/latex/njuvisual} - \file{\jobname.sty} {\from{\jobname.dtx}{package} - \from{\jobname-curves.dtx}{package}} -%</install> + \file{\jobname.sty} {\from{\jobname.dtx}{package} + \from{\jobname-curves.dtx}{color} + \from{\jobname-curves.dtx}{curve}} + \file{\jobname-example.tex} {\from{\jobname.dtx}{example} + \from{\jobname-curves.dtx}{example}} %<*internal> \usedir{source/latex/njuvisual} \file{\jobname.ins} {\from{\jobname.dtx}{install}} %</internal> -%<*install> } \obeyspaces @@ -105,33 +107,85 @@ through XeTeX. % %<package>\NeedsTeXFormat{LaTeX2e} %<package>\RequirePackage{expl3} -%<!driver>\GetIdInfo $Id: njuvisual.dtx 0.1.3 2021-11-28 16:30:00 +0800 NJU LUG <nju.lug@yaoge123.cn> $ -%<package> { LaTeX3 Package for NJU Visual Identity } +%<!(driver|example)>\GetIdInfo $Id: njuvisual.dtx 0.2.1 2022-01-09 16:00:00 +0800 NJU LUG <nju.lug@yaoge123.cn> $ +%<package> { Nanjing University Visual Identity } %<package>\ProvidesExplPackage{njuvisual} %<package>{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} % %<*driver> \documentclass{ctxdoc} -\usepackage{multirow,njuvisual} +\usepackage{listings,njuvisual,tabularray} +\usepackage[firstpage=true]{background} +\backgroundsetup{contents={\njuemblem[white!85!gray]{22cm}{!}},scale=1,angle=0,hshift=-4cm} +\DeclareGraphicsExtensions{.pdf} +\UseTblrLibrary{booktabs,siunitx,diagbox} +\DefTblrTemplate{caption-tag}{default}{表\hspace{0.25em}\thetable} +\SetTblrStyle{caption-tag}{font=\bfseries} +\DefTblrTemplate{caption-sep}{default}{\quad} \setlist[1]{labelindent=0.5em} +\hypersetup{pdftitle={The njuvisual package - Display logos related to Nanjing University}} +\hypersetup{% + citecolor = njublue, + linkcolor = njuviolet, + urlcolor = njumagenta} +\lstdefinestyle{style@base} + { + basewidth = 0.5 em, + gobble = 3, + lineskip = 3 pt, + frame = l, + framerule = 1 pt, + framesep = 0 pt, + xleftmargin = 2 em, + xrightmargin = 3 em, + escapeinside = {(*}{*)}, + breaklines = true, + basicstyle = \small\ttfamily, + keywordstyle = \bfseries\color{njuviolet}, + commentstyle = \itshape\color{white!50!gray}, + stringstyle = \color{nju-chem-red}, + backgroundcolor = \color{white!95!gray} + } +\lstdefinestyle{style@shell} + { + style = style@base, + rulecolor = \color{njumagenta}, + language = bash, + alsoletter = {-}, + emphstyle = \color{green} + } +\lstdefinestyle{style@latex} + { + style = style@base, + rulecolor = \color{njublue}, + language = [LaTeX]TeX, + alsoletter = {*, -}, + texcsstyle = *\color{njuviolet}, + emphstyle = [1]\color{nju-ai-orange}, + emphstyle = [2]\color{nju-cs-green}, + } +\lstnewenvironment{shellexample}[1][]{% + \lstset{style=style@shell, #1}}{} +\lstnewenvironment{latexexample}[1][]{% + \lstset{style=style@latex, #1}}{} \begin{document} - \DocInput{njuvisual.dtx} - \DocInput{njuvisual-curves.dtx} - \PrintChanges - \PrintIndex + \DocInput{njuvisual.dtx} + \DocInput{njuvisual-curves.dtx} + \PrintChanges + \PrintIndex \end{document} %</driver> % % \fi % % \title{\color{njuviolet}{^^A -% The \pkg{njuvisual} package \\ 南京大学视觉形象规范化标准}} +% The \pkg{njuvisual} package \\ \textbf{南京大学视觉形象规范化标准}}} % % \author{^^A -% Nanjing University Linux User Group +% 南京大学 Linux 用户组 % \thanks{E-mail: \href{mailto:nju.lug@yaoge123.cn}{nju.lug@yaoge123.cn}}} % -% \date{v0.1.3 \\ Released 2021-11-28} +% \date{v0.2.1 \quad 2022-01-09} % % \changes{v0.1}{2021/11/21}{将 \pkg{njuvisual} 分离为独立宏包。} % \changes{v0.1}{2021/11/27}{完成文档编写并发布至 CTAN。} @@ -147,8 +201,8 @@ through XeTeX. % % \def\abstractname{Abstract} % \begin{abstract} -% The \pkg{njuvisual} package collects standard colors and logos related to -% Nanjing University, saves the vector logos as \pkg{tikz} pictures and +% The \pkg{njuvisual} package collects standard colors and logos related to +% Nanjing University, saves the vector logos as \pkg{tikz} pictures and % provides a user-friendly interface to display them in documents and beamers. % \end{abstract} % @@ -156,8 +210,6 @@ through XeTeX. % % \tableofcontents % -% \EnableDocumentation -% % % \begin{documentation} % @@ -165,12 +217,21 @@ through XeTeX. % % \pkg{njuvisual} 用于收录南京大学及其各院系制定的标准色彩及图标,并提供简洁的绘制指令。 % -% 本宏包衍生自 \pkg{njuthesis},依赖 \hologo{LaTeX3} 项目 +% 本宏包衍生自 \cls{njuthesis},依赖 \hologo{LaTeX3} 项目 % 中的 \pkg{expl3}、\pkg{xparse} 和 \pkg{l3keys2e} 宏包。 -% 特别感谢 \pkg{fduthesis} 与 \pkg{zhlipsum} 提供的处理思路。 +% 特别感谢 \cls{fduthesis} 与 \pkg{zhlipsum} 提供的处理思路。 +% +% 欲使用本宏包,在终端键入下述 \pkg{tlmgr} 的命令(很可能需要管理员权限): +% \begin{shellexample}[morekeywords={tlmgr,install}] +% tlmgr install njuvisual +% \end{shellexample} +% 即可完成安装。 +% % % \section{使用方法} % +% 本节提供命令的使用方法。关于绘制的内容,请参阅后文的 \ref{subsec:colors-and-curves}。 +% % \subsection{标准色彩} % % \begin{function}{\color} @@ -183,35 +244,40 @@ through XeTeX. % 本宏包定义的所有标准色彩见表~\ref{tab:pre-defined-colors}。 % \begingroup % \def\B#1{\color{#1}$\blacksquare\blacksquare\blacksquare\blacksquare\blacksquare$} -% \def\M#1{\multirow{2}*{#1}} -% \def\MN#1{\multirow{4}*{#1}} % \begin{table}[htb] % \caption{预定义标准色} \label{tab:pre-defined-colors} -% \centering\small -% \begin{tabular}{cccc} +% \centering +% \begin{tblr}[expand=\B]{cccc} % \toprule -% 名称 & 颜色名称 & CMYK 数值 & 示例 \\ +% 名称 & 颜色名称 & CMYK 数值 & 示例 \\ % \midrule -% \MN{南京大学} & |njuviolet| & $0.50, 1 , 0 , 0.40$ & \B{njuviolet} \\ -% & |njumagenta| & $0.05, 1 , 0.55, 0$ & \B{njumagenta} \\ -% & |njublue| & $0.80, 0.50, 0 , 0$ & \B{njublue} \\ -% & |njuyellow| & $0 , 0.30, 1 , 0$ & \B{njuyellow} \\ -% \M{人工智能学院} & |nju-ai-blue| & $0.75, 0.65, 0 , 0$ & \B{nju-ai-blue} \\ -% & |nju-ai-orange| & $0 , 0.75, 1 , 0$ & \B{nju-ai-orange} \\ -% \M{计算机科学与技术系} & |nju-cs-blue| & $0.89, 0.66, 0.13, 0$ & \B{nju-cs-blue} \\ -% & |nju-cs-green| & $0.60, 0.23, 1 , 0$ & \B{nju-cs-green} \\ +% \SetCell[r=4]{c} 南京大学 +% & |njuviolet| & $0.50, 1 , 0 , 0.40$ & \B{njuviolet} \\ +% & |njumagenta| & $0.05, 1 , 0.55, 0 $ & \B{njumagenta} \\ +% & |njublue| & $0.80, 0.50, 0 , 0 $ & \B{njublue} \\ +% & |njuyellow| & $0 , 0.30, 1 , 0 $ & \B{njuyellow} \\ +% \SetCell[r=2]{c} 人工智能学院 +% & |nju-ai-blue| & $0.75, 0.65, 0 , 0 $ & \B{nju-ai-blue} \\ +% & |nju-ai-orange| & $0 , 0.75, 1 , 0 $ & \B{nju-ai-orange} \\ +% \SetCell[r=2]{c} 计算机科学与技术系 +% & |nju-cs-blue| & $0.89, 0.66, 0.13, 0 $ & \B{nju-cs-blue} \\ +% & |nju-cs-green| & $0.60, 0.23, 1 , 0 $ & \B{nju-cs-green} \\ +% \SetCell[r=2]{c} 化学化工学院 +% & |nju-chem-red| & $0.28, 0.95, 0.84, 0 $ & \B{nju-chem-red} \\ +% & |nju-chem-gold| & $0.40, 0.42, 0.60, 0 $ & \B{nju-chem-gold} \\ % \bottomrule -% \end{tabular} +% \end{tblr} % \end{table} % \endgroup % +% % \subsection{标准图标} % % \begin{function}[added=2021-09-24,updated=2021-11-27]{\njuemblem} % \begin{syntax} % \tn{njuemblem}\oarg{选项}\Arg{宽度}\Arg{高度} % \end{syntax} -% 生成徽标,默认生成校徽。参数 \meta{选项} 是可选的。注意各 +% 生成徽标,默认生成校徽。参数 \oarg{选项} 是可选的,详见下文说明。注意各 % 参数之间不可以有空格。 % \end{function} % @@ -233,7 +299,7 @@ through XeTeX. % % \begin{function}[added=2021-11-27]{color,color*} % \begin{syntax} -% color = \meta{主要颜色} +% color = \meta{主要颜色} % color* = \meta{辅助颜色} % \end{syntax} % 定制图标颜色。 @@ -255,7 +321,7 @@ through XeTeX. % 院系名称。 % \end{function} % -% 为保证无歧义,|department| 选项使用的名称来自于院系官网域名。如化学化工学院域名为\url{https://chem.nju.edu.cn/},其选项名称即为 |chem|。 +% 为保证无歧义,|department| 选项使用的名称来自于院系官网域名。如化学化工学院域名为 \url{https://chem.nju.edu.cn/},其选项名称即为 |chem|。 % % 目前的支持情况如表~\ref{tab:supported-departments-list}所示。对于不支持的院系,本宏包会抛出异常。 % \begingroup @@ -263,7 +329,7 @@ through XeTeX. % \begin{table}[htb] % \caption{收录院系列表} \label{tab:supported-departments-list} % \centering\small -% \begin{tabular}{cccccccc} +% \begin{tblr}[expand=\B]{cccccccc} % \toprule % 名称 & 选项名称 & emblem & name & name* \\ % \midrule @@ -273,20 +339,19 @@ through XeTeX. % 计算机科学与技术系 & |cs| & \B & & \\ % 软件学院 & |software| & \B & & \\ % \bottomrule -% \end{tabular} +% \end{tblr} % \end{table} % \endgroup % -% 举例如下: -% \begin{ctexexam} -% \njuemblem{!}{3cm} % 默认生成指定大小的紫色南大校徽 -% \njuname{4cm}{!} % 默认生成指定大小的紫色南大中文校名 -% \njuname*{4cm}{!} % 默认生成指定大小的紫色南大英文校名 +% 对这两个命令的举例如下: +% \begin{latexexample}[moretexcs={\njuemblem,\njuname,\njuname*}] +% \njuemblem{!}{3cm} % 生成指定大小的紫色南大校徽 +% \njuname{4cm}{!} % 生成指定大小的紫色南大中文校名 +% \njuname*{4cm}{!} % 生成指定大小的紫色南大英文校名 % \njuemblem[black]{!}{3cm} % 黑色的南大校徽 % \njuemblem[department=dii]{!}{4cm} % 紫色匡院徽标 % \njuemblem[department=cs,color=blue]{!}{3cm} % 纯蓝色计科徽标 -% \end{ctexexam} -% +% \end{latexexample} % % \begin{function}[added=2021-09-24]{\njumotto} % \begin{syntax} @@ -295,7 +360,6 @@ through XeTeX. % 生成指定颜色和大小的南京大学校训。 % \end{function} % -% % \begin{function}[added=2021-09-24]{\njuspirit} % \begin{syntax} % \tn{njuspirit}\oarg{颜色}\Arg{宽度}\Arg{高度} @@ -303,9 +367,31 @@ through XeTeX. % 生成指定颜色和大小的南京大学校风。 % \end{function} % +% +% \subsection{导出图像} +% \changes{v0.2}{2021/12/04}{提供导出 PNG 图像的方法。} +% +% 为了便于存储独立的图像,本宏包内置了 \file{njuvisual-example.tex},使用 \pkg{tikz} 的外置化功能生成独立的图片文件。编译此文件时需使用 |--shell-escape| 参数。 +% +% 对于大部分日常用途,PDF 格式的矢量图并没有受到良好的支持。在此提供将上述独立图像通过 inkscape 程序进行转换的方法,相应的自动转换脚本请从项目仓库内获取。关于命令行使用方法的请参考\href{https://inkscape.org/doc/inkscape-man.html}{官方手册}。 +% \begin{description} +% \item[|--export-type=|] 指定输出格式,|"png"| 即可,不支持 JPEG 格式。 +% \item[|-w|] 指定输出宽度。 +% \item[|-h|] 指定输出高度。 +% \end{description} +% +% 以下为在 Linux 系统中将当前目录下全部 PDF 文件转化为高度为1000像素的 PNG 图片的命令示例。 +% \begin{shellexample}[morekeywords={inkscape}] +% inkscape --export-type="png" nju-*.pdf -h 1000 +% \end{shellexample} +% +% 以下为在 Windows 系统的 Powershell 中将南大校名转化为 PNG 图片的命令示例。 +% \begin{shellexample} +% & 'C:\Program Files (x86)\Inkscape\bin\inkscape.exe' --export-type="png" nju-name.pdf +% \end{shellexample} +% % \end{documentation} % -% \EnableImplementation % % \begin{implementation} % @@ -333,10 +419,10 @@ through XeTeX. % \end{macrocode} % \end{macro} % -% \begin{macro}{\l_@@_department_tl} +% \begin{macro}{\l_@@_dept_tl} % 存储院系 % \begin{macrocode} -\tl_new:N \l_@@_department_tl +\tl_new:N \l_@@_dept_tl % \end{macrocode} % \end{macro} % @@ -358,49 +444,49 @@ through XeTeX. % \begin{macro}{department} % 院系。设定院系选项初始值为学校官方。 % \begin{macrocode} - department .tl_set:N = \l_@@_department_tl, + department .tl_set:N = \l_@@_dept_tl, department .initial:n = nju, } % \end{macrocode} % \end{macro} % -% \begin{variable}{\c_@@_department_all_clist} +% \begin{variable}{\c_@@_dept_all_clist} % 定义南京大学全体院系名单。 % \begin{macrocode} -\clist_const:Nn \c_@@_department_all_clist -{ nju, dii, eng, chin, history, philo, jc, law, nubs, sfs, im, sociology, - math, physics, astronomy, chem, cs, software, ai, ese, hjxy, sgos, - as, life, med, sme, hwxy, arch, marxism, art, edu } +\clist_const:Nn \c_@@_dept_all_clist + { nju, dii, eng, chin, history, philo, jc, law, nubs, sfs, im, sociology, + math, physics, astronomy, chem, cs, software, ai, ese, hjxy, sgos, + as, life, med, sme, hwxy, arch, marxism, art, edu } % \end{macrocode} % \end{variable} % -% \begin{variable}{\c_@@_department_emblem_clist} +% \begin{variable}{\c_@@_dept_emblem_clist} % 定义受图标支持的南京大学院系名单。 % \begin{macrocode} -\clist_const:Nn \c_@@_department_emblem_clist { nju, dii, eng, cs, ai, software } +\clist_const:Nn \c_@@_dept_emblem_clist { nju, dii, eng, cs, ai, software, chem } % \end{macrocode} % \end{variable} % -% \begin{variable}{\c_@@_department_name_clist} +% \begin{variable}{\c_@@_dept_name_clist} % 定义受名称支持的南京大学院系名单。 % \begin{macrocode} -\clist_const:Nn \c_@@_department_name_clist { nju } +\clist_const:Nn \c_@@_dept_name_clist { nju } % \end{macrocode} % \end{variable} % -% \begin{variable}{\c_@@_department_color_clist} +% \begin{variable}{\c_@@_dept_color_clist} % 定义受色彩支持的南京大学院系名单。 % \begin{macrocode} -\clist_const:Nn \c_@@_department_color_clist { cs, ai } +\clist_const:Nn \c_@@_dept_color_clist { cs, ai, chem } % \end{macrocode} % \end{variable} % % 定义对不支持的院系的报错信息。 % \begin{macrocode} \msg_new:nnn { njuvisual } { unsupported-department } -{ "#1"~ is~ not~ an~ valid~ option~ \\\\ - Please~ refer~ to~ the~ package~ documentation~ for~ supported~ - departments~ and~ check~ your~ spelling. \\ } + { "#1"~ is~ not~ an~ valid~ option~ \\\\ + Please~ refer~ to~ the~ package~ documentation~ for~ supported~ + departments~ and~ check~ your~ spelling. \\ } % \end{macrocode} % % \subsection{内部命令} @@ -412,18 +498,18 @@ through XeTeX. \cs_new_protected:Nn \@@_set_color: { \str_if_eq:VnTF \l_@@_color_a_tl { default } - { + { % \end{macrocode} % 如果没有单独设定,则使用默认颜色。 % \begin{macrocode} - \clist_if_in:NVTF \c_@@_department_color_clist \l_@@_department_tl - { \tl_set:Nn \l_@@_color_a_tl - { \clist_item:cn { c_@@_color_ \l_@@_department_tl _clist } { 1 } } - \tl_set:Nn \l_@@_color_b_tl - { \clist_item:cn { c_@@_color_ \l_@@_department_tl _clist } { 2 } } } + \clist_if_in:NVTF \c_@@_dept_color_clist \l_@@_dept_tl + { \tl_set:Nn \l_@@_color_a_tl + { \clist_item:cn { c_@@_color_ \l_@@_dept_tl _clist } { 1 } } + \tl_set:Nn \l_@@_color_b_tl + { \clist_item:cn { c_@@_color_ \l_@@_dept_tl _clist } { 2 } } } { \tl_set:Nn \l_@@_color_a_tl { njuviolet } } - } - { \clist_if_in:NVT \c_@@_department_color_clist \l_@@_department_tl + } + { \clist_if_in:NVT \c_@@_dept_color_clist \l_@@_dept_tl % \end{macrocode} % 将双色图标设定为纯色。 % \begin{macrocode} @@ -442,12 +528,12 @@ through XeTeX. % 封装 resizebox 和 tikzpicture 环境,减少重复。 % \begin{macrocode} \cs_new_protected:Npn \@@_tikz_wrapper:nnn #1#2#3 -{ - \resizebox { #2 } { #3 } { - \begin{tikzpicture}[y=0.80pt, x=0.80pt, yscale=-1, - xscale=1, inner~sep=0pt, outer~sep=0pt] #1 - \end{tikzpicture} } -} + { + \resizebox { #2 } { #3 } { + \begin{tikzpicture}[y=0.80pt, x=0.80pt, yscale=-1, + xscale=1, inner~sep=0pt, outer~sep=0pt] #1 + \end{tikzpicture} } + } % \end{macrocode} % \end{macro} % @@ -459,13 +545,6 @@ through XeTeX. % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_colon} -% 定义类别为 other 的冒号,用于在 Expl3 中表示路径 -% \begin{macrocode} -\def \@@_colon { \char_generate:nn { 58 } { 12 } } -% \end{macrocode} -% \end{macro} -% % % \subsection{用户接口} % @@ -479,31 +558,31 @@ through XeTeX. % \end{arguments} % \begin{macrocode} \NewDocumentCommand \njuemblem { O { njuviolet } m m } -{ - \group_begin: + { + \group_begin: % \end{macrocode} -% 根据参数是否含有 |=| 来判断该参数是段落数还是选项列表。 +% 根据参数是否含有 |=| 来判断该参数是颜色还是选项列表。 % \begin{macrocode} - \@@_if_key_value_list:nTF { #1 } - { - \keys_set:nn { njuvisual } { #1 } + \@@_if_key_value_list:nTF { #1 } + { + \keys_set:nn { njuvisual } { #1 } % \end{macrocode} % 检查是否受支持。 % \begin{macrocode} - \clist_if_in:NVTF \c_@@_department_emblem_clist \l_@@_department_tl - { \@@_set_color: - \@@_tikz_wrapper:nnn - { \use:c { @@_path_emblem_ \l_@@_department_tl } } { #2 } { #3 } } - { \msg_error:nnx { njuvisual } - { unsupported-department } { \l_@@_department_tl } } - } + \clist_if_in:NVTF \c_@@_dept_emblem_clist \l_@@_dept_tl + { \@@_set_color: + \@@_tikz_wrapper:nnn + { \use:c { @@_path_emblem_ \l_@@_dept_tl } } { #2 } { #3 } } + { \msg_error:nnx { njuvisual } + { unsupported-department } { \l_@@_dept_tl } } + } % \end{macrocode} % 单独设置颜色时输出官方徽标。 % \begin{macrocode} - { \tl_set:Nn \l_@@_color_a_tl { #1 } - \@@_tikz_wrapper:nnn { \@@_path_emblem_nju } { #2 } { #3 } } - \group_end: -} + { \tl_set:Nn \l_@@_color_a_tl { #1 } + \@@_tikz_wrapper:nnn { \@@_path_emblem_nju } { #2 } { #3 } } + \group_end: + } % \end{macrocode} % \end{macro} % @@ -518,34 +597,34 @@ through XeTeX. % \end{arguments} % \begin{macrocode} \NewDocumentCommand \njuname { t* O { njuviolet } m m } -{ - \group_begin: - \@@_if_key_value_list:nTF { #2 } - { - \keys_set:nn { njuvisual } { #2 } - \clist_if_in:NVTF \c_@@_department_name_clist \l_@@_department_tl - { - \@@_set_color: + { + \group_begin: + \@@_if_key_value_list:nTF { #2 } + { + \keys_set:nn { njuvisual } { #2 } + \clist_if_in:NVTF \c_@@_dept_name_clist \l_@@_dept_tl + { + \@@_set_color: % \end{macrocode} % 通过是否含有可选星号区分输出中英文名称。 % \begin{macrocode} - \bool_if:NTF { #1 } - { \@@_tikz_wrapper:nnn - { \use:c { @@_path_name_ #2 _en } } { #3 } { #4 } } - { \@@_tikz_wrapper:nnn - { \use:c { @@_path_name_ #2 _cn } } { #3 } { #4 } } - } - { \msg_error:nnx { njuvisual } - { unsupported-department } { \l_@@_department_tl } } - } - { - \tl_set:Nn \l_@@_color_a_tl { #2 } - \bool_if:NTF { #1 } - { \@@_tikz_wrapper:nnn { \@@_path_name_nju_en } { #3 } { #4 } } - { \@@_tikz_wrapper:nnn { \@@_path_name_nju_cn } { #3 } { #4 } } - } - \group_end: -} + \bool_if:NTF { #1 } + { \@@_tikz_wrapper:nnn + { \use:c { @@_path_name_ #2 _en } } { #3 } { #4 } } + { \@@_tikz_wrapper:nnn + { \use:c { @@_path_name_ #2 _cn } } { #3 } { #4 } } + } + { \msg_error:nnx { njuvisual } + { unsupported-department } { \l_@@_dept_tl } } + } + { + \tl_set:Nn \l_@@_color_a_tl { #2 } + \bool_if:NTF { #1 } + { \@@_tikz_wrapper:nnn { \@@_path_name_nju_en } { #3 } { #4 } } + { \@@_tikz_wrapper:nnn { \@@_path_name_nju_cn } { #3 } { #4 } } + } + \group_end: + } % \end{macrocode} % \end{macro} % @@ -558,13 +637,13 @@ through XeTeX. % \item 高度 % \end{arguments} % \begin{macrocode} -\NewDocumentCommand \njumotto { o m m } -{ - \group_begin: - \tl_set:Nn \l_@@_color_a_tl { #1 } - \@@_tikz_wrapper:nnn { \@@_path_motto } { #2 } { #3 } - \group_end: -} +\NewDocumentCommand \njumotto { O {black} m m } + { + \group_begin: + \tl_set:Nn \l_@@_color_a_tl { #1 } + \@@_tikz_wrapper:nnn { \@@_path_motto } { #2 } { #3 } + \group_end: + } % \end{macrocode} % \end{macro} % @@ -577,14 +656,33 @@ through XeTeX. % \item 高度 % \end{arguments} % \begin{macrocode} -\NewDocumentCommand \njuspirit { o m m } -{ - \group_begin: - \tl_set:Nn \l_@@_color_a_tl { #1 } - \@@_tikz_wrapper:nnn { \@@_path_spirit } { #2 } { #3 } - \group_end: -} +\NewDocumentCommand \njuspirit { O {black} m m } + { + \group_begin: + \tl_set:Nn \l_@@_color_a_tl { #1 } + \@@_tikz_wrapper:nnn { \@@_path_spirit } { #2 } { #3 } + \group_end: + } %</package> % \end{macrocode} % \end{macro} % +% \subsection{生成文件} +% \changes{v0.2}{2021/11/29}{提供导出 PDF 图像的方法。} +% +% 以下文件用于生成各图案。 +% 需要在编译命令中加入 |--shell-escape| 参数。 +% \DoNotIndex{\FIG} +% \begin{macrocode} +%<*example> +\documentclass{article} +\usepackage{njuvisual} +% \end{macrocode} +% 使用 \pkg{tikz} 库的外置化功能生成独立的 PDF 格式矢量图。每个图标仅需绘制一次,可以减轻编译负担。 +% \begin{macrocode} +\usetikzlibrary{backgrounds,external} +\tikzexternalize[prefix=nju-] +\let\FIG=\tikzsetnextfilename +%</example> +% \end{macrocode} +% |