diff options
author | Karl Berry <karl@freefriends.org> | 2020-07-08 21:17:01 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-07-08 21:17:01 +0000 |
commit | e7fb1d347bd79674681647b79603361e950e1e68 (patch) | |
tree | 2f8706a67d80fe4ca1c19481534c2ca69fa7e881 /Master/texmf-dist/tex/xelatex | |
parent | 60f0cd150e1d599e1de835564f69f4034a37674b (diff) |
nanicolle (8jul20)
git-svn-id: svn://tug.org/texlive/trunk@55784 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/xelatex')
-rw-r--r-- | Master/texmf-dist/tex/xelatex/nanicolle/nanicolle.cls | 216 |
1 files changed, 139 insertions, 77 deletions
diff --git a/Master/texmf-dist/tex/xelatex/nanicolle/nanicolle.cls b/Master/texmf-dist/tex/xelatex/nanicolle/nanicolle.cls index 76f4cddc7c9..205cd992abc 100644 --- a/Master/texmf-dist/tex/xelatex/nanicolle/nanicolle.cls +++ b/Master/texmf-dist/tex/xelatex/nanicolle/nanicolle.cls @@ -1,5 +1,5 @@ %% nanicolle.cls -%% Copyright 2016--2019 Yuchang Yang < yang.yc.allium@gmail.com > +%% Copyright 2016--2020 Yuchang Yang < yang.yc.allium@gmail.com > % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3c @@ -16,11 +16,13 @@ % This work consists of: % - the class file: [nanicolle.cls]; % - the illustration files: [point.pdf, ChinaMainland.pdf, Dongguan.pdf]; -% - the manual files: [nanicolle.tex, nanicolle.pdf, README.md]; -% - the example files: [nanicolle-example.tex, nanicolle-example.pdf]. +% - the manual files: [nanicolle-doc-zh.tex, nanicolle-doc-zh.pdf, +% nanicolle-doc-en.tex, nanicolle-doc-en.pdf, README.md]; +% - the example files: [nanicolle-ex-zh.tex, nanicolle-ex-zh.pdf, +% nanicolle-ex-en.tex, nanicolle-ex-en.pdf]. %% \NeedsTeXFormat{LaTeX2e} -\ProvidesClass{nanicolle}[2019/09/27 v2.01 class nanicolle] +\ProvidesClass{nanicolle}[2020/07/08 v2.02 class nanicolle] % CATCODE PART I \makeatletter % CLASS OPTIONS @@ -62,7 +64,7 @@ \newif\if@drew@map@ \newif\if@barcodeprepared@ \newif\if@identifying@ - \@identifying@false + \@identifying@false % KERNING AND SPACING \def\!{\kern-.0889em\relax} \def\:{\kern+.0667em\relax} @@ -99,7 +101,6 @@ \newbox\pin@point \setbox\pin@point=\vb@xt@\z@{\vss\hb@xt@\z@{% \hss\includegraphics{point.pdf}\hss}\vss} -% 20190926 \newdimen\whiterule \newdimen\whitevsep \newdimen\whitehsep @@ -127,23 +128,23 @@ \kern-1em}\vskip-\ht\@tempboxa\box\@tempboxa\par} % UNIT EXPRESSIONS \def\degree{\ensuremath{^\circ}} -\def\gobble@char#1{\relax} -\def\plus@one@degree#1#2#3{% +\def\add@degree#1#2#3{% + \edef\@arg{#1}% \if\relax#1\relax\else \ifdim#1\@unit>\z@ - #1\:\ensuremath{^\circ}\!#2% + #1\:\degree\!#2% \else - \expandafter\gobble@char#1\:\degree\!#3% + \expandafter\@gobble\@arg\:\degree\!#3% \fi \fi} -\def\plus@one@long#1{\plus@one@degree{#1}EW} -\def\plus@one@lat#1{\plus@one@degree{#1}NS} -\def\plus@one@second#1#2{% +\def\add@long#1{\add@degree{#1}EW} +\def\add@lat#1{\add@degree{#1}NS} +\def\add@unit#1#2{% \if\relax#1\relax\else #1\,#2% \fi} -\def\plus@one@cm#1{\plus@one@second{#1}{cm}} -\def\plus@one@m#1{\plus@one@second{#1}{m}} +\def\add@cm#1{\add@unit{#1}{cm}} +\def\add@m#1{\add@unit{#1}{m}} % PARSING % LATIN PARSING \def\inter@taxon@skip{ \hskip .1667em minus .1667em\relax} @@ -168,10 +169,10 @@ \strsubs{ }{ \upd@shape}% \strsubs{subsp.}{\textup{subsp.}\word@cnt\tw@} \strsubs{var.}{\textup{var.}\word@cnt\tw@} - \strsubs{f.}{\handle@f} - \strsubs{sp.}{\upshape sp.\word@cnt\z@} \strsubs{cf.}{\textup{cf.}\word@cnt\tw@} \strsubs{aff.}{\textup{aff.}\word@cnt\tw@} + \strsubs{f.}{\handle@f} + \strsubs{sp.}{\upshape sp.\word@cnt\z@} \strsubs{et}{\penalty-\@ne et\penalty-\@ne} \strsubs{ex}{\penalty-\tw@ et\penalty-\tw@} \strsubs{(}{\penalty-\thr@@(}\strsubs{)}{)\penalty-\thr@@} @@ -217,8 +218,7 @@ \fi\fi \if\relax\Collector\relax\@param@enough@false\fi \if\relax\ColDate\relax\@param@enough@false\fi - \if\relax\Location\relax\@param@enough@false\fi - } + \if\relax\Location\relax\@param@enough@false\fi} \def\det@parse@params#1{% \readlist\temp@argin{#1} \@param@enough@true @@ -232,13 +232,13 @@ \def\temp@name{\Identifier\IdentifierStd} \if\relax\LatName\relax\@param@enough@false\fi \if\relax\temp@name\relax\@param@enough@false\fi - \if\relax\DateIdentification\relax\@param@enough@false\fi - } + \if\relax\DateIdentification\relax\@param@enough@false\fi} % FONT STYLE \def\headerstyle{\bfseries} \def\headingstyle{\scshape} \def\detlatinstyle{\sffamily\bfseries} \def\detchinesestyle{\bfseries} +\def\detcommonnamestyle{\mdseries} \def\identifierstyle{\itshape} % INDIVIDUALIZATION \def\@herbariumcode{} @@ -255,8 +255,7 @@ \expandafter\def\csname#1@longmin\endcsname{#3}% \expandafter\def\csname#1@longmax\endcsname{#4}% \expandafter\def\csname#1@latmin\endcsname{#5}% - \expandafter\def\csname#1@latmax\endcsname{#6}% -} + \expandafter\def\csname#1@latmax\endcsname{#6}} % MAP DEFINITIONS \mapdef{ChinaMainland}{ChinaMainland.pdf}{73}{136}{17}{54} % \mapdef{Dongguan}{Dongguan.pdf}{113.5}{114.26667}{22.63333}{23.16667} @@ -273,29 +272,26 @@ \centerline{\hss\rule{.25\paperwidth}{\NC@seprule}\hss}} % COMPONENTS OF COLLECTION LABELS \RequirePackage{color} +\long\def\length@test#1#2#3#4{% + \sbox\temp@box{#1}% + \ifdim\wd\temp@box>#2\linewidth\relax#3\else#4\fi} +\def\form@wrap#1#2{% + \sbox\header@box{\headerstyle\white@uline{#1}}% + \length@test{\copy\header@box\quad#2}{}% + {\par\hangindent=1em\relax + \leavevmode\box\header@box\quad\CJKglue#2\par}} \def\form@line#1#2{% - \par\hangindent=1em% - \leavevmode - \setbox\header@box=\hbox{\headerstyle\white@uline{#1}}% - \setbox\temp@box=\hbox{\copy\header@box\quad#2}% - \def\glue@begin{\quad\hfill}% - \def\glue@end{\hfill\hfill\hbox{}}% - \ifdim\wd\temp@box>\linewidth - \def\glue@begin{\CJKglue\quad\CJKglue}% - \def\glue@end{}\fi - \box\header@box - \glue@begin#2\glue@end\par} + \form@wrap{#1}{#2}% + {\leavevmode\box\header@box + \quad\hfill#2\hskip\stretch2\null\par}} \def\form@cell#1#2{% - \leavevmode - \hbox{\headerstyle\white@uline{#1}}\nobreak - \;\hfill#2\hfill\;\hbox{}\penalty-1\relax\ignorespaces} + \form@wrap{#1}{#2}% + {\leavevmode\box\header@box + \;\hfill#2\hfill\;\null\penalty-1\relax\ignorespaces}} \def\heading@line#1{% - \setbox\temp@box=\hbox{#1}% - \ifdim\wd\temp@box>\linewidth - \centerline{\resizebox{\linewidth}{\height}{\box\temp@box}}% - \else - \centerline{\box\temp@box}% - \fi} + \length@test{#1}{}% + {\centerline{\resizebox{\linewidth}{\height}{\box\temp@box}}}% + {\centerline{\box\temp@box}}} \if@rulerhead \RequirePackage{rulerbox} \setlength\rulersep{-.2pt} @@ -309,9 +305,8 @@ \heading@line{\headingstyle\@subheading}\fi \if@rulerhead \nointerlineskip\vskip2pt\relax - \centerline{\hbox{}\hss - \rulerbox[tb]{\kern-.9mm\rule{6.18cm}{.4pt}\kern-.9mm}% - \hss\hbox{}}% + \centerline{% + \rulerbox[tb]{\kern-.9mm\rule{6.18cm}{.4pt}\kern-.9mm}}% \vskip5pt\relax \else \hrule\@height\NC@seprule @@ -326,13 +321,13 @@ \form@cell{采集日期}{\ColDate}% \if@internal\form@cell{标本份数}{\NumDup}\fi\par \form@line{产地}{\Location}% - \form@cell{经度}{\plus@one@long\Longitude}% - \form@cell{纬度}{\plus@one@lat\Latitude}\par - \form@cell{海拔}{\plus@one@m\Altitude}% + \form@cell{经度}{\add@long\Longitude}% + \form@cell{纬度}{\add@lat\Latitude}\par + \form@cell{海拔}{\add@m\Altitude}% \form@cell{生境}{\Habitat}\par \form@cell{生活型}{\LifeForm}\penalty-2\relax% - \form@cell{体高}{\plus@one@m\Height}% - \form@cell{胸径}{\plus@one@cm\DBH}\par + \form@cell{体高}{\add@m\Height}% + \form@cell{胸径}{\add@cm\DBH}\par \form@cell{科名}{\Family}% \form@cell{中文名}{\ChnName}\par \form@line{学名}{\col@latin{\LatName}} @@ -354,7 +349,23 @@ \fi \cutting@line} \RequirePackage{calc} -\def\makemap#1{% +\def\make@map#1{% + \setlength\map@x{\wd\csname#1@map\endcsname*% + \ratio{\Longitude\@unit-\csname#1@longmin\endcsname\@unit}% + {\csname#1@longmax\endcsname\@unit-\csname#1@longmin\endcsname\@unit}}% + \setlength\map@y{\ht\csname#1@map\endcsname*% + \ratio{\Latitude\@unit-\csname#1@latmin\endcsname\@unit}% + {\csname#1@latmax\endcsname\@unit-\csname#1@latmin\endcsname\@unit}}% + \begingroup\ooalign{% + \copy\csname#1@map\endcsname\cr + \hb@xt@\map@x{\hss\vb@xt@\map@y{\copy\pin@point\vss}}\cr}% + \endgroup} +\def\print@map#1{% + \vskip3.5mm\relax + \make@map{#1}% + \vskip\NC@margin + \cutting@line} +\def\choose@map#1{% \unless\if@drew@map@ \if\relax\Longitude\relax\else \if\relax\Latitude\relax\else @@ -362,42 +373,87 @@ \ifdim\Longitude\@unit<\csname#1@longmax\endcsname\@unit \ifdim\Latitude\@unit>\csname#1@latmin\endcsname\@unit \ifdim\Latitude\@unit<\csname#1@latmax\endcsname\@unit - \setlength\map@x{\wd\csname#1@map\endcsname*% - \ratio{\Longitude\@unit-\csname#1@longmin\endcsname\@unit}% - {\csname#1@longmax\endcsname\@unit-\csname#1@longmin\endcsname\@unit}} - \setlength\map@y{\ht\csname#1@map\endcsname*% - \ratio{\Latitude\@unit-\csname#1@latmin\endcsname\@unit}% - {\csname#1@latmax\endcsname\@unit-\csname#1@latmin\endcsname\@unit}} - \vskip3.5mm\relax - \begingroup\ooalign{% - \copy\csname#1@map\endcsname\cr - \hb@xt@\map@x{\hss\vb@xt@\map@y{\copy\pin@point\vss}}\cr} - \endgroup - \vskip\NC@margin - \cutting@line + \print@map{#1}% \@drew@map@true \fi\fi\fi\fi\fi\fi \fi} +\def\printmap{\ifmap\@for\@tmp:=\map@series\do{\choose@map{\@tmp}}\fi} +\@drew@map@false % \def\map@series{Dongguan,ChinaMainland} \def\map@series{ChinaMainland} \def\mapseries#1{\def\map@series{#1}} +\def\loop@the@loop#1{% + \loop\ifnum\repeat@cnt>\z@#1% + \advance\repeat@cnt-\@ne\repeat} \def\@Collect#1{% - \@drew@map@false \col@parse@params{#1}% \if@param@enough@ - \loop\ifnum\repeat@cnt>\z@ - \nointerlineskip - \begin{minipage}[c]{\linewidth}% - \vskip\NC@margin - \printheadings - \printform - \printbarcode - \ifmap\@for\@tmp:=\map@series\do{\makemap{\@tmp}}\fi - \end{minipage}% - \filbreak - \advance\repeat@cnt-\@ne\repeat + \loop@the@loop{% + \nointerlineskip + \begin{minipage}[c]{\linewidth}% + \vskip\NC@margin + \printheadings + \printform + \printbarcode + \printmap + \end{minipage}% + \filbreak} \fi} \def@to@eol\Collect\@Collect +% COLLECTING LABELS IN WESTERN LANGUAGES +\def\translation@asl{a.s.l.} +\def\translation@dbh{DBH} +\def\translation@tall{tall} +\def\aster{\ensuremath{\ast}\hss} +\def\printheadings@en{% + \if\relax\@heading\relax\else + \heading@line{\headingstyle\@heading} + \if\relax\@subheading\relax\else + \heading@line{\headingstyle\@subheading}\fi + \vskip2pt\relax + \centerline{\makebox[0.618\linewidth][s]{% + \aster\aster\aster\aster\aster\unskip}} + \vskip4pt\relax + \fi} +\def\init@punct{\def\the@punct{}}\init@punct +\def\push@punct#1{\def\the@punct{#1 }} +\def\pop@punct{\the@punct\init@punct} +\def\unless@empty#1#2#3#4{% + \edef\@tmp{#1}% + \unless\ifx\@tmp\empty + \pop@punct#2#1#3\push@punct{#4}\fi} +\def\print@col@num#1#2{% + \length@test{#1\hskip0.7em\relax#2}{0.85}% + {#1\hskip0.7em\relax\allowbreak\null\nobreak\hfill#2}% + {\leavevmode\box\temp@box}\par} +\def\capitalize@one#1{\uppercase{#1}} +\def\capitalize@first#1{% + \edef\@tmp{#1}% + \expandafter\capitalize@one\@tmp} +\def\printform@en{% + \raggedright + \unless@empty{\Family}{\textsc}{}{}\par + {\leftskip2em\relax\hangindent1em\relax + \unless@empty{\LatName}{\det@latin}{}{}\par} + \parskip=5pt\relax + \print@col@num{\Collector}{\#\,\ColNum}% + \unless@empty{\ColDate}{\capitalize@first}{}{;}% + \unless@empty{\Location}{}{}{,}% + \unless@empty{\Longitude}{\add@long}{}{,}% + \unless@empty{\Latitude}{\add@lat}{}{,}% + \unless@empty{\Altitude}{\add@m}{ \translation@asl}{}\push@punct{;}% + \unless@empty{\Habitat}{}{}{}\push@punct{.}\pop@punct\par + \unless@empty{\LifeForm}{\capitalize@first}{}{,}% + \unless@empty{\Height}{\add@m}{ \translation@tall}{,}% + \unless@empty{\DBH}{\translation@dbh\space\add@cm}{}{.}\push@punct{.}\pop@punct% + \Descr\par + \parskip\z@} +\def\@Collect@en#1{{% + \let\printheadings\printheadings@en + \let\printform\printform@en + \@Collect{#1}}} +\def@to@eol\Collect@en\@Collect@en +\let\collect\Collect@en % COMPONENTS OF IDENTIFICATION LABELS \if@det@barcode \RequirePackage{qrcode} @@ -438,6 +494,12 @@ \fi \@identifying@false} \def@to@eol\Identify\@Identify +% COLLECTING LABELS IN WESTERN LANGUAGES +\def\@Identify@en#1{{% + \let\detchinesestyle\detcommonnamestyle + \@Identify{#1}}} +\def@to@eol\Identify@en\@Identify@en +\let\identify\Identify@en % CATCODES PART III \catcode`\&\active \def&{et} |