summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--metapost/context/base/mp-chem.mpiv262
-rw-r--r--tex/context/base/chem-str.lua27
-rw-r--r--tex/context/base/chem-str.mkiv57
-rw-r--r--tex/context/base/cont-new.mkii2
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4143 -> 4144 bytes
-rw-r--r--tex/context/base/context-version.pngbin105861 -> 106760 bytes
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/file-job.lua21
-rw-r--r--tex/context/base/grph-inc.lua16
-rw-r--r--tex/context/base/m-graph.mkiv22
-rw-r--r--tex/context/base/mult-def.mkiv2
-rw-r--r--tex/context/base/status-files.pdfbin24580 -> 24573 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin195370 -> 195374 bytes
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
16 files changed, 262 insertions, 155 deletions
diff --git a/metapost/context/base/mp-chem.mpiv b/metapost/context/base/mp-chem.mpiv
index 066a60bfd..59179ed85 100644
--- a/metapost/context/base/mp-chem.mpiv
+++ b/metapost/context/base/mp-chem.mpiv
@@ -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_max, chem_circle_radius,
+ chem_width, chem_radical_min, chem_radical_max, chem_text_min, 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 ;
@@ -41,24 +41,26 @@ pair
chem_adjacent_p, chem_substituent_p, chem_direction_p, chem_move_p ;
numeric
- chem_width[], chem_angle[], chem_start[], chem_initialrot[], chem_initialmov[] ;
+ chem_width[], chem_angle[], chem_dbl_offset[], chem_initialmov[] ;
pair
chem_stack_d[],
chem_b_zero[], chem_n_zero[],
- chem_r_max[], chem_r_min[],
+ chem_r_max[],
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_sd_path[], chem_bb_path[], chem_oe_path[],
+ chem_e_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[],
@@ -69,18 +71,18 @@ path
chem_midt_path[], chem_midb_path[], chem_midst_path[], chem_midsb_path[] ;
chem_setting_scale := 1 ;
-chem_base_width := 40pt ;
-chem_text_offset := 3pt ;
+chem_base_width := 40pt ; % Should this rather follow the font size?
+chem_text_offset := 3pt ; % ?
chem_center_offset := 6pt ;
-chem_picture_offset := 10pt ;
-chem_substituent_offset := 10pt ;
+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_radical_min := 1.25 ;
chem_radical_max := 1.50 ;
chem_text_min := 0.75 ;
-chem_text_max := 1.75 ;
+chem_text_max := 1.25 ;
chem_circle_radius := 0.80 ;
chem_circle_radius := 1.10 ;
-chem_rotation := 1 ;
+chem_rotation := 0 ;
chem_adjacent := 0 ;
chem_substituent := 0 ;
chem_direction := 0 ;
@@ -96,6 +98,7 @@ 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 ;
@@ -108,7 +111,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 := 1 ;
+ chem_rotation := 0 ;
chem_adjacent := 0 ;
chem_substituent := 0 ;
chem_direction := 0 ;
@@ -227,13 +230,8 @@ vardef chem_eb (expr n, f, t, r, c) =
enddef ;
vardef chem_db (expr 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 ;
+ chem_draw (n, chem_dbl_path [n], f, t, r, c) ;
+ chem_draw (n, chem_dbr_path [n], f, t, r, c) ;
enddef ;
vardef chem_er (expr n, f, t, r, c) =
@@ -319,7 +317,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, t, r, c)
+ chem_draw (n, chem_c_path[n], f, f, r, c)
enddef ;
vardef chem_cc (expr n, f, t, r, c) =
@@ -327,7 +325,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, t, r, c)
+ chem_dashed_connected (n, chem_c_path[n], f, f, r, c)
enddef ;
vardef chem_ccd (expr n, f, t, r, c) =
@@ -347,13 +345,13 @@ vardef chem_rbn (expr n, i, t) =
enddef ;
vardef chem_tb (expr n, f, t, r, c) = % one
- 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) ;
+ 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) ;
enddef ;
vardef chem_ep (expr n, f, t, r, c) = % one
- chem_draw (n, chem_e_path[n], f, t, r, c) ;
+ chem_draw (n, (subpath (.25,.75) of chem_e_path[n]), f, t, r, c) ;
enddef ;
vardef chem_es (expr n, f, t, r, c) = % one
@@ -361,8 +359,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 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) ;
+ 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) ;
enddef ;
vardef chem_et (expr n, f, t, r, c) = % one
@@ -379,11 +377,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_psb_path[n], f, t, r, c) ;
+ chem_draw (n, chem_sb_path [n], f, t, r, c) ;
enddef ;
vardef chem_ldd (expr n, f, t, r, c) = % one
- 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_rdt_path[n], f, t, r, c) ;
chem_draw (n, chem_rdb_path[n], f, t, r, c) ;
enddef ;
@@ -394,10 +392,11 @@ 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
+vardef chem_bb (expr n, f, t, r, c) = % one and front
if n < 0 :
- chem_fill (n, chem_bb_path[n], 1, 1, r, c) ;
- chem_b (n, f, t, r, c) ;
+ if ((f = 1) and (t = -n)) : % ignore all but "BB"
+ chem_fill (n, chem_bb_path[n], 1, 1, r, c) ;
+ fi
else :
chem_fill (n, chem_bb_path[n], f, t, r, c) ;
fi ;
@@ -434,7 +433,9 @@ vardef chem_z@#(expr n, p) (text t) =
enddef ;
vardef chem_cz@#(expr n, p) (text t) =
- if n = 1 :
+ if p = 0 :
+ chem_text@#(t, chem_do(origin)) ;
+ elseif 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))) ;
@@ -445,12 +446,37 @@ 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 :
- chem_text@#(t, chem_do(chem_r_zero[n] rotated chem_ang(n,p))) ;
+ 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
fi ;
enddef ;
@@ -489,35 +515,27 @@ vardef chem_rbt@#(expr n, p) (text t) =
enddef ;
vardef chem_zt@#(expr n, p) (text 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 ;
+ chem_text@#(t, chem_do(chem_n_zero[n] rotated chem_ang(n,p))) ;
enddef ;
vardef chem_zn@#(expr n, p) (text 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 ;
+ chem_zt@#(n, p, t) ;
enddef ;
vardef chem_zbt@#(expr n, p) (text t) =
- chem_text@#(t, chem_do(chem_rtt_zero[n] rotated chem_ang(n,p))) ;
+ chem_text@#(t, chem_do(chem_zbt_zero[n] rotated chem_ang(n,p))) ;
enddef ;
vardef chem_zbn@#(expr n, p) (text t) =
- chem_text@#(t, chem_do(chem_rtt_zero[n] rotated chem_ang(n,p))) ;
+ chem_zbt@#(n, p, t) ;
enddef ;
vardef chem_ztt@#(expr n, p) (text t) =
- chem_text@#(t, chem_do(chem_rbt_zero[n] rotated chem_ang(n,p))) ;
+ chem_text@#(t, chem_do(chem_ztt_zero[n] rotated chem_ang(n,p))) ;
enddef ;
vardef chem_ztn@#(expr n, p) (text t) =
- chem_text@#(t, chem_do(chem_rbt_zero[n] rotated chem_ang(n,p))) ;
+ chem_ztt@#(n, p, t) ;
enddef ;
vardef chem_symbol(expr t) =
@@ -550,12 +568,14 @@ vardef chem_c_text(expr txt, z) = % adapted copy of thelabel@
% draw a withcolor red ;
enddef ;
-vardef chem_ang (expr n, d) =
- ((1-d)*chem_angle[n] + (1-chem_rotation)*90 + chem_start[n]) % no ;
+vardef chem_ang (expr n, d) =
+ ((1 - d)*chem_angle[n] + if (n<0): -90 else: chem_rotation fi) % no ;
enddef ;
vardef chem_rot (expr n, d) =
- chem_rotation := d ;
+ if (d <> 0) :
+ chem_rotation := chem_rotation + 180/(if (d=1): 8 else: abs(d) fi) ;
+ fi
enddef ;
vardef chem_adj (expr n, d) =
@@ -579,9 +599,11 @@ 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 := (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]) ;
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 ;
@@ -620,7 +642,6 @@ 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) =
@@ -680,7 +701,7 @@ vardef chem_save =
chem_shift := origin ;
% chem_adjacent := 0 ;
% chem_substituent := 0 ;
-% chem_rotation := 1 ;
+% chem_rotation := 0 ;
currentpicture := nullpicture ;
enddef ;
@@ -695,12 +716,12 @@ vardef chem_restore =
fi ;
enddef ;
-def chem_init_some(expr n, initialrot, initialmov, front) =
+def chem_init_some(expr n) =
+ boolean front ; front := n < 0 ;
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_start [n] := 0 ;
- chem_initialrot[n] := initialrot ;
- chem_initialmov[n] := initialmov ;
+ 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] ;
@@ -713,32 +734,38 @@ def chem_init_some(expr n, initialrot, initialmov, front) =
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_au_path [n] := subpath (0.2,0.8) of (chem_r_max[n] -- (chem_r_max[n] rotated chem_angle[n])) ;
+ 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_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_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_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_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_sr_path [n] := chem_radical_min*chem_b_zero[n] -- chem_r_max[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_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_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 ;
@@ -747,81 +774,80 @@ def chem_init_some(expr n, initialrot, initialmov, front) =
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_psr_path [n] := chem_sr_path[n] rotatedaround(chem_b_zero[n],-(180-chem_angle[n])/2) ;
- % 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]));
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 (chem_base_width/20))) paralleled (chem_base_width/20) --
- cycle ;
- chem_r_max [n] := chem_radical_max*chem_b_zero[n] ;
+ 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_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] ;
+ chem_r_path [n] := chem_mr_zero[n] -- chem_pr_zero[n] ;
fi
enddef ;
-def chem_init_three = chem_init_some(3,1,2,false) ; enddef ;
-def chem_init_four = chem_init_some(4,1,0,false) ; enddef ;
-def chem_init_five = chem_init_some(5,1,0,false) ; enddef ;
-def chem_init_six = chem_init_some(6,1,0,false) ; enddef ;
-def chem_init_eight = chem_init_some(8,1,0,false) ; enddef ;
-def chem_init_five_front = chem_init_some(-5,2,0,true) ; enddef ;
-def chem_init_six_front = chem_init_some(-6,2,0,true) ; 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 ;
% bb R -R R Z -RZ +RZ
vardef chem_init_one =
- chem_width [1] := chem_setting_scale * chem_base_width ;
chem_angle [1] := 360/8 ;
- chem_start [1] := 0 ;
- chem_initialrot[1] := 1 ;
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_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] := (.5*chem_width[1],0) -- (1.25*chem_width[1],0) ;
- 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] := (.5*chem_width[1],-.25*chem_width[1]) -- (.5*chem_width[1],.25*chem_width[1]) ;
- chem_sb_path [1] := subpath(.25,.75) of chem_b_path [1] ;
- chem_msb_path [1] := subpath (0.00,0.75) of chem_b_path[1] ;
- chem_psb_path [1] := subpath (0.25,1.00) of chem_b_path[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]) ;
+ 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] ;
save pr ; pair pr[] ;
- 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 ;
+ 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 ;
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 (.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):
+ xsized (abs(pr1-pr0)) shifted pr0 ;
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/tex/context/base/chem-str.lua b/tex/context/base/chem-str.lua
index a794f5fe7..3c1b88123 100644
--- a/tex/context/base/chem-str.lua
+++ b/tex/context/base/chem-str.lua
@@ -55,6 +55,7 @@ local common_keys = {
mid = "fixed", mids = "fixed", midz = "text",
z = "text", rz = "text", mrz = "text", prz = "text", crz = "text",
rt = "text", rtt = "text", rbt = "text", zt = "text", zn = "number",
+ zbt = "text", zbn = "number", ztt = "text", ztn = "number",
mov = "transform", rot = "transform", adj = "transform", sub = "transform",
off = "transform",
}
@@ -64,6 +65,7 @@ local front_keys = {
sb = "line", msb = "line", psb = "line",
r = "line", pr = "line", mr = "line",
z = "text", mrz = "text", prz = "text",
+ zt = "text", zn = "number",
}
local one_keys = {
@@ -86,15 +88,16 @@ local syntax = {
one = {
n = 1, max = 8, keys = one_keys,
align = {
--- z = { { "r", "r_b", "b", "l_b", "l", "l_t", "t", "r_t" } },
---~ z = { { "r", "r", "b", "l", "l", "l", "t", "r" } },
+ -- z = { { "r", "r_b", "b", "l_b", "l", "l_t", "t", "r_t" } },
+ -- z = { { "r", "r", "b", "l", "l", "l", "t", "r" } },
}
},
three = {
n = 3, max = 3, keys = common_keys,
align = {
mrz = { { "r","b","l" }, { "b","l","t" }, { "l","t","r" }, { "t","r","b" } },
- rz = { { "r_t","r_b","l" }, { "r_b","l_b","t" }, { "l_b","l_t","r" }, { "l_t","r_t","b" } },
+ rz = { { "auto","auto","auto" }, { "auto","auto","auto" }, { "auto","auto","auto" }, { "auto","auto","auto" } },
+ -- rz = { { "r_t","r_b","l" }, { "r_b","l_b","t" }, { "l_b","l_t","r" }, { "l_t","r_t","b" } },
prz = { { "r","l","t" }, { "b","t","r" }, { "l","r","b" }, { "t","b","l" } },
}
},
@@ -102,7 +105,8 @@ local syntax = {
n = 4, max = 4, keys = common_keys,
align = {
mrz = { { "t","r","b","l" }, { "r","b","l","t" }, { "b","l","t","r" }, { "l","t","r","b" } },
- rz = { { "r_t","r_b","l_b","l_t" }, { "r_b","l_b","l_t","r_t" }, { "l_b","l_t","r_t","r_b" }, { "l_t","r_t","r_b","l_b" } },
+ rz = { { "auto","auto","auto","auto" }, { "auto","auto","auto","auto" }, { "auto","auto","auto","auto" }, { "auto","auto","auto","auto" } },
+ -- rz = { { "r_t","r_b","l_b","l_t" }, { "r_b","l_b","l_t","r_t" }, { "l_b","l_t","r_t","r_b" }, { "l_t","r_t","r_b","l_b" } },
prz = { { "r","b","l","t" }, { "b","l","t","r" }, { "l","t","r","b" }, { "t","r","b","l" } },
}
},
@@ -110,7 +114,8 @@ local syntax = {
n = 5, max = 5, keys = common_keys,
align = {
mrz = { { "t","r","b","b","l" }, { "r","b","l","l","t" }, { "b","l","t","r","r" }, { "l","t","r","r","b" } },
- rz = { { "r","r","b","l","t" }, { "b","b","l","t","r" }, { "l","l","t","r","b" }, { "t","t","r","b","l" } },
+ rz = { { "auto","auto","auto","auto","auto" }, { "auto","auto","auto","auto","auto" }, { "auto","auto","auto","auto","auto" }, { "auto","auto","auto","auto","auto" } },
+ -- rz = { { "r","r","b","l","t" }, { "b","b","l","t","r" }, { "l","l","t","r","b" }, { "t","t","r","b","l" } },
prz = { { "r","b","l","t","t" }, { "b","l","t","r","r" }, { "l","t","r","b","b" }, { "t","r","b","l","l" } },
}
},
@@ -118,7 +123,8 @@ local syntax = {
n = 6, max = 6, keys = common_keys,
align = {
mrz = { { "t","t","r","b","b","l" }, { "r","b","b","l","t","t" }, { "b","b","l","t","t","r" }, { "l","t","t","r","b","b" } },
- rz = { { "r","r","b","l","l","t" }, { "b","b","l","t","t","r" }, { "l","l","t","r","r","b" }, { "t","t","r","b","b","l" } },
+ rz = { { "auto","auto","auto","auto","auto","auto" }, { "auto","auto","auto","auto","auto","auto" }, { "auto","auto","auto","auto","auto","auto" }, { "auto","auto","auto","auto","auto","auto" } },
+ -- rz = { { "r","r","b","l","l","t" }, { "b","b","l","t","t","r" }, { "l","l","t","r","r","b" }, { "t","t","r","b","b","l" } },
prz = { { "r","b","l","l","t","r" }, { "b","l","t","t","r","b" }, { "l","t","r","r","b","l" }, { "t","r","b","b","l","t" } },
}
},
@@ -126,7 +132,8 @@ local syntax = {
n = 8, max = 8, keys = common_keys,
align = { -- todo
mrz = { { "t","r","r","b","b","l","l","t" }, { "r","b","b","l","l","t","t","r" }, { "b","l","l","t","t","r","r","b" }, { "l","t","t","r","r","b","b","l" } },
- rz = { { "r","r","b","b","l","l","t","t" }, { "b","b","l","l","t","t","r","r" }, { "l","l","t","t","r","r","b","b" }, { "t","t","r","r","b","b","l","l" } },
+ rz = { { "auto","auto","auto","auto","auto","auto","auto","auto" }, { "auto","auto","auto","auto","auto","auto","auto","auto" }, { "auto","auto","auto","auto","auto","auto","auto","auto" }, { "auto","auto","auto","auto","auto","auto","auto","auto" } },
+ -- rz = { { "r","r","b","b","l","l","t","t" }, { "b","b","l","l","t","t","r","r" }, { "l","l","t","t","r","r","b","b" }, { "t","t","r","r","b","b","l","l" } },
prz = { { "r","b","b","l","l","t","t","r" }, { "b","l","l","t","t","r","r","b" }, { "l","t","t","r","r","b","b","l" }, { "t","r","r","b","b","l","l","t" } },
}
},
@@ -344,7 +351,8 @@ local function process(spec,text,n,rulethickness,rulecolor,offset)
if not t then txt, t = fetch(txt) end
if t then
t = molecule(processor_tostring(t))
- m = m + 1 ; metacode[m] = format('chem_%s_zero("\\chemicaltext{%s}");',operation,t)
+ m = m + 1 ; metacode[m] = format('chem_%s(%s,%s,"\\chemicaltext{%s}");',operation,bonds,index,t)
+ -- m = m + 1 ; metacode[m] = format('chem_%s_zero("\\chemicaltext{%s}");',operation,t)
end
elseif index then
local t = text
@@ -455,7 +463,8 @@ function chemistry.start(settings)
tostring(settings.axis == variables.on), tostring(width), tostring(height), tostring(offset)
)
--
- variant, keys, bonds, stack, rot, pstack = "six", { }, 6, { }, 1, { }
+ -- variant, keys, bonds, stack, rot, pstack = "six", { }, 6, { }, 1, { }
+ variant, keys, bonds, stack, rot, pstack = "one", { }, 1, { }, 1, { }
end
function chemistry.stop()
diff --git a/tex/context/base/chem-str.mkiv b/tex/context/base/chem-str.mkiv
index 121adf6fd..64e2679dc 100644
--- a/tex/context/base/chem-str.mkiv
+++ b/tex/context/base/chem-str.mkiv
@@ -28,24 +28,24 @@
% Here we use chemicalformula instead, so no longer a mix:
%
% \startchemicalformula
-% \chemical{H_2}{top}{bottom}
+% \chemical{2H_2}{top}{bottom}
% \chemical{PLUS}{top}{bottom}
-% \chemical{O}{top}{bottom}
+% \chemical{O_2}{top}{bottom}
% \chemical{GIVES}{top}{bottom}
-% \chemical{H_2O}{top}{bottom}
+% \chemical{2H_2O}{top}{bottom}
% \stopchemicalformula
%
% \startchemicalformula
-% \chemical{H_2}
+% \chemical{2H_2}
% \chemical{PLUS}
-% \chemical{O}
+% \chemical{O_2}
% \chemical{GIVES}
-% \chemical{H_2O}
+% \chemical{2H_2O}
% \stopchemicalformula
%
% The inline variant has only one argument:
%
-% \chemical{H_2,PLUS,O,GIVES,H_2O}
+% \chemical{2H_2,PLUS,O_2,GIVES,2H_2O}
% todo: seven | eight | frontsix | fontfive | carbon | newmans | chair
@@ -456,12 +456,12 @@
\definechemicalsymbol[i:equilibrium] [\enspace\mathematics{\xrightpverleftarrow{}{}}\enspace]
\definechemicalsymbol[i:mesomeric] [\enspace\mathematics{\xleftrightarrow{}{}}\enspace]
\definechemicalsymbol[i:single] [\chemicalbondrule]
-\definechemicalsymbol[i:tripple] [\hbox{\lower.5ex\chemicalbondrule\hskip-1em\raise.5ex\chemicalbondrule}]
-\definechemicalsymbol[i:double] [\hbox{\chemicalbondrule\hskip-1em\lower.5ex\chemicalbondrule\hskip-1em\raise.5ex\chemicalbondrule}]
+\definechemicalsymbol[i:double] [\hbox{\lower.5ex\chemicalbondrule\hskip-1em\raise.5ex\chemicalbondrule}]
+\definechemicalsymbol[i:triple] [\hbox{\chemicalbondrule\hskip-1em\lower.5ex\chemicalbondrule\hskip-1em\raise.5ex\chemicalbondrule}]
\unexpanded\def\chemicalsinglebond {\chemicalsymbol[i:single]}
-\unexpanded\def\chemicaldoublebond {\chemicalsymbol[i:tripple]}
-\unexpanded\def\chemicaltriplebond {\chemicalsymbol[i:double]}
+\unexpanded\def\chemicaldoublebond {\chemicalsymbol[i:double]}
+\unexpanded\def\chemicaltriplebond {\chemicalsymbol[i:triple]}
\unexpanded\def\chemicalgives {\chemicalsymbol[i:gives]}
\unexpanded\def\chemicalmesomeric {\chemicalsymbol[i:mesomeric]}
\unexpanded\def\chemicalequilibrium{\chemicalsymbol[i:equilibrium]}
@@ -580,6 +580,41 @@
\def\chem_formula_top_indeed#1{\strut#1}
\def\chem_formula_bot_indeed#1{\strut#1}
+% Experimental: defaults might change.
+
+\definefloat
+ [\v!chemical]
+ [\v!chemicals]
+
+\setuplabeltext
+ [\v!chemical=]
+
+\setupfloat
+ [\v!chemical]
+ [\c!location=\v!here,
+ \c!inner=\hsize.8\textwidth\dontleavehmode, % brr
+ \c!align={\v!flushleft,\v!lohi}]
+
+\setupcaption
+ [\v!chemical]
+ [\c!location=\v!right,
+ \c!distance=\zeropoint,
+ \c!width=.2\textwidth,
+ \c!align=\v!flushright]
+
+% Can be used as for displayed math: \startplaceformula... to display a chemical formula
+% or a chemical structure:
+%
+% \startplacechemical
+% \startchemicalformula
+% \chemical{2H_2}
+% \chemical{PLUS}
+% \chemical{O_2}
+% \chemical{GIVES}
+% \chemical{2H_2O}
+% \stopchemicalformula
+% \stopplacechemical
+
% gone: state option resolution offset (now frame offset) alternative
\setupchemicalframed
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index de3436ac3..902ea5681 100644
--- a/tex/context/base/cont-new.mkii
+++ b/tex/context/base/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2012.10.15 19:10}
+\newcontextversion{2012.10.15 22:38}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index c2651e60c..015cdcffc 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2012.10.15 19:10}
+\newcontextversion{2012.10.15 22:38}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 1468d8749..80f16daa8 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png
index 7c4fb75a0..10e66ac9c 100644
--- a/tex/context/base/context-version.png
+++ b/tex/context/base/context-version.png
Binary files differ
diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii
index 6a61fca48..42ccf76d5 100644
--- a/tex/context/base/context.mkii
+++ b/tex/context/base/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2012.10.15 19:10}
+\edef\contextversion{2012.10.15 22:38}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index d49877e41..bf7794936 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -25,7 +25,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2012.10.15 19:10}
+\edef\contextversion{2012.10.15 22:38}
%D For those who want to use this:
diff --git a/tex/context/base/file-job.lua b/tex/context/base/file-job.lua
index b62944abc..bced0b4d2 100644
--- a/tex/context/base/file-job.lua
+++ b/tex/context/base/file-job.lua
@@ -36,8 +36,10 @@ local basename = file.basename
local addsuffix = file.addsuffix
local removesuffix = file.removesuffix
local dirname = file.dirname
+local joinpath = file.join
local is_qualified_path = file.is_qualified_path
+local cleanpath = resolvers.cleanpath
local inputstack = resolvers.inputstack
local v_outer = variables.outer
@@ -551,9 +553,28 @@ function resolvers.jobs.currentenvironment() return topofstack(v_environment) en
local done = { }
local tolerant = false -- too messy, mkii user with the wrong sructure should adapt
+local function toppath()
+ local pathname = dirname(inputstack[#inputstack] or "")
+ if pathname == "" then
+ return "."
+ else
+ return pathname
+ end
+end
+
+resolvers.toppath = topath
+
+resolvers.prefixes.toppath = function(str)
+ local fullname = cleanpath(joinpath(toppath(),str))
+ return fullname
+end
+
local function process(what,name)
local depth = #typestack
local process
+ --
+ name = resolvers.resolve(name)
+ --
-- if not tolerant then
-- okay, would be best but not compatible with mkii
process = processors[currenttype][what]
diff --git a/tex/context/base/grph-inc.lua b/tex/context/base/grph-inc.lua
index 8ec319247..f8c9a5134 100644
--- a/tex/context/base/grph-inc.lua
+++ b/tex/context/base/grph-inc.lua
@@ -216,14 +216,16 @@ function figures.guess(filename)
if f then
local str = f:read(100)
f:close()
- for i=1,#magics do
- local pattern = magics[i]
- if pattern.pattern:match(str) then
- local format = pattern.format
- if trace_figures then
- report_inclusion("file %q has format %s",filename,format)
+ if str then
+ for i=1,#magics do
+ local pattern = magics[i]
+ if pattern.pattern:match(str) then
+ local format = pattern.format
+ if trace_figures then
+ report_inclusion("file %q has format %s",filename,format)
+ end
+ return format
end
- return format
end
end
end
diff --git a/tex/context/base/m-graph.mkiv b/tex/context/base/m-graph.mkiv
index 45903e532..35f487775 100644
--- a/tex/context/base/m-graph.mkiv
+++ b/tex/context/base/m-graph.mkiv
@@ -18,9 +18,21 @@
\startluacode
local format, gsub, find, match = string.format, string.gsub, string.find, string.match
- local function strip(s)
- s = gsub(s,"^([+-]*)0+(%d)","%1%2")
- return format("\\times10^{%s}",s)
+ local simplify = true
+
+ local function strip(n,e)
+ -- get rid of e(0)
+ e = gsub(e,"^[+-]*0+$","")
+ -- get rid of e(+*)
+ e = gsub(e,"^+","")
+ -- remove leading zeros
+ e = gsub(e,"^([+-]*)0+(%d)","%1%2")
+ if not simplify then
+ -- take it as it is
+ elseif n == "1" then
+ return format("10^{%s}",e)
+ end
+ return format("%s\\times10^{%s}",n,e)
end
function metapost.format_n(fmt,str)
@@ -28,11 +40,11 @@
local initial, hasformat, final = match(fmt,"^(.-)(%%.-[%a])(.-)$")
if hasformat then
str = format(fmt,str)
- str = gsub(str,"e(.-)$",strip)
+ str = gsub(str,"(.-)e(.-)$",strip)
str = format("%s\\mathematics{%s}%s",initial,str,final)
elseif not find(fmt,"%%") then
str = format("%"..fmt,str)
- str = gsub(str,"e(.-)$",strip)
+ str = gsub(str,"(.-)e(.-)$",strip)
str = format("\\mathematics{%s}",str)
end
context(str)
diff --git a/tex/context/base/mult-def.mkiv b/tex/context/base/mult-def.mkiv
index 4c145590d..0ee59d8c3 100644
--- a/tex/context/base/mult-def.mkiv
+++ b/tex/context/base/mult-def.mkiv
@@ -63,6 +63,8 @@
\def\v!shiftdown {shiftdown}
\def\v!construction {construction}
\def\v!unframed {unframed}
+\def\v!chemical {chemical}
+\def\v!chemicals {chemicals}
\def\s!lcgreek {lcgreek}
\def\s!ucgreek {ucgreek}
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 5b6dd8af6..8e80dfbbc 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index 46a19e3b1..4e4cf0d81 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index d87f182f7..f9b122f85 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 10/15/12 19:10:22
+-- merge date : 10/15/12 22:38:49
do -- begin closure to overcome local limits and interference