summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/metapost
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-07-23 20:41:09 +0000
committerKarl Berry <karl@freefriends.org>2017-07-23 20:41:09 +0000
commitec67d4a883fa66eed59c390c8d893603f2e5bfaa (patch)
treef82edb844879fb1b32c4c2338d2428ed5cbab24f /Master/texmf-dist/metapost
parent601fb902d34846ca8f52ba74851787c8e90ec58c (diff)
mcf2graph (23jul17)
git-svn-id: svn://tug.org/texlive/trunk@44875 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost')
-rw-r--r--Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf94
1 files changed, 38 insertions, 56 deletions
diff --git a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
index 92631563f66..48c2b301b3a 100644
--- a/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
+++ b/Master/texmf-dist/metapost/mcf2graph/mcf2graph.mf
@@ -1,5 +1,5 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% mcf2graph ver 4.24 Copyright (c) 2013-2017 Akira Yamaji
+% mcf2graph ver 4.25 Copyright (c) 2013-2017 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,
@@ -100,10 +100,6 @@ offset_atom:=0.8pt; offset_wedge:=0.4pt; thickness_font_frame:=0
max_bond_length:=10mm; bond_len:=8mm;
font_wd:=30mm; font_ht:=20mm;
%==================================================================================================
-%%%%defaultfont:="uhvr8r"; % Helvetica
-%%%%defaultfont:="ucrr8r"; % Courier
-%%%%defaultfont:="ucrb8r"; % Courier bold
-%%%%defaultfont:="utmr8r"; % Times
ahangle:=45;
ahlength:=4bp;
defaultsize:=8bp;
@@ -129,7 +125,7 @@ def parameter_list=
sw_atom_frame,sw_font_frame,sw_subst_off,sw_bond_single,sw_clip,sw_arrow,
margin_left_right,margin_top_bottom,ratio_atom_bond,ratio_thickness_bond,ratio_char_bond,
ratio_chain_ring,ratio_bondgap_bond,ratio_zebra_black,ratio_zebragap_bond,
- ratio_wedge_bond,ratio_atomgap_atom,ratio_bond_width,font_wd,font_ht,labeloffset,
+ ratio_wedge_bond,ratio_atomgap_atom,ratio_bond_width,font_wd,font_ht,
bond_len,offset_atom,offset_wedge,max_bond_length,offset_zebra_gap,offset_bond_gap,
thickness_font_frame,offset_thickness,numberA_start,numberA_end,numberB_start,numberB_end,
atomfontsize,defaultsize,defaultscale,labeloffset
@@ -335,52 +331,45 @@ def ext_setup=
labeloffset:=3bp;
em=defaultscale*defaultsize;
if (defaultfont="draw")or(f_MP=0):
+ save label,dotlabel;
def label = label_emu enddef;
def dotlabel = dotlabel_emu enddef;
fi
- if sw_arrow=0:
+ if (sw_arrow=0)or(f_MP=0):
+ save drawarrow,drawdblarrow;
def drawarrow = drawarrow_emu enddef;
def drawdblarrow = drawdblarrow_emu enddef;
fi
enddef;
%--------------------------------------------------------------------------------------------------
-def EXT(text s)=
+def EXT(text TXT)=
begingroup
save w,h,wd,ht,n,p,am,em,aw;
pair p[];
ext_setup;
- w:=font_wd;
- h:=font_ht;
- wd:=w-2margin_left_right;
- ht:=h-2margin_top_bottom;
+ w:=font_wd; h:=font_ht;
+ wd:=w-2margin_left_right; ht:=h-2margin_top_bottom;
p0:=(margin_left_right,margin_top_bottom);
aw:=atom_wd;
n:=cntM;
for i=1 upto n: p[i]:=posM[1][i]; endfor
- s addto mol_stru[0] also currentpicture; clearit; f_ext:=1;
+ TXT addto mol_stru[0] also currentpicture; clearit; f_ext:=1;
endgroup;
enddef;
%--------------------------------------------------------------------------------------------------
-def ext(text s)=
+def ext(text TXT)=
begingroup
- save wd,ht,n,l,p,am,em,aw,A,B,Bs,Be;
- numeric A[]bra,B[]ang;
- pair p[],A[],B[],Bs[],Be[];
+ save wd,ht,n,l,p,am,em,aw,A,B;
+ numeric A[]dir,B[]dir;
+ pair p[],A[],B[],B[]s,B[]e;
ext_setup;
- wd:=mol_wd;
- ht:=mol_ht;
- l:=bond_len;
- aw:=atom_wd;
- p0:=(minX,minY);
- An:=cntA;
- Bn:=cntB;
- for i=1 upto An: A[i]:=posA[i]; A[i]bra:=ang_br[i]; endfor
+ wd:=mol_wd; ht:=mol_ht; l:=bond_len; aw:=atom_wd;
+ p0:=(minX,minY); An:=cntA; Bn:=cntB;
+ for i=1 upto An: A[i]:=posA[i]; A[i]dir:=ang_br[i]; endfor
for i=1 upto Bn:
- Bs[i]:=posA[sB[i]]; Be[i]:=posA[eB[i]];
- B[i]:=0.5[Bs[i],Be[i]];
- B[i]ang:=angB[i];
+ B[i]s:=posA[sB[i]]; B[i]e:=posA[eB[i]]; B[i]:=0.5[B[i]s,B[i]e]; B[i]dir:=angB[i];
endfor
- s addto mol_stru[cntM] also currentpicture; clearit;
+ TXT addto mol_stru[cntM] also currentpicture; clearit;
endgroup;
enddef;
%==================================================================================================
@@ -747,7 +736,7 @@ def add_bond(expr m)=
if f_end=0:
if lenB[cntB+1]=_size_a: posBe:=sfB(posBs,atom_wd,angT);
else:
- nA:=lenB[cntB+1];glu:=0; if nA<0: nA:=-nA; glu_c(adrT); glu_c(cntA+1); fi
+ nA:=lenB[cntB+1]; glu:=0; if nA<0: nA:=-nA; glu_c(adrT); glu_c(cntA+1); fi
posBe:=sfB(posBs,nA*bond_len+glu,angT);
fi
posA[cntA+1]:=posBe; f_term:=0;
@@ -841,7 +830,11 @@ def draw_bond(expr NN,BP,EP,ANG,LN)=
elseif LN=zf:wz_put(Ls,sfB(Le,ww,ap),sfB(Le,ww,am),nB);
elseif LN=zb:wz_put(Le,sfB(Ls,ww,am),sfB(Ls,ww,ap),nB);
elseif LN=dt:for i=0 step .75zebra_gap/length(Le-Ls) until 1: drawdot i[Ls,Le]; endfor
- elseif LN=wv:draw_wv;
+ elseif LN=wv:nB:=3bond_pen_wd; nA:=nB/length(Le-Ls);
+ draw Le for i=1 upto 1/nA:
+ if odd(i): ..controls(((i-.5)*nA)[sfB(Le,nB,ap),sfB(Ls,nB,ap)])
+ else: ..controls(((i-.5)*nA)[sfB(Le,nB,am),sfB(Ls,nB,am)]) fi
+ ..(i*nA)[Le,Ls] endfor ..Ls;
elseif LN=vf:draw pA Cp(nB);draw sfB(Le,bondgap,ANG-150)--Le--sfB(Le,bondgap,ANG+150) Cp(nB);
elseif LN=vb:draw pA Cp(nB);draw sfB(Ls,bondgap,ANG-30)--Ls--sfB(Ls,bondgap,ANG+30) Cp(nB);
elseif LN=si_:erase draw 0.15[Ls,Le]--0.85[Ls,Le] wpcs 0.8bondgap; draw pA Cp(nB);
@@ -862,11 +855,6 @@ def draw_bond(expr NN,BP,EP,ANG,LN)=
fi
endgroup
enddef;
-%-------------------------------------------------------------------------------------------------
-def draw_wv= nB:=3bond_pen_wd; nA:=nB/length(Le-Ls);
- draw Le for i=1 upto 1/nA: if odd(i): ..controls(((i-.5)*nA)[sfB(Le,nB,ap),sfB(Ls,nB,ap)])
- else: ..controls(((i-.5)*nA)[sfB(Le,nB,am),sfB(Ls,nB,am)]) fi ..(i*nA)[Le,Ls] endfor ..Ls;
-enddef;
%------------------------------------------------------------------------------------------------
def wpcs expr n= withpen pencircle scaled n enddef;
def wpss expr n= withpen pensquare scaled n enddef;
@@ -901,8 +889,7 @@ lr:='(60 for i==1 upto 10:: ,-60,60 endfor); rl:='(-60,lr);
def ring expr n= <((-180 DIV n)-90),(_chg_len,0),
for i==2 upto n:: ,(360 DIV n) endfor,(_cyc_sB,1-n) enddef;
for i=3 upto 20: ?[i]:='(|:,ring i,:|); endfor
-Ph:=Ph1:='(?6,(_dl,-2),(_dl,-4),(_dl,-6));
-Ph2:='(?6,(_dl,-1),(_dl,-3),(_dl,-5));
+Ph:=Ph1:='(?6,(_dl,-2),(_dl,-4),(_dl,-6)); Ph2:='(?6,(_dl,-1),(_dl,-3),(_dl,-5));
!:=!1:='((_mk_bond,_arg_ang)); !!:='(!,(_mb,db)); !!!:='(!,(_mb,tm)); !0:='(<180,180);
for i=2 upto 20: ![i]:='(|:,(_get_len,0),! for j==2 upto i::,! endfor,:|); endfor
Me:='(); Et:=!; Pr:=!2; Bu:=!3;
@@ -1114,30 +1101,18 @@ STa("F" ,18.9984, 18.99840316273); STa("{Fe}",55.845, 55.93493633);
STa("{Hg}",200.59, 201.97064340); STa("I" ,126.90447,126.9044719);
STa("K" ,39.0983, 38.9637064864); STa("{Li}",6.941, 7.0160034366);
STa("{Mg}",24.305, 23.985041697); STa("{Mn}",54.938044, 54.93804391);
-STa("N" ,14.0067, 14.00307400443); STa("{Na}",22.98977, 22.9897692820);
-STa("{Ni}",58.693, 57.93534241); STa("O" ,15.9994, 15.99491461957);
-STa("P" ,30.973762, 30.97376199842); STa("S" ,32.065, 31.9720711744);
-STa("{Se}",78.971, 79.9165218); STa("{Si}",28.0855, 27.97692653465);
+STa("N" ,14.0067, 14.00307400443); STa("{Na}",22.98977, 22.9897692820);
+STa("{Ni}",58.693, 57.93534241); STa("O" ,15.9994, 15.99491461957);
+STa("P" ,30.973762, 30.97376199842); STa("S" ,32.065, 31.9720711744);
+STa("{Se}",78.971, 79.9165218); STa("{Si}",28.0855, 27.97692653465);
STa("{Sn}",118.71, 119.90220163); STa("{Ti}",47.867, 47.94794198);
STa("{Zn}",65.409, 63.92914201);
%--------------------------------------------------------------------------------------------------
STb("{H_2_}")("H","H"); STb("OH")("O","H"); STb("O{Na}")("O","{Na}"); STb("CN")("C","N");
STb("SH")("S","H"); STb("CHO")("C","H","O"); STb("N{O_2_}")("N","O","O");
-STb("N{H_2_}")("N","H","H");
-STb("S{O_3_}")("S","O","O","O"); STb("COOH")("C","O","O","H");
+STb("N{H_2_}")("N","H","H"); STb("S{O_3_}")("S","O","O","O"); STb("COOH")("C","O","O","H");
STb("C{H_3_}")("C","H","H","H"); STb("C{F_3_}")("C","F","F","F");
%==================================================================================================
-def proc_get_info=
- for j=1 upto inf_num:
- nA:=0; for i=0 upto length(info[j]): if pic_c(i,info[j])=":": nA:=i; fi exitif nA>0; endfor
- if nA>0:
- s_tag:=substring (0,nA) of info[j];
- s_var:=substring (nA+1,length(info[j])) of info[j];
- if known scantokens("inf_"&s_tag): scantokens("inf_"&s_tag):=s_var; fi
- fi
- endfor
-enddef;
-%==================================================================================================
def proc_calc_out=
begingroup
save warning_cnt,cal_MW,MWp,knownA,cal_FM,bondC,tmp_wtp,bond_cnt,cnt_hide_H,
@@ -1148,7 +1123,14 @@ def proc_calc_out=
inf_NO:=inf_EN:=inf_JN:=inf_FM:=inf_CAS:=inf_USE:=inf_EXA:=inf_EXB:=inf_MW:="";
cal_MW:=cal_MW_str:=cal_FM:=""; cnt_hide_H:=warning_cnt:=MW_num:=MI_num:=MWp:=0;
%------------------------------------------------------------------------------------------
- proc_get_info;
+ for j=1 upto inf_num:
+ nA:=0; for i=0 upto length(info[j]): if pic_c(i,info[j])=":": nA:=i; fi exitif nA>0; endfor
+ if nA>0:
+ s_tag:=substring (0,nA) of info[j];
+ s_var:=substring (nA+1,length(info[j])) of info[j];
+ if known scantokens("inf_"&s_tag): scantokens("inf_"&s_tag):=s_var; fi
+ fi
+ endfor
for i=1 upto tbl_cnt: sumA[i]:=0; endfor
for i=1 upto cntA:
knownA:=bond_cnt:=0;