# HG changeset patch # User HIROSE Yuuji # Date 1532992951 -32400 # Node ID 1ea3d99132fbb75c911ab70cc6b158873ee775ea # Parent 36a64c86ba60b2f5c38888bbee8683eade7c4455# Parent a58a35eac93f272ad6923ae9c65380ac88bc9db2 Merged with dev branch diff -r 36a64c86ba60 -r 1ea3d99132fb README.md --- a/README.md Sun Dec 10 22:03:46 2017 +0900 +++ b/README.md Tue Jul 31 08:22:31 2018 +0900 @@ -1,3 +1,5 @@ +About YaTeX +=========== YaTeX is an intelligent, acquisitive and integrated package which reduces your efforts of composing LaTeX source on Emacs. @@ -17,3 +19,9 @@ yahtmlは野鳥のユーザインタフェースを引き継いだHTML用のメジャーモードパッケージ です。LaTeX ソースの入力に野鳥が欠かせないと気づいたあなたは、おそらく yahtml にすぐなじみ同じように使いこなせることでしょう。もちろんその逆も。 + +Links +---- +* [YaTeX](https://www.yatex.org) +* [YaTeX - TeX Wiki](https://texwiki.texjp.org/?YaTeX) +* [Search yatex with google](https://www.google.com/search?q=yatex) diff -r 36a64c86ba60 -r 1ea3d99132fb docs/dir --- a/docs/dir Sun Dec 10 22:03:46 2017 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ - --*- Text -*- -This is the file .../info/dir, which contains the topmost node of the -Info hierarchy. The first time you invoke Info you start off -looking at that node, which is (dir)Top. - -File: dir Node: Top This is the top of the INFO tree - This (the Directory node) gives a menu of major topics. - Typing "d" returns here, "q" exits, "?" lists all INFO commands, "h" - gives a primer for first-timers, "mTexinfo" visits Texinfo topic, - etc. - --- PLEASE ADD DOCUMENTATION TO THIS TREE. (See INFO topic first.) --- - -* Menu: The list of major topics begins on the next line. - -* YaTeX: (yatexj). Yet Another tex-mode for Emacs. (Japanese). - -* YaTeX-e: (yatexe). Yet Another tex-mode for Emacs. (English). - -* yahtml: (yahtmlj). Yet Another HTML-mode for Emacs. (Japanese). diff -r 36a64c86ba60 -r 1ea3d99132fb docs/yatexe --- a/docs/yatexe Sun Dec 10 22:03:46 2017 +0900 +++ b/docs/yatexe Tue Jul 31 08:22:31 2018 +0900 @@ -249,6 +249,7 @@ * Changing typesetter:: * Splitting input files:: * Static region for typesetting:: +* Special Filtering Region:: * Lpr format:: * Controlling which command to invoke:: * Editing %# notation:: @@ -337,6 +338,30 @@  +File: yatexe, Node: Special Filtering Region, Next: Lpr format, Prev: Static region for typesetting, Up: %#notation + +Special Filtering Region +======================== + A region like below will be passed to external filter command. + %#BEGIN FILTER{foo.pdf}{dot -T %t -o %o} + \if0 + ....blah blah blah... + ....blah blah blah... + ....blah blah blah... + \fi + %#END + +In this case, typing `[prefix] t e' send three `blah' lines +to "dot -T pdf -o foo.pdf" as standard-input. It is useful to +have source of text-origin graphic generated by such tools as +graphviz or blockdiag, in LaTeX source. This special form of region +can be inserted via feeding `.dot' into environment completion by +`[prefix] t b'. + + + + + File: yatexe, Node: Lpr format, Next: Controlling which command to invoke, Prev: Static region for typesetting, Up: %#notation Lpr format @@ -535,7 +560,7 @@  -File: yatexe, Node: Section-type completion, Prev: Begin-type completion, Up: Completion +File: yatexe, Node: Section-type completion, Next: Label Generation, Prev: Begin-type completion, Up: Completion Section-type completion ======================= @@ -2314,60 +2339,61 @@ Node: Calling previewer8016 Node: Printing out8377 Node: %#notation8669 -Node: Changing typesetter9040 -Node: Splitting input files9404 -Node: Static region for typesetting10833 -Node: Lpr format11962 -Node: Controlling which command to invoke13035 -Node: Editing %# notation13992 -Node: Completion14536 -Node: Begin-type completion15072 -Node: Section-type completion17926 -Node: view-sectioning20318 -Node: Label Generation21897 -Node: Large-type completion22797 -Node: Maketitle-type completion23443 -Node: Arbitrary completion23995 -Node: End completion24385 -Node: Accent completion24855 -Node: Image completion25472 -Node: Greek letters completion27727 -Node: Inserting parentheses28483 -Node: Local dictionaries28890 -Node: Commenting out29827 -Node: Cursor jump31286 -Node: Jump to corresponding object31577 -Node: Invoking image processor32977 -Node: Jump to main file34320 -Node: Jumping around the environment34686 -Node: Jumping to last completion position35104 -Node: Changing and Deleting35613 -Node: Changing LaTeX commands35994 -Node: Killing LaTeX commands37171 -Node: Filling38356 -Node: Updation of includeonly40211 -Node: What column41008 -Node: Intelligent newline42093 -Node: Usepackage checker43754 -Node: Online help44345 -Node: Browsing file hierarchy46020 -Node: Cooperation with other packages47757 -Node: Customizations48462 -Node: Lisp variables48758 -Node: All customizable variables49717 -Node: Sample definitions61682 -Node: Hook variables62195 -Node: Hook file62899 -Node: Add-in functions63238 -Node: How the add-in function works64076 -Node: Defining option-add-in66262 -Node: Defining argument-add-in66984 -Node: Defining enclosing-add-in67865 -Node: How the function is called68721 -Node: Useful functions for creating add-in69397 -Node: Contribution70807 -Node: Add-in generator71081 -Node: Etcetera76657 -Node: Copying77262 +Node: Changing typesetter9069 +Node: Splitting input files9433 +Node: Static region for typesetting10862 +Node: Special Filtering Region11991 +Node: Lpr format12723 +Node: Controlling which command to invoke13796 +Node: Editing %# notation14753 +Node: Completion15297 +Node: Begin-type completion15833 +Node: Section-type completion18687 +Node: view-sectioning21103 +Node: Label Generation22682 +Node: Large-type completion23582 +Node: Maketitle-type completion24228 +Node: Arbitrary completion24780 +Node: End completion25170 +Node: Accent completion25640 +Node: Image completion26257 +Node: Greek letters completion28512 +Node: Inserting parentheses29268 +Node: Local dictionaries29675 +Node: Commenting out30612 +Node: Cursor jump32071 +Node: Jump to corresponding object32362 +Node: Invoking image processor33762 +Node: Jump to main file35105 +Node: Jumping around the environment35471 +Node: Jumping to last completion position35889 +Node: Changing and Deleting36398 +Node: Changing LaTeX commands36779 +Node: Killing LaTeX commands37956 +Node: Filling39141 +Node: Updation of includeonly40996 +Node: What column41793 +Node: Intelligent newline42878 +Node: Usepackage checker44539 +Node: Online help45130 +Node: Browsing file hierarchy46805 +Node: Cooperation with other packages48542 +Node: Customizations49247 +Node: Lisp variables49543 +Node: All customizable variables50502 +Node: Sample definitions62467 +Node: Hook variables62980 +Node: Hook file63684 +Node: Add-in functions64023 +Node: How the add-in function works64861 +Node: Defining option-add-in67047 +Node: Defining argument-add-in67769 +Node: Defining enclosing-add-in68650 +Node: How the function is called69506 +Node: Useful functions for creating add-in70182 +Node: Contribution71592 +Node: Add-in generator71866 +Node: Etcetera77442 +Node: Copying78047  End tag table diff -r 36a64c86ba60 -r 1ea3d99132fb docs/yatexe.tex --- a/docs/yatexe.tex Sun Dec 10 22:03:46 2017 +0900 +++ b/docs/yatexe.tex Tue Jul 31 08:22:31 2018 +0900 @@ -8,7 +8,7 @@ @iftex @c @syncodeindex fn cp -@c Last modified Sat Sep 9 23:41:37 2017 on firestorm +@c Last modified Sat Jan 6 23:42:24 2018 on firestorm @syncodeindex vr cp @end iftex @@ -265,6 +265,7 @@ * Changing typesetter:: * Splitting input files:: * Static region for typesetting:: +* Special Filtering Region:: * Lpr format:: * Controlling which command to invoke:: * Editing %# notation:: @@ -377,6 +378,28 @@ @code{%#BEGIN} alone at the middle of very long text. Do not forget to erase @code{%#BEGIN} @code{%#END} pair. +@node Special Filtering Region, Lpr format, Static region for typesetting, %#notation +@section Special Filtering Region + A region like below will be passed to external filter command. +@example +%#BEGIN FILTER{foo.pdf}{dot -T %t -o %o} +\if0 +....blah blah blah... +....blah blah blah... +....blah blah blah... +\fi +%#END +@end example + +In this case, typing @kbd{[prefix] t e} send three `blah' lines +to "dot -T pdf -o foo.pdf" as standard-input. It is useful to +have source of text-origin graphic generated by such tools as +graphviz or blockdiag, in La@TeX{} source. This special form of region +can be inserted via feeding @code{.dot} into environment completion by +@kbd{[prefix] t b}. + + + @node Lpr format, Controlling which command to invoke, Static region for typesetting, %#notation @comment node-name, next, previous, up @section Lpr format @@ -587,7 +610,7 @@ begin-type completion to enclose text into a environment. -@node Section-type completion, , Begin-type completion, Completion +@node Section-type completion, Label Generation, Begin-type completion, Completion @comment node-name, next, previous, up @section Section-type completion @cindex section-type completion diff -r 36a64c86ba60 -r 1ea3d99132fb docs/yatexj --- a/docs/yatexj Sun Dec 10 22:03:46 2017 +0900 +++ b/docs/yatexj Tue Jul 31 08:22:31 2018 +0900 @@ -21,7 +21,7 @@ * Main features:: ȋ@\ * Installation:: CXg[ * Invocation:: vZXN -* %#notation :: %#L@ +* %#notation :: * Completion:: ⊮ * Local dictionary:: [J * Commenting out:: RgAEg @@ -326,9 +326,10 @@ * Changing typesetter:: ^CvZbgpR}h̕ύX * Splitting input files:: ̓t@C * Fix region for typesetting:: ̈̌Œ +* Special Filtering Region:: * lpr format:: vgAEgR}hptH[}bg * Controlling which command to invoke:: ̑̋NR}h -* Editing %# notation:: %#L@̕ҏW +* Editing %# notation::  @@ -424,6 +425,33 @@ Yɂ͏\ӉB + +File: yatexj, Node: Special Filtering Region, Next: lpr format, Prev: Fix region for typesetting, Up: %#notation + +OtB^ +================ + +Ƃ΁AeLXgt@C摜𐶐悤ȃc[ɗ^\[X +LaTeX\[Xɖߍ݁A̕c[̕W͂ɓnƂ +ł܂B̂߂ɂ͈ȉ̂悤ȃ\[X𕶏ɏ܂B + + %#BEGIN FILTER{foo.pdf}{blockdiag -T %t -o %o} + \if0 + --- + ....blah blah blah... + ....blah blah blah... + ....blah blah blah... + --- + \fi + %#END + +̗̈ `[prefix] t e' ^CvƁA̗łblaĥ3 +sOR}h `"blockdiag -T pdf -o foo.pdf"' ̕W͂ɓnA +ʂƂ foo.pdf ܂B̓ʂȃubN`[prefix] tb' +̊‹⊮ŁA`.blockdiag' ̂悤ȃsIhŎn܂‹͂ +邱ƂŎIɑ}܂B + +  File: yatexj, Node: lpr format, Next: Controlling which command to invoke, Prev: Fix region for typesetting, Up: %#notation @@ -2255,66 +2283,67 @@  Tag table: Node: Top257 -Node: Intro1311 -Node: Terminology1614 -Node: Main features2254 -Node: Installation3376 -Node: Invocation4636 -Node: Calling typesetter5512 -Node: Calling previewer6973 -Node: Print out7289 -Node: %#notation7555 -Node: Changing typesetter7983 -Node: Splitting input files8241 -Node: Fix region for typesetting9197 -Node: lpr format10105 -Node: Controlling which command to invoke10915 -Node: Editing %# notation11629 -Node: Completion12087 -Node: begin^⊮12498 -Node: section^⊮15247 -Node: 2ˆȏ̈Ƃ section^R}h16340 -Node: Enclose section-type command17156 -Node: Recursive completion17480 -Node: view-sectioning17785 -Node: label-generation18981 -Node: large^⊮19655 -Node: maketitle^⊮20189 -Node: Arbitrary completion20488 -Node: end⊮20801 -Node: Accent mark completion21142 -Node: Image completion21567 -Node: Greek letter completion23382 -Node: Inserting parens23866 -Node: Local dictionary24214 -Node: Commenting out24818 -Node: Cursor jump25978 -Node: ΉIuWFNgւ̃Wv26195 -Node: G`c[N27181 -Node: Ct@Cւ̃Wv28099 -Node: ‹PʂƂWv28435 -Node: Ō̕⊮ʒuւ̃Wv28792 -Node: Modifying/Deleting29029 -Node: Changing LaTeX command29435 -Node: Killing LaTeX command29985 -Node: Filling30857 -Node: Includeonly32187 -Node: What column32748 -Node: Intelligent newline33528 -Node: Usepackage cheker34560 -Node: Changing mode of YaTeX34987 -Node: Online help35563 -Node: Inclusion hierarchy browser36540 -Node: Cooperation with other packages37818 -Node: Customizations38273 -Node: Lisp variables38570 -Node: All customizable variables39177 -Node: Sample definitions48157 -Node: Hook variables48591 -Node: Hook file49486 -Node: Add-in functions49692 -Node: Etc49919 -Node: Copying50204 -Node: Concept Index50828 +Node: Intro1290 +Node: Terminology1593 +Node: Main features2233 +Node: Installation3355 +Node: Invocation4615 +Node: Calling typesetter5491 +Node: Calling previewer6952 +Node: Print out7268 +Node: %#notation7534 +Node: Changing typesetter7975 +Node: Splitting input files8233 +Node: Fix region for typesetting9189 +Node: Special Filtering Region10096 +Node: lpr format10732 +Node: Controlling which command to invoke11542 +Node: Editing %# notation12256 +Node: Completion12714 +Node: begin^⊮13125 +Node: section^⊮15874 +Node: 2ˆȏ̈Ƃ section^R}h16967 +Node: Enclose section-type command17783 +Node: Recursive completion18107 +Node: view-sectioning18412 +Node: label-generation19608 +Node: large^⊮20282 +Node: maketitle^⊮20816 +Node: Arbitrary completion21115 +Node: end⊮21428 +Node: Accent mark completion21769 +Node: Image completion22194 +Node: Greek letter completion24009 +Node: Inserting parens24493 +Node: Local dictionary24841 +Node: Commenting out25445 +Node: Cursor jump26605 +Node: ΉIuWFNgւ̃Wv26822 +Node: G`c[N27808 +Node: Ct@Cւ̃Wv28726 +Node: ‹PʂƂWv29062 +Node: Ō̕⊮ʒuւ̃Wv29419 +Node: Modifying/Deleting29656 +Node: Changing LaTeX command30062 +Node: Killing LaTeX command30612 +Node: Filling31484 +Node: Includeonly32814 +Node: What column33375 +Node: Intelligent newline34155 +Node: Usepackage cheker35187 +Node: Changing mode of YaTeX35614 +Node: Online help36190 +Node: Inclusion hierarchy browser37167 +Node: Cooperation with other packages38445 +Node: Customizations38900 +Node: Lisp variables39197 +Node: All customizable variables39804 +Node: Sample definitions48784 +Node: Hook variables49218 +Node: Hook file50113 +Node: Add-in functions50319 +Node: Etc50546 +Node: Copying50831 +Node: Concept Index51455  End tag table diff -r 36a64c86ba60 -r 1ea3d99132fb docs/yatexj.tex --- a/docs/yatexj.tex Sun Dec 10 22:03:46 2017 +0900 +++ b/docs/yatexj.tex Tue Jul 31 08:22:31 2018 +0900 @@ -13,7 +13,7 @@ @c m[h C-l C-u C-n S̃m[hXV C-l C-u C-e @c j[₵ C-l C-u C-m S̃j[XV C-l C-u C-a @c tH[}bgƂ C-l C-e C-b -@c Last modified Sat Sep 9 23:43:04 2017 on firestorm +@c Last modified Sat Jan 6 23:49:50 2018 on firestorm @syncodeindex vr cp @end iftex @@ -35,7 +35,7 @@ * Main features:: ȋ@\ * Installation:: CXg[ * Invocation:: vZXN -* %#notation :: %#L@ +* %#notation :: * Completion:: ⊮ * Local dictionary:: [J * Commenting out:: RgAEg @@ -357,9 +357,10 @@ * Changing typesetter:: ^CvZbgpR}h̕ύX * Splitting input files:: ̓t@C * Fix region for typesetting:: ̈̌Œ +* Special Filtering Region:: * lpr format:: vgAEgR}hptH[}bg * Controlling which command to invoke:: ̑̋NR}h -* Editing %# notation:: %#L@̕ҏW +* Editing %# notation:: @end menu @node Changing typesetter, Splitting input files, %#notation , %#notation @@ -479,6 +480,31 @@ ̏Yɂ͏\ӉB @cindex t@C̕ҏW[Ȃӂ̂ւ񂵂䂤] +@node Special Filtering Region, lpr format, Fix region for typesetting, %#notation +@section OtB^ + +Ƃ΁AeLXgt@C摜𐶐悤ȃc[ɗ^\[X +La@TeX{}\[Xɖߍ݁A̕c[̕W͂ɓnƂł +܂B̂߂ɂ͈ȉ̂悤ȃ\[X𕶏ɏ܂B + +@example +%#BEGIN FILTER{foo.pdf}{blockdiag -T %t -o %o} +\if0 +--- +....blah blah blah... +....blah blah blah... +....blah blah blah... +--- +\fi +%#END +@end example + +̗̈ @kbd{[prefix] t e} ^CvƁA̗łblaĥ3s +OR}h @code{"blockdiag -T pdf -o foo.pdf"} ̕W͂ɓnA +ʂƂ foo.pdf ܂B̓ʂȃubN +@kbd{[prefix] tb} ̊‹⊮ŁA@code{.blockdiag} ̂悤ȃsIhŎn܂ +‹͂邱ƂŎIɑ}܂B + @c @node Require, lpr format, Fix region for typesetting, %#notation @comment node-name, next, previous, up @@ -778,7 +804,7 @@ }As͂J[\͎Iɒʂ̓Ɉړ܂B @menu -* 2ˆȏ̈Ƃ section^R}h:: +* 2ˆȏ̈Ƃ section^R}h:: * Enclose section-type command:: ⊮ * Recursive completion:: ċA⊮ * view-sectioning:: ZNV؂̃AEgC\ @@ -1261,11 +1287,11 @@ @menu -* ΉIuWFNgւ̃Wv:: -* G`c[N:: -* Ct@Cւ̃Wv:: -* ‹PʂƂWv:: -* Ō̕⊮ʒuւ̃Wv:: +* ΉIuWFNgւ̃Wv:: +* G`c[N:: +* Ct@Cւ̃Wv:: +* ‹PʂƂWv:: +* Ō̕⊮ʒuւ̃Wv:: @end menu @node ΉIuWFNgւ̃Wv, G`c[N, Cursor jump, Cursor jump diff -r 36a64c86ba60 -r 1ea3d99132fb help/YATEXHLP.jp --- a/help/YATEXHLP.jp Sun Dec 10 22:03:46 2017 +0900 +++ b/help/YATEXHLP.jp Tue Jul 31 08:22:31 2018 +0900 @@ -1805,6 +1805,95 @@ \textbackslash obNXbV̂ +FILTER +%#BEGIN FILTER{OUTPUT}{COMMANDLINE} ... %#END +\if0 \fi ܂łɈ͂܂ꂽ̈A %#SRC{...} Ŏw肳ꂽt@C +OvO COMMANDLINE ̕W͂ƂēnAOUTPUTt@C쐬B + +.blockdiag +%#BEGIN FILTER{OUTPUT}{blockdiag -T %t -o %o -} ... %#END + + +http://blockdiag.com/ja/ +blockdiag ɂeLXgOt摜ϊpB +LaTeX\[XɈȉ̂悤ɏĂ + +%#BEGIN FILTER{graph.png}{blockdiag -T %t -o %o -} +\if0 +=== +blockdiag { + default_fontsize = 24; + A -> B; +} +=== +\fi +%#END + +āABEGIN...END̗̈ [prefix] t e (‹^CvZbg)ĂԂ +2‚ === ň͂܂ꂽ͂Ƃ + + blockdiag -T png -o graph.png - + +Ă΂A[ A ] -> [ B ] ̂悤ȃOt graph.png ɓB +LaTeX{ \includegraphics Ή摜̃\[X{Ɠ +t@CňꌳǗłB + +摜̃\[Xʃt@C(Ƃ src.diag)ɂꍇ͈ȉ̂悤ɂB + +%#BEGIN FILTER{graph.png}{blockdiag -T %t -o %o -} +%#SRC{src.diag} +%#END + + +.nwdiag +%#BEGIN FILTER{OUTPUT}{nwdiag -T %t -o %o -} ... %#END + + +.seqdiag +%#BEGIN FILTER{OUTPUT}{seqdiag -T %t -o %o -} ... %#END + + +.actdiag +%#BEGIN FILTER{OUTPUT}{actdiag -T %t -o %o -} ... %#END + + +.rackdiag +%#BEGIN FILTER{OUTPUT}{rackdiag -T %t -o %o -} ... %#END + + +.dot +%#BEGIN FILTER{OUTPUT}{dot -T %t -o %o} ... %#END + + +http://www.graphviz.org/ +https://ja.wikipedia.org/wiki/Graphviz +Graphviz ɂeLXgOt摜ϊpB +LaTeX\[XɈȉ̂悤ɏĂ + +%#BEGIN FILTER{graph.png}{dot -T %t -o %o} +\if0 +=== +digraph { + graph [charset="utf-8"] + A -> B +} +=== +\fi + +āABEGIN...END̗̈ [prefix] t e (‹^CvZbg)ĂԂ +2‚ === ň͂܂ꂽ͂Ƃ + + dot -T png -o graph.png + +Ă΂A + + [ A ] + + [ B ] + +̂悤ȃOt graph.png ɓB + + LaiTeX a Little Assistant Interface for TeX on Vz 炭Ȃ Vz ŎgĂ邱̃[hB diff -r 36a64c86ba60 -r 1ea3d99132fb makefile --- a/makefile Sun Dec 10 22:03:46 2017 +0900 +++ b/makefile Tue Jul 31 08:22:31 2018 +0900 @@ -49,10 +49,10 @@ # make tag to add release tags LISP = ${LISP18} ${LISP19} ${LISP23} YAHTML = yahtml.el -COMMON = yatexlib.el yatexprc.el +COMMON = yatexlib.el yatexprc.el yatexhlp.el LISP18 = yatex.el yatexadd.el yatexgen.el yatexenv.el \ ${COMMON} \ - yatexmth.el yatexhks.el yatexhlp.el \ + yatexmth.el yatexhks.el yatexhlp.el yatexflt.el \ yatexm-o.el yatexsec.el yatexhie.el yatexpkg.el ${YAHTML} LISP19 = yatex19.el LISP23 = yatex23.el @@ -233,9 +233,8 @@ RSYNCDIR = ${HOME}/http/yatex/rsync/yatex -#sync: -# @-mkdir ${PACKDIR} -# @tar cf - ${PACK} | (cd ${PACKDIR}; tar xf -) -# syncdir -A -x CVS ${PACKDIR} ${RSYNCDIR} -# (cd ${RSYNCDIR}; cvs ci -m '') -# rm -rf ${PACKDIR} +sync: + -hg push + -hg push git + -hg push cvs + (cd ${RSYNCDIR} && hg up -Cv dev && cvs ci -m '') diff -r 36a64c86ba60 -r 1ea3d99132fb manifest --- a/manifest Sun Dec 10 22:03:46 2017 +0900 +++ b/manifest Tue Jul 31 08:22:31 2018 +0900 @@ -27,6 +27,7 @@ yatex23.el Emacs-23ȍ~p̐ݒ yatexadd.el t֐̒` yatexenv.el LaTeX ‹ˑ̊֐ +yatexflt.el OtB^R}hƂ̘Ag yatexgen.el 쒹pt֐쐬[h yatexhie.el 쒹phLgKw\vO yatexhks.el hook lߍނ߂Ɏg([Up) diff -r 36a64c86ba60 -r 1ea3d99132fb yatex.el --- a/yatex.el Sun Dec 10 22:03:46 2017 +0900 +++ b/yatex.el Tue Jul 31 08:22:31 2018 +0900 @@ -1,6 +1,6 @@ ;;; yatex.el --- Yet Another tex-mode for emacs //쒹// -*- coding: sjis -*- -;;; (c)1991-2017 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Sun Sep 17 10:22:43 2017 on firestorm +;;; (c)1991-2018 by HIROSE Yuuji.[yuuji@yatex.org] +;;; Last modified Sat Jun 2 14:13:17 2018 on firestorm ;;; $Id$ ;;; The latest version of this software is always available at; ;;; https://www.yatex.org/ @@ -16,7 +16,7 @@ ;;; Code: (require 'yatexlib) -(defconst YaTeX-revision-number "1.80.1" +(defconst YaTeX-revision-number "1.80.3" "Revision number of running yatex.el") ;---------- Local variables ---------- @@ -49,15 +49,21 @@ (defvar tex-command (cond - (YaTeX-use-LaTeX2e "platex") + (YaTeX-use-LaTeX2e "platex -kanji=%k") (YaTeX-japan "jlatex") (t "latex")) "*Default command for typesetting LaTeX text. -Overridden with `%#! CommandLine...' in the buffer.") +Overridden with `%#! CommandLine...' in the buffer. +`%'s followed by a character are replaced as follows: +%f -> Parent(main) document file name +%r -> %f without extension +%k -> One of Kanji code mnemonic: euc, jis, sjis, utf8 +") -(defvar bibtex-command (if YaTeX-japan "jbibtex" "bibtex") +(defvar bibtex-command (if YaTeX-japan "pbibtex -kanji=%k" "bibtex") "*Default command of BibTeX. -Overridden with `%#BIBTEX CommandLine...' in the buffer.") +Overridden with `%#BIBTEX CommandLine...' in the buffer. +Pettern `%k' in a string will be replaced with Kanji-code mnemonic of ptex.") (defvar dvi2-command ;previewer command for your site (cond (YaTeX-dos "dviout -wait=0") @@ -89,7 +95,14 @@ (YaTeX-macos (cond ((file-executable-p YaTeX-cmd-displayline) "open -a Skim") (t "open"))) - (t "evince")) + ((YaTeX-executable-find "evince") "evince") + ((YaTeX-executable-find "xreader") "xreader") + ((YaTeX-executable-find "atril") "atril") + ((YaTeX-executable-find "okular") "okular") + ((YaTeX-executable-find "kpdf") "kpdf") + ((YaTeX-executable-find "xpdf") "xpdf") + ((YaTeX-executable-find "mupdf") "mupdf") + (t "acroread")) "*Default PDF viewer command including its option. Overridden with `%#PDFVIEW CommandLine...' in the buffer.") @@ -290,9 +303,10 @@ ("author") ("thanks") ("documentstyle") ("pagestyle") ("thispagestyle") ("title") ("underline") ("label") ("makebox") ("footnote") ("footnotetext") ("index") - ("hspace*") ("vspace*") ("bibliography") ("bibitem") ("cite") + ("hspace*") ("vspace*") + ("bibliography") ("bibliographystyle") ("bibitem") ("cite") ("input") ("include") ("includeonly") ("mbox") ("hbox") ("caption") - ("arabic") ("cetering") ("uline") + ("arabic") ("centering") ("uline") ("newcounter") ("newlength") ("setlength" 2) ("addtolength" 2) ("settowidth" 2) ("setcounter" 2) ("addtocounter" 2) ("stepcounter" 2) @@ -323,6 +337,7 @@ ("rotatebox" 2) ("resizebox" 3) ("reflectbox") ("colorbox" 2) ("fcolorbox" 3) ("textcolor" 2) ("color") ("pagecolor") ("includegraphics") ("includegraphics*") + ("includesvg") ("bou") ;defined in plext ("url") ;defined in url ("shadowbox") ("doublebox") ("ovalbox") ("Ovalbox") @@ -369,6 +384,9 @@ (append YaTeX-ams-math-begin-alist YaTeX-ams-math-gathering-alist) "*Standard AMS-LaTeX(2e) environment completion table.") +(defvar YaTeX-use-dot-env-extension t + "*Use YaTeX's dot-env filter special environment.") + ; Set tex-environment possible completion (defvar env-table (append @@ -392,7 +410,10 @@ ("multicols") ;defined in multicol ("breakbox"))) ;defined in eclbkbox (if YaTeX-use-AMS-LaTeX YaTeX-ams-env-table) - YaTeX-math-other-env-alist) + YaTeX-math-other-env-alist + (and YaTeX-use-dot-env-extension + (require 'yatexflt) + YaTeX-filter-special-env-alist)) "Default completion table for begin-type completion.") (defvar user-env-table nil) @@ -608,7 +629,7 @@ (defvar YaTeX-kanji-code nil "*File kanji code used by Japanese TeX. nil: Do not care (Preserve coding-system) -0: no-converion (mule) +0: no-conversion (mule) 1: Shift JIS 2: JIS 3: EUC @@ -846,6 +867,9 @@ ;;autoload from yatexpkg.el (autoload 'YaTeX-package-auto-usepackage "yatexpkg" "Auto \\usepackage" t) +;;autoload from yatexflt.el +(autoload 'YaTeX-filter-goto-source "yatexflt" "Go to graphic source file" t) + ;;; ;; YaTeX-mode functions ;;; @@ -913,7 +937,10 @@ by completing read. If you invoke this command with universal argument, \(key binding for universal-argument is \\[universal-argument]\) -you can put REGION into that environment between \\begin and \\end." +you can put REGION into that environment between \\begin and \\end. +If the environment name begins with `.'(dot), +that environment will be treated as `special environment', which +enables special feature such as text conversion." (interactive "P") (let* ((region-p (or arg (YaTeX-region-active-p))) @@ -921,13 +948,17 @@ (env (save-excursion ;for Emacs24 work-around to avoid point warp (YaTeX-read-environment - (format "Begin environment%s(default %s): " mode YaTeX-env-name))))) + (format "Begin environment%s(default %s): " mode YaTeX-env-name)))) + special) (if (string= env "") (setq env YaTeX-env-name)) - (setq YaTeX-env-name env) + (setq special (assoc env YaTeX-filter-special-env-alist) + YaTeX-env-name env) (YaTeX-update-table (list YaTeX-env-name) 'env-table 'user-env-table 'tmp-env-table) - (YaTeX-insert-begin-end YaTeX-env-name region-p))) + (if special + (YaTeX-insert-filter-special YaTeX-env-name (cdr special) region-p) + (YaTeX-insert-begin-end YaTeX-env-name region-p)))) (defun YaTeX-make-begin-end-region () "Call YaTeX-make-begin-end with ARG to specify region mode." @@ -1254,6 +1285,17 @@ ((YaTeX-literal-p) ?\") ((= (preceding-char) ?\\ ) ?\") ;((= (preceding-char) ?\( ) ?\") + ((save-excursion (beginning-of-line) + (skip-chars-forward "\t ") + (looking-at "%#")) + ?\") + ((let ((ovl (overlays-at (point)))) + (and ovl + (catch 'found + (while ovl + (if (overlay-get (car ovl) 'filter-input) (throw 'found t)) + (setq ovl (cdr ovl)))))) + ?\") ((or (= (preceding-char) 32) (= (preceding-char) 9) (= (preceding-char) ?\n) @@ -1913,8 +1955,9 @@ (defun YaTeX-goto-corresponding-file (&optional other) "Visit or switch buffer of corresponding file, -looking at \\input or \\include or \\includeonly on current line." - (if (not (YaTeX-on-includes-p)) nil +looking at \\input or \\include or \\includeonly or %#SRC{} on current line." + (cond + ((YaTeX-on-includes-p) (let ((parent buffer-file-name) input-file b) (save-excursion (if (and (re-search-forward "[{%]" (point-end-of-line) t) @@ -1933,7 +1976,12 @@ (t (YaTeX-switch-to-buffer input-file))) (or (YaTeX-get-builtin "!") YaTeX-parent-file - (setq YaTeX-parent-file parent))))) + (setq YaTeX-parent-file parent)))) + ;; On %#SRC{somefilters.src} + ((YaTeX-on-SRC-p) + (let ((src (YaTeX-match-string 1))) + (if other (YaTeX-switch-to-buffer-other-window src) + (goto-buffer-window (find-file-noselect src))))))) (defun YaTeX-goto-corresponding-BEGIN-END () (if (not (YaTeX-on-BEGIN-END-p)) nil @@ -1998,6 +2046,9 @@ (cons YaTeX-cmd-edit-ai ".ai") '("dia" . ".dia") (cons YaTeX-cmd-ooo ".odg") + (cons 'YaTeX-filter-goto-source ".diag") + (cons 'YaTeX-filter-goto-source ".dot") + ;; List of target file itself below... (cons YaTeX-cmd-edit-images ".jpeg") (cons YaTeX-cmd-edit-images ".jpg") (cons YaTeX-cmd-edit-images ".png") @@ -2228,6 +2279,13 @@ (re-search-forward "\\(%#BEGIN\\)\\|\\(%#END\\)" (point-end-of-line) t)))) +(defun YaTeX-on-SRC-p () + (save-excursion + (let ((case-fold-search nil)) + (beginning-of-line) + (re-search-forward + "%#SRC{\\([^}]+\\)}" (point-end-of-line) t)))) + (defun YaTeX-goto-corresponding-* (arg) "Parse current line and call suitable function." (interactive "P") @@ -2252,12 +2310,7 @@ (defun YaTeX-goto-corresponding-*-other-window (arg) "Parse current line and call suitable function." (interactive "P") - (cond - ((YaTeX-goto-corresponding-label arg t)) - ;;((YaTeX-goto-corresponding-environment)) - ((YaTeX-goto-corresponding-file t)) - ;;((YaTeX-goto-corresponding-BEGIN-END)) - (t (message "I don't know where to go.")))) + (YaTeX-goto-corresponding-* t)) (defun YaTeX-comment-region (alt-prefix) "Comment out region by '%'. diff -r 36a64c86ba60 -r 1ea3d99132fb yatex.new --- a/yatex.new Sun Dec 10 22:03:46 2017 +0900 +++ b/yatex.new Tue Jul 31 08:22:31 2018 +0900 @@ -1,6 +1,11 @@ What's new in YaTeX/yahtml 쒹/yahtml - eo[W̕ύX_ɂ‚ +1.81 emacs-26 ̎v֐̎dlύXɑΉB + == yatex == + ^CvZbgR}h` %k R[hɕϊ(-kanji=%k) + hbg‹ŊOtB^N@\ljB + 1.80 string-to-intOƓ emacs-18 T|[gOɁB 2-Clause BSDłOKƂɏĂ݂B RCSǗOB diff -r 36a64c86ba60 -r 1ea3d99132fb yatexadd.el --- a/yatexadd.el Sun Dec 10 22:03:46 2017 +0900 +++ b/yatexadd.el Tue Jul 31 08:22:31 2018 +0900 @@ -1,6 +1,6 @@ ;;; yatexadd.el --- YaTeX add-in functions -*- coding: sjis -*- -;;; (c)1991-2017 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Sun Sep 17 10:23:10 2017 on firestorm +;;; (c)1991-2018 by HIROSE Yuuji.[yuuji@yatex.org] +;;; Last modified Wed May 30 13:35:42 2018 on firestorm ;;; $Id$ ;;; Code: @@ -1296,7 +1296,7 @@ (overlay-put (setq ov (make-overlay b e)) 'face repface))) - (switch-to-buffer buf) + (set-window-buffer nil buf) ;Emacs26 (while t (message qmsg new) (setq ch (read-char)) @@ -1519,6 +1519,23 @@ (t nil))) +(defvar YaTeX::bibliographystyle-alist-default + '(("unsrt")("junsrt")("plain")("jplain")("alpha")("jalpha") + ("abbrv")("jabbrv")("jipsj")("jname")("tieice")("tipsj") + ("apalike")("ieeetr")("siam"))) +(defvar YaTeX::bibliographystyle-alist-private + nil + "*Completion table for bibliographystyle") + +(defun YaTeX::bibliographystyle(argp) + (cond + ((= argp 1) + (YaTeX-completing-read-or-skip + "BibStyle: " + (append YaTeX::bibliographystyle-alist-private + YaTeX::bibliographystyle-alist-default) + nil)))) + (defun YaTeX::bibitem (argp) "Add-in function to insert argument of \\bibitem." (YaTeX::label argp "label" "cite")) @@ -1815,6 +1832,7 @@ (setq file (substring file 0 (string-match "\\.tex$" file)))))))) (fset 'YaTeX::input 'YaTeX::include) +(fset 'YaTeX::svg 'YaTeX::include) ;;; -------------------- LaTeX2e stuff -------------------- diff -r 36a64c86ba60 -r 1ea3d99132fb yatexflt.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yatexflt.el Tue Jul 31 08:22:31 2018 +0900 @@ -0,0 +1,420 @@ +;;; yatexflt.el --- YaTeX filter command utilizer -*- coding: sjis -*- +;;; +;;; (c)1993-2018 by HIROSE Yuuji.[yuuji@yatex.org] +;;; Last modified Sat Jun 2 18:12:41 2018 on firestorm +;;; $Id$ + +;;; Commentary: +;;; +;;; This lisp enables passing inline text to some external filter +;;; command to generate files such as graphic files. +;;; +;;; Typical situation is using blockdiag/dot(graphviz) command to +;;; generate png/pdf file. +;;; +;;; Example: +;;; +;;; [[LaTeX Source]] +;;; %#BEGIN FILTER{foo.pdf}{dot -T %t -o o} +;;; \if0 +;;; === +;;; digraph { +;;; A -> B; +;;; B -> C; +;;; } +;;; === +;;; \fi +;;; %#END +;;; \includegraphics{foo.pdf} +;;; +;;; In this case above, when you type `[prefix] t e' between two +;;; `===' lines, the content in a region are fed to dot command as +;;; follows: +;;; +;;; echo TEXT | dot -T pdf -o foo.pdf +;;; +;;; Then foo.pdf file will be generated and the image (as PNG) will +;;; be displayed in the next window. + + +;;; Code: +(require 'yatexlib) +(defvar YaTeX-filter-special-env-alist-default + '((".blockdiag" + "blockdiag -T %t -o %o -" + "blockdiag { + default_fontsize = 32; + A -> B; +}") + (".seqdiag" "seqdiag -T %t -o %o -" + "seqdiag { + client -> server [label = \"SYN\"]; + client <- server [label = \"SYN/ACK\"]; + client -> server [label = \"ACK\"];}") + (".actdiag" "actdiag -T %t -o %o -" + "actdiag { + sayHo -> ho -> hohoho + lane dj { + label = \"DJ\" + sayHo [label = \"Say Ho\"]; hohoho [label = \"Ho Ho Ho!\"]; } + lane mc { label = \"MC\"; ho [label = \"Hooooh!\"]}}") + (".nwdiag" "nwdiag -T %t -o %o -" + "nwdiag { + network ext { + address = \"10.1.2.0/24\" + router [address = \"10.1.2.1\"] + } + network int { + address = \"192.168.22.0/24\" + router [address = \"192.168.22.1\"] + websrv [address = \"192.168.22.80\"] + cli-1; cli-2 + } +}") + (".rackdiag" "rackdiag -T %t -o %o -" + "rackdiag { + 16U; + 1: UPS [4U]; 5: Storage [3U]; 8: PC [2U]; 8: PC [2U]; +}") + (".dot" + "dot -T %t -o %o" + "digraph { + graph [charset=\"utf-8\"] + A -> B +}" + ))) + +;;;###autoload +(defun YaTeX-filter-goto-source (file other-win) + "Go to corresponding text source of the graphic file" + (cond + ((file-exists-p file) + (let ((buf (find-file-noselect file))) + (funcall (cond (other-win 'YaTeX-switch-to-buffer-other-window) + ((get-buffer-window buf) 'goto-buffer-window) + (t 'YaTeX-switch-to-buffer)) + buf))))) + +(defvar YaTeX-filter-special-env-alist-private nil) +(defvar YaTeX-filter-special-env-alist + (append YaTeX-filter-special-env-alist-private + YaTeX-filter-special-env-alist-default)) + +(defun YaTeX-filter-filter-set-conversion-flag () + (let ((ovl (get 'YaTeX-filter-filter-sentinel 'overlay))) + (if ovl ;; When successful conversion met, + (progn ;; (1)Set conversion complete flag + (add-hook ;; (2)Add hook of seim-automatic + 'write-file-hooks ;; update of convert to write- + 'YaTeX-filter-update-all) ;; file hook. + (overlay-put ovl 'converted t))))) + +(defun YaTeX-filter-filter-unset-conversion-flag + (ovl after beg end &optional length) + (if after (overlay-put ovl 'converted nil))) + + +(defun YaTeX-filter-pngify-sentinel (proc msg) + (save-excursion + (let ((b (process-buffer proc)) (selw (selected-window)) + img) + (set-buffer b) + (cond + ((eq (process-status proc) 'run) + (put-text-property (point-min) (point-max) 'invisible t)) + ((eq (process-status proc) 'exit) + (set-buffer b) + (YaTeX-popup-image + (YaTeX-buffer-substring + (get 'YaTeX-filter-pngify-sentinel 'start) (point-max)) + b) + (YaTeX-filter-filter-set-conversion-flag)) + (t + (set-buffer b) + (remove-text-properties (point-min) (point-max) '(invisible t)) + (insert "\nProcess aborted %s\n" msg)))))) + +(defvar YaTeX-filter-pdf2png-stdout + (cond + ((YaTeX-executable-find "convert") "convert -trim %s PNG:-") + (t + "gs -dNOPAUSE -sDEVICE=png256 -sOutputFile=- -dBATCH -q -r75 %s")) + "Command line syntax to convert PDF file to PNG stream") + +(defun YaTeX-filter-modified-BEGEND-regions () + "Return the list of overlays which contains un-converted text." + (save-excursion + (save-restriction + (widen) + (let (r prop dest src pl (list (overlays-in (point-min) (point-max)))) + (while list + (setq prop (overlay-properties (car list))) + (if (setq dest (plist-get prop 'filter-output)) + (if (if (setq src (plist-get prop 'filter-source)) + (file-newer-than-file-p src dest) + (and (setq pl (plist-member prop 'converted)) + (not (plist-get pl 'converted)))) + (setq r (cons (car list) r)))) + (setq list (cdr list))) + (nconc r) + r)))) + +(defun YaTeX-filter-update-all () + "Update all destination files from built-in source text." + (interactive) + (let ((timeout 4) + ans ovl (update-list (YaTeX-filter-modified-BEGEND-regions))) + (if update-list + (save-excursion + (save-window-excursion + (catch 'abort + (while update-list + (goto-char (overlay-start (setq ovl (car update-list)))) + (or (pos-visible-in-window-p) + (set-window-start nil (point))) + (unwind-protect + (progn + (overlay-put ovl 'face 'YaTeX-on-the-fly-activated-face) + (message "Non-update source found: Update here: %s " + "Y)es N)o S)top-watching-Here A)bort") + (setq ans (read-char)) + (cond + ((memq ans '(?Y ?y)) + (YaTeX-filter-BEGEND) + (while (and (> (setq timeout (1- timeout))) + (eq (process-status "Filter") 'run)) + (message "Waiting for conversion process to finish") + (sit-for 1))) + ((memq ans '(?A ?a)) (throw 'abort t)) + ((memq ans '(?S ?s)) (delete-overlay ovl)) + (t nil))) + (overlay-put ovl 'face nil)) + (setq update-list (cdr update-list))))))) + ;; Write file hook should return nil + nil)) + +(defun YaTeX-filter-filter-sentinel (proc msg) + (put 'YaTeX-filter-pngify-sentinel 'start nil) + (let ((b (process-buffer proc)) + (imagefile (get 'YaTeX-filter-filter-sentinel 'outfile)) + ovl + (selw (selected-window))) + (save-excursion + (cond + ((eq (process-status proc) 'run)) + ((eq (process-status proc) 'exit) + (set-buffer b) + (remove-images (point-min) (point-max)) + (if (and (file-regular-p imagefile) + (file-readable-p imagefile)) + (save-excursion + (setq buffer-read-only nil) + (cond + ((string-match "\\.\\(jpg\\|png\\)" imagefile) + (erase-buffer) + (YaTeX-popup-image imagefile b) + (YaTeX-filter-filter-set-conversion-flag)) + (t ;Convert again to PNG file + (goto-char (point-max)) + (insert "\nConvert Again to PNG file...\n") + (put 'YaTeX-filter-pngify-sentinel 'start (point)) + (set-process-sentinel + (start-process + "Filter" b ;Safe to reuse + shell-file-name YaTeX-shell-command-option + (format YaTeX-filter-pdf2png-stdout imagefile)) + 'YaTeX-filter-pngify-sentinel) + (set-buffer-multibyte nil) + )) + (select-window selw))) + (YaTeX-preview-image-mode) + ) + (t ;Other status might be an error + (set-buffer b) + (goto-char (point-max)) + (insert (format "%s\n" (process-status proc)))))))) + +(defvar YaTeX-filter-block-marker "===" + "Begining and Ending marker for contents for external filter program") +(defvar YaTeX-filter-src "#SRC" + "Keyword for input filename for external filter program") + +(defun YaTeX-filter-parse-filter-region (begend-info) + "Return the list of SpecialFilter region. If not on, return nil. +BEGEND-INFO is a value from the function YaTeX-in-BEGEND-p. +Return the alist of: +'((outfile $OutPutFileName) + (source $InputFileName) ; or nil for embeded data source + (cmdline $CommandLine) + (begin $TextRegionBeginning) + (end TextRegionEnd))" + (if begend-info + (let ((b (car begend-info)) (e (nth 1 begend-info)) + delim (args (nth 2 begend-info)) + (p (point)) openb closeb outfile source cmdline point-beg point-end + (src-ptn (format "^\\s *%s%s" + (regexp-quote comment-start) + (regexp-quote YaTeX-filter-src)))) + (save-excursion + (and + (string-match "FILTER" args) ;easy test + (goto-char (car begend-info)) + (re-search-forward + "FILTER\\s *{\\([^}]+\\)}" e t) + (setq outfile (YaTeX-match-string 1)) + (goto-char (match-end 0)) + (prog2 ;Step into the second brace + (skip-chars-forward "\t ") + (looking-at "{") ;Check if 2nd brace surely exists + (skip-chars-forward "{") + (skip-chars-forward "\t")) + (setq openb (point)) + (condition-case nil + (progn (up-list 1) t) + (error nil)) + (setq closeb (1- (point)) + cmdline (YaTeX-buffer-substring openb closeb)) + (cond + ((re-search-forward "^\\\\if0\\>" p t) ;; Embedded source + (forward-line 1) + (setq point-beg (if (looking-at YaTeX-filter-block-marker) + (progn (setq delim (YaTeX-match-string 0)) + (forward-line 1) + (point)) + (point))) + (re-search-forward "^\\\\fi\\>" e t) + (goto-char (match-beginning 0)) + (setq point-end (if delim + (progn + (re-search-backward + (concat "^" (regexp-quote delim)) + (1+ point-beg) t) + (match-beginning 0)) + (point)))) + ((re-search-forward + (format "%s{\\(.*\\)}" src-ptn) e t) ; external file + (setq source (YaTeX-match-string 1) + point-beg (match-beginning 0) + point-end (match-end 0))) + (t ;; If source notation not found, + (let ((ovl (overlays-in b e))) ;; clear all remaining overlays + (while ovl + (delete-overlay (car ovl)) + (setq ovl (cdr ovl)))))) ;; Return nil + + ;; Then return all values + (list (cons 'outfile outfile) + (cons 'source source) + (cons 'cmdline cmdline) + (cons 'begin point-beg) + (cons 'end point-end))))))) + +;;debug;; (YaTeX-filter-parse-filter-region (YaTeX-in-BEGEND-p)) +(defun YaTeX-filter-pass-to-filter (begend-info) + "Pass current BEGIN FILTER environment to external command." + (put 'YaTeX-filter-filter-sentinel 'outfile nil) + ;; begend-info is from YaTeX-in-BEGEND-p: (BEG END ARGS) + (let ((b (car begend-info)) (e (nth 1 begend-info)) + (r (YaTeX-filter-parse-filter-region begend-info)) + insmark) + (save-excursion + (if r (let*((case-fold-search t) + (outfile (cdr (assq 'outfile r))) + (source (cdr (assq 'source r))) + (type (cond + ((string-match "\\.png$" outfile) "png") + ((string-match "\\.svg$" outfile) "svg") + ((string-match "\\.tex$" outfile) "tex") + (t "pdf"))) + (newcmdline (YaTeX-replace-formats + (cdr (assq 'cmdline r)) + (list (cons "t" type) + (cons "o" outfile) + (cons "i" source)))) + (text-start (cdr (assq 'begin r))) + (text-end (cdr (assq 'end r))) + (text (and (numberp text-start) + (numberp text-end) + (YaTeX-buffer-substring text-start text-end))) + ;; + ;; Now it's time to start filter process + ;; + (procbuf (YaTeX-system newcmdline "Filter" 'force)) + (proc (get-buffer-process procbuf)) + ;;(procbuf (get-buffer-create " *Filter*")) + (ovl (progn + (remove-overlays text-start text-end) + (make-overlay text-start text-end))) + (ovlmodhook ;hook function to reset conv-success flag + 'YaTeX-filter-filter-unset-conversion-flag)) + (if proc + (progn + (overlay-put ovl 'filter-output outfile) + (overlay-put ovl 'filter-source source) + (overlay-put ovl 'converted nil) + (overlay-put ovl 'modification-hooks (list ovlmodhook)) + (set-process-coding-system proc 'undecided 'utf-8) + (set-process-sentinel proc 'YaTeX-filter-filter-sentinel) + (YaTeX-showup-buffer procbuf) + (set-buffer procbuf) + (setq buffer-read-only nil) + (erase-buffer) + (insert (format "Starting process `%s'...\n" newcmdline)) + (set-marker (process-mark proc) (point-max)) + (setq insmark (point-max)) + (cond + (text + (process-send-string + proc + (if source + (progn + (insert-file-contents-literally source) + (YaTeX-buffer-substring insmark (point-max))) + text)) + (process-send-string proc "\n") + (process-send-eof proc) ;Notify stream chunk end + (process-send-eof proc))) ;Notify real EOF + (put 'YaTeX-filter-filter-sentinel 'outfile outfile) + (put 'YaTeX-filter-filter-sentinel 'overlay ovl)))))))) + +(defun YaTeX-insert-filter-special (filter list &optional region-p) + (let*((f (YaTeX-read-string-or-skip + "Output file(Maybe *.(pdf|png|jpg|tex)): ")) + (insert-default-directory) + (cmdargs (car list)) + (template-text (car (cdr list))) + (ifile (read-file-name "Data source(Default: in this buffer): " nil)) + (in-line (string= "" ifile))) + (if region-p + (if (< (point) (mark)) (exchange-point-and-mark))) + (save-excursion + (insert (if in-line "===\n\\fi\n" "") + "%#END\n" + (cond + ((string-match "\\.tex$" f) + (format "\\input{%s}\n" (substring f 0 (match-beginning 0)))) + ((string-match "\\.\\(pdf\\|png\\|jpe?g\\|tiff?\\)$" f) + (format "%%# \\includegraphics{%s}\n" f))))) + (and region-p (exchange-point-and-mark)) + (insert (format "%%#BEGIN FILTER{%s}{%s}\n%s%s" + f (or cmdargs "") + (format "%%#%% If you call program in yatex, type `%se'\n" + (key-description + (car (where-is-internal 'YaTeX-typeset-menu)))) + (if in-line "\\if0\n===\n" ""))) + (save-excursion + (insert + (if in-line + (cond (template-text + (concat template-text + (or (string-match "\n$" template-text) "\n"))) + (t "\n")) + (format "%%#SRC{%s}\n" ifile)))))) + +(provide 'yatexflt) + +; Local variables: +; fill-prefix: ";;; " +; paragraph-start: "^$\\| \\|;;;$" +; paragraph-separate: "^$\\| \\|;;;$" +; End: diff -r 36a64c86ba60 -r 1ea3d99132fb yatexhlp.el --- a/yatexhlp.el Sun Dec 10 22:03:46 2017 +0900 +++ b/yatexhlp.el Tue Jul 31 08:22:31 2018 +0900 @@ -1,7 +1,7 @@ ;;; yatexhlp.el --- YaTeX helper for LaTeX -*- coding: sjis -*- ;;; -;;; (c)1994,1998,2004,2014,2015 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Sun Sep 17 10:23:19 2017 on firestorm +;;; (c)1994,1998,2004,2014,2015,2018 by HIROSE Yuuji.[yuuji@yatex.org] +;;; Last modified Sat Jun 2 16:45:45 2018 on firestorm ;;; $Id$ ;;; Code: @@ -302,9 +302,11 @@ (message "No matches found."))) ;;;###autoload -(defun YaTeX-help (&optional macro) +(defun YaTeX-help (&optional macro ref-only) "Show help buffer of LaTeX/TeX commands or macros. -Optional argument MACRO, if supplied, is directly selected to keyword." +Optional argument MACRO, if supplied, is directly selected to keyword. +Non-nil for optional second argument REF-ONLY inhibits call enrich-help +for non-interactive use." (interactive) (let (p beg end command) (save-excursion @@ -341,4 +343,5 @@ (setq YaTeX-help-saved-config (current-window-configuration)) (or (YaTeX-refer-help command YaTeX-help-file) (YaTeX-refer-help command YaTeX-help-file-private) + ref-only (YaTeX-enrich-help command)))) diff -r 36a64c86ba60 -r 1ea3d99132fb yatexlib.el --- a/yatexlib.el Sun Dec 10 22:03:46 2017 +0900 +++ b/yatexlib.el Tue Jul 31 08:22:31 2018 +0900 @@ -1,7 +1,7 @@ ;;; yatexlib.el --- YaTeX and yahtml common libraries -*- coding: sjis -*- ;;; -;;; (c)1994-2017 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Sun Sep 17 10:23:31 2017 on firestorm +;;; (c)1994-2018 by HIROSE Yuuji.[yuuji@yatex.org] +;;; Last modified Wed May 23 07:59:08 2018 on firestorm ;;; $Id$ ;;; Code: @@ -121,6 +121,25 @@ ;---------- Define default key bindings on YaTeX mode map ---------- ;;;###autoload +(defun YaTeX-kanji-ptex-mnemonic () + "Return the kanji-mnemonic of pTeX from current buffer's coding-system." + (if (boundp 'NEMACS) + (or (cdr-safe (assq kanji-fileio-code + '((1 . "sjis") (2 . "jis") (3 . "euc")))) + "") + (let ((coding + (cond + ((boundp 'buffer-file-coding-system) + (symbol-name buffer-file-coding-system)) + ((boundp 'file-coding-system) (symbol-name file-coding-system)))) + (case-fold-search t)) + (cond ((string-match "utf-8\\>" coding) "utf8") + ((string-match "shift.jis\\|cp932\\>" coding) "sjis") + ((string-match "junet\\|iso.2022" coding) "jis") + ((string-match "euc.jp\\|ja.*iso.8bit" coding) "euc") + (t ""))))) + +;;;###autoload (defun YaTeX-define-key (key binding &optional map) "Define key on YaTeX-prefix-map." (if YaTeX-inhibit-prefix-letter @@ -1205,6 +1224,23 @@ ;;(if (eobp) nil (forward-char 1)) ;OUT 2015/1/5 )))) +(defun YaTeX-in-BEGEND-p (&optional pt) + "Check if the point (or PT) is in a %#BEGIN...%#END region. +Return the list of beginning and ending point of the region and arg-string +if the point is in BEGEND. Otherwise nil." + (let ((b "%#BEGIN") bp args (e "%#END") (p (point))) + (save-excursion + (save-match-data ;emacs-19+ yatex1.80+ + (and (re-search-backward b nil t) + (progn + (setq bp (match-beginning 0)) + (goto-char (match-end 0)) ;Start to get args of %#BEGIN + (skip-chars-forward " \t") + (setq args (YaTeX-buffer-substring (point) (point-end-of-line)))) + (re-search-forward e nil t) + (> (point) p) + (list bp (match-end 0) args)))))) + (defun YaTeX-kill-buffer (buffer) "Make effort to show parent buffer after kill." (interactive "bKill buffer: ") diff -r 36a64c86ba60 -r 1ea3d99132fb yatexmth.el --- a/yatexmth.el Sun Dec 10 22:03:46 2017 +0900 +++ b/yatexmth.el Tue Jul 31 08:22:31 2018 +0900 @@ -1,7 +1,7 @@ ;;; yatexmth.el --- YaTeX math-mode-specific functions -*- coding: sjis -*- ;;; ;;; (c)1993-2017 by HIROSE Yuuji [yuuji@yatex.org] -;;; Last modified Sun Sep 17 10:23:45 2017 on firestorm +;;; Last modified Sat Feb 24 16:40:22 2018 on firestorm ;;; $Id$ ;;; Commentary: @@ -985,9 +985,9 @@ (t (setq size nil lr nil))) (while (not newsize) - (message (format (concat "Change from %s: " + (message (concat "Change from %s: " "l(big) L(Big) h(bigg) H(Bigg) " - "r(left-right) n(NONE) ( { [") size)) + "r(left-right) n(NONE) ( { [") size) (setq char (read-char) newsize (cond ((char-equal char ?l) "\\big") ((char-equal char ?L) "\\Big") diff -r 36a64c86ba60 -r 1ea3d99132fb yatexpkg.el --- a/yatexpkg.el Sun Dec 10 22:03:46 2017 +0900 +++ b/yatexpkg.el Tue Jul 31 08:22:31 2018 +0900 @@ -1,7 +1,7 @@ ;;; yatexpkg.el --- YaTeX package manager -*- coding: sjis -*- ;;; -;;; (c)2003-2017 by HIROSE, Yuuji [yuuji@yatex.org] -;;; Last modified Sun Sep 17 10:22:13 2017 on firestorm +;;; (c)2003-2018 by HIROSE, Yuuji [yuuji@yatex.org] +;;; Last modified Fri Jan 5 00:22:46 2018 on firestorm ;;; $Id$ ;;; Code: @@ -41,6 +41,7 @@ ("graphicx" (section "includegraphics" "rotatebox" "scalebox" "resizebox" "reflectbox") (option . YaTeX-package-graphics-driver-alist)) + ("svg" (section "includesvg")) ("color" (section "textcolor" "colorbox" "pagecolor" "color") (option . YaTeX-package-graphics-driver-alist) (default-option . "usenames,dvipsnames")) diff -r 36a64c86ba60 -r 1ea3d99132fb yatexprc.el --- a/yatexprc.el Sun Dec 10 22:03:46 2017 +0900 +++ b/yatexprc.el Tue Jul 31 08:22:31 2018 +0900 @@ -1,7 +1,7 @@ ;;; yatexprc.el --- YaTeX process handler -*- coding: sjis -*- ;;; -;;; (c)1993-2017 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Mon Oct 30 21:00:21 2017 on firestorm +;;; (c)1993-2018 by HIROSE Yuuji.[yuuji@yatex.org] +;;; Last modified Wed May 30 08:32:30 2018 on firestorm ;;; $Id$ ;;; Code: @@ -115,7 +115,7 @@ (cons YaTeX-typeset-process bibcmd) (delq (assq YaTeX-typeset-process bcprop) bcprop))) (put 'YaTeX-typeset-process 'bibcmd bcprop))))) - (message (format "Calling `%s'..." command)) + (message "Calling `%s'..." command) (setq YaTeX-current-TeX-buffer (buffer-name)) (use-local-map map) ;map may be localized (set-syntax-table YaTeX-typeset-buffer-syntax) @@ -353,7 +353,7 @@ reg-begin reg-end lineinfo) (setq ppcmd (if (stringp pp) (concat pp " " texputroot) pp)) (save-excursion - (if (search-backward "%#BEGIN" nil t) + (if (re-search-backward "%#BEGIN\\s *$" nil t) (progn (setq typeout "--- Region from BEGIN to " end "the end of the buffer ---" @@ -445,10 +445,13 @@ (list "pdfcrop --clip %b.pdf tmp.pdf" (if (YaTeX-executable-find "convert") - "convert -density %d tmp.pdf %b.%f" + "convert -alpha off -density %d tmp.pdf %b.%f" ;; If we use sips, specify jpeg as format "sips -s format jpeg -s dpiWidth %d -s dpiHeight %d %b.pdf --out %b.jpg") - "rm -f tmp.pdf"))) + "rm -f tmp.pdf")) + ((YaTeX-executable-find "convert") + (list "convert -trim -alpha off -density %d %b.pdf %b.%f")) + ) "*Pipe line of command as a list to create image file from PDF. See also doc-string of YaTeX-typeset-dvi2image-chain.") @@ -458,6 +461,10 @@ (list (format "%s -E -o %%b.eps %%b.dvi" YaTeX-cmd-dvips) "convert -alpha off -density %d %b.eps %b.%f")) + ((YaTeX-executable-find YaTeX-dvipdf-command) + (list + (format "%s %%b.dvi" YaTeX-dvipdf-command) + "convert -trim -alpha off -density %d %b.pdf %b.%f")) ((and (equal YaTeX-use-image-preview "png") (YaTeX-executable-find "dvipng")) (list "dvipng %b.dvi"))) @@ -475,6 +482,38 @@ The value is generated from YaTeX-typeset-pdf2image-chain and YaTeX-typeset-dvi2image-chain.") +(defun YaTeX-popup-image (imagesrc buffer &optional func) + (let ((sw (selected-window)) image + (data-p (and (> (length imagesrc) 128) + (not (file-readable-p imagesrc))))) + (save-excursion + (cond + ((featurep 'image) window-system + (YaTeX-showup-buffer ;showup and select + (get-buffer-create buffer) + (or func 'YaTeX-showup-buffer-bottom-most) + t) + (remove-images (point-min) (point-max)) + (erase-buffer) + (if data-p + (insert-image + (setq image (create-image imagesrc nil data-p))) + ;; create-image does not re-create img-object for the same file + (insert-image-file (expand-file-name imagesrc)) + (setq image (plist-get (text-properties-at (point)) 'intangible))) + (YaTeX-preview-image-mode) + (let ((height (1+ (cdr (image-size image))))) + (enlarge-window + (- (ceiling (min height (/ (frame-height) 2))) + (window-height)))) + (select-window sw)) + (t ;; Without direct image, display image with image viewer + (YaTeX-system + (format "%s %s" YaTeX-cmd-view-images target) + "YaTeX-region-image" + 'noask))) + ))) + (defvar YaTeX-typeset-conv2image-process nil "Process of conv2image chain") (defun YaTeX-typeset-conv2image-chain () (let*((proc (or YaTeX-typeset-process YaTeX-typeset-conv2image-process)) @@ -528,39 +567,11 @@ 'YaTeX-typeset-conv2image-chain) (get 'YaTeX-typeset-process 'ppcmd)))) ;; After all chain executed, display image in current window - (cond - ((and (featurep 'image) window-system) - ;; If direct image displaying available in running Emacs, - ;; display target image into the next window in Emacs. - (select-window w) - ;(setq foo (selected-window)) - (YaTeX-showup-buffer - (get-buffer-create " *YaTeX-region-image*") - 'YaTeX-showup-buffer-bottom-most t) - (remove-images (point-min) (point-max)) - (erase-buffer) - (cd pwd) ;when reuse from other source - ;(put-image (create-image (expand-file-name target)) (point)) - (insert-image-file target) - (setq img (plist-get (text-properties-at (point)) 'intangible)) - (YaTeX-preview-image-mode) - (if img - (let ((height (1+ (cdr (image-size img))))) - (enlarge-window - (- (ceiling (min height (/ (frame-height) 2))) - (window-height))))) - ;; Remember elapsed time, which will be threshold in onthefly-preview - (put 'YaTeX-typeset-conv2image-chain 'elapse - (YaTeX-elapsed-time - (get 'YaTeX-typeset-conv2image-chain 'start) (current-time)))) - (t - ;; Without direct image, display image with image viewer - (YaTeX-system - (format "%s %s" YaTeX-cmd-view-images target) - "YaTeX-region-image" - 'noask) - ) - ))))) + (YaTeX-popup-image target " *YaTeX-popup-image*") + (put 'YaTeX-typeset-conv2image-chain 'elapse + (YaTeX-elapsed-time + (get 'YaTeX-typeset-conv2image-chain 'start) (current-time))) + )))) (defvar YaTeX-typeset-environment-timer nil) @@ -632,10 +643,12 @@ (goto-char (overlay-end YaTeX-on-the-fly-overlay))) ((YaTeX-region-active-p) nil) ;if region is active, use it - (math (setq usetimer t) (YaTeX-mark-environment)) + (math (setq usetimer YaTeX-on-the-fly-preview-interval) + (YaTeX-mark-environment)) ((equal (or (YaTeX-inner-environment t) "document") "document") (mark-paragraph)) - (t (setq usetimer t) (YaTeX-mark-environment))) + (t (setq usetimer YaTeX-on-the-fly-preview-interval) + (YaTeX-mark-environment))) (if YaTeX-use-image-preview (let ((YaTeX-typeset-buffer (concat "*bg:" YaTeX-typeset-buffer)) (b (region-beginning)) (e (region-end))) @@ -654,6 +667,14 @@ (if usetimer (YaTeX-typeset-environment-auto b e))) (YaTeX-typeset-region)))) +(defun YaTeX-filter-BEGEND () + (let ((begend-info (YaTeX-in-BEGEND-p))) + (if begend-info + (progn + (require 'yatexflt) + (YaTeX-filter-pass-to-filter begend-info) + )))) + (defun YaTeX-typeset-environment () "Typeset current environment or paragraph. If region activated, use it." @@ -661,7 +682,8 @@ (let ((md (match-data))) (unwind-protect (save-excursion - (YaTeX-typeset-environment-1)) + (or (YaTeX-filter-BEGEND) + (YaTeX-typeset-environment-1))) (store-match-data md)))) @@ -753,8 +775,10 @@ (setq pparg (substring cmd 0 (string-match "[;&]" cmd)) ;rm multistmt pparg (substring pparg (rindex pparg ? )) ;get last arg pparg (substring pparg 0 (rindex pparg ?.)) ;rm ext - bibcmd (or (YaTeX-get-builtin "BIBTEX") bibtex-command)) - (or (string-match "\\s " bibcmd) ;if bibcmd has no spaces, + bibcmd (YaTeX-replace-format + (or (YaTeX-get-builtin "BIBTEX") bibtex-command) + "k" (YaTeX-kanji-ptex-mnemonic))) + (or (string-match "\\s [^-]" bibcmd) ;if bibcmd has no argument, (setq bibcmd (concat bibcmd pparg))) ;append argument(== %#!) (and pp (stringp pp) @@ -775,7 +799,7 @@ (if (string-match (concat "[{,/]" me "[,}]") s) nil ; Nothing to do when it's already in includeonly. (ding) - (switch-to-buffer (current-buffer));Display this buffer. + (set-window-buffer nil (current-buffer));Display this buffer. (setq me ;;Rewrite my name(me) to contain sub directory name. (concat @@ -798,7 +822,7 @@ (t nil)) (basic-save-buffer)))) (exchange-point-and-mark))) - (switch-to-buffer cb)) ;for 19 + (set-window-buffer nil cb)) ;for 19 and 26 (YaTeX-typeset cmd YaTeX-typeset-buffer nil nil ppcmd) (put 'dvi2-command 'region nil))) @@ -857,7 +881,7 @@ (key-description (this-command-keys))) (sit-for 2))))) (YaTeX-typeset - command + (YaTeX-replace-format command "k" (YaTeX-kanji-ptex-mnemonic)) (format " *YaTeX-%s*" (downcase builtin-type)) builtin-type builtin-type))) @@ -886,8 +910,8 @@ (defun YaTeX-system (command name &optional noask basedir) "Execute some COMMAND with process name `NAME'. Not a official function. -Optional second argument NOASK skip query when privious process running. -Optional third argument BASEDIR changes default-directory there." +Optional third argument NOASK skip query when privious process running. +Optional fourth argument BASEDIR changes default-directory there." (save-excursion (let ((df default-directory) (buffer (get-buffer-create (format " *%s*" name))) @@ -896,7 +920,7 @@ (setq default-directory (cd (or basedir df))) (erase-buffer) (insert (format "Calling `%s'...\n" command) - "==Kill this buffer to STOP process==") + "==Kill this buffer to STOP process==\n") (YaTeX-showup-buffer buffer 'YaTeX-showup-buffer-bottom-most) (if (not (fboundp 'start-process)) (call-process @@ -1099,7 +1123,7 @@ ;;Send patch to the author, please previewer bnr cf line)) ((string-match "okular" previewer) ;;?? - (format "%s '%s.pdf#src:%d' '%s'" + (format "%s '%s.pdf#src:%d %s'" ;;Send patch to the author, please previewer bnr line cf)) ))) @@ -1296,7 +1320,7 @@ (defvar YaTeX-dvi2-command-ext-alist '(("[agxk]dvi\\|dviout" . ".dvi") ("ghostview\\|gv" . ".ps") - ("acroread\\|[xk]pdf\\|pdfopen\\|Preview\\|TeXShop\\|Skim\\|evince\\|mupdf\\|zathura\\|okular" . ".pdf"))) + ("acroread\\|[xk]pdf\\|pdfopen\\|Preview\\|TeXShop\\|Skim\\|evince\\|atril\\|xreader\\|mupdf\\|zathura\\|okular" . ".pdf"))) (defun YaTeX-get-preview-file-name (&optional preview-command) "Get file name to preview by inquiring YaTeX-get-latex-command" @@ -1351,7 +1375,8 @@ (t (concat (substring magic 0 (string-match "\\s [^-]\\S *$" magic)) " ")))) (t (concat tex-command " " (if switch parent)))) (list (cons "f" tparent) - (cons "r" (substring tparent 0 (rindex tparent ?.))))))) + (cons "r" (substring tparent 0 (rindex tparent ?.))) + (cons "k" (YaTeX-kanji-ptex-mnemonic)))))) (defvar YaTeX-lpr-command-history nil "Holds command line history of YaTeX-lpr.") diff -r 36a64c86ba60 -r 1ea3d99132fb yatexsec.el --- a/yatexsec.el Sun Dec 10 22:03:46 2017 +0900 +++ b/yatexsec.el Tue Jul 31 08:22:31 2018 +0900 @@ -1,7 +1,7 @@ ;;; yatexsec.el --- YaTeX sectioning browser ;;; ;;; (c) 1994-2017 by HIROSE Yuuji [yuuji@yatex.org] -;;; Last modified Sun Dec 21 14:16:35 2014 on firestorm +;;; Last modified Wed May 30 13:29:50 2018 on firestorm ;;; $Id$ ;;; Code: @@ -192,6 +192,7 @@ (other-window 1) (setq sb (current-buffer)) (switch-to-buffer hb) + (setq buffer-read-only nil) ;; Emacs26 (erase-buffer) (insert "===== View sectioning ===== C-p Up sectioning level. 0 Show only \\part,