diff options
author | Karl Berry <karl@freefriends.org> | 2020-11-03 22:17:49 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-11-03 22:17:49 +0000 |
commit | f843c3726969f1ad1dfd8851fa7784d1b43cdcda (patch) | |
tree | b37c8a00f19546fa70299ffda2a30f3f48566c3e /Master/texmf-dist/metapost | |
parent | 7ca2811db642b89ee352d71791418c7113877b78 (diff) |
mcf2graph (3nov20)
git-svn-id: svn://tug.org/texlive/trunk@56846 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost')
-rw-r--r-- | Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf | 69 |
1 files changed, 37 insertions, 32 deletions
diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf index e28af21d625..9314283dea8 100644 --- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf +++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% mcf2graph ver 4.52 Copyright (c) 2013-2020 Akira Yamaji +% mcf2graph ver 4.53 Copyright (c) 2013-2020 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,6 +37,9 @@ % Set to use plain.mp (label,arrow,atom) : mpost -s labeloffset=2 FILENAME %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tracingstats:=1; +message "---------------------------------------------"; +message "This is mcf2graph ver 4.53 2020.11"; +message "---------------------------------------------"; %------------------------------------------------------------------------------------------------- newinternal com,par,nA,nB,nC,nD,nE,nF,nP; numeric save_num[],comD[][],parD[][],adrD[][],cntD[],tbl_atom[],tbl_group[][],f_char[], @@ -125,8 +128,6 @@ else: f_MP:=0; fi clearit; %-------------------------------------------------------------------------------------------------- -message "---------------------------------------------"; -message "This is mcf2graph ver 4.52 2020.08"; if f_MP=1: if bboxmargin=0: message "output no image file"; elseif bboxmargin=1: message "output first font only"; @@ -149,8 +150,8 @@ if f_MP=1: message "outputtemplate="&outputtemplate; message "atomfont="&atomfont; message "defaultfont="&defaultfont; + message "---------------------------------------------"; fi -message "---------------------------------------------"; %-------------------------------------------------------------------------------------------------- let DIV= /; let MUL= *; let LT= <; let GT= >; let AND= &; let :: = : ; let == = =; let ef=elseif; %-------------------------------------------------------------------------------------------------- @@ -160,15 +161,14 @@ def ext(text TXT)= sw_ext_all:=1; def EXT_ALL = TXT enddef; enddef; def ext_clear= sw_ext_all:=0; def EXT_ALL = enddef; enddef; %-------------------------------------------------------------------------------------------------- ?3:=?20:=Ph:=Ph1:=Ph2:=hz:=0; vt:=1; -ratio_chain_ring:= 0.66; ratio_atom_bond:=0.36; -ratio_thickness_bond:=0.015; ratio_thickness_char:=0.1; -ratio_char_bond:=1.5; ratio_bondgap_bond:=0.15; ratio_zebragap_bond:=0.12; -ratio_zebra_black:=0.4; ratio_wedge_bond:=0.12; ratio_atomgap_atom:=0.040; +ratio_chain_ring:=0.66; ratio_atom_bond:=0.36; ratio_thickness_bond:=0.015; +ratio_thickness_char:=0.1; ratio_char_bond:=1.5; ratio_bondgap_bond:=0.15; +ratio_zebragap_bond:=0.12; ratio_zebra_black:=0.4; ratio_wedge_bond:=0.12; +ratio_atomgap_atom:=0.040; offset_thickness:=0.2bp; offset_bond_gap:=0.3bp; offset_zebra_gap:=0.1bp; -offset_atom:=0.8pt; offset_wedge:=0.4bp; max_labelsize:=20mm; +offset_atom:=0.8pt; offset_wedge:=0.4bp; thickness_fframe:=0.2bp; thickness_mframe:=0.2bp; thickness_aframe:=0.1bp; -max_blength:=10mm; blength:=0; mangle:=0; -dottedline_gap:=1.5bp; +max_blength:=10mm; blength:=mangle:=0; max_labelsize:=20mm; dottedline_gap:=1.5bp; %-------------------------------------------------------------------------------------------------- fsize:=(30mm,20mm); fmargin:=(0.4mm,0.4mm); msize:=(1,1); mposition:=(0.5,0.5); %================================================================================================== @@ -190,7 +190,7 @@ def_com(-4090)(_com,_jp_atom,_jp_absA,_jp_bond,_cyc,_cyc_sB,_cyc_eB,_set_line,_d _chg_len,_get_len,_ring_len,_tmp_len,_rot_ang,_adj_ang,_chg_env,_tmp_env,_set_colorA,_set_colorB, _group_si,_set_adr,_mk_bond,_set_atom,_arg_ang,_chg_atom,_tmp_rot,_fuse,_size_atom,_numeric, _jump_at,_connect_at,_set_and,_chg_charge,_nop,_mark,_moff,_term,_len_s,_len_e,_len_ss,_len_ee, - _group_s,_group_e,si,dl,dr,db,dm,tm,wf,wb,bd,bz,zf,zb,dt,wv,nl,vf,vb,nb,si_,wf_,wb_,bd_); + _group_s,_group_e,_rest,si,dl,dr,db,dm,tm,wf,wb,bd,bz,zf,zb,dt,wv,nl,vf,vb,nb,si_,wf_,wb_,bd_); %-------------------------------------------------------------------------------------------------- def parameter_list= sw_rep_out,sw_numberA,sw_numberB,sw_mframe,sw_aux_out,sw_expand,sw_mol_out,sw_calc,sw_single, @@ -313,7 +313,7 @@ def endfont= enddef; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def set_def_MC= - save /,//,/*,*/,**,*/*,~,^,`,``,<,>,&,:,=,\,\\,*\,\*,*\*,@,#,@#,$, + save /,//,/*,*/,**,*/*,~,^,',`,``,<,>,&,:,=,\,\\,*\,\*,*\*,@,#,@#,$, {,},|,||,|||,|=,=|,|<,>|,|:,:|,_,d,w,z,inside_def_MC; inside_def_MC:=1; _:=Me; d:=db; w:=wf; z:=zf; @@ -332,13 +332,14 @@ def set_def_MC= def \ == @,0 enddef; def \\ == \~dm enddef; def *\ == \~wf enddef; def \* == \~zf enddef; def *\* == \~wv enddef; def | == (_com,_mark) enddef; def || == (_com,_moff) enddef; def ||| == (_com,_term) enddef; - def |< == (_com,_len_s) enddef; def >| == (_com,_len_e) enddef; + def |< == (_com,_len_s) enddef; def >| == (_com,_len_e) enddef; def |: == (_com,_len_ss) enddef; def :| == (_com,_len_ee) enddef; def |=primary n == |<,(_chg_len,n) enddef; def =| == >| enddef; def /secondary n == if known n:: (_group_si,n) else:: _nop fi enddef; def //secondary n == /n~dm enddef; def */secondary n == /n~wf enddef; def /*secondary n == /n~zf enddef; def */*secondary n == /n~wv enddef; def **secondary n == /n~nb enddef; + vardef '(text TXT)== read_mcf(incr parts_usr)(|,TXT,(_com,_rest)); parts_usr enddef; enddef; %================================================================================================= vardef '(text TXT)= read_mcf(incr parts_usr)(TXT); parts_usr enddef; @@ -743,8 +744,8 @@ enddef; %------------------------------------------------------------------------------------------------- def MC(text TXT)= begingroup - save markA,markB,f_bra,envT,envB,lenT,lineT,strAT,cnt_group,bondL,temp_lenE,temp_lenF, - temp_cntB,f_end,f_term,rotT,f_at,f_lineT,f_rotT,f_lenT,f_envT,angT, + save markA,markB,saveA,saveB,f_bra,envT,envB,lenT,lineT,strAT,cnt_group,bondL,temp_lenE, + temp_lenF,temp_cntB,f_end,f_term,rotT,f_at,f_lineT,f_rotT,f_lenT,f_envT,angT, maxX,maxY,sA,sC,sD,pA,pB,factor,m_wd,m_ht,crR,CP,CPe,CPx,defaultsize,defaultscale; %----------------------------------------------------------------------------------------------- def CP= com_par enddef; @@ -972,12 +973,13 @@ enddef; def proc_bond_atom(expr a)(expr n)= f_bra:=f_end:=f_term:=rotT:=f_lineT:=f_rotT:=f_lenT:=f_envT:=envT:=envB:=strAT:=f_at:=0; bondL:=crR; lenT:=crR; sB[0]:=0; eB[0]:=1; lineT:=si; - andAT:=markA:=markB:=0; + andAT:=markA:=markB:=saveA:=saveB:=0; %----------------------------------------------------------------------------------------------- for i=n upto cntD[a]: com:=comD[a][i]; par:=parD[a][i]; if com=_mk_bond: if (par=0)and(rotT<>0): rotT:=0; fi add_atom; ef com=_set_adr: adrT:=par; - ef com=_com: if par=_mark: markA:=cntA; markB:=cntB; + ef com=_com: if par=_mark: saveA:=markA; saveB:=markB; markA:=cntA; markB:=saveB:=cntB; + ef par=_rest: markA:=saveA; markB:=saveB; ef par=_moff: markA:=markB:=0; ef par=_term: termA; ef par=_len_s: temp_lenE:=bondL; ef par=_len_e: bondL:=temp_lenE; @@ -1097,10 +1099,10 @@ def add_bond(expr ROT)= fi cntB:=cntB+1; posBs:=posBe; enddef; -%================================================================================================== +%================================================================================================= vardef getA(expr n)= if n>=0: markA+n ef n>=-999: cntA+n+1 else: n+4095 fi enddef; vardef getB(expr n)= if n>=0: markB+n ef n>=-999: cntB+n+1 else: n+4095 fi enddef; -%-------------------------------------------------------------------------------------------------- +%------------------------------------------------------------------------------------------------- def termA= if f_term=0: if f_bra=0: @@ -1171,17 +1173,17 @@ def draw_atom(expr NUM)= endfor endgroup enddef; -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% def draw_bond(expr NUM)= begingroup save ww,ap,am,ang,col,len,Ls,Le,nL,nS,nE,pA,zA,zL,wpcs; pair pA,Ls,Le; path zA,zL; def wpcs expr n= withpen pencircle scaled n enddef; - %------------------------------------------------------------------------------------------------ + %----------------------------------------------------------------------------------------------- nL:=lineB[NUM]; ang:=angB[NUM]; nS:=sB[NUM]; nE:=eB[NUM]; col:=colorB[NUM]; zL:=posA[nS]--posA[nE]; ww:=wedge_wd; ap:=ang+90; am:=ang-90; - %------------------------------------------------------------------------------------------------ + %----------------------------------------------------------------------------------------------- if (numS[nS]=0)and(numS[nE]=0)or(sw_numberA=1)or(sw_numberB=1): Ls:=posA[nS]; Le:=posA[nE]; pA:=(.1,.9); ef numS[nS]=0: Le:=zL intersectionpoint frame_str(nE); Ls:=posA[nS]; pA:=(.15,1); @@ -1189,7 +1191,7 @@ def draw_bond(expr NUM)= else: Ls:=zL intersectionpoint frame_str(nS); Le:=zL intersectionpoint frame_str(nE); pA:=(0,1); fi zA:=Ls--Le; len:=length(Le-Ls); - %------------------------------------------------------------------------------------------------ + %----------------------------------------------------------------------------------------------- pickup pencircle scaled bond_pen_wd; if (nL=si)or(sw_single=1): draw zA Cp(col); ef nL=dl: draw zA Cp(col); draw sfB(subpath pA of zA,bondgap,ap) Cp(col); @@ -1259,7 +1261,7 @@ Me:='(); Et:='(!); Pr:='(!,!); Bu:='(!,!,!); for i=4,5,6: for j=2 upto i-2: ?[i][j]:='((_fuse,i),(j,0)); endfor endfor for i=5,6,7,8: for j=11 upto 15: ?[i][j]:='((_fuse,i),(j,0)); endfor endfor %================================================================================================= -H :='("H");C:='("C");N:='("N");O:='("O");S:='("S");P:='("P");F:='("F");I:='("I");K:='("K"); +H :='("H");C:='("C");N:='("N");O:='("O");S:='("S");P:='("P");F:='("F");I:='("I"); K:='("K"); Si:='("{Si}");Al:='("{Al}");Mg:='("{Mg}");Zn:='("{Zn}");As:='("{As}");Co:='("{Co}");Cu:='("{Cu}"); Ag:='("{Ag}");Au:='("{Au}");Sn:='("{Sn}");Cl:='("{Cl}");Br:='("{Br}");Li:='("{Li}");Cr:='("{Cr}"); Na:='("{Na}");Ca:='("{Ca}");Hg:='("{Hg}");Ni:='("{Ni}");Ti:='("{Ti}");U:='("U"); @@ -1269,29 +1271,32 @@ O[1]:= '("{O^+^}"); O[-1]:='("{O^-^}"); N[1]:='("{N^+^}"); N[-1]:='("{N^-^} S[1]:= '("{S^+^}"); S[-1]:='("{S^-^}"); P[1]:='("{P^+^}"); P[-1]:='("{P^-^}"); Li[1]:='("{Li^+^}"); Na[1]:='("{Na^+^}"); Cl[-1]:='("{Cl^-^}"); Br[-1]:='("{Br^-^}"); %------------------------------------------------------------------------------------------------- -R:='("R"); R1:='("{R^1^}"); R2:='("{R^2^}"); R3:='("{R^3^}"); R4:='("R^4^"); R5:='("{R^5^}"); +R:='("R"); R1:='("{R^1^}"); R2:='("{R^2^}"); R3:='("{R^3^}"); R4:='("R^4^"); R5:='("{R^5^}"); R6:='("R6"); R7:='("{R^7^}"); R8:='("{R^8^}"); R9:='("{R^9^}"); R10:='("R^10^"); R11:='("{R^11^}"); %------------------------------------------------------------------------------------------------- CHO:='("CHO"); OH:='("OH"); COOH:='("COOH"); CH2:='("C{H_2_}"); CH3:='("C{H_3_}"); CN:='("CN"); NH2:='("N{H_2_}"); NO2:='("N{O_2_}"); SH:='("SH"); SO3:='("S{O_3_}"); NH:='(N,/H~nl); %------------------------------------------------------------------------------------------------- -NMe:=N!:='(N,/_); iPr:=Me!:='(/_,60); tBu:='(/_,/_^60,60); SO:='(S,//O); SOO :='(S,//O^-35,//O^35); +NMe:=N!:='(N,/_); iPr:=Me!:='(/_,60); tBu:='(/_,/_^60,60); SO:='(S,//O); SOO:='(S,//O^-35,//O^35); OMe:=O!:='(O,!); OEt:=O!2:='(O,!,!); OPr:=O!3:='(O,!,!,!); OiPr:=OMe!:='(O,!,iPr); SMe:=S!:='(S,!); SEt:=S!2:='(S,!,!); SPr:=S!3:='(S,!,!,!); SiPr:=SMe!:='(S,!,iPr); %------------------------------------------------------------------------------------------------- COO:='(//O,!,O); COOMe:=COO!:='(COO,!); COOEt:=COO!2:='(COO,!,!); COOiPr:=COOMe!:='(COO,!,iPr); COOPr:=COO!3:='(COO,!,!,!); COOtBu:='(COO,!,tBu); COMe:=CO!:='(//O,!); COEt:=CO!2:='(//O,!,!); COPr:=CO!3:='(//O,!,!,!); -OCOMe:=OCO!:='(O,!,//O,!); NMeMe:=NMe!:='(N!,!); NMeEt:=NMe!2:='(N!,!,!); NMePr:=NMe!3:='(N!,!,!,!); -NHCOMe:=NHCO!:='(NH,!,//O,!); NHiPr:=NHMe!:='(NH,!,iPr); NHtBu:='(NH,!,tBu); NHMe:=NH!:='(NH,!); -NHEt:=NH!2:='(NH,!,!); NHPr:=NH!3:='(NH,!,!,!); +OCOMe:=OCO!:='(O,!,//O,!); NMeMe:=NMe!:=N!_:='(N!,!); NMeEt:=NMe!2:=N!2_:='(N!,!,!); +NMePr:=NMe!3:='(N!,!,!,!); +NHCOMe:=NHCO!:='(NH,!,//O,!); NHiPr:=NHMe!:='(NH,!,iPr); NHtBu:='(NH,!,tBu); +NHMe:=NH!:='(NH,!); NHEt:=NH!2:='(NH,!,!); NHPr:=NH!3:='(NH,!,!,!); %------------------------------------------------------------------------------------------------- !OH:='(!,OH); !SH:='(!,SH); !NH2:='(!,NH2); !COMe:=!CO!:='(!,//O,!); !COEt:=!CO!2:='(!,CO!2); !COPr:=!CO!3:='(!,CO!3); !OMe:=!O!:='(!,O!); !OEt:=!O!2:='(!,O!2); !OPr:=!O!3:='(!,O!3); !OiPr:=!OMe!:='(!,OMe!); !SMe:=!S!:='(!,S!); !SEt:=!S!2:='(!,S!2); !SPr:=!S!3:='(!,S!3); !SiPr:=!SMe!:='(!,SMe!); -!NHMe:=!NH!:='(!,NH!); !NHEt:=!NH!2:='(!,NH!2); !NHPr:=!NH!3:='(!,NH!3); !NHiPr:=!NHMe!:='(!,NHMe!); -!COOH:='(!,COOH); !COOMe:=!COO!:='(!,COO!); !COOEt:=!COO!2:='(!,COO!2); !COOPr:=!COO!3:='(!,COO!3); +!NHMe:=!NH!:='(!,NH!); !NHEt:=!NH!2:='(!,NH!2); !NHPr:=!NH!3:='(!,NH!3); +!NHiPr:=!NHMe!:='(!,NHMe!); +!COOH:='(!,COOH); !COOMe:=!COO!:='(!,COO!); !COOEt:=!COO!2:='(!,COO!2); +!COOPr:=!COO!3:='(!,COO!3); !COOtBu:='(!,COOtBu); !OCOMe:=!OCO!:='(!,OCO!); !NMeMe:=!NMe!:='(!,NMe!); !NMeEt:=!NMe!2:='(!,NMe!2); !NMePr:=!NMe!3:='(!,NMe!3); !CH3:='(!,CH3); !CN:='(!,CN); !iPr:=!Me!:='(!,iPr); !tBu:='(!,tBu); |