diff options
Diffstat (limited to 'metapost')
-rw-r--r-- | metapost/context/base/metafun.mpiv | 7 | ||||
-rw-r--r-- | metapost/context/base/mp-abck.mpiv | 2 | ||||
-rw-r--r-- | metapost/context/base/mp-apos.mpiv | 2 | ||||
-rw-r--r-- | metapost/context/base/mp-asnc.mpiv | 2 | ||||
-rw-r--r-- | metapost/context/base/mp-butt.mpiv | 2 | ||||
-rw-r--r-- | metapost/context/base/mp-char.mpiv | 2 | ||||
-rw-r--r-- | metapost/context/base/mp-chem.mpiv | 350 | ||||
-rw-r--r-- | metapost/context/base/mp-core.mpiv | 2 | ||||
-rw-r--r-- | metapost/context/base/mp-crop.mpiv | 14 | ||||
-rw-r--r-- | metapost/context/base/mp-figs.mpiv | 2 | ||||
-rw-r--r-- | metapost/context/base/mp-form.mpiv | 2 | ||||
-rw-r--r-- | metapost/context/base/mp-func.mpiv | 2 | ||||
-rw-r--r-- | metapost/context/base/mp-grap.mpiv | 202 | ||||
-rw-r--r-- | metapost/context/base/mp-grid.mpiv | 2 | ||||
-rw-r--r-- | metapost/context/base/mp-grph.mpiv | 2 | ||||
-rw-r--r-- | metapost/context/base/mp-mlib.mpiv | 29 | ||||
-rw-r--r-- | metapost/context/base/mp-page.mpiv | 2 | ||||
-rw-r--r-- | metapost/context/base/mp-shap.mpiv | 2 | ||||
-rw-r--r-- | metapost/context/base/mp-step.mpiv | 2 | ||||
-rw-r--r-- | metapost/context/base/mp-text.mpiv | 2 | ||||
-rw-r--r-- | metapost/context/base/mp-tool.mpiv | 4 |
21 files changed, 191 insertions, 445 deletions
diff --git a/metapost/context/base/metafun.mpiv b/metapost/context/base/metafun.mpiv index 8247c121f..d600764a3 100644 --- a/metapost/context/base/metafun.mpiv +++ b/metapost/context/base/metafun.mpiv @@ -11,9 +11,10 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -%D First we input John Hobby's metapost plain file. However, because we want to -%D prevent dependency problems and in the end even may use a patched version, -%D we prefer to use a copy. +%D First we input John Hobby's metapost plain file. However, +%D because we want to prevent dependency problems and in the +%D end even may use a patched version, we prefer to use a +%D copy. input "mp-base.mpiv" ; input "mp-tool.mpiv" ; diff --git a/metapost/context/base/mp-abck.mpiv b/metapost/context/base/mp-abck.mpiv index abd7d8848..02fab0337 100644 --- a/metapost/context/base/mp-abck.mpiv +++ b/metapost/context/base/mp-abck.mpiv @@ -5,7 +5,7 @@ %D subtitle=anchored background macros, %D author=Hans Hagen, %D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for diff --git a/metapost/context/base/mp-apos.mpiv b/metapost/context/base/mp-apos.mpiv index 7b7737754..f92efc5fd 100644 --- a/metapost/context/base/mp-apos.mpiv +++ b/metapost/context/base/mp-apos.mpiv @@ -5,7 +5,7 @@ %D subtitle=anchored background macros, %D author=Hans Hagen, %D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for diff --git a/metapost/context/base/mp-asnc.mpiv b/metapost/context/base/mp-asnc.mpiv index 2626e4d58..dfd88317c 100644 --- a/metapost/context/base/mp-asnc.mpiv +++ b/metapost/context/base/mp-asnc.mpiv @@ -5,7 +5,7 @@ %D subtitle=anchored background macros, %D author=Hans Hagen, %D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for diff --git a/metapost/context/base/mp-butt.mpiv b/metapost/context/base/mp-butt.mpiv index 6f5b90a7e..df7e9e4fd 100644 --- a/metapost/context/base/mp-butt.mpiv +++ b/metapost/context/base/mp-butt.mpiv @@ -5,7 +5,7 @@ %D subtitle=buttons, %D author=Hans Hagen, %D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See licen-en.pdf for diff --git a/metapost/context/base/mp-char.mpiv b/metapost/context/base/mp-char.mpiv index f604accd8..c293b7284 100644 --- a/metapost/context/base/mp-char.mpiv +++ b/metapost/context/base/mp-char.mpiv @@ -5,7 +5,7 @@ %D subtitle=charts, %D author=Hans Hagen, %D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See licen-en.pdf for diff --git a/metapost/context/base/mp-chem.mpiv b/metapost/context/base/mp-chem.mpiv index 2b2d8e5bf..cb595f2c6 100644 --- a/metapost/context/base/mp-chem.mpiv +++ b/metapost/context/base/mp-chem.mpiv @@ -3,15 +3,15 @@ %D version=2009.05.13, %D title=\CONTEXT\ \METAPOST\ graphics, %D subtitle=chemicals, -%D author=Hans Hagen \& Alan Braslau", +%D author=Hans Hagen, %D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%D copyright=\PRAGMA] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See licen-en.pdf for %C details. -%D This module is incomplete and experimental. +%D This module in incomplete and experimental. % either consistent setting or not @@ -20,7 +20,7 @@ if known context_chem : endinput ; fi ; boolean context_chem ; context_chem := true ; numeric - chem_width, chem_radical_min, chem_radical_max, chem_text_min, chem_text_max, chem_circle_radius, + chem_width, chem_radical_min, chem_radical_max, chem_text_max, chem_circle_radius, chem_rotation, chem_adjacent, chem_stack, chem_substituent, chem_direction, chem_setting_scale, chem_setting_offset, chem_text_offset, chem_picture_offset, chem_center_offset, chem_substituent_offset, chem_setting_l, chem_setting_r, chem_setting_t, chem_setting_b ; @@ -30,9 +30,6 @@ boolean chem_setting_fixedwidth, chem_setting_fixedheight, chem_doing_pb, chem_text_trace ; -color - chem_axis_color ; - path chem_setting_bbox ; @@ -41,26 +38,24 @@ pair chem_adjacent_p, chem_substituent_p, chem_direction_p, chem_move_p ; numeric - chem_width[], chem_angle[], chem_dbl_offset[], chem_initialmov[] ; + chem_width[], chem_angle[], chem_start[], chem_initialrot[], chem_initialmov[] ; pair chem_stack_d[], chem_b_zero[], chem_n_zero[], - chem_r_max[], + chem_r_max[], chem_r_min[], chem_r_zero[], chem_mr_zero[], chem_pr_zero[], chem_crz_zero[], chem_rt_zero[], chem_rtt_zero[], chem_rbt_zero[], - chem_zbt_zero[], chem_ztt_zero[], chem_mid_zero[] ; path chem_b_path[], chem_bx_path[], chem_eb_path[], chem_sr_path[], chem_br_path[], chem_sb_path[], chem_msb_path[], chem_psb_path[], chem_s_path[], chem_ss_path[], chem_mss_path[], chem_pss_path[], - chem_e_path[], chem_bb_path[], chem_oe_path[], + chem_e_path[], chem_sd_path[], chem_bb_path[], chem_oe_path[], chem_bd_path[], chem_bw_path[], chem_ddt_path[], chem_ddb_path[], chem_ldt_path[], chem_ldb_path[], chem_rdt_path[], chem_rdb_path[], chem_dbl_path[], chem_dbr_path[], - chem_tbl_path[], chem_tbr_path[], chem_ad_path[], chem_au_path[], chem_r_path[], chem_rl_path[], chem_rr_path[], chem_rb_path[], chem_prb_path[], chem_mrb_path[], @@ -71,23 +66,23 @@ path chem_midt_path[], chem_midb_path[], chem_midst_path[], chem_midsb_path[] ; chem_setting_scale := 1 ; -chem_base_width := 40pt ; % Should this rather follow the font size? -chem_text_offset := 3pt ; % ? +chem_base_width := 40pt ; +chem_text_offset := 3pt ; chem_center_offset := 6pt ; -chem_picture_offset := 10pt ; % Should this follow chem_base_width (thus the font size)? -chem_substituent_offset := 10pt ; % Should this follow chem_base_width (thus the font size)? +chem_picture_offset := 10pt ; +chem_substituent_offset := 10pt ; chem_radical_min := 1.25 ; chem_radical_max := 1.50 ; chem_text_min := 0.75 ; -chem_text_max := 1.25 ; +chem_text_max := 1.75 ; chem_circle_radius := 0.80 ; chem_circle_radius := 1.10 ; -chem_rotation := 0 ; +chem_rotation := 1 ; chem_adjacent := 0 ; chem_substituent := 0 ; chem_direction := 0 ; chem_stack_n := 0 ; -chem_doing_pb := false ; +chem_doing_pb := false ; chem_shift := origin ; chem_dot_factor := 4 ; chem_text_trace := false ; @@ -95,10 +90,8 @@ chem_bd_n := 4 ; chem_bw_n := 4 ; chem_bd_angle := 4 ; chem_bb_angle := 4 ; -chem_axis_color := blue ; % TODO: add "axiscolor=" option in lua... vardef chem_start_structure(expr n, l, r, t, b, scale, axis, fixedwidth, fixedheight, offset) = - % note that "n" is not used... chem_setting_axis := axis ; chem_setting_l := l * scale ; chem_setting_r := r * scale ; @@ -111,7 +104,7 @@ vardef chem_start_structure(expr n, l, r, t, b, scale, axis, fixedwidth, fixedhe chem_setting_scale := scale ; chem_init_all ; fi ; - chem_rotation := 0 ; + chem_rotation := 1 ; chem_adjacent := 0 ; chem_substituent := 0 ; chem_direction := 0 ; @@ -134,18 +127,17 @@ def chem_stop_structure = chem_setting_bbox := (-chem_setting_l,-chem_setting_b) -- ( chem_setting_r,-chem_setting_b) -- ( chem_setting_r, chem_setting_t) -- (-chem_setting_l, chem_setting_t) -- cycle ; - if chem_setting_axis : % put it behind the picture - picture chem_picture ; chem_picture := currentpicture ; currentpicture := nullpicture ; + % maybe put it behind the picture + if chem_setting_axis : save stp ; stp := chem_base_width/ 2 * chem_setting_scale ; - save siz ; siz := stp/5 ; - draw (-chem_setting_l,0) -- (chem_setting_r,0) withcolor chem_axis_color ; - draw (0,-chem_setting_b) -- (0,chem_setting_t) withcolor chem_axis_color ; - for i = 0 step stp until chem_setting_r : draw (i,-siz) -- (i,siz) withcolor chem_axis_color ; endfor ; - for i = 0 step -stp until -chem_setting_l : draw (i,-siz) -- (i,siz) withcolor chem_axis_color ; endfor ; - for i = 0 step stp until chem_setting_t : draw (-siz,i) -- (siz,i) withcolor chem_axis_color ; endfor ; - for i = 0 step -stp until -chem_setting_b : draw (-siz,i) -- (siz,i) withcolor chem_axis_color ; endfor ; - % frame=on: draw chem_setting_bbox withcolor chem_axis_color ; - addto currentpicture also chem_picture ; + save siz ; siz := chem_base_width/10 * chem_setting_scale ; + draw (-chem_setting_l,0) -- (chem_setting_r,0) withcolor blue ; + draw (0,-chem_setting_b) -- (0,chem_setting_t) withcolor blue ; + for i = 0 step stp until chem_setting_r : draw (i,-siz) -- (i,siz) withcolor blue ; endfor ; + for i = 0 step -stp until -chem_setting_l : draw (i,-siz) -- (i,siz) withcolor blue ; endfor ; + for i = 0 step stp until chem_setting_t : draw (-siz,i) -- (siz,i) withcolor blue ; endfor ; + for i = 0 step -stp until -chem_setting_b : draw (-siz,i) -- (siz,i) withcolor blue ; endfor ; + draw chem_setting_bbox withcolor blue ; fi ; setbounds currentpicture to chem_setting_bbox ; enddef ; @@ -154,8 +146,8 @@ def chem_start_component = enddef ; def chem_stop_component = enddef ; def chem_pb = -% draw boundingbox currentpicture withpen pencircle scaled 1mm withcolor chem_axis_color ; -% draw origin withpen pencircle scaled 2mm withcolor chem_axis_color ; +% draw boundingbox currentpicture withpen pencircle scaled 1mm withcolor blue ; +% draw origin withpen pencircle scaled 2mm withcolor blue ; chem_doing_pb := true ; enddef ; @@ -182,7 +174,6 @@ vardef chem_do (expr p) = fi enddef ; -% f_rom, t_o, r_ule, c_olor vardef chem_b (expr n, f, t, r, c) = chem_draw (n, chem_b_path[n], f, t, r, c) ; enddef ; @@ -230,8 +221,13 @@ vardef chem_eb (expr n, f, t, r, c) = enddef ; vardef chem_db (expr n, f, t, r, c) = - chem_draw (n, chem_dbl_path [n], f, t, r, c) ; - chem_draw (n, chem_dbr_path [n], f, t, r, c) ; + if n = 1 : + chem_draw (n, chem_msb_path [n], f, t, r, c) ; + chem_draw (n, chem_psb_path [n], f, t, r, c) ; + else : + chem_draw (n, chem_dbl_path [n], f, t, r, c) ; + chem_draw (n, chem_dbr_path [n], f, t, r, c) ; + fi ; enddef ; vardef chem_er (expr n, f, t, r, c) = @@ -317,7 +313,7 @@ vardef chem_psr (expr n, f, t, r, c) = enddef ; vardef chem_c (expr n, f, t, r, c) = - chem_draw (n, chem_c_path[n], f, f, r, c) + chem_draw (n, chem_c_path[n], f, t, r, c) enddef ; vardef chem_cc (expr n, f, t, r, c) = @@ -325,7 +321,7 @@ vardef chem_cc (expr n, f, t, r, c) = enddef ; vardef chem_cd (expr n, f, t, r, c) = - chem_dashed_connected (n, chem_c_path[n], f, f, r, c) + chem_dashed_connected (n, chem_c_path[n], f, t, r, c) enddef ; vardef chem_ccd (expr n, f, t, r, c) = @@ -345,13 +341,13 @@ vardef chem_rbn (expr n, i, t) = enddef ; vardef chem_tb (expr n, f, t, r, c) = % one - chem_draw (n, chem_tbl_path [n], f, t, r, c) ; - chem_draw (n, chem_sb_path [n], f, t, r, c) ; - chem_draw (n, chem_tbr_path [n], f, t, r, c) ; + chem_draw (n, chem_msb_path[n], f, t, r, c) ; + chem_draw (n, chem_sb_path [n], f, t, r, c) ; + chem_draw (n, chem_psb_path[n], f, t, r, c) ; enddef ; vardef chem_ep (expr n, f, t, r, c) = % one - chem_draw (n, (subpath (.25,.75) of chem_e_path[n]), f, t, r, c) ; + chem_draw (n, chem_e_path[n], f, t, r, c) ; enddef ; vardef chem_es (expr n, f, t, r, c) = % one @@ -359,8 +355,8 @@ vardef chem_es (expr n, f, t, r, c) = % one enddef ; vardef chem_ed (expr n, f, t, r, c) = % one - chem_draw_dot (n, point .25 of chem_e_path[n], f, t, r, c) ; - chem_draw_dot (n, point .75 of chem_e_path[n], f, t, r, c) ; + chem_draw_dot (n, point 0 of chem_e_path[n], f, t, r, c) ; + chem_draw_dot (n, point 1 of chem_e_path[n], f, t, r, c) ; enddef ; vardef chem_et (expr n, f, t, r, c) = % one @@ -377,11 +373,11 @@ enddef ; vardef chem_rdd (expr n, f, t, r, c) = % one chem_draw (n, chem_ldt_path[n], f, t, r, c) ; chem_draw (n, chem_ldb_path[n], f, t, r, c) ; - chem_draw (n, chem_sb_path [n], f, t, r, c) ; + chem_draw (n, chem_psb_path[n], f, t, r, c) ; enddef ; vardef chem_ldd (expr n, f, t, r, c) = % one - chem_draw (n, chem_sb_path [n], f, t, r, c) ; + chem_draw (n, chem_msb_path[n], f, t, r, c) ; chem_draw (n, chem_rdt_path[n], f, t, r, c) ; chem_draw (n, chem_rdb_path[n], f, t, r, c) ; enddef ; @@ -392,11 +388,10 @@ vardef chem_hb (expr n, f, t, r, c) = % one chem_draw_dot (n, point 1 of chem_sb_path[n], f, t, r, c) ; enddef ; -vardef chem_bb (expr n, f, t, r, c) = % one and front +vardef chem_bb (expr n, f, t, r, c) = % one if n < 0 : - if ((f = 1) and (t = -n)) : % ignore all but "BB" - chem_fill (n, chem_bb_path[n], 1, 1, r, c) ; - fi + chem_fill (n, chem_bb_path[n], 1, 1, r, c) ; + chem_b (n, f, t, r, c) ; else : chem_fill (n, chem_bb_path[n], f, t, r, c) ; fi ; @@ -433,9 +428,7 @@ vardef chem_z@#(expr n, p) (text t) = enddef ; vardef chem_cz@#(expr n, p) (text t) = - if p = 0 : - chem_text@#(t, chem_do(origin)) ; - elseif n = 1 : + if n = 1 : chem_c_text(t, chem_do(chem_crz_zero[n] rotated chem_ang(n,p))) ; else : chem_text@#(t, chem_do(chem_b_zero[n] rotated chem_ang(n,p))) ; @@ -446,37 +439,12 @@ vardef chem_midz@#(expr n, p) (text t) = chem_text@#(t, chem_do(chem_mid_zero[n] rotated chem_ang(n,p))) ; enddef ; -string mfun_auto_align[] ; -mfun_auto_align[0] := "rt" ; -mfun_auto_align[1] := "urt" ; -mfun_auto_align[2] := "top" ; -mfun_auto_align[3] := "ulft" ; -mfun_auto_align[4] := "lft" ; -mfun_auto_align[5] := "llft" ; -mfun_auto_align[6] := "bot" ; -mfun_auto_align[7] := "lrt" ; -mfun_auto_align[8] := "rt" ; - -def autoalign(expr n) = - scantokens mfun_auto_align[round((n mod 360)/45)] -enddef ; - -% draw textext.autoalign(60) ("\strut oeps 1") ; -% draw textext.autoalign(160)("\strut oeps 2") ; -% draw textext.autoalign(260)("\strut oeps 3") ; -% draw textext.autoalign(360)("\strut oeps 4") ; - - vardef chem_rz@#(expr n, p) (text t) = if n < 0 : % quite special chem_text@#(t, chem_do(chem_r_zero[n] shifted (chem_b_zero[n] rotated chem_ang(n,p)))) ; else : - if (length(str @#)>0) and (str @# = "auto") : - chem_text.autoalign(chem_ang(n,p-.5)) (t, chem_do(chem_r_zero[n] rotated chem_ang(n,p))) ; - else : - chem_text@#(t, chem_do(chem_r_zero[n] rotated chem_ang(n,p))) ; - fi + chem_text@#(t, chem_do(chem_r_zero[n] rotated chem_ang(n,p))) ; fi ; enddef ; @@ -515,27 +483,35 @@ vardef chem_rbt@#(expr n, p) (text t) = enddef ; vardef chem_zt@#(expr n, p) (text t) = - chem_text@#(t, chem_do(chem_n_zero[n] rotated chem_ang(n,p))) ; + if n = 1 : + chem_text@#(t, chem_do(chem_rt_zero[n] rotated chem_ang(n,p))) ; + else : + chem_text@#(t, chem_do(chem_n_zero[n] rotated chem_ang(n,p))) ; + fi ; enddef ; vardef chem_zn@#(expr n, p) (text t) = - chem_zt@#(n, p, t) ; + if n = 1 : + chem_text@#(t, chem_do(chem_rt_zero[n] rotated chem_ang(n,p))) ; + else : + chem_text@#(t, chem_do(chem_n_zero[n] rotated chem_ang(n,p))) ; + fi ; enddef ; vardef chem_zbt@#(expr n, p) (text t) = - chem_text@#(t, chem_do(chem_zbt_zero[n] rotated chem_ang(n,p))) ; + chem_text@#(t, chem_do(chem_rtt_zero[n] rotated chem_ang(n,p))) ; enddef ; vardef chem_zbn@#(expr n, p) (text t) = - chem_zbt@#(n, p, t) ; + chem_text@#(t, chem_do(chem_rtt_zero[n] rotated chem_ang(n,p))) ; enddef ; vardef chem_ztt@#(expr n, p) (text t) = - chem_text@#(t, chem_do(chem_ztt_zero[n] rotated chem_ang(n,p))) ; + chem_text@#(t, chem_do(chem_rbt_zero[n] rotated chem_ang(n,p))) ; enddef ; vardef chem_ztn@#(expr n, p) (text t) = - chem_ztt@#(n, p, t) ; + chem_text@#(t, chem_do(chem_rbt_zero[n] rotated chem_ang(n,p))) ; enddef ; vardef chem_symbol(expr t) = @@ -569,13 +545,11 @@ vardef chem_c_text(expr txt, z) = % adapted copy of thelabel@ enddef ; vardef chem_ang (expr n, d) = - ((1 - d)*chem_angle[n] + if (n<0): -90 else: chem_rotation fi) % no ; + ((-1 * (d-1) * chem_angle[n]) + (-chem_rotation+1) * 90 + chem_start[n]) % no ; enddef ; vardef chem_rot (expr n, d) = - if (d <> 0) : - chem_rotation := chem_rotation + 180/(if (d=1): 8 else: abs(d) fi) ; - fi + chem_rotation := d ; enddef ; vardef chem_adj (expr n, d) = @@ -588,7 +562,7 @@ enddef ; vardef chem_dir (expr n, d) = if n = 1 : - chem_direction_p := (origin - 2*center(chem_b_path[n] rotated chem_ang(n,d))/cosd(chem_angle[n])) ; + chem_direction_p := (origin - 2*center(chem_b_path[n] rotated chem_ang(n,d+1))) ; currentpicture := currentpicture shifted chem_direction_p ; chem_shift := chem_shift + chem_direction_p ; fi ; @@ -599,21 +573,23 @@ vardef chem_mov (expr n, d) = currentpicture := currentpicture shifted - chem_shift ; chem_shift := origin ; else : - %chem_move_p := (origin - 2*center(chem_b_path[n] rotated chem_ang(n,d+chem_initialmov[n]))) ; - chem_move_p := -chem_b_zero[n] rotated chem_ang(n,d+chem_initialmov[n]) ; + chem_move_p := (origin - 2*center(chem_b_path[n] rotated chem_ang(n,d+chem_initialmov[n]))) ; currentpicture := currentpicture shifted chem_move_p ; chem_shift := chem_shift + chem_move_p ; - %if (n = 3) or (n = 5) : chem_rot(n, -n) ; fi fi ; enddef ; vardef chem_off (expr n, d) = - pair o ; o := (-chem_setting_offset,0) rotated chem_ang(1,d+chem_initialmov[1]) ; - currentpicture := currentpicture shifted o ; - chem_shift := chem_shift + o ; + if (d = 1) or (d = 2) or (d = 8) : % positive + currentpicture := currentpicture shifted (-chem_setting_offset,0) ; + chem_shift := chem_shift + (-chem_setting_offset,0) + elseif (d = 4) or (d = 5) or (d = 6) : % negative + currentpicture := currentpicture shifted ( chem_setting_offset,0) ; + chem_shift := chem_shift + ( chem_setting_offset,0) + fi ; enddef ; -vardef chem_set (expr n, m) = +vardef chem_set(expr n, m) = if chem_adjacent > 0 : chem_adjacent_d := xpart chem_b_zero[n] + xpart chem_b_zero[m] ; if chem_adjacent = 1 : chem_adjacent_p := (-chem_adjacent_d, 0) ; @@ -642,6 +618,7 @@ vardef chem_set (expr n, m) = chem_shift := chem_shift + chem_substituent_p ; chem_substituent := 0 ; fi ; + chem_rotation := chem_initialrot[m] ; enddef ; vardef chem_draw (expr n, path_fragment, from_point, to_point, linewidth, linecolor) = @@ -701,7 +678,7 @@ vardef chem_save = chem_shift := origin ; % chem_adjacent := 0 ; % chem_substituent := 0 ; -% chem_rotation := 0 ; +% chem_rotation := 1 ; currentpicture := nullpicture ; enddef ; @@ -716,16 +693,14 @@ vardef chem_restore = fi ; enddef ; -def chem_init_some(expr n) = - boolean front ; front := n < 0 ; +def chem_init_some(expr n, ratio, start, initialrot, initialmov) = + chem_width [n] := ratio * chem_base_width * chem_setting_scale ; chem_angle [n] := 360/abs(n) ; - chem_initialmov[n] := 0 ; - chem_width [n] := chem_setting_scale * (chem_base_width/2) / sind(chem_angle[n]/2) ; - chem_dbl_offset[n] := chem_setting_scale * chem_base_width / 20 ; - chem_b_path [n] := ((chem_width[n],0) rotated -(chem_angle[n]/2))-- - ((chem_width[n],0) rotated +(chem_angle[n]/2)) ; - chem_b_zero [n] := point 1 of chem_b_path [n] ; - chem_n_zero [n] := chem_text_min*chem_b_zero[n] ; + chem_start [n] := start ; + chem_initialrot[n] := initialrot ; + chem_initialmov[n] := initialmov ; + chem_b_zero [n] := (chem_width[n],0) rotated (chem_angle[n]/2) ; + chem_n_zero [n] := (chem_text_min*chem_width[n],0) rotated (chem_angle[n]/2) ; chem_r_max [n] := chem_radical_max*chem_b_zero[n] ; chem_r_path [n] := chem_b_zero[n] -- chem_r_max[n] ; chem_mr_path [n] := chem_r_path [n] rotatedaround(chem_b_zero[n], (180-chem_angle[n])/2) ; @@ -734,120 +709,119 @@ def chem_init_some(expr n) = chem_mr_zero [n] := point 1 of chem_mr_path[n] ; chem_pr_zero [n] := point 1 of chem_pr_path[n] ; chem_crz_zero [n] := point 1 of (chem_r_path[n] enlonged chem_center_offset) ; - chem_ztt_zero [n] := chem_text_max*(center chem_b_path[n]) ; - chem_zbt_zero [n] := chem_text_min*(center chem_b_path[n]) ; - chem_au_path [n] := chem_b_path[n] paralleled ((1-chem_text_max)*(abs(center chem_b_path[n]))) ; + chem_au_path [n] := subpath (0.2,0.8) of (chem_r_max[n] -- (chem_r_max[n] rotated chem_angle[n])) ; chem_ad_path [n] := reverse(chem_au_path[n]) ; chem_rt_zero [n] := (((chem_radical_max+chem_radical_min)/2)*chem_width[n],0) rotated (chem_angle[n]/2) ; chem_rtt_zero [n] := chem_rt_zero[n] rotated + 10 ; chem_rbt_zero [n] := chem_rt_zero[n] rotated - 10 ; - chem_bx_path [n] := reverse(chem_b_zero[n] -- (chem_b_zero[n] rotated -chem_angle[n])) ; % ? NOT USED... + chem_b_path [n] := reverse(chem_b_zero[n] -- (chem_b_zero[n] rotated -chem_angle[n])) ; + chem_bx_path [n] := reverse(chem_b_zero[n] -- (chem_b_zero[n] rotated -chem_angle[n])) ; % ? chem_sb_path [n] := subpath (0.25,0.75) of chem_b_path[n] ; - chem_msb_path [n] := subpath (0.00,0.75) of chem_b_path[n] ; - chem_psb_path [n] := subpath (0.25,1.00) of chem_b_path[n] ; - chem_dbl_path [n] := chem_sb_path[n] paralleled - chem_dbl_offset[n] ; - chem_dbr_path [n] := chem_sb_path[n] paralleled + chem_dbl_offset[n] ; - chem_eb_path [n] := chem_sb_path[n] paralleled +2chem_dbl_offset[n] ; - chem_c_path [n] := (fullcircle scaled 2) - scaled (abs(center chem_b_path[n]) - 2chem_dbl_offset[n]) ; - chem_cc_path [n] := (subpath (0,(length chem_c_path[n])*(1-1/n)) of chem_c_path[n]) - rotated chem_angle[n] ; chem_s_path [n] := point 0 of chem_b_path[n] -- point 0 of (chem_b_path[n] rotated (2chem_angle[n])) ; chem_ss_path [n] := subpath (0.25,0.75) of (chem_s_path[n]) ; chem_pss_path [n] := subpath (0.00,0.75) of (chem_s_path[n]) ; chem_mss_path [n] := subpath (0.25,1.00) of (chem_s_path[n]) ; chem_mid_zero [n] := origin shifted (-.25chem_width[n],0) ; - chem_midt_path[n] := chem_mid_zero[n] -- chem_b_zero[n] rotated (+chem_angle[n]*floor(n/4)) ; - chem_midb_path[n] := chem_mid_zero[n] -- chem_b_zero[n] rotated (-chem_angle[n]*ceiling(n/4)) ; - chem_midst_path [n] := subpath (0.25,1.00) of chem_midt_path [n] ; - chem_midsb_path [n] := subpath (0.25,1.00) of chem_midb_path [n] ; + chem_midst_path[n] := chem_mid_zero[n] -- (chem_width[n],0) rotated ( chem_angle[n] + chem_angle[n]/2) ; + chem_midsb_path[n] := chem_mid_zero[n] -- (chem_width[n],0) rotated (-chem_angle[n] - chem_angle[n]/2) ; + chem_midt_path [n] := subpath (0.25,1.00) of chem_midst_path [n] ; + chem_midb_path [n] := subpath (0.25,1.00) of chem_midsb_path [n] ; + chem_msb_path [n] := subpath (0.00,0.75) of chem_b_path[n] ; + chem_psb_path [n] := subpath (0.25,1.00) of chem_b_path[n] ; + chem_dbl_path [n] := chem_sb_path[n] shifted - (0.05[origin,center chem_sb_path[n]]) ; % parallel + chem_dbr_path [n] := chem_sb_path[n] shifted + (0.05[origin,center chem_sb_path[n]]) ; + chem_eb_path [n] := chem_sb_path[n] shifted - (0.25[origin,center chem_sb_path[n]]) ; chem_sr_path [n] := chem_radical_min*chem_b_zero[n] -- chem_r_max[n] ; - chem_rl_path [n] := chem_r_path[n] paralleled +chem_dbl_offset[n] ; - chem_rr_path [n] := chem_r_path[n] paralleled -chem_dbl_offset[n] ; - chem_srl_path [n] := chem_sr_path[n] paralleled +chem_dbl_offset[n] ; - chem_srr_path [n] := chem_sr_path[n] paralleled -chem_dbl_offset[n] ; + chem_rl_path [n] := chem_r_path[n] paralleled (chem_base_width/20) ; + chem_rr_path [n] := chem_r_path[n] paralleled -(chem_base_width/20) ; + chem_srl_path [n] := chem_sr_path[n] paralleled (chem_base_width/20) ; + chem_srr_path [n] := chem_sr_path[n] paralleled -(chem_base_width/20) ; chem_br_path [n] := point 1 of chem_sb_path[n] -- point 0 of chem_sb_path[n] rotatedaround(point 1 of chem_sb_path[n], -4) -- point 0 of chem_sb_path[n] rotatedaround(point 1 of chem_sb_path[n], 4) -- cycle ; chem_rb_path [n] := chem_b_zero[n] -- chem_r_max[n] rotated -2 -- chem_r_max[n] -- chem_r_max[n] rotated 2 -- cycle ; - chem_mrb_path [n] := chem_rb_path[n] rotatedaround(chem_b_zero[n],+(180-chem_angle[n])/2) ; + chem_mrb_path [n] := chem_rb_path[n] rotatedaround(chem_b_zero[n], (180-chem_angle[n])/2) ; chem_prb_path [n] := chem_rb_path[n] rotatedaround(chem_b_zero[n],-(180-chem_angle[n])/2) ; - chem_msr_path [n] := chem_sr_path[n] rotatedaround(chem_b_zero[n],+(180-chem_angle[n])/2) ; + chem_msr_path [n] := chem_sr_path[n] rotatedaround(chem_b_zero[n], (180-chem_angle[n])/2) ; chem_psr_path [n] := chem_sr_path[n] rotatedaround(chem_b_zero[n],-(180-chem_angle[n])/2) ; - - if (front) : - chem_bb_path [n] := chem_b_path[n] rotated -chem_angle[n] -- - chem_b_path[n] -- - chem_b_path[n] rotated +chem_angle[n] -- - (reverse(chem_b_path[n])) % shortened (.5chem_dbl_offset[n]))) - paralleled chem_dbl_offset[n] -- - cycle ; - chem_mr_path [n] := origin -- origin shifted (0,-.25chem_base_width) ; - chem_pr_path [n] := origin -- origin shifted (0,+.25chem_base_width) ; - chem_mr_zero [n] := point 1 of chem_mr_path[n] ; - chem_pr_zero [n] := point 1 of chem_pr_path[n] ; - chem_r_path [n] := chem_mr_zero[n] -- chem_pr_zero[n] ; - fi + % not yet ok: +% chem_c_path [n] := subpath (30/45, -30/45) of (fullcircle scaled (1.25*chem_circle_radius*chem_width[n])); +% chem_cc_path [n] := subpath (30/45,8-30/45) of (fullcircle rotated 90 scaled (1.25*chem_circle_radius*chem_width[n])); + chem_c_path [n] := subpath (30/45, -30/45) of (fullcircle scaled (chem_width[n])); + chem_cc_path [n] := subpath (30/45,8-30/45) of (fullcircle rotated 90 scaled (chem_width[n])); enddef ; -def chem_init_three = chem_init_some(3) ; enddef ; -def chem_init_four = chem_init_some(4) ; enddef ; -def chem_init_five = chem_init_some(5) ; enddef ; -def chem_init_six = chem_init_some(6) ; enddef ; -def chem_init_eight = chem_init_some(8) ; enddef ; -def chem_init_five_front = chem_init_some(-5) ; enddef ; -def chem_init_six_front = chem_init_some(-6) ; enddef ; +def chem_init_three = chem_init_some(3,30/52 ,-60,1,2) ; enddef ; % 60 +def chem_init_four = chem_init_some(4,30/42.5, 0,1,0) ; enddef ; % 45 +def chem_init_five = chem_init_some(5,30/35 , 0,1,0) ; enddef ; % 36 +def chem_init_six = chem_init_some(6, 1 , 0,1,0) ; enddef ; % 30 +def chem_init_eight = chem_init_some(8,30/22.5, 0,1,0) ; enddef ; % 22.5 % bb R -R R Z -RZ +RZ +def chem_init_some_front(expr n, ratio, start, initialrot, initialmov) = + chem_init_some(n, ratio, start, initialrot, initialmov) ; + chem_bb_path [n] := chem_b_path[n] rotated -chem_angle[n] -- chem_b_path[n] -- chem_b_path[n] rotated chem_angle[n] -- + (reverse(chem_b_path[n] shortened (chem_base_width/20))) paralleled (chem_base_width/20) -- + cycle ; + chem_r_max [n] := chem_radical_max*chem_b_zero[n] ; + chem_mr_path [n] := origin -- origin shifted (0,-.25chem_base_width) ; + chem_pr_path [n] := origin -- origin shifted (0, .25*chem_base_width) ; + chem_r_path [n] := point 1 of chem_mr_path[n] -- point 1 of chem_pr_path[n] ; + chem_mr_zero [n] := point 1 of chem_mr_path[n] ; + chem_pr_zero [n] := point 1 of chem_pr_path[n] ; +enddef ; + +def chem_init_five_front = chem_init_some_front(-5,30/35,0,2,0) ; enddef ; % 36 +def chem_init_six_front = chem_init_some_front(-6, 1 ,0,2,0) ; enddef ; % 30 + vardef chem_init_one = + chem_width [1] := .75 * chem_base_width * chem_setting_scale ; chem_angle [1] := 360/8 ; - chem_initialmov[1] := 0 ; - chem_width [1] := chem_setting_scale * chem_base_width ; - chem_dbl_offset[1] := chem_width[1] / 20 ; - chem_b_path [1] := origin -- (chem_width[1],0) ; - chem_b_zero [1] := point 1 of chem_b_path[1] ; + chem_start [1] := 0 ; + chem_initialrot[1] := 1 ; + chem_initialmov[1] := 1 ; + chem_b_zero [1] := (1.75*chem_width[1],0) ; + chem_r_min [1] := chem_radical_min*chem_b_zero[1] ; chem_r_max [1] := chem_radical_max*chem_b_zero[1] ; - chem_r_path [1] := (center chem_b_path[1]) -- (chem_radical_min*chem_b_zero[1]) ; - chem_r_zero [1] := point 1 of chem_r_path[1] ; - chem_crz_zero [1] := chem_r_zero[1] enlonged chem_center_offset ; % ??? - chem_e_path [1] := ((1,-.5) -- (1,+.5)) scaled (.25chem_width[1]) ; - chem_sb_path [1] := subpath (0.25,0.75) of chem_b_path[1] ; - chem_msb_path [1] := subpath (0, 0.75) of chem_b_path[1] ; - chem_psb_path [1] := subpath (0.25,1) of chem_b_path[1] ; - chem_ddt_path [1] := subpath (0, 0.4) of chem_sb_path[1] ; - chem_ddb_path [1] := subpath (0.6, 1) of chem_sb_path[1] ; - chem_dbl_path [1] := chem_sb_path[1] paralleled -1chem_dbl_offset[1] ; - chem_dbr_path [1] := chem_sb_path[1] paralleled +1chem_dbl_offset[1] ; - chem_tbl_path [1] := chem_sb_path[1] paralleled -2chem_dbl_offset[1] ; - chem_tbr_path [1] := chem_sb_path[1] paralleled +2chem_dbl_offset[1] ; - chem_ldt_path [1] := chem_ddt_path[1] paralleled -2chem_dbl_offset[1] ; - chem_ldb_path [1] := chem_ddb_path[1] paralleled -2chem_dbl_offset[1] ; - chem_rdt_path [1] := chem_ddt_path[1] paralleled +2chem_dbl_offset[1] ; - chem_rdb_path [1] := chem_ddb_path[1] paralleled +2chem_dbl_offset[1] ; - chem_n_zero [1] := center chem_b_path[1] ; - chem_ztt_zero [1] := chem_n_zero[1] rotated +.5chem_angle[1] ; - chem_zbt_zero [1] := chem_n_zero[1] rotated -.5chem_angle[1] ; + chem_r_path [1] := (.5*chem_width[1],0) -- (1.25*chem_width[1],0) ; + chem_r_zero [1] := point 1 of chem_r_path [1] ; + chem_b_path [1] := chem_r_path[1] rotated + (chem_angle[1]) ; % used for move here + chem_b_zero [1] := chem_r_zero[1] ; + chem_crz_zero [1] := chem_r_zero[1] enlonged chem_center_offset ; + chem_e_path [1] := (.5*chem_width[1],-.25*chem_width[1]) -- (.5*chem_width[1],.25*chem_width[1]) ; + chem_sb_path [1] := chem_r_path [1] ; + chem_msb_path [1] := chem_r_path [1] shifted (0,-.1chem_width[1]) ; + chem_psb_path [1] := chem_r_path [1] shifted (0, .1chem_width[1]) ; + chem_ddt_path [1] := subpath(0,.4) of chem_r_path [1] ; + chem_ddb_path [1] := subpath(.6,1) of chem_r_path [1] ; + chem_ldt_path [1] := chem_ddt_path [1] shifted (0,-.1chem_width[1]) ; % parallel + chem_ldb_path [1] := chem_ddb_path [1] shifted (0,-.1chem_width[1]) ; + chem_rdt_path [1] := chem_ddt_path [1] shifted (0, .1chem_width[1]) ; + chem_rdb_path [1] := chem_ddb_path [1] shifted (0, .1chem_width[1]) ; save pr ; pair pr[] ; - pr0 := point 0 of chem_sb_path[1] ; - pr1 := point 1 of chem_sb_path[1] ; - chem_bb_path [1] := pr0 -- (pr1 rotatedaround(pr0,-chem_bb_angle)) -- - (pr1 rotatedaround(pr0,+chem_bb_angle)) -- cycle ; + pr0 := point 0 of chem_r_path[1] ; + pr1 := point 1 of chem_r_path[1] ; + chem_bb_path [1] := pr0 -- (pr1 rotatedaround(pr0,-chem_bb_angle)) -- (pr1 rotatedaround(pr0,chem_bb_angle)) -- cycle ; chem_oe_path [1] := ((-20,0)--(10,0){up}..(20,10)..(30,0)..(40,-10)..(50.0,0)..(60,10)..(70,0)..(80,-10)..{up}(90,0)--(120,0)) - xsized (abs(pr1-pr0)) shifted pr0 ; + xsized (.75*chem_width[1]) shifted pr0 ; + chem_rt_zero [1] := point .5 of chem_r_path[1] ; + chem_rtt_zero [1] := chem_rt_zero[1] rotated + (chem_angle[1]/2) ; + chem_rbt_zero [1] := chem_rt_zero[1] rotated - (chem_angle[1]/2) ; + % added by Alan Braslau (adapted to use shared variables): save p ; pair p[] ; p0 := pr1 rotatedaround(pr0, -chem_bd_angle) ; p1 := pr1 rotatedaround(pr0, +chem_bd_angle) ; - p2 := p0 shifted -pr1 ; - p3 := p1 shifted -pr1 ; + p2 := p0 shifted - pr1 ; + p3 := p1 shifted - pr1 ; chem_bd_path [1] := p0 -- p1 for i=chem_bd_n downto 0 : - -- p2 shifted (i/chem_bd_n)[pr1,pr0] - -- p3 shifted (i/chem_bd_n)[pr1,pr0] + -- p2 shifted (i/chem_bd_n)[pr1,pr0] + -- p3 shifted (i/chem_bd_n)[pr1,pr0] endfor ; chem_bw_path [1] := for i=0 upto chem_bw_n - 1 : - ((i) /chem_bw_n)[pr0,pr1] .. ((i+.25)/chem_bw_n)[pr0,pr1] shifted +p2 .. + ((i) /chem_bw_n)[pr0,pr1] .. ((i+.25)/chem_bw_n)[pr0,pr1] shifted p2 .. ((i+.50)/chem_bw_n)[pr0,pr1] .. ((i+.75)/chem_bw_n)[pr0,pr1] shifted -p2 .. endfor pr1 ; enddef ; diff --git a/metapost/context/base/mp-core.mpiv b/metapost/context/base/mp-core.mpiv index 3dba4a004..1934e3040 100644 --- a/metapost/context/base/mp-core.mpiv +++ b/metapost/context/base/mp-core.mpiv @@ -5,7 +5,7 @@ %D subtitle=background macros, %D author=Hans Hagen, %D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for diff --git a/metapost/context/base/mp-crop.mpiv b/metapost/context/base/mp-crop.mpiv index 00bcdcb44..6360757e5 100644 --- a/metapost/context/base/mp-crop.mpiv +++ b/metapost/context/base/mp-crop.mpiv @@ -5,7 +5,7 @@ %D subtitle=Cropmarks, %D author=Hans Hagen, %D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for @@ -15,20 +15,20 @@ if known context_crop : endinput ; fi ; boolean context_crop ; context_crop := true ; -vardef crop_marks_lines (expr box, len, offset, nx, ny) = - save p ; picture p ; save w, h, x, y ; numeric w, h, x, y ; +vardef crop_marks_lines (expr box, length, offset, nx, ny) = + save p ; picture p ; save w, h, x, y ; numeric w, h, x, y ; p := image ( x := if nx = 0 : 1 else : nx - 1 fi ; y := if ny = 0 : 1 else : ny - 1 fi ; w := bbwidth (box) / x ; h := bbheight(box) / y ; for i=0 upto y : - draw ((llcorner box) -- (llcorner box) shifted (-len,0)) shifted (-offset,i*h) ; - draw ((lrcorner box) -- (lrcorner box) shifted ( len,0)) shifted ( offset,i*h) ; + draw ((llcorner box) -- (llcorner box) shifted (-length,0)) shifted (-offset,i*h) ; + draw ((lrcorner box) -- (lrcorner box) shifted ( length,0)) shifted ( offset,i*h) ; endfor ; for i=0 upto x : - draw ((llcorner box) -- (llcorner box) shifted (0,-len)) shifted (i*w,-offset) ; - draw ((ulcorner box) -- (ulcorner box) shifted (0, len)) shifted (i*w, offset) ; + draw ((llcorner box) -- (llcorner box) shifted (0,-length)) shifted (i*w,-offset) ; + draw ((ulcorner box) -- (ulcorner box) shifted (0, length)) shifted (i*w, offset) ; endfor ; ) ; setbounds p to box ; diff --git a/metapost/context/base/mp-figs.mpiv b/metapost/context/base/mp-figs.mpiv index aac7c5ad2..c65808f6d 100644 --- a/metapost/context/base/mp-figs.mpiv +++ b/metapost/context/base/mp-figs.mpiv @@ -5,7 +5,7 @@ %D subtitle=figures, %D author=Hans Hagen, %D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See licen-en.pdf for diff --git a/metapost/context/base/mp-form.mpiv b/metapost/context/base/mp-form.mpiv index b58792e1a..d0519b4f2 100644 --- a/metapost/context/base/mp-form.mpiv +++ b/metapost/context/base/mp-form.mpiv @@ -5,7 +5,7 @@ %D subtitle=form support, %D author=Hans Hagen, %D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See licen-en.pdf for diff --git a/metapost/context/base/mp-func.mpiv b/metapost/context/base/mp-func.mpiv index 58df711f2..1d289b606 100644 --- a/metapost/context/base/mp-func.mpiv +++ b/metapost/context/base/mp-func.mpiv @@ -5,7 +5,7 @@ %D subtitle=function hacks, %D author=Hans Hagen, %D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See licen-en.pdf for diff --git a/metapost/context/base/mp-grap.mpiv b/metapost/context/base/mp-grap.mpiv deleted file mode 100644 index 68d95c9eb..000000000 --- a/metapost/context/base/mp-grap.mpiv +++ /dev/null @@ -1,202 +0,0 @@ -%D \module -%D [ file=mp-grap.mpiv, -%D version=2012.10.16, % 2008.09.08 and earlier, -%D title=\CONTEXT\ \METAPOST\ graphics, -%D subtitle=graph packagesupport, -%D author=Hans Hagen \& Alan Braslau, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See licen-en.pdf for -%C details. - -if known context_grap : endinput ; fi ; - -boolean context_grap ; context_grap := true ; - -input graph.mp ; - -vardef roundd(expr x, d) = - if abs d > 4 : - if d > 0 : - x - else : - 0 - fi - elseif d > 0 : - save i ; i = floor x ; - i + round(Ten_to[d]*(x-i))/Ten_to[d] - else : - round(x/Ten_to[-d])*Ten_to[-d] - fi -enddef ; - -Ten_to0 = 1 ; -Ten_to1 = 10 ; -Ten_to2 = 100 ; -Ten_to3 = 1000 ; -Ten_to4 = 10000 ; - -def sFe_base = enddef ; - -if unknown Fe_plus : - picture Fe_plus ; Fe_plus := textext("+") ; % btex + etex ; -fi ; - -vardef format (expr f,x) = dofmt_.Feform_(f,x) enddef ; -vardef Mformat (expr f,x) = dofmt_.Meform (f,x) enddef ; -vardef formatstr (expr f,x) = dofmt_.Feform_(f,x) enddef ; -vardef Mformatstr(expr f,x) = dofmt_.Meform(f,x) enddef ; - -vardef escaped_format(expr s) = - "" for n=1 upto length(s) : & - if ASCII substring (n,n+1) of s = 37 : - "@" - else : - substring (n,n+1) of s - fi - endfor -enddef ; - -vardef dofmt_@#(expr f, x) = - % textext("\MPgraphformat{" & escaped_format(f) & "}{" & (if string x : x else: decimal x fi) & "}") - textext(mfun_format_number(escaped_format(f),x)) -enddef ; - -% We redefine autogrid from graph.mp adding the possibility of differing X and Y -% formats. Autoform is defined in graph.mp (by default "%g"). -% -% string Autoform_X ; Autoform_X := "@.0e" ; -% string Autoform_Y ; Autoform_Y := "@.0e" ; - -vardef autogrid(suffix tx, ty) text w = - Gneedgr_ := false ; - if str tx <> "" : - for x=auto.x : - tx ( - if string Autoform_X : - if Autoform_X <> "" : - Autoform_X - else : - Autoform - fi - else : - Autoform - fi, - x) w ; - endfor - fi ; - if str ty <> "" : - for y=auto.y : - ty ( - if string Autoform_Y : - if Autoform_Y <> "" : - Autoform_Y - else : - Autoform - fi - else : - Autoform - fi, - y) w ; - endfor - fi ; -enddef ; - -% A couple of extensions: - -% Define a vector function sym returning a picture: 10 different shapes, -% unfilled outline, interior filled with different shades of the background. -% Thus, overlapping points on a plot are more clearly distinguishable. - -% grap_symsize := fontsize defaultfont ; % can be redefined -% -% dynamic version: - -vardef grap_symsize = - fontsize defaultfont -enddef ; - -path grap_sym[] ; % (internal) symbol path - -grap_sym[0] := (0,0) ; % point -grap_sym[1] := fullcircle ; % circle -grap_sym[2] := (up -- down) scaled .5 ; % vertical bar - -for i = 3 upto 9 : % polygons - grap_sym[i] := for j = 0 upto i-1 : - (up scaled .5) rotated (j*360/i) -- - endfor cycle ; -endfor - -grap_sym[12] := grap_sym[2] rotated +90 ; % horizontal line -grap_sym[22] := grap_sym[2] rotated +45 ; % backslash -grap_sym[32] := grap_sym[2] rotated -45 ; % slash -grap_sym[13] := grap_sym[3] rotated 180 ; % down triangle -grap_sym[23] := grap_sym[3] rotated -90 ; % right triangle -grap_sym[33] := grap_sym[3] rotated +90 ; % left triangle -grap_sym[14] := grap_sym[4] rotated +45 ; % square -grap_sym[15] := grap_sym[5] rotated 180 ; % down pentagon -grap_sym[16] := grap_sym[6] rotated +90 ; % turned hexagon -grap_sym[17] := grap_sym[7] rotated 180 ; -grap_sym[18] := grap_sym[8] rotated +22.5 ; - -numeric l ; - -for j = 5 upto 9 : - l := length(grap_sym[j]) ; - pair p[] ; - for i = 0 upto l : - p[i] = whatever [point i of grap_sym[j], - point (i+2 mod l) of grap_sym[j]] ; - p[i] = whatever [point (i+1 mod l) of grap_sym[j], - point (i+l-1 mod l) of grap_sym[j]] ; - endfor - grap_sym[20+j] := for i = 0 upto l : point i of grap_sym[j]--p[i]--endfor cycle ; -endfor - -path s ; s := grap_sym[4] ; -path q ; q := s scaled .25 ; -numeric l ; l := length(s) ; - -pair p[] ; - -grap_sym[24] := for i = 0 upto l-1 : - hide( - p[i] = whatever [point i of s, point (i+1 mod l) of s] ; - p[i] = whatever [point i of q, point (i-1+l mod l) of q] ; - p[i+l] = whatever [point i of s, point (i+1 mod l) of s] ; - p[i+l] = whatever [point i+1 of q, point (i+2 mod l) of q] ; - ) - point i of q -- p[i] -- p[i+l] -- -endfor cycle ; - -grap_sym[34] := grap_sym[24] rotated 45 ; - - % usage: gdraw p plot plotsymbol(1,red,1) ; % a filled red circle - % usage: gdraw p plot plotsymbol(4,blue,0) ; % a blue square - % usage: gdraw p plot plotsymbol(14,green,0.5) ; % a 50% filled green diamond - -def plotsymbol(expr n,c,f) = % (number,color,color|number) - if known grap_sym[n] : - image( - path p ; p := grap_sym[n] scaled grap_symsize ; - undraw p withpen currentpen scaled 2 ; - if cycle p : fill p withcolor - if color f and known f : - f - elseif numeric f and known f and color c and known c : - f[background,c] - elseif numeric f and known f : - f[background,black] - else : - background - fi ; - fi - draw p if color c and known c : withcolor c fi ; - ) - else : - nullpicture - fi -enddef ; diff --git a/metapost/context/base/mp-grid.mpiv b/metapost/context/base/mp-grid.mpiv index b9243b1b9..cc5c2b76e 100644 --- a/metapost/context/base/mp-grid.mpiv +++ b/metapost/context/base/mp-grid.mpiv @@ -5,7 +5,7 @@ %D subtitle=grid support, %D author=Hans Hagen, %D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See licen-en.pdf for diff --git a/metapost/context/base/mp-grph.mpiv b/metapost/context/base/mp-grph.mpiv index 30c49e6e0..a8868033b 100644 --- a/metapost/context/base/mp-grph.mpiv +++ b/metapost/context/base/mp-grph.mpiv @@ -5,7 +5,7 @@ %D subtitle=graphic text support, %D author=Hans Hagen, %D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See licen-en.pdf for diff --git a/metapost/context/base/mp-mlib.mpiv b/metapost/context/base/mp-mlib.mpiv index b8fabbfb9..71985cef8 100644 --- a/metapost/context/base/mp-mlib.mpiv +++ b/metapost/context/base/mp-mlib.mpiv @@ -5,7 +5,7 @@ %D subtitle=plugins, %D author=Hans Hagen, %D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See licen-en.pdf for @@ -255,7 +255,7 @@ vardef thetextext@#(expr p,z) = fi enddef ; -vardef textext@#(expr p) = % no draw here +vardef textext@#(expr p) = % no draw hers thetextext@#(p,origin) enddef ; @@ -614,28 +614,3 @@ primarydef t asgroup s = % s = isolated|knockout wrappedpicture endgroup enddef ; - -% Also experimental - -string mfun_auto_align[] ; - -mfun_auto_align[0] := "rt" ; -mfun_auto_align[1] := "urt" ; -mfun_auto_align[2] := "top" ; -mfun_auto_align[3] := "ulft" ; -mfun_auto_align[4] := "lft" ; -mfun_auto_align[5] := "llft" ; -mfun_auto_align[6] := "bot" ; -mfun_auto_align[7] := "lrt" ; -mfun_auto_align[8] := "rt" ; - -def autoalign(expr n) = - scantokens mfun_auto_align[round((n mod 360)/45)] -enddef ; - -% draw textext.autoalign(60) ("\strut oeps 1") ; -% draw textext.autoalign(160)("\strut oeps 2") ; -% draw textext.autoalign(260)("\strut oeps 3") ; -% draw textext.autoalign(360)("\strut oeps 4") ; - - diff --git a/metapost/context/base/mp-page.mpiv b/metapost/context/base/mp-page.mpiv index c8e3c6237..96f617257 100644 --- a/metapost/context/base/mp-page.mpiv +++ b/metapost/context/base/mp-page.mpiv @@ -5,7 +5,7 @@ %D subtitle=page enhancements, %D author=Hans Hagen, %D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for diff --git a/metapost/context/base/mp-shap.mpiv b/metapost/context/base/mp-shap.mpiv index 713656510..b62e636d5 100644 --- a/metapost/context/base/mp-shap.mpiv +++ b/metapost/context/base/mp-shap.mpiv @@ -5,7 +5,7 @@ %D subtitle=shapes, %D author=Hans Hagen, %D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See licen-en.pdf for diff --git a/metapost/context/base/mp-step.mpiv b/metapost/context/base/mp-step.mpiv index f7a7ba5de..654ef443d 100644 --- a/metapost/context/base/mp-step.mpiv +++ b/metapost/context/base/mp-step.mpiv @@ -5,7 +5,7 @@ %D subtitle=steps, %D author=Hans Hagen, %D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See licen-en.pdf for diff --git a/metapost/context/base/mp-text.mpiv b/metapost/context/base/mp-text.mpiv index b68e8412a..d5630f68e 100644 --- a/metapost/context/base/mp-text.mpiv +++ b/metapost/context/base/mp-text.mpiv @@ -5,7 +5,7 @@ %D subtitle=text support, %D author=Hans Hagen, %D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See licen-en.pdf for diff --git a/metapost/context/base/mp-tool.mpiv b/metapost/context/base/mp-tool.mpiv index cdf0e02a9..764863b65 100644 --- a/metapost/context/base/mp-tool.mpiv +++ b/metapost/context/base/mp-tool.mpiv @@ -5,14 +5,12 @@ %D subtitle=auxiliary macros, %D author=Hans Hagen, %D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -% def loadfile(expr name) = scantokens("input " & name & ";") enddef ; - if known context_tool : endinput ; fi ; boolean context_tool ; context_tool := true ; |