diff options
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/mcf2graph/CHANGELOG | 9 | ||||
-rw-r--r-- | graphics/mcf2graph/README | 2 | ||||
-rw-r--r-- | graphics/mcf2graph/mcf2graph.mf | 58 | ||||
-rw-r--r-- | graphics/mcf2graph/mcf_data_base.mcf | 43 | ||||
-rw-r--r-- | graphics/mcf2graph/mcf_exa_soc.mf | 13 | ||||
-rw-r--r-- | graphics/mcf2graph/mcf_example.pdf | bin | 319297 -> 320334 bytes | |||
-rw-r--r-- | graphics/mcf2graph/mcf_example.tex | 2 | ||||
-rw-r--r-- | graphics/mcf2graph/mcf_man_soc.mf | 158 | ||||
-rw-r--r-- | graphics/mcf2graph/mcf_manual.pdf | bin | 381229 -> 383107 bytes | |||
-rw-r--r-- | graphics/mcf2graph/mcf_manual.tex | 103 | ||||
-rw-r--r-- | graphics/mcf2graph/mcf_mplib_exa.pdf | bin | 184370 -> 184371 bytes | |||
-rw-r--r-- | graphics/mcf2graph/mcf_mplib_exa.tex | 4 | ||||
-rw-r--r-- | graphics/pgf/contrib/xistercian/README.md | 35 | ||||
-rw-r--r-- | graphics/pgf/contrib/xistercian/xistercian.dtx | 1546 | ||||
-rw-r--r-- | graphics/pgf/contrib/xistercian/xistercian.pdf | bin | 0 -> 316107 bytes |
15 files changed, 1820 insertions, 153 deletions
diff --git a/graphics/mcf2graph/CHANGELOG b/graphics/mcf2graph/CHANGELOG index 684fdf8016..fcde9811d3 100644 --- a/graphics/mcf2graph/CHANGELOG +++ b/graphics/mcf2graph/CHANGELOG @@ -1,7 +1,12 @@ ******************************************************************************* - Changelog of mcf2graph software package by Akira Yamaji 2021-06-28 + Changelog of mcf2graph software package by Akira Yamaji 2021-07-18 ******************************************************************************* -[ver. 4.68 / 2021-06-28 +[ver. 4.69 / 2021-07-18] + -add bond type wf_r,wb_r,bd_r for steric ring + -update mcf_data_base.mcf + -update MCF manual,example + +[ver. 4.68 / 2021-06-28] -fix bug in data base file handling -update mcf_data_base.mcf -update MCF manual,example diff --git a/graphics/mcf2graph/README b/graphics/mcf2graph/README index 3f1624af40..c6252c7f5c 100644 --- a/graphics/mcf2graph/README +++ b/graphics/mcf2graph/README @@ -1,7 +1,7 @@ ******************************************************************************** mcf2graph : Convert Molecular Coding Format to graphics with METAFONT/METAPOST Author : Akira Yamaji - version : 4.68 2021-06-28 + version : 4.69 2021-07-18 E-mail : mcf2graph@gmail.com Located at : http://www.ctan.org/pkg/mcf2graph ******************************************************************************** diff --git a/graphics/mcf2graph/mcf2graph.mf b/graphics/mcf2graph/mcf2graph.mf index 33fec242fe..d248fe014a 100644 --- a/graphics/mcf2graph/mcf2graph.mf +++ b/graphics/mcf2graph/mcf2graph.mf @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% mcf2graph ver 4.68 Copyright (c) 2013-2021 Akira Yamaji +% mcf2graph ver 4.69 Copyright (c) 2013-2021 Akira Yamaji % % Permission is hereby granted, free of charge, to any person obtaining a copy of this software % and associated documentation files (the "Software"), to deal in the Software without restriction, @@ -37,17 +37,16 @@ % Set to use plain.mp (label,arrow,atom) : mpost -s labeloffset=2 FILENAME %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tracingstats:=1; -message "* This is mcf2graph ver 4.68 2021.06.28"; +message "* This is mcf2graph ver 4.69 2021.07.18"; %------------------------------------------------------------------------------------------------- newinternal cntA,cntB,cntM,minX,minY,maxX,maxY,sftX,sftY,com,par,envT,envB,lenT,lineT,angT,rotT, crR,nA,nB,nC,nD,nE,nF,nS,nL,nR,nU,nP,xpos,ypos,markA,markB,saveA,saveB,bondL; numeric save_num[],comD[][],parD[][],adrD[][],cntD[],tbl_atom[],tbl_group[][],f_char[], tbl_atom_wt[],tbl_atom_mi[],tbl_char_wd[],tbl_char_ht[],addA[],add_rot[],chargeA[], - com_group[][],par_group[][],cnt_group[],colorA[],colorB[],sumA[],bondC[],hideH[], - lineB[],sB[],eB[],angB[],angA[],lenB[],angX[],numS[],wdM[],htM[],wdA[],dxA[],cmm_adr[], - mc_indent[]; -string save_str[],tbl_atom_str[],strD[],tag[],file_name_output,blank_str,aux_delimiter, - atomfont,mpfont,s_tag,s_var,cal_FM,cal_MW,cal_MI, + com_group[][],par_group[][],cnt_group[],colorA[],colorB[],sumA[],bondC[],hideH[],lineB[], + sB[],eB[],angB[],angA[],lenB[],angX[],numS[],wdM[],htM[],wdA[],dxA[],cmm_adr[],mc_indent[]; +string save_str[],tbl_atom_str[],strD[],tag[],file_name_output,blank_str,aux_delimiter,atomfont, + mpfont,s_tag,s_var,cal_FM,cal_MW,cal_MI, inf_NO,inf_EN,inf_JN,inf_FM,inf_CAS,inf_USE,inf_EXA,inf_EXB,inf_MW; pair save_pair[],posA[],posM[][],msize,mposition,fsize,fmargin,save_mposition,posBs,posBe,dum; picture mol_stru[],atom_picture,save_picture,temp_picture; @@ -207,7 +206,8 @@ def_com(-4090)(_com,_jp_atom,_jp_absA,_jp_bond,_cyc,_cyc_sB,_cyc_eB,_set_line,_t _group_si,_set_adr,_mk_bond,_set_atom,_arrange_ang,_chg_atom,_tmp_rot,_fuse,_size_atom,_numeric, _jump_at,_set_add,_chg_add,_nop,_mark,_moff,_term,_len_s,_len_e,_len_ss,_len_ee, _group_s,_group_e,_rest,_charge,_from,_until, - si,dl,dl_,dr,dr_,db,dm,dm_,tm,wf,wb,bd,bz,zf,zb,dt,wv,nl,vf,vb,nb,si_,wf_,wb_,zf_,zb_,wv_,bd_); + si,dl,dl_,dr,dr_,db,dm,dm_,tm,wf,wb,bd,bz,zf,zb,dt,wv,nl,vf,vb,nb,wf_r,wb_r,bd_r, + si_,wf_,wb_,zf_,zb_,wv_,bd_); %-------------------------------------------------------------------------------------------------- def parameter_list= sw_numbering,sw_expand,sw_output,sw_ext_all,sw_frame,sw_trimming,sw_arrow_emu,sw_abbreviate, @@ -384,7 +384,7 @@ def pickup_data_unit(expr t,v)= if temps=EOF: f_EOF:=1; fi exitif temps=EOF; if subc(1,temps)="%": - ef subc(1,temps)="+": + ef (subc(1,temps)="+")and(subc(2,temps)<>"-"): data_unit_cnt:=data_unit_cnt+1; if v="*": cond:=1; ef t="n": if data_unit_cnt=n_var: cond:=1; fi @@ -410,7 +410,7 @@ def pickup_data_unit(expr t,v)= temps:=readfrom file_name_input; if temps=EOF: f_EOF:=1; fi exitif temps=EOF; - exitif subc(1,temps)="+"; + exitif (subc(1,temps)="+")and(subc(2,temps)="-"); endfor fi else: @@ -464,8 +464,8 @@ enddef; vardef '(text TXT)= parts_cnt:=parts_cnt+1; read_mcf(parts_cnt)(TXT); parts_cnt enddef; vardef read_id(text TXT)=read_mcf(incr parts_cnt)(|,#crR,TXT,##,(_com,_rest)); parts_cnt enddef; vardef read_ud(text TXT)=read_mcf(incr parts_cnt)(dum,dum,|,TXT,(_com,_rest)); parts_cnt enddef; -vardef abs_adress primary n == n-4095 enddef; -primarydef a from_until b == (_from,a),(_until,b) enddef; +vardef abs_adress primary n = if n LT 0:: (n+360)-4095 else:: n-4095 fi enddef; +primarydef a from_until b = (_from,a),(_until,b) enddef; tertiarydef a op_equ b = if (known a)and(known b):: change_bond(a,b) else:: _nop fi enddef; tertiarydef a op_col b = if (known a)and(known b):: change_atom(a,b) else:: _nop fi enddef; tertiarydef a op_hat b = if known b:: (_tmp_rot,b),a else:: _nop,a fi enddef; @@ -478,10 +478,10 @@ def jump_atom primary a = if numeric a:: (_jp_atom,a) elseif pair a:: (_jp_atom,$1),<$0,angle(a)~0`length(a),<$0 fi enddef; def chg_length primary n = (_com,_len_s),(_chg_len,n) enddef; -def group_si secondary n == if known n:: (_group_si,n) else:: _nop fi enddef; -def group_dm secondary n == /n~dm enddef; def group_wf secondary n == /n~wf enddef; -def group_zf secondary n == /n~zf enddef; def group_wv secondary n == /n~wv enddef; -def group_nb secondary n == /n~nb enddef; +def group_si secondary n = if known n:: (_group_si,n) else:: _nop fi enddef; +def group_dm secondary n = /n~dm enddef; def group_wf secondary n = /n~wf enddef; +def group_zf secondary n = /n~zf enddef; def group_wv secondary n = /n~wv enddef; +def group_nb secondary n = /n~nb enddef; %------------------------------------------------------------------------------------------------- def CP = com_par enddef; def CPe = com_par_ex(0) enddef; def CPx = com_par_ex(1) enddef; %================================================================================================= @@ -1323,6 +1323,11 @@ def draw_bond(expr NUM)= draw Le for i=1 upto nB: ..controls(((i-.5)/nB)[sfrt(Le,nA,iif(odd(i),ap,am)),sfrt(Ls,nA,iif(odd(i),ap,am))]) ..(i/nB)[Le,Ls] endfor ..Ls Cp(col); +% + ef nL=wf_r: filldraw Ls--sfrt(Le,.35ww,am)--sfrt(Le,.35ww,ap)--cycle wpcs .05ww Cp(col); + ef nL=wb_r: filldraw sfrt(Ls,.35ww,am)--Le--sfrt(Ls,.35ww,ap)--cycle wpcs .05ww Cp(col); + ef nL=bd_r: draw zA wpcs .65bondgap Cp(col); +% ef nL=vf: draw zA Cp(col);draw sfrt(Le,bondgap,ang-150)--Le--sfrt(Le,bondgap,ang+150) Cp(col); ef nL=vb: draw zA Cp(col);draw sfrt(Ls,bondgap,ang-30)--Ls--sfrt(Ls,bondgap,ang+30) Cp(col); ef nL=si_: erase draw subpath (0.15,0.85) of zA wpcs 0.8bondgap; draw zA Cp(col); @@ -2053,3 +2058,24 @@ def proc_err(expr ERR_CODE,ADR)= fi enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +vardef count_data_unit(expr f)= + save temps,file_name,f_mcf,f_error,line_cnt,unit_cnt; + string temps,file_name; + line_cnt:=unit_cnt:=f_mcf:=f_error:=0; + file_name:=f&".mcf"; + forever: + temps:=readfrom file_name; + exitif temps=EOF; + line_cnt:=line_cnt+1; + if subc(1,temps)="%": + else: + if (subc(1,temps)="+")and(subc(2,temps)<>"-"): if f_mcf=1: f_error:=1; fi f_mcf:=1; fi + if (subc(1,temps)="+")and(subc(2,temps)="-"): + if f_mcf=0: f_error:=1; else: f_mcf:=0; unit_cnt:=unit_cnt+1; fi + fi + exitif f_error=1; + fi + endfor + if f_error=1: -line_cnt else: unit_cnt fi +enddef; +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/graphics/mcf2graph/mcf_data_base.mcf b/graphics/mcf2graph/mcf_data_base.mcf index 10944442ea..3b56141203 100644 --- a/graphics/mcf2graph/mcf_data_base.mcf +++ b/graphics/mcf2graph/mcf_data_base.mcf @@ -1,9 +1,10 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% molecular data base file mcf_data_base.mcf by Akira Yamaji 2021.06.28 +% molecular data base file mcf_data_base.mcf by Akira Yamaji 2021.07.18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % tag1:var1;tag2:var2;tag3:var3 ..... -% first character of line '%' comment out -% first character of line '+' begin MCF , end MCF +% first character of line "%" comment out +% first character of line "+" begin MCF +% first string of line "+-" end MCF % Cat = Category %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %============================================================================== @@ -148,6 +149,38 @@ Cat:biological;EN:Oxaloacetate;MW:132.07;EXA:3 <30,COOH,!,//O,!2,COOH +------------------------------------------------------------------------------ %============================================================================== +Cat:biological;EN:Glucose;MW:180.16;EXA:- ++ +<30,?6,5:O,2:*/OH,{1,3}:/*OH,4:*/*OH,6:*/!OH ++------------------------------------------------------------------------------ +Cat:biological;EN:Glucose;MW:180.16;EXA:- ++ +<-30,OH,!2,*/OH,!,/*OH,!,/*OH,!,/*OH,!,//O,!,H ++------------------------------------------------------------------------------ +Cat:biological;EN:Fructose;MW:180.16;EXA:- ++ +<30,OH,!2,/*OH,!,*/OH,!,*/OH,!,//O,!2,OH ++------------------------------------------------------------------------------ +Cat:biological;EN:Fructose;MW:180.16;EXA:- ++ +<-18,?5,5:O,1^-48:*/*!OH,1^48:/OH,2:/*OH,3:*/OH,4:/*!OH ++------------------------------------------------------------------------------ +Cat:biological;EN:Glucose(1);MW:180.16;EXA:1 ++ +#1,-60~wf_r,75~bd_r,-30~wb_r,130,O,75,&1,##, +{1^$-160,2^$175,3^$-60}:/OH`-.5,4:*/*OH`-.5,6:/!OH^$90`-.5 ++------------------------------------------------------------------------------ +Cat:biological;EN:Glucose(2);MW:180.16;EXA:1 ++ +#1.25,-30~wf_r,30~bd_r`1,30~wb_r,120,O,30,&1,##, + {1^$-90,2^$90,3^$-90,4^$90}:/OH`-.5,6^$90:/!OH`-.5 ++------------------------------------------------------------------------------ +Cat:biological;EN:Fluctose;MW:180.16;EXA:- ++ +#1.4,-35~wf_r,35~bd_r`1,30~wb_r,130`1.66,O,&1,##, + 1^$-90:/OH,{2^$-90,3^$90}:/OH`-.45,{1^$90,4^$90}:/!OH`-.45 ++------------------------------------------------------------------------------ +%============================================================================== Cat:biological;EN:Geraniol;MW:154.25;EXA:1 + <30,!8,OH,{2,6}=dr,{2,6}:/_ @@ -868,11 +901,11 @@ Cat:biological;EN:Warfarin;MW:308.333;EXA:1 + <30,Ph,3=?6,8=dl,10:O,7:/OH,9://O,@8,\,/Ph`1,60,!,//O,! +------------------------------------------------------------------------------ -Cat:biological;EN:Genistein;MW:270.24;EXA:1 +Cat:biological;EN:Genistein;MW:270.24;EXA:- + <30,Ph,3=?6,9=dl,10:O,{2,6}:/OH,7://O,@8,\,Ph,-3:/OH +------------------------------------------------------------------------------ -Cat:biological;EN:Baicalein;MW:270.24;EXA:1 +Cat:biological;EN:Baicalein;MW:270.24;EXA:1- + <30,Ph,3=?6,9=dl,10:O,{1,2,6}:/OH,7://O,@8,\,Ph +------------------------------------------------------------------------------ diff --git a/graphics/mcf2graph/mcf_exa_soc.mf b/graphics/mcf2graph/mcf_exa_soc.mf index 516424a549..1f947a342f 100644 --- a/graphics/mcf2graph/mcf_exa_soc.mf +++ b/graphics/mcf2graph/mcf_exa_soc.mf @@ -1,8 +1,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Molecular Coding Format for mcf_example.tex by Akira Yamaji 2021.06.28 +% Molecular Coding Format for mcf_example.tex by Akira Yamaji 2021.07.18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -input mcf2graph.mf; %%% it must be version 4.68 -message "* mcf_exa_soc 2021.06.28"; +input mcf2graph.mf; %%% it must be version 4.69 +message "* mcf_exa_soc 2021.07.18"; message ""; %------------------------------------------------------------------------------ fsize:=(35mm,24mm); @@ -12,9 +12,16 @@ tag1:="J"; tag2:="C"; tag3:="fm"; tag4:="mw"; tag5:="EN"; tag6:="MW"; %%%%sw_fframe:=1; %%%% outputformat:="png"; hppp:=vppp:=0.1; outputtemplate:="%j-%3c.png"; %ext(defaultfont:="uhvr8r"; defaultscale:=.6; label.lrt(inf_EN,(-2bp,1.5bp));) +%sw_output:=Font; +%ext(defaultfont:="uhvr8r"; defaultscale:=.6; +%label.lrt(inf_EN&"MW="&cal_MW +% &"("&decimal(num_MW-scantokens(inf_MW))&")",(-2bp,1.5bp)); +%) %------------------------------------------------------------------------------ if f_MP=0: input mcf_exa_soc-mf.aux; % (metafont) make aux file before typeset else: % mpost -s ahlength=7 mcf_exa_soc.mf +%------------------------------------------------------------------------------ +%%message "counr unit= "&decimal(count_data_unit("mcf_data_base")); %****************************************************************************** beginfont("f:mcf_data_base","t:EN","v:Adenine") % select EN=Adenine if check(mc)=0: MC(scantokens(mc)) fi diff --git a/graphics/mcf2graph/mcf_example.pdf b/graphics/mcf2graph/mcf_example.pdf Binary files differindex 3e206972ac..0201f795ed 100644 --- a/graphics/mcf2graph/mcf_example.pdf +++ b/graphics/mcf2graph/mcf_example.pdf diff --git a/graphics/mcf2graph/mcf_example.tex b/graphics/mcf2graph/mcf_example.tex index 8d44f7522b..0069f100e6 100644 --- a/graphics/mcf2graph/mcf_example.tex +++ b/graphics/mcf2graph/mcf_example.tex @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Example of MCF typeset by LaTeX mcf_examples.tex by A.Yamaji 2021.06.28 +% Example of MCF typeset by LaTeX mcf_examples.tex by A.Yamaji 2021.07.18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \documentclass[a4paper]{article} \usepackage{graphicx} diff --git a/graphics/mcf2graph/mcf_man_soc.mf b/graphics/mcf2graph/mcf_man_soc.mf index 75591a8fe3..1561ec3b64 100644 --- a/graphics/mcf2graph/mcf_man_soc.mf +++ b/graphics/mcf2graph/mcf_man_soc.mf @@ -1,9 +1,9 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Molecular Coding Format file for mcf_manual.tex by Akira.Yamaji 2021.06.28 +% Molecular Coding Format file for mcf_manual.tex by Akira.Yamaji 2021.07.18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -input mcf2graph.mf; %% it must be version 4.68 +input mcf2graph.mf; %% it must be version 4.69 % ** use data base file 'mcf_data_base.mcf' -message "mcf_man_soc 2021.06.28"; message ""; +message "mcf_man_soc 2021.07.18"; message ""; %------------------------------------------------------------------------ sw_mframe:=0; sw_expand:=0; @@ -257,96 +257,95 @@ beginfont("EN:rotate 1") endfont %*********************************************************************** beginfont("EN:change bond 1") - fsize:=(70mm,12mm); - fmargin:=(2mm,3mm); + fsize:=(70mm,10mm); + fmargin:=(2mm,2mm); sw_trimming:=0; ratio_chain_ring:=1; MC(<-30,!~dm,!,!~dl,!,!~dr,!~db,!~db,!,!~tm) add(defaultscale:=0.6; labeloffset:=0; - label.rt("(dm)",A1+(0,-0.8l)); - label.rt("(dl)",A3+(0,-0.8l)); - label.rt("(dr)",A5+(0,-0.8l)); - label.rt("(db)",A6+(0,-0.3l)); - label.rt("(db)",A7+(0,-0.8l)); - label.rt("(tm)",A9+(0,-0.8l)); + label.rt("(dm)",A1+(0,-0.7l)); + label.rt("(dl)",A3+(0,-0.7l)); + label.rt("(dr)",A5+(0,-0.7l)); + label.rt("(db)",A6+(0,-0.7l)); + label.rt("(db)",A7+(0,-0.7l)); + label.rt("(tm)",A9+(0,-0.7l)); ) endfont %*********************************************************************** beginfont("EN:change bond 2") - fsize:=(60mm,12mm); - fmargin:=(2mm,3mm); - blength:=9.5mm; - sw_trimming:=1; + fsize:=(70mm,10mm); + fmargin:=(2mm,2mm); + sw_trimming:=0; ratio_chain_ring:=1; - MC(<-30,!~wf,!,!~wb,!,!~zf,!,!~zb) + MC(<-30,!~wf,!,!~wb,!,!~zf,!,!~zb,!,!~vf,!,!~vb) add(defaultscale:=0.6; labeloffset:=0; label.rt("(wf)",A1+(0,-0.7l)); label.rt("(wb)",A3+(0,-0.7l)); label.rt("(zf)",A5+(0,-0.7l)); label.rt("(zb)",A7+(0,-0.7l)); + label.rt("(vf)",A9+(0,-0.7l)); + label.rt("(vb)",A11+(0,-0.7l)); ) endfont %*********************************************************************** beginfont("EN:change bond 3") - fsize:=(70mm,12mm); - fmargin:=(2mm,3mm); - blength:=10mm; - sw_trimming:=1; - ratio_chain_ring:=1; - MC(<-30,!~vf,!,!~vb) - add(defaultscale:=0.6; labeloffset:=0; - label.rt("(vf)",A1+(0,-0.7l)); - label.rt("(vb)",A3+(0,-0.7l)); - ) -endfont -%*********************************************************************** -beginfont("EN:change bond 3") - fsize:=(70mm,12mm); - fmargin:=(2mm,3mm); + fsize:=(70mm,10mm); + fmargin:=(2mm,2mm); blength:=9mm; sw_trimming:=1; ratio_chain_ring:=1; MC(<-30,!7,1=dt,3=wv,5=bd,7=bz) add(defaultscale:=0.6; labeloffset:=0; - label.rt("(dt)",A1+(0,-0.7l)); - label.rt("(wv)",A3+(0,-0.7l)); - label.rt("(bd)",A5+(0,-0.7l)); - label.rt("(bz)",A7+(0,-0.7l)); + label.rt("(dt)",A1+(0,-0.6l)); + label.rt("(wv)",A3+(0,-0.6l)); + label.rt("(bd)",A5+(0,-0.6l)); + label.rt("(bz)",A7+(0,-0.6l)); ) endfont %*********************************************************************** -beginfont("EN:change bond 4") - fsize:=(60mm,12mm); - fmargin:=(2mm,3mm); - blength:=9mm; - sw_trimming:=1; - ratio_chain_ring:=1; - MC(<30,!7,{2,4,6}=dr) -endfont -%*********************************************************************** beginfont("EN:over line") sw_trimming:=1; - fsize:=(80mm,20mm); + fsize:=(75mm,20mm); ratio_chain_ring:=1; - MC(<30,!18,!,60,90`17, + MC(<30,!18,$90`1.5,90`15.5, {2~si_,4~wf_,6~wb_,8~zf_,10~zb_, 12~bd_,14~dl_,16~dr_,18~dm_}:/_`2) endfont %*********************************************************************** +beginfont("EN:Steric ring") + fsize:=(75mm,16mm); + MCat(0.05,0.5)(#1.25,-30~wf_r,30~bd_r`1,30~wb_r,120,O,30,&1,##, + {1^$-90,2^$90,3^$-90,4^$90}:/OH`-.5,6^$90:/!OH`-.5) + defaultscale:=0.6; + MCat(0.5,0.7)(0~wf_r) add(label.lft("wf_r:",A1);) + MCat(0.5,0.2)(0~wf) add(label.lft("wf:",A1);) + MCat(0.75,0.7)(0~bd_r) add(label.lft("bd_r:",A1);) + MCat(0.75,0.2)(0~bd) add(label.lft("bd:",A1);) + MCat(1,0.7)(0~wb_r) add(label.lft("wb_r:",A1);) + MCat(1,0.2)(0~wb) add(label.lft("wb:",A1);) +endfont +%*********************************************************************** +beginfont("EN:change multi bond") + fsize:=(40mm,8mm); + fmargin:=(2mm,3mm); + ratio_chain_ring:=1; + MC(<30,!7,{2,4,6}=dr) +endfont +%*********************************************************************** beginfont("EN:change bond length1") - fsize:=(75mm,10mm); + fsize:=(55mm,8mm); sw_numbering:=Bond; MC(<-30,!2,!4`1.2,!2) endfont %*********************************************************************** beginfont("EN:change bond length2") - fsize:=(75mm,10mm); + fsize:=(55mm,8mm); sw_numbering:=Bond; MC(<-30,!2,#1.2,!4,##,!2) endfont %*********************************************************************** beginfont("EN:change ring length") - fsize:=(60mm,20mm); + fsize:=(60mm,16mm); fmargin:=(2mm,2mm); sw_trimming:=1; sw_numbering:=Bond; @@ -355,7 +354,7 @@ endfont %*********************************************************************** beginfont("EN:Insert atom") sw_trimming:=1; - fsize:=(70mm,12mm); + fsize:=(50mm,7mm); MC(<-30,!2,O,!2,N,!2) endfont %*********************************************************************** @@ -368,7 +367,7 @@ beginfont("EN:change atom") endfont %*********************************************************************** beginfont("EN:change atom brock address 1") - fsize:=(70mm,15mm); + fsize:=(70mm,14mm); fmargin:=(3mm,1.5mm); MCat(0,.5)(?6,@4,\,|,?6,2:O) sw_numbering:=Atom; @@ -377,7 +376,7 @@ beginfont("EN:change atom brock address 1") endfont %*********************************************************************** beginfont("EN:change atom brock address 2") - fsize:=(70mm,15mm); + fsize:=(70mm,14mm); fmargin:=(3mm,1.5mm); MCat(0,.5)(?6,@4,\,|,?6,||,2:N) sw_numbering:=Atom; @@ -386,7 +385,7 @@ beginfont("EN:change atom brock address 2") endfont %*********************************************************************** beginfont("EN:change atom absolute address") - fsize:=(70mm,15mm); + fsize:=(70mm,14mm); fmargin:=(3mm,1.5mm); MCat(0,.5)(?6,@4,\,?6,$2:N) sw_numbering:=Atom; @@ -395,7 +394,7 @@ beginfont("EN:change atom absolute address") endfont %*********************************************************************** beginfont("EN:change atom relative adress") - fsize:=(70mm,15mm); + fsize:=(70mm,14mm); fmargin:=(3mm,1.5mm); MCat(0,.5)(?6,@4,\,?6,-2:N) sw_numbering:=Atom+Inverse; @@ -414,7 +413,7 @@ beginfont("EN:fused ring") fmargin:=(2mm,1.5mm); sw_trimming:=1; sw_numbering:=Bond; - MC(<30,?6,3=?6,3=dt,{7--11}=bd) + MC(<30,?6,3=?6,3=dt,{7--11}=bd_r) endfont %----------------------------------------------------------------------- beginfont("EN:change ring length") @@ -423,7 +422,7 @@ beginfont("EN:change ring length") sw_trimming:=1; sw_numbering:=Bond; MC(?6,@4,\,?6`1.2,5=?6,11=?6, - {14--23}=bd,{5,11}=dt) + {14--23}=bd_r,{5,11}=dt) endfont %----------------------------------------------------------------------- beginfont("EN:fused large 6 ring") @@ -432,7 +431,7 @@ beginfont("EN:fused large 6 ring") margin_top_bottom:=1.5mm; sw_numbering:=Bond; sw_trimming:=1; - MC(<30,?6,3=?6[13],3=dt,{7--11}=bd) + MC(<30,?6,3=?6[13],3=dt,{7--11}=bd_r) endfont %----------------------------------------------------------------------- beginfont("EN:fuse multi ring") @@ -448,13 +447,13 @@ beginfont("EN:fused ring 2") fmargin:=(2mm,2mm); sw_numbering:=Bond; msize:=(1,.9); - MCat( 0,.5)(<30,?6,3=?6,(11,4)=?6[4],{11,4}=dt,{12--15}=bd) + MCat( 0,.5)(<30,?6,3=?6,(11,4)=?6[4],{11,4}=dt,{12--15}=bd_r) add(defaultscale:=0.4; label("(1)",p0);) msize:=(1,.9); - MCat(.5,.5)(<30,?6,3=?6,(11,4)=?5[3],{11,4}=dt,{12--14}=bd) + MCat(.5,.5)(<30,?6,3=?6,(11,4)=?5[3],{11,4}=dt,{12--14}=bd_r) add(defaultscale:=0.4; label("(2)",p0);) msize:=(1,.9); - MCat( 1,.5)(<30,?6,3=?6,(11,4)=?4[2],{11,4}=dt,{12,13}=bd) + MCat( 1,.5)(<30,?6,3=?6,(11,4)=?4[2],{11,4}=dt,{12,13}=bd_r) add(defaultscale:=0.4; label("(3)",p0);) endfont %*********************************************************************** @@ -462,24 +461,22 @@ beginfont("EN:fused ring 3") fsize:=(60mm,20mm); fmargin:=(2mm,2mm); sw_numbering:=Bond; - MCat(0,1)(?6,{3,10}=?6,(16,4)=?6[3],{16,4}=dt,{17--19}=bd) + MCat(0,1)(?6,{3,10}=?6,(16,4)=?6[3],{16,4}=dt,{17--19}=bd_r) add(defaultscale:=0.4; label("(1)",p0);) - MCat(1,0)(?6,{3,10}=?6,(16,4)=?5[2],{16,4}=dt,{17,18}=bd) + MCat(1,0)(?6,{3,10}=?6,(16,4)=?5[2],{16,4}=dt,{17,18}=bd_r) add(defaultscale:=0.4; label("(2)",p0);) endfont %*********************************************************************** beginfont("EN:fused ring 4") - fsize:=(60mm,22mm); + fsize:=(60mm,20mm); fmargin:=(2mm,2mm); sw_trimming:=1; sw_numbering:=Bond; - MC(<-30,?6,{3,10,15}=?6,(21,4)=?6[2],{21,4}=dt,{22,23}=bd) + MC(<-30,?6,{3,10,15}=?6,(21,4)=?6[2],{21,4}=dt,{22,23}=bd_r) endfont %*********************************************************************** beginfont("EN:Spiro ring ") - sw_trimming:=1; - fsize:=(60mm,18mm); - fmargin:=(2mm,3mm); + fsize:=(40mm,15mm); sw_numbering:=Atom; numbering_end:=7; ratio_chain_ring:=1; @@ -487,14 +484,12 @@ beginfont("EN:Spiro ring ") endfont %*********************************************************************** beginfont("EN:group 1") - fsize:=(60mm,25mm); - sw_trimming:=1; - MC(<-30,!,/_,!,/!,!3,/!2,!,/iPr,!3,/tBu,!,/Ph^-30,!) + fsize:=(75mm,18mm); + MC(<30,!,/_,!2,/!,!2,/!2,!4,/?!,!4,/??!,!2,/'(Ph`0.8)^-60,!) endfont %*********************************************************************** beginfont("EN:group 2") - fsize:=(80mm,15mm); - sw_trimming:=1; + fsize:=(70mm,14mm); MC(<30,!`1,//O,!2`1,*/H,!2`1,/*H,!2`1,*/*H,!2`1,**?3,!`1) add(defaultscale:=0.75; label("//",A2-(0,0.45l)); @@ -506,18 +501,17 @@ beginfont("EN:group 2") endfont %*********************************************************************** beginfont("EN:group 3") - fsize:=(60mm,18mm); + fsize:=(60mm,16mm); sw_trimming:=1; MC(<-30,#1,!2,/_`2^30,!2,/!2>lr,!2,/!2>rl,!) endfont %*********************************************************************** beginfont("EN:group 3") - fsize:=(80mm,18mm); + fsize:=(75mm,18mm); fmargin:=(2mm,2mm); sw_numbering:=Atom; - sw_trimming:=1; numbering_end:=17; - MC(<30,!16,2:/_,4:/!,6:/!2,10:/iPr,14:/tBu,16:/Ph^-60) + MC(<30,!16,2:/_,4:/!,6:/!2,10:/iPr,14:/tBu,16:/'(Ph`0.8)^-60) endfont %*********************************************************************** beginfont("EN:group 4") @@ -529,14 +523,14 @@ beginfont("EN:group 4") endfont %*********************************************************************** beginfont("EN:group 5") - fsize:=(60mm,18mm); + fsize:=(60mm,16mm); sw_trimming:=1; sw_numbering:=Atom; numbering_end:=8; MC(<-30,!7`1,3:/_`2^30,5:/!2>lr,7:/!2>rl) endfont %*********************************************************************** beginfont("EN:chain strech direction mode 1") - fsize:=(50mm,35mm); + fsize:=(50mm,25mm); sw_trimming:=1; ratio_chain_ring:=1; MC( @@ -546,7 +540,7 @@ beginfont("EN:chain strech direction mode 1") endfont %*********************************************************************** beginfont("EN:chain strech direction mode 2") - fsize:=(60mm,23mm); + fsize:=(60mm,20mm); sw_trimming:=1; ratio_chain_ring:=1; MC( @@ -562,7 +556,7 @@ beginfont("EN:chain strech direction mode 3") endfont %*********************************************************************** beginfont("EN:chain strech direction mode 4") - fsize:=(60mm,22mm); + fsize:=(60mm,20mm); sw_trimming:=1; MC(<30,!6,6>'(90,-90,90,-90,90):/!5) endfont @@ -574,7 +568,7 @@ beginfont("EN:change atom and group") endfont %*********************************************************************** beginfont("EN:methyl*2,isopropyl,tert-butyl") - fsize:=(60mm,15mm); + fsize:=(60mm,12mm); sw_trimming:=1; MC(<30,!9`1,?!,!,??,!,2:??,4:/?!,6:/??!,8:/N?!) endfont @@ -612,7 +606,7 @@ beginfont("EN:Serial number") fsize:=(75mm,14mm); max_blength:=8mm; sw_numbering:=Atom; numbering_end:=15; - MC(<30,!14,{2,6--10,14}:/_~bd`0.5) + MC(<30,!14,{2,6--10,14}:/_~bd_r`0.5) endfont %*********************************************************************** beginfont("EN:Change color") diff --git a/graphics/mcf2graph/mcf_manual.pdf b/graphics/mcf2graph/mcf_manual.pdf Binary files differindex 02bb3fa0e2..e3f8d908bc 100644 --- a/graphics/mcf2graph/mcf_manual.pdf +++ b/graphics/mcf2graph/mcf_manual.pdf diff --git a/graphics/mcf2graph/mcf_manual.tex b/graphics/mcf2graph/mcf_manual.tex index a40f0331f2..415adf1bf0 100644 --- a/graphics/mcf2graph/mcf_manual.tex +++ b/graphics/mcf2graph/mcf_manual.tex @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Molecular Coding Format manual by Akira Yamaji 2021.06.28 +% Molecular Coding Format manual by Akira Yamaji 2021.07.18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \documentclass[a4paper]{article} \usepackage[pdftex]{graphicx} @@ -228,29 +228,20 @@ tm : triple \index{wb}% \index{zf}% \index{zb}% +\index{vf}% +\index{vb}% \begin{verbatim} -(Wedge) +(Wedge,Vector) wf: wedge forward wb: wedge backward zf: hashed(zebra stripe) wedge foward zb: hashed(zebra stripe) wedge backward - -<-30,!~wf,!,!~wb,!,!~zf,!,!~zb -\end{verbatim} -\MCFgraph -\vspace{-3mm}% -%----------------------------------------------------------------------------- -%%\subsubsection{Vector} -\index{vf}% -\index{vb}% -\begin{verbatim} - -(Vector) vf:vector forward vb:vector backward -<-30,!~vf,!,!~vb +<-30, + !~wf,!,!~wb,!,!~zf,!,!~zb,!,!~vf,!~vb \end{verbatim} \MCFgraph \vspace{-3mm}% @@ -264,25 +255,14 @@ vb:vector backward (Dotted,wave) Bn=bond type : change bond type at Bn -dt : dotted -wv : wave -bd : broad -bz : broad dotted +dt : dotted / wv : wave +bd : broad / bz : broad dotted <-30,!7,1=dt,3=wv,5=bd,7=bz \end{verbatim} \MCFgraph \vspace{-3mm}% %----------------------------------------------------------------------------- -\subsubsection{Change multiple bond type} -\index{vf}% -\begin{verbatim} -{2,4,6}=dr : 2=dr,4=dr,6=dr - -<30,!7,{2,4,6}=dr -\end{verbatim} -\MCFgraph -%----------------------------------------------------------------------------- \subsubsection{Over line} \index{si\_}% \index{wf\_}% @@ -310,6 +290,30 @@ dm_ : duble over line \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- +\subsubsection{Steric ring} +\index{wf\_r}% +\index{wb\_r}% +\index{bd\_r}% +\begin{verbatim} +wf_r : wedge foward (half width) +bd_r : broad (half width, rounded) +wb_r : wedge backward (half width) + +#1.25,-30~wf_r,30~bd_r`1,30~wb_r, + 120,O,30,&1,##,6^$90:/!OH`-.5, + {1^$-90,2^$90,3^$-90,4^$90}:/OH`-.5, +\end{verbatim} +\MCFgraph +%----------------------------------------------------------------------------- +\subsubsection{Change multiple bond type} +\index{vf}% +\begin{verbatim} +{2,4,6}=dr : 2=dr,4=dr,6=dr + +<30,!7,{2,4,6}=dr +\end{verbatim} +\MCFgraph +%----------------------------------------------------------------------------- \subsection{Change bond length} \subsubsection{Chain length} \index{`}% @@ -401,9 +405,13 @@ p_ : positive / n_ : negative \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- +\newpage +%----------------------------------------------------------------------------- \subsection{Fuse ring} -\subsubsection{Attached 1 bond} +%%%\subsubsection{Attached 1 bond} \begin{verbatim} +(Attached 1 bond) + ?6,3=?6 : fuse ?6 at B3 ** Bn(n:-999<=n<=4095): bond number @@ -434,8 +442,10 @@ attached bond length \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- -\subsubsection{Attached 2 bond} +%%%\subsubsection{Attached 2 bond} \begin{verbatim} +(Attached 2 bond) + (4,11)=?6[4] : fuse 4/6 ring to B11..B4 (4,11)=?5[3] : fuse 3/5 ring to B11..B4 (4,11)=?4[2] : fuse 2/4 ring to B11..B4 @@ -450,8 +460,10 @@ attached bond length \begin{verbatim} \end{verbatim} %----------------------------------------------------------------------------- -\subsubsection{Attached 3 bond} +%%%\subsubsection{Attached 3 bond} \begin{verbatim} +(Attached 3 bond) + (16,4)=?6[3] : fuse 3/6 ring to B16..B4 (16,4)=?5[2] : fuse 2/5 ring to B16..B4 ** ?m[n] (5<=m<=6,n=m-3) @@ -464,8 +476,10 @@ attached bond length \begin{verbatim} \end{verbatim} %----------------------------------------------------------------------------- -\subsubsection{Attached 4 bond} +%%%%\subsubsection{Attached 4 bond} \begin{verbatim} +(Attached 4 bond) + (21,4)=?6[2] : fuse 2/6 ring to B21..B4 MC(<-30,?6,{3,10,15}=?6,(21,4)=?6[2]) @@ -474,7 +488,7 @@ MC(<-30,?6,{3,10,15}=?6,(21,4)=?6[2]) \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- -\subsubsection{Spiro ring} +\subsection{Spiro ring} \begin{verbatim} @4,?5 : add ?5 at A4 @@ -487,13 +501,17 @@ MC(<-30,?6,{3,10,15}=?6,(21,4)=?6[2]) \index{/}% \index{Ph}% \begin{verbatim} -/ : single -<-30,!,/_,!,/!,!3,/!2,!,/?!, - !3,/??!,!,/Ph^-30,! +/ : group start single bond + +/_ : methyl +/! : ethyl +/!2 : propyl +/?! : isopropyl +/??! : tert-butyl +/Ph : phenyl -** /_ : methyl /! : ethyl - /!2 : propyl /?! : isopropyl - /??! : tert-butyl /Ph : phenyl +<30,!,/_,!2,/!,!2,/!2,!4,/?!, + !4,/??!,!2,/Ph^-60,! \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- @@ -532,7 +550,7 @@ MC(<-30,?6,{3,10,15}=?6,(21,4)=?6[2]) \subsubsection{Add group} \begin{verbatim} <30,!17,2:/_,4:/!,6:/!2, -10:/?!,14:/??!,16:/Ph^-60 + 10:/?!,14:/??!,16:/Ph^-60 \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- @@ -552,6 +570,8 @@ MC(<-30,?6,{3,10,15}=?6,(21,4)=?6[2]) \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- +\newpage +%----------------------------------------------------------------------------- \subsection{Chain environment} \subsubsection{Horizontal,vertical} \index{hz}% @@ -600,6 +620,7 @@ MC(<-30,?6,{3,10,15}=?6,(21,4)=?6[2]) \end{verbatim} \MCFgraph %----------------------------------------------------------------------------- +\newpage \subsection{Miscellaneous} %----------------------------------------------------------------------------- \subsubsection{Abbreviated parts} @@ -657,7 +678,7 @@ MC(<30,?6,{4,6}:/iBuOH) \index{--}% \begin{verbatim} 6--10 : 6,7,8,9,10 -<30,!14,{2,6--10,14}:/_~bd`0.5 +<30,!14,{2,6--10,14}:/_~bd_r`0.5 \end{verbatim} \MCFgraph \newpage diff --git a/graphics/mcf2graph/mcf_mplib_exa.pdf b/graphics/mcf2graph/mcf_mplib_exa.pdf Binary files differindex b488e6cb46..a7641d4bad 100644 --- a/graphics/mcf2graph/mcf_mplib_exa.pdf +++ b/graphics/mcf2graph/mcf_mplib_exa.pdf diff --git a/graphics/mcf2graph/mcf_mplib_exa.tex b/graphics/mcf2graph/mcf_mplib_exa.tex index d8496b1212..b536b62860 100644 --- a/graphics/mcf2graph/mcf_mplib_exa.tex +++ b/graphics/mcf2graph/mcf_mplib_exa.tex @@ -1,7 +1,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Example of MCF typest with LuaLaTeX(luamplib) by A.Yamaji 2021.06.28 +% Example of MCF typest with LuaLaTeX(luamplib) by A.Yamaji 2021.07.18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% ** mcf2graph.mf must be version 4.68 +% ** mcf2graph.mf must be version 4.69 % ** use mcf_data_base.mcf \documentclass{article} %------------------------------------------------------------------------------ diff --git a/graphics/pgf/contrib/xistercian/README.md b/graphics/pgf/contrib/xistercian/README.md new file mode 100644 index 0000000000..d9d17f16d7 --- /dev/null +++ b/graphics/pgf/contrib/xistercian/README.md @@ -0,0 +1,35 @@ +------------------------------------------------------------------------------- +# xistercian -- Cistercian numerals in LaTeX + +Version 2021-07-17 v1.0 + +Released under the LaTeX Project Public License v1.3c or later +See http://www.latex-project.org/lppl.txt + +Hosted at https://github.com/Skillmon/ltx_xistercian + +------------------------------------------------------------------------------- + +Copyright (C) 2021 Jonathan P. Spratte + +This work may be distributed and/or modified under the conditions of the +LaTeX Project Public License (LPPL), either version 1.3c of this license or +(at your option) any later version. The latest version of this license is in +the file: + + http://www.latex-project.org/lppl.txt + +This work is "maintained" (as per LPPL maintenance status) by + Jonathan P. Spratte. + +------------------------------------------------------------------------------- + +This package adds Cistercian numerals to LaTeX. The glyphs are created with PGF, +but cashed inside boxes to get better performance. + +The package provides (among other macros) the commands: + +- `\cistercian{<counter>}` to format a LaTeX2e counter +- `\cisterciannum{<integer>}` to format the `<integer>` handed in as a string + +It supports the LaTeX typical syntax `\pagenumbering{cistercian}` as well. diff --git a/graphics/pgf/contrib/xistercian/xistercian.dtx b/graphics/pgf/contrib/xistercian/xistercian.dtx new file mode 100644 index 0000000000..934b4fe044 --- /dev/null +++ b/graphics/pgf/contrib/xistercian/xistercian.dtx @@ -0,0 +1,1546 @@ +% \iffalse meta-comment +% +% File: xistercian.dtx Copyright (C) 2021 Jonathan P. Spratte +% +% This work may be distributed and/or modified under the conditions of the +% LaTeX Project Public License (LPPL), either version 1.3c of this license or +% (at your option) any later version. The latest version of this license is in +% the file: +% +% http://www.latex-project.org/lppl.txt +% +% ------------------------------------------------------------------------------ +% +%<*driver>^^A>>= +\def\nameofplainTeX{plain} +\ifx\fmtname\nameofplainTeX\else + \expandafter\begingroup +\fi +\input l3docstrip.tex +\askforoverwritefalse +\preamble + +-------------------------------------------------------------- +xistercian -- Cistercian numerals in LaTeX +E-mail: jspratte@yahoo.de +Released under the LaTeX Project Public License v1.3c or later +See http://www.latex-project.org/lppl.txt +-------------------------------------------------------------- + +Copyright (C) 2020-2021 Jonathan P. Spratte + +This work may be distributed and/or modified under the conditions of the +LaTeX Project Public License (LPPL), either version 1.3c of this license or +(at your option) any later version. The latest version of this license is in +the file: + + http://www.latex-project.org/lppl.txt + +This work is "maintained" (as per LPPL maintenance status) by + Jonathan P. Spratte. + +This work consists of the file xistercian.dtx +and the derived files xistercian.pdf + xistercian.sty + +\endpreamble +% stop docstrip adding \endinput +\postamble +\endpostamble +\generate{\file{xistercian.sty}{\from{xistercian.dtx}{pkg}}} +\ifx\fmtname\nameofplainTeX + \expandafter\endbatchfile +\else + \expandafter\endgroup +\fi +% +\IfFileExists{xistercian.sty}{\RequirePackage[debug]{xistercian}}{} +\ProvidesFile{xistercian.dtx}[2021-07-17 v1.0.0 Cistercian numerals in LaTeX] +\PassOptionsToPackage{full}{textcomp} +\documentclass{l3doc} +\RequirePackage[fulloldstyle,nott]{kpfonts} +\RequirePackage{csquotes} +\RequirePackage{tikz} +\usetikzlibrary{arrows.meta} +\RequirePackage{randtext} +\input{glyphtounicode} +\pdfgentounicode=1 +\makeatletter +\@ifdefinable\gobbledocstriptag{\def\gobbledocstriptag#1>{}} +\makeatother +\let\metaORIG\meta +\protected\def\meta#1{\texttt{\metaORIG{#1}}} +\renewcommand*\thefootnote{\cistercian{footnote}} +\newcommand*\cistexnum[1] + {^^A + \begingroup + \color{red!65!black}^^A + \cisterciansetup{s=.15ex}^^A + \cisterciannum{#1}^^A + \endgroup + } +\newcommand*\mydefault[1] + {^^A + \begingroup + \color{darkgray}^^A + \myrestoredefaults + \hfill + \texttt + {^^A + \detokenize\expandafter\expandafter\expandafter + {\csname xister@#1\endcsname}^^A + \unskip + }^^A + \endgroup + } +\newcommand*\mysdefault[1] + {^^A + \begingroup + \color{darkgray}^^A + \myrestoredefaults + \hfill + \texttt{#1}^^A + \endgroup + } +\pagenumbering{cistercian} +\ExplSyntaxOn +\makeatletter +\def\myrestoredefaults#1{\def\unexpanded{#1}{\unexpanded\expandafter{#1}}} +\edef\myrestoredefaults + { + \myrestoredefaults\xister@x + \myrestoredefaults\xister@y + \myrestoredefaults\xister@bx + \myrestoredefaults\xister@by + \myrestoredefaults\xister@tv + \myrestoredefaults\xister@th + \myrestoredefaults\xister@tdu + \myrestoredefaults\xister@tdd + \myrestoredefaults\xister@font + } +\makeatother +\newcommand\examplerow[1] + { + \cisterciannum{1#1}&\cisterciannum{2#1}&\cisterciannum{3#1}& + \cisterciannum{4#1}&\cisterciannum{5#1}&\cisterciannum{6#1}& + \cisterciannum{7#1}&\cisterciannum{8#1}&\cisterciannum{9#1}\\ + \noalign{\vskip-.5ex} + $1#1$&$2#1$&$3#1$& + $4#1$&$5#1$&$6#1$& + $7#1$&$8#1$&$9#1$\\ + \noalign{\vskip1ex} + } +\AddToHook{bfseries} + {\cisterciansetup{sv=.27ex,sdd=.27ex,sh=.12ex,sdu=.12ex,wd=.5em}} +\AddToHook{mdseries}{\myrestoredefaults} +\cisterciansetup{redraw+=series} +\ExplSyntaxOff +\begin{document} + \title{The \pkg{xistercian} package} + \author{Jonathan P. Spratte\thanks{\protect\randomize{jspratte@yahoo.de}}} + \date{2021-07-17 v1.0} + \DocInput{xistercian.dtx} +\end{document} +%</driver>^^A=<< +% \fi +% +% \maketitle +% \tableofcontents +% +% \section{Documentation} +% +% The \pkg{xistercian} package provides Cistercian numerals for use in \LaTeX. +% The name is chosen to be \pkg{xistercian} instead of \pkg{cistercian} because +% I've learned that a (currently) unpublished package by that name already +% exists and I don't want to be an evil name-stealer. +% +% +% \subsection{Introduction} +% +% Cistercian numerals are a system to denote the numbers from $1$ to $9999$ with +% a single glyph. They use a stem (\cistexnum{0}) that is used as zero by this +% package, and add the digits to that using small tick marks, the place denoting +% the digits value. On the upper right means units (\cistexnum{1}), upper left +% tens (\cistexnum{10}), lower right hundreds (\cistexnum{100}), and lower left +% thousands (\cistexnum{1000}). Figure~\ref{fig:glyphs} gives an overview over +% the base glyphs. +% +% In the medieval times it was quite common (according to Wikipedia more common +% than the vertical style) to use the Cistercian numerals horizontally instead. +% This package also supports that, in which case the numerals are rotated by +% $90$ degrees counter-clockwise, see figure~\ref{fig:glyphs:h}. +% +% All glyphs have the same bounding box, are drawn using the \pkg{pgf} +% package, and cached inside \TeX\ box registers. Therefore the performance is +% quite well, at least well enough to actually consider using these numerals +% without a major performance hit. But it still slows down the compilation, +% especially if the glyphs have to be redrawn often. By default they will be +% redrawn if the font size changed since the last usage inside the current group +% scope, but you can specify which font feature changes should cause a redraw. +% +% \begin{figure} +% \centering +% \small +% \cistercianredraw +% \begin{tabular}{*9c} +% \examplerow{} +% \examplerow{0} +% \examplerow{00} +% \examplerow{000} +% \end{tabular} +% \caption{The different base glyphs in vertical mode\label{fig:glyphs}} +% \end{figure} +% +% \begin{figure} +% \centering +% \small +% \cisterciansetup{horizontal}\cistercianredraw +% \begin{tabular}{*9c} +% \examplerow{} +% \examplerow{0} +% \examplerow{00} +% \examplerow{000} +% \end{tabular} +% \caption{The different base glyphs in horizontal mode\label{fig:glyphs:h}} +% \end{figure} +% +% Since Cistercian numerals quite compactly cover a big range of natural numbers +% they might be used to compactly keep track of running numbers. For instance, +% to use Cistercian numerals as page numbers you can use: +% \begin{verbatim} +% \pagenumbering{cistercian} +% \end{verbatim} +% or to use them as footnotes: +% \begin{verbatim} +% \renewcommand\thefootnote{\cistercian{footnotes}} +% \end{verbatim} +% +% The package tries to play nice on \pkg{hyperref} if it is loaded, but +% bookmarks containing material that should've been a Cistercian numeral will +% have a leading |CISTER| in front of the numeric value to give unique +% strings compared to |\arabic|. +% +% Negative numbers just keep a leading~|-|, and numbers with an absolute number +% greater than $9999$ are displayed with multiple Cistercian digits. For +% instance $-12345678$ is displayed as \cistexnum{-12345678}. And in the case +% that four consecutive digits are zeros they get displayed as that: +% \cistexnum{10000} is $10000$. +% +% +% \subsection{Macros} +% +% \begin{function}{\cistercian} +% \begin{syntax} +% \cs{cistercian}\marg{counter} +% \end{syntax} +% Prints the value of the \LaTeXe\ \meta{counter} as a Cistercian numeral +% (similar to how |\roman| prints a \meta{counter} as a Roman numeral). It can +% also be used as |\pagenumbering|\hskip0pt |{cistercian}| to change the page +% numbering, \emph{etc}. +% \end{function} +% +% \begin{function}{\cisterciannum} +% \begin{syntax} +% \cs{cisterciannum}\marg{integer} +% \end{syntax} +% Prints the \meta{integer} as a Cistercian numeral. The \meta{integer} has to +% be provided as a string containing only digits and optionally a single +% leading~|-| (spaces are ignored). This can handle integers of almost +% arbitrary size (well, an integer with more than $2147483647$ places will be +% an issue). +% \end{function} +% +% \begin{function}{\cisterciannumE} +% \begin{syntax} +% \cs{cisterciannum}\marg{integer expression} +% \end{syntax} +% Evaluates the \meta{integer expression} and prints the result as a +% Cistercian numeral. +% \end{function} +% +% \begin{function}{\cisterciansetup} +% \begin{syntax} +% \cs{cisterciansetup}\marg{key=value,\ldots} +% \end{syntax} +% Can be used to locally change the options after the package was loaded. The +% glyphs of the Cistercian numerals aren't automatically updated when you +% change the setup. +% \end{function} +% +% \begin{function}{\cistercianredraw,\cistercianredrawlazy} +% \begin{syntax} +% \cs{cistercianredraw} +% \end{syntax} +% When this is used the glyphs will be redrawn for the current group. The +% |lazy| variant will not immediately redraw the glyphs, but instead ensure +% that the next usage of a Cistercian numeral in the current scope will redraw +% the glyphs. The |lazy| variant could result in the glyphs being redrawn +% multiple times (if Cistercian numerals are used in different nested groups), +% while the normal variant might result in the glyphs being redrawn too +% eagerly. +% \end{function} +% +% \begin{function}{\cistercianstyle} +% \begin{syntax} +% \cs{cistercianstyle}\marg{name}\marg{key=value,\ldots} +% \end{syntax} +% With this macro you can define a key called \meta{name} that'll set the +% options in the \meta{key=value} list if used inside |\cisterciansetup|. +% Only new names are allowed. +% \end{function} +% For example, the key |horizontal| is equivalently defined to +% \begin{verbatim} +% \cistercianstyle{horizontal}{o=h,wd=0.62em,ht=1ex} +% \end{verbatim} +% +% +% \subsection{Options} +% +% The options described here are all usable as package options (except when +% explicitly stated otherwise). \pkg{xistercian} doesn't parse the global +% options provided to the documentclass. Additionally you can change the +% options (except for the |debug| option) using |\cisterciansetup|. +% +% For the options |width| and |height|, and probably also the strokes, you +% should use dimensions using |ex| or |em| to get sizes depending on the current +% font size. For all three of those options the \meta{dimension expression} is +% evaluated (using the setup specified in |font|) every time the font changed +% according to the |redraw| option's feature list (by default only when the size +% changed) since the last time they were drawn. +% +% Initial values if present are printed on the right. A small graphic explaining +% most of the size related options is shown in figure~\ref{fig:size}. +% +% \begin{figure} +% \centering +% \def\share{1/3} +% \expanded +% {^^A +% \cisterciansetup +% {bx=1,by=1,fr=\share,ht=4cm,wd=2cm,sv=9pt,sh=5pt,sdd=9pt,sdu=5pt}^^A +% }^^A +% \cistercianredraw +% \begin{tikzpicture}[>=Stealth,baseline=(base)] +% \node[color=green,inner sep=0] (sym) {\cisterciannum{9}}; +% \begin{scope}[y=(sym.north),x=(sym.east)] +% \draw (-1,-1) rectangle (1,1); +% \draw[dashed, line width=0.2pt] +% \foreach\x in{{-1,0},{1,0},{0,-1},{0,1}} { (0,0) -- (\x) } +% ; +% \draw[dashed, line width=0.2pt] (0, \share) coordinate(fr) -- ++(1,0); +% \draw[<->] +% (1.2, 0) -- node[rotate=90,below]{\texttt{0.5*fr*ht}} (1.2,0 |- fr); +% \draw[<->] (-1, -1.1) -- node[below]{\texttt{wd}} ++(2,0); +% \draw[<->] (-1.2, -1) -- node[rotate=90,above]{\texttt{ht}} ++(0,2); +% \draw[red] (-1.6, -1.3) rectangle (1.6, 1.3); +% \draw[<->] (-1.6, -1.4) -- node[below]{\texttt{bx*wd}} (1.6, -1.4); +% \draw[<->] +% (1.8, -1.3) -- node[rotate=90,below]{\texttt{by*ht}} (1.8, 1.3); +% \draw[<->] +% (-1.8, 0) -- node[rotate=90,above]{\texttt{0.5*bs*ht}} (-1.8, -.75); +% \fill (-1.6, -0.75) circle[radius=2pt] coordinate(base); +% \end{scope} +% \end{tikzpicture} +% \cisterciansetup{o=h,ht=2cm,wd=4cm}\cistercianredraw +% \begin{tikzpicture}[>=Stealth,baseline=(base)] +% \node[color=green,inner sep=0] (sym) {\cisterciannum{9}}; +% \begin{scope}[y=(sym.north),x=(sym.east)] +% \draw (-1,-1) rectangle (1,1); +% \draw[dashed, line width=0.2pt] +% \foreach\x in{{-1,0},{1,0},{0,-1},{0,1}} { (0,0) -- (\x) } +% ; +% \draw[dashed, line width=0.2pt] (-\share,0) coordinate(fr) -- ++(0,1); +% \draw[<->] (0, 1.2) -- node[above]{\texttt{0.5*fr*wd}} (0,1.2 -| fr); +% \draw[<->] (-1, -1.2) -- node[below]{\texttt{wd}} ++(2,0); +% \draw[<->] (-1.1, -1) -- node[rotate=90,above]{\texttt{ht}} ++(0,2); +% \draw[red] (-1.3, -1.6) rectangle (1.3, 1.6); +% \draw[<->] (-1.3, -1.8) -- node[below]{\texttt{bx*wd}} (1.3, -1.8); +% \draw[<->] +% (1.4, -1.6) -- node[rotate=90,below]{\texttt{by*ht}} (1.4, 1.6); +% \draw[<->] +% (-1.4, 0) -- node[rotate=90,above]{\texttt{0.5*bs*ht}} (-1.4, -.75); +% \fill (-1.3, -0.75) circle[radius=2pt] coordinate(base); +% \end{scope} +% \end{tikzpicture} +% \caption[Measurements of a glyph] +% {Measurements of a glyph. The red rectangle is the bounding box, the +% dot on the left shows the reference point placed on the surrounding +% baseline.\label{fig:size}} +% \end{figure} +% +% \begin{function}{width,wd} +% \begin{syntax} +% width = \marg{dimension expression} \mydefault{x} +% \end{syntax} +% Set the width of the Cistercian numeral digits. +% \end{function} +% +% \begin{function}{height,ht} +% \begin{syntax} +% height = \marg{dimension expression} \mydefault{y} +% \end{syntax} +% Set the height of the Cistercian numeral digits. +% \end{function} +% +% \begin{function}{bound-x,bx} +% \begin{syntax} +% bound-x = \marg{float} \mydefault{bx} +% \end{syntax} +% Specifies the factor the bounding box in $x$-direction is bigger than the +% |width|. An empty \meta{float} is considered the same as $1$. +% \end{function} +% +% \begin{function}{bound-y,by} +% \begin{syntax} +% bound-y = \marg{float} \mysdefault{\normalfont\emph{empty}} +% \end{syntax} +% Specifies the factor the bounding box in $y$-direction is bigger than the +% |height|. An empty \meta{float} is considered the same as $1$. +% \end{function} +% +% \begin{function}{baseline,bs} +% \begin{syntax} +% baseline = \marg{float} \mysdefault{\normalfont\emph{empty}} +% \end{syntax} +% Sets the baseline of the symbols in multiples of the negative height. $1$ +% (or empty) results in the symbol starting on the surrounding baseline, +% bigger values shift the symbols upwards, smaller values downwards. +% \end{function} +% +% \begin{function}{stroke-v,sv} +% \begin{syntax} +% stroke-v = \marg{dimension expression} \mydefault{tv} +% \end{syntax} +% Sets the stroke thickness of vertical strokes. +% \end{function} +% +% \begin{function}{stroke-h,sh} +% \begin{syntax} +% stroke-h = \marg{dimension expression} \mydefault{th} +% \end{syntax} +% Sets the stroke thickness of horizontal strokes. +% \end{function} +% +% \begin{function}{stroke-du,sdu} +% \begin{syntax} +% stroke-du = \marg{dimension expression} \mydefault{tdu} +% \end{syntax} +% Sets the stroke thickness of diagonal strokes going from lower left to upper +% right. +% \end{function} +% +% \begin{function}{stroke-dd,sdd} +% \begin{syntax} +% stroke-dd = \marg{dimension expression} \mydefault{tdd} +% \end{syntax} +% Sets the stroke thickness of diagonal strokes going from upper left to lower +% right. +% \end{function} +% +% \begin{function}{strokes,s} +% \begin{syntax} +% stroke = \marg{dimension expression} +% \end{syntax} +% Sets all stroke thicknesses at once. +% \end{function} +% +% \begin{function}{fraction,fr} +% \begin{syntax} +% fraction = \marg{float} \mysdefault{/6} +% fraction = \marg{float}/\marg{integer} +% \end{syntax} +% The Cistercian digits are drawn only in a fraction of the total bounding box +% of each symbol. The ones are drawn (with vertical Cistercians) in the upper +% right rectangle. The width of that rectangle is determined by |width|, and +% the upper border by |height|, and with this option you can set the lower +% border as a fraction of the |height|. You can either just give a factor as a +% \meta{float}, or just pass in a divisor as an \meta{integer}, or both. An +% empty \meta{float} equals $1$. +% \end{function} +% Consider the following example (result on the right):\\[\bigskipamount] +% \begin{minipage}[c]{.8\linewidth} +% \begin{verbatim} +% {\cisterciansetup{fr=2/9,redraw}\cisterciannum{9}}\par +% {\cisterciansetup{fr=0.6,redraw}\cisterciannum{9}}\par +% \end{verbatim} +% \end{minipage} +% \begin{minipage}[c]{1em} +% {\cisterciansetup{fr=2/9,redraw}\cisterciannum{9}}\par +% {\cisterciansetup{fr=0.6,redraw}\cisterciannum{9}}\par +% \end{minipage} +% +% \begin{function}{orientation,o} +% \begin{syntax} +% orientation = \marg{choice} \mysdefault{vertical} +% \end{syntax} +% Sets the orientation of the Cistercian numerals. Choices are |horizontal| +% (or |h| for short) or |vertical| (or |v| for short). You'll most likely want +% to change the |width| and |height| of the symbols if you decide to change +% this. +% \end{function} +% +% \begin{function}{horizontal} +% \begin{syntax} +% horizontal +% \end{syntax} +% Same as setting |orientation = horizontal, width = 0.62em, height = 1ex|. +% \end{function} +% +% \begin{function}{vertical} +% \begin{syntax} +% vertical +% \end{syntax} +% Same as setting |orientation = vertical, width = 0.4em, height = 1.55ex|. +% \end{function} +% +% \begin{function}{alternate-5,5} +% \begin{syntax} +% alternate-5 = \marg{choice} \mysdefault{triangle} +% \end{syntax} +% There are alternative forms of the digit $5$, while the most often used one +% nowadays seems to be the |triangle| form, this package also supports two +% other variants. Those are called |dot| and |dash|. While if you choose +% |triangle| you can't give an additional value, if your choice is |dot| or +% |dash| you can customise those using a second equals sign and some value. If +% you don't customise them they use their respective initial value (or last +% value if you changed the value at some point in time). +% +% For |dot| you can also specify the radius as a dimension. The default is +% \mbox{\mydefault{five@dot}}. +% +% For |dash| you can specify the length of the dash in multiples of the used +% stroke thickness (which might differ for the horizontal and vertical +% symbols), an empty value is considered the same as $1$. The default is +% \mbox{\mysdefault{\normalfont\emph{empty}}}. +% +% A comparison of the three alternate forms is shown in +% figure~\ref{fig:fives}. +% \end{function} +% The usage might look like any of the following: +% \begin{verbatim} +% \cisterciansetup +% { +% 5=triangle, +% 5=dot, 5=dot=.1ex, 5={dot=.1ex}, +% 5=dash, 5=dash=2, 5={dash=2} +% } +% \end{verbatim} +% +% \begin{figure} +% \centering +% \def\showbb#1{^^A +% \begingroup +% \cisterciansetup{#1}\cistercianredraw +% \fboxrule=.5pt +% \fboxsep=-.5\fboxrule +% \leavevmode +% \rlap{\textcolor{red}{\fbox{\phantom{\cisterciannum{5555}}}}}^^A +% \kern.5\fboxrule\cisterciannum{5555}\kern.5\fboxrule^^A +% \endgroup +% }^^A +% \cisterciansetup{bx=1,by=1,wd=1cm,ht=2cm,sv=3pt,sdd=3pt,sh=2pt,sdu=2pt} +% \cistercianstyle{hexample}{o=h,ht=1cm,wd=2cm} +% \begin{tabular}{*5c} +% \texttt{triangle} & +% \texttt{dot=2pt} & \texttt{dot=4pt} & +% \texttt{dash=1} & \texttt{dash=3} \\ +% \showbb{5=triangle} & +% \showbb{5=dot=2pt} & \showbb{5=dot=4pt} & +% \showbb{5=dash=1} & \showbb{5=dash=3} \\ +% \showbb{5=triangle,hexample} & +% \showbb{5=dot=2pt,hexample} & \showbb{5=dot=4pt,hexample} & +% \showbb{5=dash=1,hexample} & \showbb{5=dash=3,hexample} +% \end{tabular} +% \caption[Alternate forms of the digit $5$] +% {Alternate forms of the digit $5$. The tight bounding +% boxes using \texttt{bx=1,by=1} are drawn red.\label{fig:fives}} +% \end{figure} +% +% \begin{function}{font,f} +% \begin{syntax} +% font = \marg{font setup} \mydefault{font} +% \end{syntax} +% Set the font which \pkg{xistercian} uses locally to evaluate the dimensions +% given to |width|, |height|, and |stroke| (only font switches work here, you +% can't use stuff like |\texttt|, instead use |\ttfamily|). +% \end{function} +% +% \begin{function}{redraw,r} +% \begin{syntax} +% redraw = \marg{feature-list} \mysdefault{size} +% redraw += \marg{feature-list} +% redraw +% redraw! +% \end{syntax} +% Selects which font features to consider when deciding to redraw the glyphs. +% If one of the features has changed (or the features to consider) the glyphs +% will be redrawn. This is especially handy if you change the |font| used +% while evaluating the given dimensions. The available features in the comma +% separated \meta{feature-list} are |encoding|, |family|, |series|, |shape|, +% |size|, and |color|. +% +% If you see that a Cistercian numeral doesn't have the correct colour of the +% surrounding text you need to add |color| to the font features +% (\pkg{xistercian} uses some hack to get the boxed glyphs to respect the +% surrounding colour, but that hack might fail in certain circumstances). +% +% If you use the |+=|~variant of this option the \meta{feature-list} is added +% to the existing features, else they overwrite any existing configuration. +% +% Without a value the key will issue |\cistercianredrawlazy|, and if you use +% the |!|~variant it'll use |\cistercianredraw|. This usage is only available +% after the package was loaded. +% \end{function} +% +% \begin{function}{debug} +% \begin{syntax} +% debug +% \end{syntax} +% Only usable as a package option. If this is used a bit of debugging +% information is printed in the log file and terminal, and some keys try to +% evaluate the given argument on the spot instead of lazily. This might help +% to locate faulty input. +% \end{function} +% +% +% \subsection{Bold Cistercian Numerals} +% +% While the package doesn't directly support bold glyphs, it is possible to +% utilize the hooks provided by the NFSS to pick different stroke widths +% whenever the font is changed to |bfseries| and back to |mdseries|: +% +% \begin{verbatim} +% \AddToHook{bfseries} +% {% +% \cisterciansetup{sv=.27ex,sdd=.27ex,sh=.15ex,sdu=.15ex,wd=.5em}% +% \cistercianredrawlazy +% } +% \AddToHook{mdseries} +% {% +% \cisterciansetup{sv=.18ex,sdd=.18ex,sh=.1ex,sdu=.1ex,wd=.4em}% +% \cistercianredrawlazy +% } +% This results in \cisterciannum{2} different \enquote{series}.\par +% \bfseries +% This results in \cisterciannum{2} different \enquote{series}. +% \end{verbatim} +% +% \begingroup +% This results in \cisterciannum{2} different \enquote{series}.\par +% \bfseries +% This results in \cisterciannum{2} different \enquote{series}. +% \endgroup +% +% Of course, instead of doing |\cistercianredrawlazy| in the above code, we +% could as well do the following equivalent thing and let \pkg{xistercian} +% determine when to redraw: +% \begin{verbatim} +% \AddToHook{bfseries} +% {\cisterciansetup{sv=.27ex,sdd=.27ex,sh=.15ex,sdu=.15ex,wd=.5em}} +% \AddToHook{mdseries} +% {\cisterciansetup{sv=.18ex,sdd=.18ex,sh=.1ex,sdu=.1ex,wd=.4em}} +% \cisterciansetup{redraw+=series} +% \end{verbatim} +% +% +% \clearpage +% \section{Implementation} +% +% First we load the required packages +% \gobbledocstriptag +%<*pkg> +% \begin{macrocode} +\RequirePackage{pgf,expkv-opt} +% \end{macrocode} +% +% +% \subsection{Variables} +% +% There are variables stored as macros to be evaluated later, as well as +% register types for faster access during the glyph drawing. +% \begin{macrocode} +\newcommand*\xister@th{.1ex} +\newcommand*\xister@tv{.18ex} +\newcommand*\xister@tdu{.1ex} +\newcommand*\xister@tdd{.18ex} +\newcommand*\xister@x{.4em} +\newcommand*\xister@y{1.55ex} +\newcommand*\xister@bx{1.2} +\newcommand*\xister@by{} +\newcommand*\xister@bs{} +\newcommand*\xister@font{\normalfont} +\newcommand*\xister@five@dot{.09ex} +\newcommand*\xister@five@dash{} +\newcommand*\xister@share@div{/6} +\newcommand*\xister@share@mul{} +\newif\ifxister@dbg@ +\newif\ifxister@five@triangle@\xister@five@triangle@true +\newif\ifxister@five@dot@ +\newdimen\xister@X +\newdimen\xister@Y +\newdimen\xister@XY@share +\newdimen\xister@Th +\newdimen\xister@Tv +\newdimen\xister@Tdu +\newdimen\xister@Tdd +\newdimen\xister@TMPA +\newdimen\xister@TMPB +% \end{macrocode} +% +% We also need a bunch of box registers ($37$ of them to be precise). For the +% loop we borrow an \pkg{expl3} function. +% \begin{macrocode} +\ExplSyntaxOn +\int_step_inline:nn {9} + { + \expandafter\newsavebox\csname xister@digitbox@#1\endcsname + \expandafter\newsavebox\csname xister@digitbox@#10\endcsname + \expandafter\newsavebox\csname xister@digitbox@#100\endcsname + \expandafter\newsavebox\csname xister@digitbox@#1000\endcsname + } +\ExplSyntaxOff +\expandafter\newsavebox\csname xister@digitbox@0\endcsname +% \end{macrocode} +% +% \begin{macro}[internal]{\xister@dbg@dim,\xister@dbg@float} +% These are initially just |\@gobble|, but the |debug| option might change +% things. +% \begin{macrocode} +\let\xister@dbg@dim\@gobble +\let\xister@dbg@div\@gobble +\let\xister@dbg@float\@gobble +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Options} +% +% Some macros are required to parse options. +% +% \begin{macro}[internal]{\xister@if@slash} +% We need to test whether a slash is inside an argument to parse some user +% option. Since this isn't needed inside an inner loop we don't create an +% optimised version and only borrow a generic \pkg{expl3} function. +% \begin{macrocode} +\ExplSyntaxOn +\cs_new_protected:Npn \xister@if@slash #1 { \tl_if_in:nnTF {#1} { / } } +\ExplSyntaxOff +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\xister@fraction} +% \begin{macrocode} +\protected\long\def\xister@fraction#1/#2\xister@stop + {% + \edef\xister@share@mul{\unexpanded{#1}}% + \xister@dbg@float{#1}% + \edef\xister@share@div{/\unexpanded{#2}}% + \xister@dbg@div{#2}% + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal] +% { +% \xister@build, +% \xister@build@h,\xister@build@horizontal, +% \xister@build@v,\xister@build@vertical +% } +% First we set the length registers to the correct size, than we draw the +% glyphs batch wise. We have to flip the $x$-direction for the tenths and +% thousands, and the $y$-direction for the hundreds and thousands. The macro +% |\xister@sgn| is used to set the baseline in the correct direction. We +% locally disable |\pgfsetcolor| to allow building colour-unsafe boxes. This +% only works as long as \pkg{luacolor} (or something equivalent) isn't used, +% so consider this a crude hack. +% \begin{macrocode} +\protected\def\xister@build@vertical + {% + \let\xister@pgfsetcolor\pgfsetcolor + \let\pgfsetcolor\@gobble + \xister@setlengths + \def\xister@sgn{-}% + \xister@drawzero@vertical + \xister@drawdigits@vertical{}{}{}% + \xister@X=-\xister@X + \xister@Y=-\xister@Y + \def\xister@sgn{+}% + \xister@drawdigits@vertical{000}{-}{-}% + \xister@TMPA=\xister@Tdd + \xister@Tdd=\xister@Tdu + \xister@Tdu=\xister@TMPA + \xister@X=-\xister@X + \xister@drawdigits@vertical{00}{-}{}% + \xister@X=-\xister@X + \xister@Y=-\xister@Y + \def\xister@sgn{-}% + \xister@drawdigits@vertical{0}{}{-}% + \let\pgfsetcolor\xister@pgfsetcolor + } +\protected\def\xister@build@horizontal + {% + \let\xister@pgfsetcolor\pgfsetcolor + \let\pgfsetcolor\@gobble + \xister@setlengths + \def\xister@sgn{-}% + \xister@drawzero@horizontal + \xister@drawdigits@horizontal{}{}{}% + \xister@X=-\xister@X + \xister@Y=-\xister@Y + \def\xister@sgn{+}% + \xister@drawdigits@horizontal{000}{-}{-}% + \xister@TMPA=\xister@Tdd + \xister@Tdd=\xister@Tdu + \xister@Tdu=\xister@TMPA + \xister@X=-\xister@X + \xister@drawdigits@horizontal{0}{-}{}% + \xister@X=-\xister@X + \xister@Y=-\xister@Y + \def\xister@sgn{-}% + \xister@drawdigits@horizontal{00}{}{-}% + \let\pgfsetcolor\xister@pgfsetcolor + } +\let\xister@build\xister@build@vertical +\let\xister@build@v\xister@build@vertical +\let\xister@build@h\xister@build@horizontal +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\xister@fontfeatures,\xister@add@fontfeature} +% This macro should store the different font features which should be kept +% track of. It will be redefined programmatically but the default is quite +% easy, just track the font size. +% \begin{macrocode} +\protected\long\def\xister@add@fontfeature#1% + {% + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx + \csname xister@add@fontfeature@\detokenize{#1}\endcsname + \relax + \PackageError{xistercian}{Unsupported font feature `\detokenize{#1}'.}{}% + \else + \csname xister@add@fontfeature@\detokenize{#1}\endcsname + \fi + } +\def\xister@fontfeatures{\unexpanded\expandafter{\f@size}/} +% \end{macrocode} +% We know that the colour hack breaks if \pkg{luacolor} is loaded, so if that +% is found to be the case we add the |color| feature to the list of things we +% need to track. But we only want to add it if it's not yet in the list, so we +% run a check we borrow from \pkg{expl3}. +% \begin{macrocode} +\ExplSyntaxOn +\AddToHook{begindocument/before} + { + \@ifpackageloaded { luacolor } + { + \exp_args:No \str_if_in:nnF \xister@fontfeatures { color } + { \xister@add@fontfeature{color} } + } + {} + } +\ExplSyntaxOff +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal] +% { +% \xister@add@fontfeature@encoding, +% \xister@add@fontfeature@family, +% \xister@add@fontfeature@series, +% \xister@add@fontfeature@shape, +% \xister@add@fontfeature@size, +% } +% These macros all just add a specific macro to the list of things contained +% in |\xister@fontfeatures|, which determines what to consider deciding to +% redraw. +% \begin{macrocode} +\def\xister@tmp#1#2% + {% + \protected\expandafter\def\csname xister@add@fontfeature@#2\endcsname + {% + \edef\xister@fontfeatures + {% + \unexpanded\expandafter + {\xister@fontfeatures\unexpanded\expandafter{#1}}/% + }% + }% + } +\expandafter\xister@tmp\csname\string\color@.\endcsname{color} +\xister@tmp\f@encoding{encoding} +\xister@tmp\f@family {family} +\xister@tmp\f@series {series} +\xister@tmp\f@shape {shape} +\xister@tmp\f@size {size} +% \end{macrocode} +% \end{macro} +% +% Now we define the keys +% \begin{macrocode} +\ekvifdefinedset{xister} + {\PackageError{xistercian}{keyval conflict detected. Aborting}{}\endinput}{} +\def\xister@tmp#1#2#3% + {% + \protected\long\ekvdef{xister}{#1}{#3}% + \ekvletkv{xister}{#2}{xister}{#1}% + } +\xister@tmp{wd}{width}{\edef\xister@x{\unexpanded{#1}}\xister@dbg@dim{#1}} +\xister@tmp{ht}{height}{\edef\xister@y{\unexpanded{#1}}\xister@dbg@dim{#1}} +\xister@tmp{sv}{stroke-v}{\edef\xister@tv{\unexpanded{#1}}\xister@dbg@dim{#1}} +\xister@tmp{sh}{stroke-h}{\edef\xister@th{\unexpanded{#1}}\xister@dbg@dim{#1}} +\xister@tmp{sdu}{stroke-du} + {\edef\xister@tdu{\unexpanded{#1}}\xister@dbg@dim{#1}} +\xister@tmp{sdd}{stroke-dd} + {\edef\xister@tdd{\unexpanded{#1}}\xister@dbg@dim{#1}} +\xister@tmp{bx}{bound-x}{\edef\xister@bx{\unexpanded{#1}}\xister@dbg@float{#1}} +\xister@tmp{by}{bound-y}{\edef\xister@by{\unexpanded{#1}}\xister@dbg@float{#1}} +\xister@tmp{bs}{baseline}{\edef\xister@bs{\unexpanded{#1}}\xister@dbg@float{#1}} +\xister@tmp{s}{strokes} + {% + \edef\xister@tv{\unexpanded{#1}}% + \let\xister@th\xister@tv + \let\xister@tdu\xister@tv + \let\xister@tdd\xister@tv + \xister@dbg@dim{#1}% + } +\xister@tmp{f}{font}{\edef\xister@font{\unexpanded{#1}}} +\xister@tmp{o}{orientation} + {% + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname xister@build@#1\endcsname\relax + \PackageError{xister}% + {Unaccepted orientation. Choices are horizontal/h or vertical/v}{}% + \else + \expandafter\let\expandafter\xister@build\csname xister@build@#1\endcsname + \fi + } +\xister@tmp{fr}{fraction} + {% + \xister@if@slash{#1}% + {\xister@fraction#1\xister@stop}% + {% + \let\xister@share@div\@empty + \edef\xister@share@mul{\unexpanded{#1}}% + \xister@dbg@float{#1}% + }% + } +\xister@tmp{r}{redraw} + {\let\xister@fontfeatures\@empty\ekvcsvloop\xister@add@fontfeature{#1}} +\xister@tmp{r+}{redraw+}{\ekvcsvloop\xister@add@fontfeature{#1}} +\ekvletkv{xister}{r +}{xister}{r+} +\ekvletkv{xister}{redraw +}{xister}{redraw+} +\protected\long\ekvdef{xister/5}{dot} + {% + \xister@five@triangle@false + \xister@five@dot@true + \edef\xister@five@dot{\unexpanded{#1}}% + \xister@dbg@dim{#1}% + } +\protected\long\ekvdef{xister/5}{dash} + {% + \xister@five@triangle@false + \xister@five@dot@false + \edef\xister@five@dash{\unexpanded{#1}}% + \xister@dbg@float{#1}% + } +\protected\ekvdefNoVal{xister/5}{triangle}{\xister@five@triangle@true} +\protected\ekvdefNoVal{xister/5}{dot} + {% + \xister@five@triangle@false + \xister@five@dot@true + } +\protected\ekvdefNoVal{xister/5}{dash} + {% + \xister@five@triangle@false + \xister@five@dot@false + } +\protected\ekvsetdef\xister@five@set{xister/5} +\ekvlet{xister}{5}\xister@five@set +\ekvlet{xister}{alternate-5}\xister@five@set +\let\xister@five@set\xister@undefined +\protected\ekvdefNoVal{xister}{horizontal} + {% + \let\xister@build\xister@build@horizontal + \def\xister@x{.62em}% + \def\xister@y{1ex}% + } +\protected\ekvdefNoVal{xister}{vertical} + {% + \let\xister@build\xister@build@vertical + \def\xister@x{.4em}% + \def\xister@y{1.55ex}% + } +% \end{macrocode} +% The |debug| option redefines the debug macros to the correct definition. +% \begin{macrocode} +\protected\ekvdefNoVal{xister}{debug} + {% + \xister@dbg@true + \protected\long\def\xister@dbg@dim##1% + {% + \typeout + {% + Package xistercian Debug: Trying to use dimension + `\unexpanded{##1}'.% + }% + \xister@TMPA=\dimexpr##1\relax + \typeout{Package xistercian Debug: Done.}% + }% + \protected\long\def\xister@dbg@float##1% + {% + \typeout + {Package xistercian Debug: Trying to use float `\unexpanded{##1}'.}% + \xister@TMPA=##1\z@ + \typeout{Package xistercian Debug: Done.}% + }% + \protected\long\def\xister@dbg@div##1% + {% + \typeout + {Package xistercian Debug: Trying to use divisor `\unexpanded{##1}'.}% + \xister@TMPA=\dimexpr\z@/##1\relax + \typeout{Package xistercian Debug: Done.}% + }% + } +% \end{macrocode} +% and parse the package options (and since the used names |width|, |height|, and +% |debug| are quite frequent we don't look at the global options). +% \begin{macrocode} +\ekvoProcessLocalOptions{xister} +% \end{macrocode} +% +% After the package was loaded we add the two |redraw| variants without a value. +% \begin{macrocode} +\protected\ekvdefNoVal{xister}{r!}{\cistercianredraw} +\protected\ekvdefNoVal{xister}{r} {\cistercianredrawlazy} +\ekvletkvNoVal{xister}{redraw} {xister}{r} +\ekvletkvNoVal{xister}{redraw!}{xister}{r!} +% \end{macrocode} +% +% The |debug| option is only available as a package option, we let it throw an +% error: +% \begin{macrocode} +\ekvdefNoVal{xister}{debug} + {\PackageError{xister}{`debug' is only available as a load time option}{}} +% \end{macrocode} +% +% +% \subsection{User macros} +% +% \begin{macro}{\cisterciansetup} +% Just as a simple way to pick options later on. +% \begin{macrocode} +\protected\ekvsetdef\cisterciansetup{xister} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\cistercianstyle} +% We allow users to define a style they can call with a single key name inside +% |\cisterciansetup|. To achieve that we just define a |NoVal| key that'll +% call a nested |\cisterciansetup|. +% \begin{macrocode} +\protected\long\def\cistercianstyle#1#2% + {% + \ekvifdefinedNoVal{xister}{#1}% + {\PackageError{xistercian}{Key `#1' already defined}{}}% + {\protected\ekvdefNoVal{xister}{#1}{\cisterciansetup{#2}}}% + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\cistercian} +% \begin{macro}[internal]{\@cistercian} +% The macro is equivalent to other \LaTeX\ counter formatting macros, so we +% let it build the counter name and forward that to the canonically named +% auxiliary macro |\@cistercian|. +% \begin{macrocode} +\newcommand\cistercian[1]{\expandafter\@cistercian\csname c@#1\endcsname} +% \end{macrocode} +% The internal just gets the current value of a counter and forwards it. +% \begin{macrocode} +\newcommand\@cistercian[1]{\expandafter\cisterciannum\expandafter{\the#1}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\cisterciannum} +% \begin{macro}[internal]{\cisterciannum@pdf} +% \begin{macrocode} +\edef\cisterciannum + {% + \unexpanded{\xister@texorpdf}% + \unexpanded\expandafter + {\csname cisterciannum \endcsname\cisterciannum@pdf}% + } +\protected\expandafter\def\csname cisterciannum \endcsname#1{\xister@a#1@} +\def\cisterciannum@pdf#1{CISTER#1} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\cisterciannumE} +% \begin{macrocode} +\newcommand\cisterciannumE[1] + {\expandafter\cisterciannum\expandafter{\the\numexpr#1\relax}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\cistercianredraw,\cistercianredrawlazy} +% \begin{macrocode} +\protected\def\cistercianredraw + {% + \def\xister@last@font{\xister@last@font}% + \xister@ensure@current + } +\protected\def\cistercianredrawlazy{\def\xister@last@font{\xister@last@font}} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Parsing} +% +% \subsubsection{Small Auxiliaries} +% +% \begin{macro}[internal] +% {\xister@gobbletoat,\xister@gobbletozero,\xister@gobblecopy,\xister@done} +% These are just small functions gobbling some tokens. +% \begin{macrocode} +\def\xister@gobbletoat#1@{} +\def\xister@gobbletozero#10{} +\def\xister@gobblecopy0\rlap#1{} +\def\xister@done#1\xister@symbols@{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\xister@count,\xister@count@done} +% A simple loop to count tokens. The loop delimiter is a single |@|. Should be +% used after |\numexpr|. +% \begin{macrocode} +\def\xister@count#1{\xister@gobbletoat#1\xister@count@done @+1\xister@count} +\def\xister@count@done @+1\xister@count{\relax @} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\xister@texorpdf} +% \begin{macrocode} +\let\xister@texorpdf\@firstoftwo +\AddToHook{package/after/hyperref} + {% + \ifdefined\texorpdfstring + \let\xister@texorpdf\texorpdfstring + \fi + } +\AddToHook{begindocument/before} + {% + \ifdefined\texorpdfstring + \let\xister@texorpdf\texorpdfstring + \fi + } +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection{Input Parsing} +% +% \begin{macro}[internal]{\xister@a,\xister@b,\xister@c} +% First we have to make sure that we're in horizontal mode, else the |\rlap|s +% used to insert the glyphs will create havoc. We also need to ensure that the +% boxes contain the correct glyphs according to the current size and colour. +% After that we check whether we have to step over a minus sign and go to the +% next step. +% \begin{macrocode} +\def\xister@a#1% + {% + \leavevmode + \xister@ensure@current + \ifx-#1-\expandafter\xister@b + \else\expandafter\xister@b\expandafter#1\fi + } +% \end{macrocode} +% Next we count the number of decimal digits in the number we want to print, +% take that modulo $4$ (that's what's |4*((#1-2)/4)| is doing, thanks to Heiko +% Oberdiek and the code in \pkg{expl3}), and use the correct symbol creating +% macro. The |@@@@| serves as the end marker since each step (except the +% first) will grab four digits. +% \begin{macrocode} +\def\xister@b#1@% + {\expandafter\xister@c\the\numexpr\xister@count#1@#1@@@@} +\def\xister@c#1@% + {\csname xister@symbols@\romannumeral\numexpr#1-4*((#1-2)/4)\relax\endcsname} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal] +% {\xister@symbols@,\xister@symbols@i,\xister@symbols@ii,\xister@symbols@iii} +% When this loop is done all arguments will be |@|, but we only check the +% first here. We generate the symbols by overlaying up to five boxes, one for +% each decade plus the zero stem. Each digit might be skipped if it is $0$. +% Next grab the next four digits. +% \begin{macrocode} +\def\xister@symbols@#1% + {% + \protected\def\xister@symbols@##1##2##3##4% + {% + \xister@gobbletoat##1\xister@done @% + \xister@gobbletozero##1\xister@gobblecopy0% + \rlap{\copy\csname xister@digitbox@##1000\endcsname}% + \xister@gobbletozero##2\xister@gobblecopy0% + \rlap{\copy\csname xister@digitbox@##200\endcsname}% + \xister@gobbletozero##3\xister@gobblecopy0% + \rlap{\copy\csname xister@digitbox@##30\endcsname}% + \xister@gobbletozero##4\xister@gobblecopy0% + \rlap{\copy\csname xister@digitbox@##4\endcsname}% + \copy#1% + \xister@symbols@ + }% + } +\expandafter\xister@symbols@\csname xister@digitbox@0\endcsname +% \end{macrocode} +% If there are less than four decimal digits inside the first Cistercian +% numeral we provide enough zeros to fill up the remainder. +% \begin{macrocode} +\def\xister@symbols@i{\xister@symbols@000} +\def\xister@symbols@ii{\xister@symbols@00} +\def\xister@symbols@iii{\xister@symbols@0} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Drawing the Digits} +% +% \begin{macro}[internal]{\xister@clip@v,\xister@clip@h} +% Some of the digit glyphs need a bit of clipping to look nice. Let's define a +% small auxiliary to select a clipping region. +% \begin{macrocode} +\newcommand*\xister@clip@v[1] + {% + \pgfpathrectanglecorners + {\pgfpoint{\dimexpr\ifdim\xister@X<\z@-\fi\xister@Tv\relax}{#1}}% + {\pgfpoint\xister@X\xister@Y}% + \pgfusepath{clip}% + } +\newcommand*\xister@clip@h[1] + {% + \pgfpathrectanglecorners + {\pgfpoint{#1}{-\dimexpr\ifdim\xister@Y<\z@-\fi\xister@Th\relax}}% + {\pgfpoint{-\xister@X}\xister@Y}% + \pgfusepath{clip}% + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal] +% {\xister@drawdigits@vertical,\xister@drawdigits@horizontal} +% The digit glyphs. Since each numeral is build from the zero stem and some +% appendix to it this only specifies the form of the appendices. The zero stem +% is defined a bit down the road. |#1| will determine the decade, and |#2| +% will be either~|-| or empty. +% \begin{macrocode} +\newcommand\xister@drawdigits@vertical[3] + {% + \xister@XY@share=\dimexpr\xister@share@mul\xister@Y\xister@share@div\relax + \xister@drawdigit{1#1}% + {% + \pgfsetlinewidth{2\xister@Th}% + \xister@TMPA=\dimexpr\xister@Y\xister@sgn\xister@Th\relax + \pgfpathmoveto{\pgfpoint\z@\xister@TMPA}% + \pgfpathlineto{\pgfpoint\xister@X\xister@TMPA}% + }% + \xister@drawdigit{2#1}% + {% + \pgfsetlinewidth{2\xister@Th}% + \xister@TMPA=\dimexpr\xister@XY@share+#2\xister@Th\relax + \pgfpathmoveto{\pgfpoint\z@\xister@TMPA}% + \pgfpathlineto{\pgfpoint\xister@X\xister@TMPA}% + }% + \xister@drawdigit{3#1}% + {% + \xister@TMPB=#3\dimexpr\xister@Tv-\xister@Tdd\relax + \xister@clip@v\xister@XY@share + \pgfsetlinewidth{2\xister@Tdd}% + \pgfpathmoveto{\pgfpoint\xister@TMPB\xister@XY@share}% + \pgfpathlineto{\pgfpoint\xister@TMPB\xister@Y}% + \pgfpathlineto{\pgfpoint\xister@X\xister@XY@share}% + }% + \xister@drawdigit{4#1}% + {% + \xister@clip@v\z@ + \xister@TMPB=#3\dimexpr\xister@Tv-\xister@Tdu\relax + \pgfsetlinewidth{2\xister@Tdu}% + \pgfpathmoveto{\pgfpoint\xister@TMPB\xister@Y}% + \pgfpathlineto{\pgfpoint\xister@TMPB\xister@XY@share}% + \pgfpathlineto{\pgfpoint\xister@X\xister@Y}% + }% + \xister@drawdigit{5#1}% + {% + \ifxister@five@triangle@ + \xister@clip@v\z@ + \xister@TMPB=% + #3\dimexpr\xister@Tv-\xister@Tdu\relax + \pgfsetlinewidth{2\xister@Tdu}% + \pgfpathmoveto{\pgfpoint\xister@TMPB\xister@Y}% + \pgfpathlineto{\pgfpoint\xister@TMPB\xister@XY@share}% + \pgfpathlineto{\pgfpoint\xister@X\xister@Y}% + \pgfusepath{stroke,clip}% + \pgfsetlinewidth{2\xister@Th}% + \xister@TMPA=\dimexpr\xister@Y\xister@sgn\xister@Th\relax + \pgfpathmoveto{\pgfpoint\z@\xister@TMPA}% + \pgfpathlineto{\pgfpoint\xister@X\xister@TMPA}% + \else\ifxister@five@dot@ + \pgfpathcircle + {\pgfpoint{\dimexpr\xister@X-#3\xister@five@dot\relax}% + {\dimexpr\xister@Y-#2\xister@five@dot\relax}}% + {\xister@five@dot}% + \pgfusepath{fill}% + \else + \xister@TMPB=\dimexpr\xister@X-#3\xister@Tv\relax + \pgfsetlinewidth{2\xister@Tv}% + \pgfpathmoveto{\pgfpoint\xister@TMPB\xister@Y}% + \pgfpathlineto + {% + \pgfpoint + \xister@TMPB + {\dimexpr\xister@Y-#2\xister@five@dash\xister@Tv*2\relax}% + }% + \fi\fi + }% + \xister@drawdigit{6#1}% + {% + \pgfsetlinewidth{2\xister@Tv}% + \xister@TMPB=\dimexpr\xister@X-#3\xister@Tv\relax + \pgfpathmoveto{\pgfpoint\xister@TMPB\xister@Y}% + \pgfpathlineto{\pgfpoint\xister@TMPB\xister@XY@share}% + }% + \xister@superimpose{7#1}% + {% + \rlap{\copy\csname xister@digitbox@1#1\endcsname}% + \copy\csname xister@digitbox@6#1\endcsname + }% + \xister@superimpose{8#1}% + {% + \rlap{\copy\csname xister@digitbox@2#1\endcsname}% + \copy\csname xister@digitbox@6#1\endcsname + }% + \xister@superimpose{9#1}% + {% + \rlap{\copy\csname xister@digitbox@1#1\endcsname}% + \rlap{\copy\csname xister@digitbox@2#1\endcsname}% + \copy\csname xister@digitbox@6#1\endcsname + }% + } +\newcommand\xister@drawdigits@horizontal[3] + {% + \xister@XY@share=-\dimexpr\xister@share@mul\xister@X\xister@share@div\relax + \xister@drawdigit{1#1}% + {% + \pgfsetlinewidth{2\xister@Tv}% + \xister@TMPA=-\dimexpr\xister@X-#3\xister@Tv\relax + \pgfpathmoveto{\pgfpoint\xister@TMPA\z@}% + \pgfpathlineto{\pgfpoint\xister@TMPA\xister@Y}% + }% + \xister@drawdigit{2#1}% + {% + \pgfsetlinewidth{2\xister@Tv}% + \xister@TMPA=-\dimexpr#3\xister@Tv-\xister@XY@share\relax + \pgfpathmoveto{\pgfpoint\xister@TMPA\z@}% + \pgfpathlineto{\pgfpoint\xister@TMPA\xister@Y}% + }% + \xister@drawdigit{3#1}% + {% + \xister@TMPB=#2\dimexpr\xister@Th-\xister@Tdu\relax + \xister@clip@h\xister@XY@share + \pgfsetlinewidth{2\xister@Tdu}% + \pgfpathmoveto{\pgfpoint\xister@XY@share\xister@TMPB}% + \pgfpathlineto{\pgfpoint{-\xister@X}\xister@TMPB}% + \pgfpathlineto{\pgfpoint\xister@XY@share\xister@Y}% + }% + \xister@drawdigit{4#1}% + {% + \xister@clip@h\z@ + \xister@TMPB=#2\dimexpr\xister@Th-\xister@Tdd\relax + \pgfsetlinewidth{2\xister@Tdd}% + \pgfpathmoveto{\pgfpoint\xister@X\xister@TMPB}% + \pgfpathlineto{\pgfpoint\xister@XY@share\xister@TMPB}% + \pgfpathlineto{\pgfpoint{-\xister@X}\xister@Y}% + }% + \xister@drawdigit{5#1}% + {% + \ifxister@five@triangle@ + \xister@clip@h\z@ + \xister@TMPB=#2\dimexpr\xister@Th-\xister@Tdd\relax + \pgfsetlinewidth{2\xister@Tdd}% + \pgfpathmoveto{\pgfpoint{-\xister@X}\xister@TMPB}% + \pgfpathlineto{\pgfpoint\xister@XY@share\xister@TMPB}% + \pgfpathlineto{\pgfpoint{-\xister@X}\xister@Y}% + \pgfusepath{stroke,clip}% + \pgfsetlinewidth{2\xister@Tv}% + \xister@TMPA=-\dimexpr\xister@X-#3\xister@Tv\relax + \pgfpathmoveto{\pgfpoint\xister@TMPA\z@}% + \pgfpathlineto{\pgfpoint\xister@TMPA\xister@Y}% + \else\ifxister@five@dot@ + \pgfpathcircle + {\pgfpoint{-\dimexpr\xister@X-#3\xister@five@dot\relax}% + {\dimexpr\xister@Y-#2\xister@five@dot\relax}}% + {\xister@five@dot}% + \pgfusepath{fill}% + \else + \pgfsetlinewidth{2\xister@Th}% + \xister@TMPB=\dimexpr\xister@Y-#2\xister@Th\relax + \pgfpathmoveto{\pgfpoint{-\xister@X}\xister@TMPB}% + \pgfpathlineto + {% + \pgfpoint + {-\dimexpr\xister@X-#3\xister@five@dash\xister@Th*2\relax}% + \xister@TMPB + }% + \fi\fi + }% + \xister@drawdigit{6#1}% + {% + \pgfsetlinewidth{2\xister@Th}% + \xister@TMPB=\dimexpr\xister@Y-#2\xister@Th\relax + \pgfpathmoveto{\pgfpoint{-\xister@X}\xister@TMPB}% + \pgfpathlineto{\pgfpoint\xister@XY@share\xister@TMPB}% + }% + \xister@superimpose{7#1}% + {% + \rlap{\copy\csname xister@digitbox@1#1\endcsname}% + \copy\csname xister@digitbox@6#1\endcsname + }% + \xister@superimpose{8#1}% + {% + \rlap{\copy\csname xister@digitbox@2#1\endcsname}% + \copy\csname xister@digitbox@6#1\endcsname + }% + \xister@superimpose{9#1}% + {% + \rlap{\copy\csname xister@digitbox@1#1\endcsname}% + \rlap{\copy\csname xister@digitbox@2#1\endcsname}% + \copy\csname xister@digitbox@6#1\endcsname + }% + } +% \end{macrocode} +% Each digit has the same bounding box and baseline which is specified here. +% |#1| will be the name, |#2| the digit specific path. +% \begin{macrocode} +\newcommand\xister@drawdigit[2] + {% + \expandafter\setbox\csname xister@digitbox@#1\endcsname=\hbox + {% + \begin{pgfpicture}% + \pgfpathrectanglecorners + {\pgfpoint{-\xister@bx\xister@X}{-\xister@by\xister@Y}}% + {\pgfpoint{\xister@bx\xister@X}{\xister@by\xister@Y}}% + \pgfusepath{use as bounding box}% + #2% + \pgfusepath{stroke}% + \pgfsetbaseline{\xister@sgn\xister@bs\xister@Y}% + \end{pgfpicture}% + }% + } +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}[internal] +% {\xister@drawzero@horizontal,\xister@drawzero@vertical} +% \begin{macrocode} +\newcommand*\xister@drawzero@vertical + {% + \xister@drawdigit{0}% + {% + \pgfsetlinewidth{2\xister@Tv}% + \pgfpathmoveto{\pgfpoint\z@{-\xister@Y}}% + \pgfpathlineto{\pgfpoint\z@\xister@Y}% + }% + } +\newcommand*\xister@drawzero@horizontal + {% + \xister@drawdigit{0}% + {% + \pgfsetlinewidth{2\xister@Th}% + \pgfpathmoveto{\pgfpoint{-\xister@X}\z@}% + \pgfpathlineto{\pgfpoint\xister@X\z@}% + }% + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\xister@superimpose} +% Some digits can be build from a few of the other ones. This is faster than +% drawing everything again, and this macro eases the process a bit. +% \begin{macrocode} +\newcommand\xister@superimpose[2] + {\expandafter\setbox\csname xister@digitbox@#1\endcsname=\hbox{#2}} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Rebuild the Glyphs} +% +% \begin{macro}[internal]{\xister@setlengths} +% Lengths are set depending on the current font size and the sizes of +% |\xister@font|. To keep the font changes local they are kept inside a group +% and a chain of |\expandafter|s is used to evaluate the user specified sizes +% while the |\xister@font| is still active. +% \begin{macrocode} +\protected\def\xister@setlengths + {% + \begingroup + \xister@font + \edef\xister@tmp + {% + \endgroup + \xister@X=\the\dimexpr.5\dimexpr\xister@x\relax\relax + \xister@Y=\the\dimexpr.5\dimexpr\xister@y\relax\relax + \xister@Th=\the\dimexpr.5\dimexpr\xister@th\relax\relax + \xister@Tv=\the\dimexpr.5\dimexpr\xister@tv\relax\relax + \xister@Tdu=\the\dimexpr.5\dimexpr\xister@tdu\relax\relax + \xister@Tdd=\the\dimexpr.5\dimexpr\xister@tdd\relax\relax + }% + \xister@tmp + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\xister@ensure@current} +% The glyphs have to be rebuilt if the font size or colour changed. The latter +% is an annoyance because we can build boxes in a way that they change colour +% to the surrounding colour, but \pkg{PGF} is too intelligent here and does +% issue the corresponding |\special|s to save the current colour for the box. +% Because of that we test which |\f@size| and colour (using |\\color@.|) was +% active when we last built the glyphs. If this matches we do nothing, else we +% rebuild the glyphs. +% +% The |\edef| is just used to remove the |debug| code if it isn't necessary. +% \begin{macrocode} +\protected\edef\xister@ensure@current + {% + \unexpanded{\edef\xister@tmp{\xister@fontfeatures}}% + \unexpanded{\unless\ifx\xister@tmp\xister@last@font}% + \ifxister@dbg@ + \unexpanded + {% + \typeout + {% + Package xistercian Debug: Font changed. Building glyphs for + \xister@tmp. + }% + }% + \fi + \unexpanded + {% + \let\xister@last@font\xister@tmp + \xister@build + }% + \ifxister@dbg@ + \unexpanded{\typeout{Package xistercian Debug: Done.}}% + \fi + \unexpanded{\fi}% + } +\AtBeginDocument{\xister@ensure@current} +% \end{macrocode} +% \end{macro} +% +% \clearpage +% \PrintIndex diff --git a/graphics/pgf/contrib/xistercian/xistercian.pdf b/graphics/pgf/contrib/xistercian/xistercian.pdf Binary files differnew file mode 100644 index 0000000000..a55d95f708 --- /dev/null +++ b/graphics/pgf/contrib/xistercian/xistercian.pdf |