yatex

changeset 130:8703f090c628 dev

`[prefix] t e' for YaTeX-typeset-environment. It automatically mark current inner environment or portion of math mode, then call typeset-region on that region saving it in texput.tex.
author yuuji@gentei.org
date Thu, 27 May 2010 16:37:44 +0900
parents b11d6271207e
children bd0a9177e5e7
files docs/yatexe docs/yatexe.tex docs/yatexj docs/yatexj.tex yatex.el yatexlib.el yatexmth.el yatexprc.el
diffstat 8 files changed, 230 insertions(+), 142 deletions(-) [+]
line diff
     1.1 --- a/docs/yatexe	Thu May 27 13:49:44 2010 +0900
     1.2 +++ b/docs/yatexe	Thu May 27 16:37:44 2010 +0900
     1.3 @@ -121,6 +121,9 @@
     1.4               ... invoke latex
     1.5  `[prefix] t r'
     1.6               ... invoke latex on region
     1.7 +`[prefix] t e'
     1.8 +             ... invoke latex on current environment or whole
     1.9 +              portion of current formulas in math-mode.
    1.10  `[prefix] t k'
    1.11               ... kill current typesetting process
    1.12  `[prefix] t b'
    1.13 @@ -175,6 +178,12 @@
    1.14  if you edit one file, and is the same as main file's if you edit splitting
    1.15  files.
    1.16  
    1.17 +  The `[prefix] te' key automatically marks current inner environment or
    1.18 +inner math mode and then call typeset-region with marked region.  This is
    1.19 +convenient to quick view of current tabular environment or current editing
    1.20 +formulas.  Keeping previewer window for `texput.dvi' is handy for
    1.21 +debugging.
    1.22 +
    1.23  
    1.24  File: yatexe, Node: Calling previewer, Next: Printing out, Prev: Calling typesetter, Up: Typesetting
    1.25  
    1.26 @@ -2084,61 +2093,61 @@
    1.27  Node: Main features1865
    1.28  Node: Installation3456
    1.29  Node: Typesetting4232
    1.30 -Node: Calling typesetter5167
    1.31 -Node: Calling previewer6512
    1.32 -Node: Printing out6872
    1.33 -Node: %#notation7163
    1.34 -Node: Changing typesetter7538
    1.35 -Node: Splitting input files7901
    1.36 -Node: Static region for typesetting9328
    1.37 -Node: Lpr format10456
    1.38 -Node: Editing %# notation11512
    1.39 -Node: Completion12030
    1.40 -Node: Begin-type completion12589
    1.41 -Node: Section-type completion15632
    1.42 -Node: view-sectioning18066
    1.43 -Node: Large-type completion19645
    1.44 -Node: Maketitle-type completion20375
    1.45 -Node: Arbitrary completion20926
    1.46 -Node: End completion21315
    1.47 -Node: Accent completion21784
    1.48 -Node: Image completion22400
    1.49 -Node: Greek letters completion24656
    1.50 -Node: Local dictionaries25382
    1.51 -Node: Commenting out26318
    1.52 -Node: Cursor jump27776
    1.53 -Node: Jump to corresponding object28087
    1.54 -Node: Invoking image processor29487
    1.55 -Node: Jump to main file30829
    1.56 -Node: Jumping around the environment31193
    1.57 -Node: Jumping to last completion position31610
    1.58 -Node: Changing and Deleting32118
    1.59 -Node: Changing LaTeX commands32509
    1.60 -Node: Killing LaTeX commands33685
    1.61 -Node: Filling34869
    1.62 -Node: Updation of includeonly36719
    1.63 -Node: What column37515
    1.64 -Node: Intelligent newline38599
    1.65 -Node: Usepackage checker40259
    1.66 -Node: Online help40849
    1.67 -Node: Browsing file hierarchy42523
    1.68 -Node: Cooperation with other packages44259
    1.69 -Node: Customizations44963
    1.70 -Node: Lisp variables45296
    1.71 -Node: All customizable variables46299
    1.72 -Node: Sample definitions56182
    1.73 -Node: Hook variables56694
    1.74 -Node: Hook file57397
    1.75 -Node: Add-in functions57735
    1.76 -Node: How the add-in function works58594
    1.77 -Node: Defining option-add-in60792
    1.78 -Node: Defining argument-add-in61513
    1.79 -Node: Defining enclosing-add-in62394
    1.80 -Node: How the function is called63247
    1.81 -Node: Useful functions for creating add-in63922
    1.82 -Node: Contribution65326
    1.83 -Node: Add-in generator65599
    1.84 -Node: Etcetera70992
    1.85 -Node: Copying71596
    1.86 +Node: Calling typesetter5300
    1.87 +Node: Calling previewer6945
    1.88 +Node: Printing out7305
    1.89 +Node: %#notation7596
    1.90 +Node: Changing typesetter7971
    1.91 +Node: Splitting input files8334
    1.92 +Node: Static region for typesetting9761
    1.93 +Node: Lpr format10889
    1.94 +Node: Editing %# notation11945
    1.95 +Node: Completion12463
    1.96 +Node: Begin-type completion13022
    1.97 +Node: Section-type completion16065
    1.98 +Node: view-sectioning18499
    1.99 +Node: Large-type completion20078
   1.100 +Node: Maketitle-type completion20808
   1.101 +Node: Arbitrary completion21359
   1.102 +Node: End completion21748
   1.103 +Node: Accent completion22217
   1.104 +Node: Image completion22833
   1.105 +Node: Greek letters completion25089
   1.106 +Node: Local dictionaries25815
   1.107 +Node: Commenting out26751
   1.108 +Node: Cursor jump28209
   1.109 +Node: Jump to corresponding object28520
   1.110 +Node: Invoking image processor29920
   1.111 +Node: Jump to main file31262
   1.112 +Node: Jumping around the environment31626
   1.113 +Node: Jumping to last completion position32043
   1.114 +Node: Changing and Deleting32551
   1.115 +Node: Changing LaTeX commands32942
   1.116 +Node: Killing LaTeX commands34118
   1.117 +Node: Filling35302
   1.118 +Node: Updation of includeonly37152
   1.119 +Node: What column37948
   1.120 +Node: Intelligent newline39032
   1.121 +Node: Usepackage checker40692
   1.122 +Node: Online help41282
   1.123 +Node: Browsing file hierarchy42956
   1.124 +Node: Cooperation with other packages44692
   1.125 +Node: Customizations45396
   1.126 +Node: Lisp variables45729
   1.127 +Node: All customizable variables46732
   1.128 +Node: Sample definitions56615
   1.129 +Node: Hook variables57127
   1.130 +Node: Hook file57830
   1.131 +Node: Add-in functions58168
   1.132 +Node: How the add-in function works59027
   1.133 +Node: Defining option-add-in61225
   1.134 +Node: Defining argument-add-in61946
   1.135 +Node: Defining enclosing-add-in62827
   1.136 +Node: How the function is called63680
   1.137 +Node: Useful functions for creating add-in64355
   1.138 +Node: Contribution65759
   1.139 +Node: Add-in generator66032
   1.140 +Node: Etcetera71425
   1.141 +Node: Copying72029
   1.142  
   1.143  End tag table
     2.1 --- a/docs/yatexe.tex	Thu May 27 13:49:44 2010 +0900
     2.2 +++ b/docs/yatexe.tex	Thu May 27 16:37:44 2010 +0900
     2.3 @@ -5,7 +5,7 @@
     2.4  
     2.5  @iftex
     2.6  @c @syncodeindex fn cp
     2.7 -@c Last modified Thu May 27 10:33:22 2010 on firestorm
     2.8 +@c Last modified Thu May 27 16:25:29 2010 on firestorm
     2.9  @syncodeindex vr cp
    2.10  @end iftex
    2.11  
    2.12 @@ -145,6 +145,9 @@
    2.13          @dots{} invoke latex
    2.14  @item [prefix] t r
    2.15          @dots{} invoke latex on region
    2.16 +@item [prefix] t e
    2.17 +        @dots{} invoke latex on current environment or whole
    2.18 +         portion of current formulas in math-mode.
    2.19  @item [prefix] t k
    2.20          @dots{} kill current typesetting process
    2.21  @item [prefix] t b
    2.22 @@ -201,6 +204,12 @@
    2.23  file if you edit one  file,  and is the same as main file's if you
    2.24  edit splitting files.
    2.25  
    2.26 +  The @kbd{[prefix] te} key automatically marks current inner environment
    2.27 +or inner math mode and then call typeset-region with marked region.  This
    2.28 +is convenient to quick view of current tabular environment or current
    2.29 +editing formulas.  Keeping previewer window for @file{texput.dvi} is
    2.30 +handy for debugging.
    2.31 +
    2.32  @node Calling previewer, Printing out, Calling typesetter, Typesetting
    2.33  @comment  node-name,  next,  previous,  up
    2.34  @section Calling previewer
     3.1 --- a/docs/yatexj	Thu May 27 13:49:44 2010 +0900
     3.2 +++ b/docs/yatexj	Thu May 27 16:37:44 2010 +0900
     3.3 @@ -185,6 +185,9 @@
     3.4               ... $B%?%$%W%;%C%?(B(platex)$B5/F0(B
     3.5  `[prefix] t r'
     3.6               ... $B%?%$%W%;%C%?5/F0(B($BNN0h;XDj(B)
     3.7 +`[prefix] t e'
     3.8 +             ... $B%?%$%W%;%C%?5/F0(B
     3.9 +             ($B%]%$%s%H0LCV$N4D6-$^$?$O?t<0%b!<%I$N$_BP>N(B)
    3.10  `[prefix] t k'
    3.11               ... $BF0:nCf$N%?%$%W%;%C%?$NDd;_(B
    3.12  `[prefix] t b'
    3.13 @@ -244,6 +247,18 @@
    3.14  $B%$%k$N$"$k%G%#%l%/%H%j$N(B`texput.tex'$B$H$$$&NW;~%U%!%$%k$K=PNO$5$l$^$9$N$G!"(B
    3.15  $B>e=q$-$K$OCm0U$7$F$/$@$5$$!#(B
    3.16  
    3.17 +
    3.18 +$B4D6-%?%$%W%;%C%H(B
    3.19 +----------------
    3.20 +
    3.21 +
    3.22 +  `[prefix] te' $B$r2!$9$H!"%]%$%s%H0LCV$N:G$bFbB&$N4D6-!"$^$?$O?t<0%b!<%IFb(B
    3.23 +$B$N>l9g$O$=$N?t<0%b!<%IA4BN$,<+F0E*$KNN0hA*Br$5$l$F!"NN0h%?%$%W%;%C%H$r8F$S(B
    3.24 +$B=P$7$^$9!#(Btabular$B4D6-$d?t<0%b!<%I$GJ#;($J$b$N$r:n$C$F$$$k>l9g$O3N$+$a$?$$(B
    3.25 +$BItJ,$@$1$r3NG'$G$-$k$N$GJXMx$G$9!#$3$l$b(B `texput.tex' $B$K3:EvItJ,$r=q$-=P$7(B
    3.26 +$B$^$9!#%W%l%t%e!<%"$G(B `texput.dvi' $B$r3+$$$?$^$^$K$7$F$*$1$P=$@5$H3NG'$,AGAa(B
    3.27 +$B$/$G$-$k$G$7$g$&!#(B
    3.28 +
    3.29  
    3.30  File: yatexj, Node: Calling previewer, Next: Print out, Prev: Calling typesetter, Up: Invocation
    3.31  
    3.32 @@ -2002,59 +2017,59 @@
    3.33  Node: Main features3186
    3.34  Node: Installation5035
    3.35  Node: Invocation7121
    3.36 -Node: Calling typesetter8216
    3.37 -Node: Calling previewer10373
    3.38 -Node: Print out10970
    3.39 -Node: %#notation11415
    3.40 -Node: Changing typesetter11982
    3.41 -Node: Splitting input files12371
    3.42 -Node: Fix region for typesetting14276
    3.43 -Node: lpr format16021
    3.44 -Node: Editing %# notation17421
    3.45 -Node: Completion18173
    3.46 -Node: begin$B7?Jd40(B18817
    3.47 -Node: section$B7?Jd40(B22947
    3.48 -Node: 2$B8D0J>e$N0z?t$r$H$k(B section$B7?%3%^%s%I(B24733
    3.49 -Node: Enclose section-type command26231
    3.50 -Node: Recursive completion26631
    3.51 -Node: view-sectioning27183
    3.52 -Node: label-generation29644
    3.53 -Node: large$B7?Jd40(B30389
    3.54 -Node: maketitle$B7?Jd40(B31516
    3.55 -Node: Arbitrary completion31998
    3.56 -Node: end$BJd40(B32604
    3.57 -Node: Accent mark completion33241
    3.58 -Node: Image completion33972
    3.59 -Node: Greek letter completion37506
    3.60 -Node: Local dictionary38501
    3.61 -Node: Commenting out39741
    3.62 -Node: Cursor jump41973
    3.63 -Node: $BBP1~%*%V%8%'%/%H$X$N%8%c%s%W(B42347
    3.64 -Node: $B$*3(IA$-%D!<%k5/F0(B44244
    3.65 -Node: $B%a%$%s%U%!%$%k$X$N%8%c%s%W(B46209
    3.66 -Node: $B4D6-$rC10L$H$7$?%8%c%s%W(B46878
    3.67 -Node: $B:G8e$NJd400LCV$X$N%8%c%s%W(B47542
    3.68 -Node: Modifying/Deleting48020
    3.69 -Node: Changing LaTeX command48674
    3.70 -Node: Killing LaTeX command49690
    3.71 -Node: Filling51123
    3.72 -Node: Includeonly53592
    3.73 -Node: What column54681
    3.74 -Node: Intelligent newline56030
    3.75 -Node: Usepackage cheker57965
    3.76 -Node: Changing mode of YaTeX58746
    3.77 -Node: Online help59893
    3.78 -Node: Inclusion hierarchy browser62036
    3.79 -Node: Cooperation with other packages64491
    3.80 -Node: Customizations65249
    3.81 -Node: Lisp variables65735
    3.82 -Node: All customizable variables66769
    3.83 -Node: Sample definitions77898
    3.84 -Node: Hook variables78477
    3.85 -Node: Hook file79837
    3.86 -Node: Add-in functions80172
    3.87 -Node: Etc80590
    3.88 -Node: Copying81231
    3.89 -Node: Concept Index82676
    3.90 +Node: Calling typesetter8352
    3.91 +Node: Calling previewer11116
    3.92 +Node: Print out11713
    3.93 +Node: %#notation12158
    3.94 +Node: Changing typesetter12725
    3.95 +Node: Splitting input files13114
    3.96 +Node: Fix region for typesetting15019
    3.97 +Node: lpr format16764
    3.98 +Node: Editing %# notation18164
    3.99 +Node: Completion18916
   3.100 +Node: begin$B7?Jd40(B19560
   3.101 +Node: section$B7?Jd40(B23690
   3.102 +Node: 2$B8D0J>e$N0z?t$r$H$k(B section$B7?%3%^%s%I(B25476
   3.103 +Node: Enclose section-type command26974
   3.104 +Node: Recursive completion27374
   3.105 +Node: view-sectioning27926
   3.106 +Node: label-generation30387
   3.107 +Node: large$B7?Jd40(B31132
   3.108 +Node: maketitle$B7?Jd40(B32259
   3.109 +Node: Arbitrary completion32741
   3.110 +Node: end$BJd40(B33347
   3.111 +Node: Accent mark completion33984
   3.112 +Node: Image completion34715
   3.113 +Node: Greek letter completion38249
   3.114 +Node: Local dictionary39244
   3.115 +Node: Commenting out40484
   3.116 +Node: Cursor jump42716
   3.117 +Node: $BBP1~%*%V%8%'%/%H$X$N%8%c%s%W(B43090
   3.118 +Node: $B$*3(IA$-%D!<%k5/F0(B44987
   3.119 +Node: $B%a%$%s%U%!%$%k$X$N%8%c%s%W(B46952
   3.120 +Node: $B4D6-$rC10L$H$7$?%8%c%s%W(B47621
   3.121 +Node: $B:G8e$NJd400LCV$X$N%8%c%s%W(B48285
   3.122 +Node: Modifying/Deleting48763
   3.123 +Node: Changing LaTeX command49417
   3.124 +Node: Killing LaTeX command50433
   3.125 +Node: Filling51866
   3.126 +Node: Includeonly54335
   3.127 +Node: What column55424
   3.128 +Node: Intelligent newline56773
   3.129 +Node: Usepackage cheker58708
   3.130 +Node: Changing mode of YaTeX59489
   3.131 +Node: Online help60636
   3.132 +Node: Inclusion hierarchy browser62779
   3.133 +Node: Cooperation with other packages65234
   3.134 +Node: Customizations65992
   3.135 +Node: Lisp variables66478
   3.136 +Node: All customizable variables67512
   3.137 +Node: Sample definitions78641
   3.138 +Node: Hook variables79220
   3.139 +Node: Hook file80580
   3.140 +Node: Add-in functions80915
   3.141 +Node: Etc81333
   3.142 +Node: Copying81974
   3.143 +Node: Concept Index83419
   3.144  
   3.145  End tag table
     4.1 --- a/docs/yatexj.tex	Thu May 27 13:49:44 2010 +0900
     4.2 +++ b/docs/yatexj.tex	Thu May 27 16:37:44 2010 +0900
     4.3 @@ -10,7 +10,7 @@
     4.4  @c ノードいじったら C-l C-u C-n 全部のノード更新 C-l C-u C-e
     4.5  @c メニュー増やしたら C-l C-u C-m 全部のメニュー更新 C-l C-u C-a
     4.6  @c フォーマットするときは C-l C-e C-b
     4.7 -@c Last modified Thu May 27 10:32:20 2010 on firestorm
     4.8 +@c Last modified Thu May 27 16:31:56 2010 on firestorm
     4.9  @syncodeindex vr cp
    4.10  @end iftex
    4.11  
    4.12 @@ -224,6 +224,9 @@
    4.13          @dots{} タイプセッタ(platex)起動
    4.14  @item [prefix] t r
    4.15          @dots{} タイプセッタ起動(領域指定)
    4.16 +@item [prefix] t e
    4.17 +        @dots{} タイプセッタ起動
    4.18 +        (ポイント位置の環境または数式モードのみ対称)
    4.19  @item [prefix] t k
    4.20          @dots{} 動作中のタイプセッタの停止
    4.21  @item [prefix] t b
    4.22 @@ -285,6 +288,15 @@
    4.23  メインファイルのあるディレクトリの@file{texput.tex}という臨時ファイルに出
    4.24  力されますので、上書きには注意してください。
    4.25  
    4.26 +@subsection{環境タイプセット}
    4.27 +
    4.28 +  @kbd{[prefix] te} を押すと、ポイント位置の最も内側の環境、または数式モー
    4.29 +ド内の場合はその数式モード全体が自動的に領域選択されて、領域タイプセットを
    4.30 +呼び出します。tabular環境や数式モードで複雑なものを作っている場合は確かめた
    4.31 +い部分だけを確認できるので便利です。これも @file{texput.tex} に該当部分を
    4.32 +書き出します。プレヴューアで @file{texput.dvi} を開いたままにしておけば
    4.33 +修正と確認が素早くできるでしょう。
    4.34 +
    4.35  @node Calling previewer, Print out, Calling typesetter, Invocation
    4.36  @comment  node-name,  next,  previous,  up
    4.37  @section プレヴューア起動
     5.1 --- a/yatex.el	Thu May 27 13:49:44 2010 +0900
     5.2 +++ b/yatex.el	Thu May 27 16:37:44 2010 +0900
     5.3 @@ -2,7 +2,7 @@
     5.4  ;;; Yet Another tex-mode for emacs - //野鳥//
     5.5  ;;; yatex.el rev. 1.74.3
     5.6  ;;; (c)1991-2010 by HIROSE Yuuji.[yuuji@yatex.org]
     5.7 -;;; Last modified Thu May 27 13:45:10 2010 on firestorm
     5.8 +;;; Last modified Thu May 27 14:55:07 2010 on firestorm
     5.9  ;;; $Id$
    5.10  ;;; The latest version of this software is always available at;
    5.11  ;;; http://www.yatex.org/
    5.12 @@ -750,6 +750,7 @@
    5.13  (autoload 'YaTeX-goto-open-paren "yatexmth" "Goto opening paren" t)
    5.14  (autoload 'YaTeX-change-parentheses "yatexmth" "Change corresponding parens" t)
    5.15  (autoload 'YaTeX-goto-corresponding-paren "yatexmth" "\bigl\bigr jumps" t)
    5.16 +(autoload 'YaTeX-typeset-math-region "yatexmth" "Typeset math-region" t)
    5.17  
    5.18  ;;autoload from yatexhlp.el
    5.19  (autoload 'YaTeX-help "yatexhlp" "YaTeX helper with LaTeX commands." t)
    5.20 @@ -1449,7 +1450,7 @@
    5.21  Optional second argument CHAR is for non-interactive call from menu."
    5.22    (interactive "P")
    5.23    (message
    5.24 -   (concat "J)latex R)egion B)ibtex mk(I)dx "
    5.25 +   (concat "J)latex R)egion E)nv B)ibtex mk(I)dx "
    5.26  	   "latex+p(D)f "
    5.27  	   (if (fboundp 'start-process) "K)ill ")
    5.28  	   "P)review "
    5.29 @@ -1461,6 +1462,7 @@
    5.30      (cond
    5.31       ((= c ?j) (YaTeX-typeset-buffer))
    5.32       ((= c ?r) (YaTeX-typeset-region))
    5.33 +     ((= c ?e) (YaTeX-typeset-environment))
    5.34       ((= c ?b) (YaTeX-call-command-on-file
    5.35  		bibtex-command "*YaTeX-bibtex*" YaTeX-parent-file))
    5.36       ((= c ?i) (YaTeX-call-command-on-file
     6.1 --- a/yatexlib.el	Thu May 27 13:49:44 2010 +0900
     6.2 +++ b/yatexlib.el	Thu May 27 16:37:44 2010 +0900
     6.3 @@ -2,7 +2,7 @@
     6.4  ;;; YaTeX and yahtml common libraries, general functions and definitions
     6.5  ;;; yatexlib.el
     6.6  ;;; (c)1994-2009 by HIROSE Yuuji.[yuuji@yatex.org]
     6.7 -;;; Last modified Mon Sep 28 10:46:39 2009 on firestorm
     6.8 +;;; Last modified Thu May 27 15:09:44 2010 on firestorm
     6.9  ;;; $Id$
    6.10  
    6.11  ;; General variables
    6.12 @@ -1015,28 +1015,31 @@
    6.13  (defun YaTeX-mark-environment ()
    6.14    "Mark current position and move point to end of environment."
    6.15    (interactive)
    6.16 +  (require 'yatexmth)
    6.17    (let ((curp (point)))
    6.18 -    (if (and (YaTeX-on-begin-end-p) (match-beginning 1)) ;if on \\begin
    6.19 -	(progn (goto-char (match-end 0)))
    6.20 -      (if (= (char-after (point)) ?\\) nil	;if on \\end
    6.21 -	(skip-chars-backward "^\n\\\\")
    6.22 -	(or (bolp) (forward-char -1))))
    6.23 -    (if (not (YaTeX-end-of-environment))   ;arg1 turns to match-beginning 1
    6.24 -	(progn
    6.25 -	  (goto-char curp)
    6.26 -	  (error "Cannot found the end of current environment."))
    6.27 -      (YaTeX-goto-corresponding-environment)
    6.28 -      (beginning-of-line)		;for confirmation
    6.29 -      (if (< curp (point))
    6.30 +    (if (YaTeX-in-math-mode-p)
    6.31 +	(YaTeX-mark-mathenv)
    6.32 +      (if (and (YaTeX-on-begin-end-p) (match-beginning 1)) ;if on \\begin
    6.33 +	  (progn (goto-char (match-end 0)))
    6.34 +	(if (= (char-after (point)) ?\\) nil ;if on \\end
    6.35 +	  (skip-chars-backward "^\n\\\\")
    6.36 +	  (or (bolp) (forward-char -1))))
    6.37 +      (if (not (YaTeX-end-of-environment)) ;arg1 turns to match-beginning 1
    6.38  	  (progn
    6.39 -	    (message "Mark this environment?(y or n): ")
    6.40 -	    (if (= (read-char) ?y) nil
    6.41 -	      (goto-char curp)
    6.42 -	      (error "Abort.  Please call again at more proper position."))))
    6.43 -      (set-mark-command nil)
    6.44 -      (YaTeX-goto-corresponding-environment)
    6.45 -      (end-of-line)
    6.46 -      (if (eobp) nil (forward-char 1)))))
    6.47 +	    (goto-char curp)
    6.48 +	    (error "Cannot found the end of current environment."))
    6.49 +	(YaTeX-goto-corresponding-environment)
    6.50 +	(beginning-of-line)		;for confirmation
    6.51 +	(if (< curp (point))
    6.52 +	    (progn
    6.53 +	      (message "Mark this environment?(y or n): ")
    6.54 +	      (if (= (read-char) ?y) nil
    6.55 +		(goto-char curp)
    6.56 +		(error "Abort.  Please call again at more proper position."))))
    6.57 +	(set-mark-command nil)
    6.58 +	(YaTeX-goto-corresponding-environment)
    6.59 +	(end-of-line)
    6.60 +	(if (eobp) nil (forward-char 1))))))
    6.61  
    6.62  (defun YaTeX-kill-buffer (buffer)
    6.63    "Make effort to show parent buffer after kill."
     7.1 --- a/yatexmth.el	Thu May 27 13:49:44 2010 +0900
     7.2 +++ b/yatexmth.el	Thu May 27 16:37:44 2010 +0900
     7.3 @@ -2,7 +2,7 @@
     7.4  ;;; YaTeX math-mode-specific functions.
     7.5  ;;; yatexmth.el
     7.6  ;;; (c)1993-2006 by HIROSE Yuuji [yuuji@yatex.org]
     7.7 -;;; Last modified Thu May 27 11:32:20 2010 on firestorm
     7.8 +;;; Last modified Thu May 27 16:33:55 2010 on firestorm
     7.9  ;;; $Id$
    7.10  
    7.11  ;;; [Customization guide]
    7.12 @@ -506,7 +506,7 @@
    7.13  	      ;;  "alignat*" "xalignat" "xalignat*" "xxalignat" "xxalignat*"
    7.14  	      YaTeX-math-begin-list
    7.15  	    )))
    7.16 -	(let*((p (point)) (nest 0) me0 r
    7.17 +	(let*((p (point)) (nest 0) me0 r firstp dollar
    7.18  	      (delim (concat YaTeX-sectioning-regexp "\\|^$\\|^\C-l"))
    7.19  	      (boundary
    7.20  	       (save-excursion
    7.21 @@ -530,8 +530,8 @@
    7.22  			  (setq nest (1+ nest))
    7.23  			(if (= (preceding-char) ?\\ ) nil ;;\\[5pt]
    7.24  			  (setq nest (1- nest))))))
    7.25 -		  (if (< nest 0) (throw 'open t))))
    7.26 -	      t)
    7.27 +		  (if (< nest 0)
    7.28 +		      (throw 'open (cons (YaTeX-match-string 0) (point)))))))
    7.29  	     ((and (setq r (YaTeX-on-section-command-p
    7.30  			    YaTeX-math-section-type-regexp))
    7.31  		   (numberp r)
    7.32 @@ -541,8 +541,10 @@
    7.33  		  (while ;(search-backward "$" boundary t);little bit fast.
    7.34  		      (YaTeX-re-search-active-backward ;;;;;; Too slow???
    7.35  		       "\\$" (concat "[^\\\\]" YaTeX-comment-prefix) boundary t)
    7.36 +		    (setq dollar "$")
    7.37  		    (cond
    7.38  		     ((equal (char-after (1- (point))) ?$) ; $$ equation $$
    7.39 +		      (setq dollar "$$")
    7.40  		      (backward-char 1)
    7.41  		      (setq nest (1+ nest)))
    7.42  		     ((let ((YaTeX-verbatim-environments
    7.43 @@ -553,8 +555,37 @@
    7.44  		     ((and (equal (char-after (1- (point))) ?\\ )
    7.45  			   (not (equal (char-after (- (point) 3)) ?\\ )))
    7.46  		      nil)		;\$
    7.47 -		     (t (setq nest (1+ nest)))))
    7.48 -		  (if (= (% nest 2) 1) (throw 'dollar t))))))))))
    7.49 +		     (t (setq nest (1+ nest))))
    7.50 +		    (if (and (= nest 1) (null firstp))
    7.51 +			(setq firstp (cons dollar (point)))))
    7.52 +		  (if (= (% nest 2) 1)
    7.53 +		      (throw 'dollar firstp))))))))))
    7.54 +
    7.55 +(defun YaTeX-mark-mathenv ()
    7.56 +  "Mark current mathematic environment."
    7.57 +  (interactive)
    7.58 +  (let ((mmp (YaTeX-in-math-mode-p)) type bpt)
    7.59 +    (if (or (null mmp) (not (stringp (setq type (car mmp)))))
    7.60 +	nil				;if nil or not string, do nothing
    7.61 +     (setq bpt (cdr mmp))
    7.62 +     (goto-char bpt)
    7.63 +     (cond
    7.64 +      ((string-match "\\$" type)
    7.65 +       (set-mark-command nil)
    7.66 +       (skip-chars-forward "$")
    7.67 +       (YaTeX-search-active-forward
    7.68 +	type YaTeX-comment-prefix nil)	;if it cause error, obey it
    7.69 +       (goto-char (match-end 0)))
    7.70 +      ;;
    7.71 +      ((string-match "^\\\\[\\[(]" type)
    7.72 +       (set-mark-command nil)
    7.73 +       (YaTeX-goto-corresponding-leftright)
    7.74 +       (skip-chars-forward "])\\\\"))
    7.75 +      ;;
    7.76 +      ((string-match "^[a-z]" type)	; \begin\end type math
    7.77 +       (set-mark-command nil)
    7.78 +       (YaTeX-goto-corresponding-environment)
    7.79 +       (goto-char (match-end 0)))))))
    7.80  
    7.81  (defun YaTeX-math-display-list (list cols)
    7.82    (goto-char (point-max))
     8.1 --- a/yatexprc.el	Thu May 27 13:49:44 2010 +0900
     8.2 +++ b/yatexprc.el	Thu May 27 16:37:44 2010 +0900
     8.3 @@ -2,7 +2,7 @@
     8.4  ;;; YaTeX process handler.
     8.5  ;;; yatexprc.el
     8.6  ;;; (c)1993-2010 by HIROSE Yuuji.[yuuji@yatex.org]
     8.7 -;;; Last modified Thu May 27 10:26:59 2010 on firestorm
     8.8 +;;; Last modified Thu May 27 14:55:49 2010 on firestorm
     8.9  ;;; $Id$
    8.10  
    8.11  ;(require 'yatex)
    8.12 @@ -279,6 +279,13 @@
    8.13        (put 'dvi2-command 'file buffer)
    8.14        (put 'dvi2-command 'offset lineinfo))))
    8.15  
    8.16 +(defun YaTeX-typeset-environment ()
    8.17 +  "Typeset current math environment"
    8.18 +  (interactive)
    8.19 +  (save-excursion
    8.20 +    (YaTeX-mark-environment)
    8.21 +    (YaTeX-typeset-region)))
    8.22 +
    8.23  (defun YaTeX-typeset-buffer (&optional pp)
    8.24    "Typeset whole buffer.
    8.25  If %#! usage says other buffer is main text,