diff --git a/.hgignore b/.hgignore index 4e0c3b3..00c824c 100644 --- a/.hgignore +++ b/.hgignore @@ -5,6 +5,7 @@ .cvsignore [._]win* __emacs +*.gz *.swp trashbox *.aux diff --git a/.hgtags b/.hgtags index 5d11821..cc018de 100644 --- a/.hgtags +++ b/.hgtags @@ -11,3 +11,4 @@ 0000000000000000000000000000000000000000 yatex-1.77 d0c09133ced7fffa1eb5fa4d114fb12580f812ff yatex-1.77 d69fd7b1ac4d06d7f8633e892dc24eab2bfc23db yatex-1.78 +a3ba09c1e8e907578f679fceb99264ce2d4eb777 yatex-1.79 diff --git a/00readme b/00readme index 5b49161..2d5a16d 100644 --- a/00readme +++ b/00readme @@ -1,5 +1,5 @@ �EMercurial���|�W�g���ł����J���Ă��܂�(1.74�ȍ~)�B - % hg clone http://www.yatex.org/hgrepos/yatex yatex + % hg clone https://www.yatex.org/hgrepos/yatex yatex �ŃR�s�[���A���̌�� yatex/ �f�B���N�g������ hg pull -u ���ĉ������B �Eyatex-1.69 ���o�C�g�R���p�C�����Ȃ��̂��f�t�H���g�Ƃ��܂����B @@ -19,5 +19,5 @@ ���v�AHidemaru�ւ̈ڐA�łł���u�򒹁v�Axyzzy�ւ̈ڐA�łł���u�Ԓ��v �Ɋւ���������̂��߂̃��C�����O���X�g�ufj�쒹�̉�v�ɐ����Q�����������B �ڂ����� docs/qanda �t�@�C���A�܂��� - http://www.yatex.org/ + https://www.yatex.org/ ���䗗���������B diff --git a/comment.el b/comment.el deleted file mode 100644 index 7ca2c76..0000000 --- a/comment.el +++ /dev/null @@ -1,86 +0,0 @@ -;;; -*- Emacs-Lisp -*- -;;; comment/uncomment region for emacs. -;;; comment.el rev.0.1 -;;; (c) 1992, 2002 by HIROSE Yuuji.(yuuji@yatex.org) -;;; Last modified Mon Nov 25 18:33:23 2002 on firestorm - -;;; Rename `comment-region' to `comment-out-region' for standard -;;; Emacs-19 function. - -(provide 'comment) - -(defvar current-comment-prefix "> " "*Default prefix string") - -(defun cite-region (beg end) - (save-excursion - (goto-char (max beg end)) - (if (bolp) - (forward-line -1)) - (if (string= string "") (setq string current-comment-prefix) - (setq current-comment-prefix string)) - (save-restriction - (narrow-to-region (min beg end) (point)) - (goto-char (point-min)) - (message "%s" string) - (while (re-search-forward "^" nil t) - (replace-match string)) - )) -) - -(defun comment-out-region (string &optional beg end once) - "Inserts STRING at the beginning of every line in the region specified -BEG and END. -Called interactively, STRING defaults to comment-start (or '> ' if -none is defined) unless a prefix argument is given, in which case it -prompts for a string. Optional second argument ONCE is only for -compatibility for uncomment-region. It has no means now." - (interactive - (list (if current-prefix-arg - (read-string - (concat "String to insert" - (format "(default \"%s\")" current-comment-prefix - " ") - ": ")) - current-comment-prefix))) - (if (not (stringp string)) (setq string current-comment-prefix)) - (cite-region (or beg (region-beginning)) (or end (region-end))) -) - - -(defun uncomment-out-region (string &optional beg end once) - "Deletes STRING from the beginning of every line in the region. -Called interactively, STRING defaults to comment-start (or '> ' if -none is defined) unless a prefix argument is given, in which case it -prompts for a string. Optional second argument ONCE restricts -deletion to first occurance of STRING on each line." - (interactive - (list (if current-prefix-arg - (read-string - (concat "String to delete" - (format "(default \"%s\")" current-comment-prefix - " ") - ": ")) - current-comment-prefix))) - (if (not (stringp string)) (setq string current-comment-prefix)) - (save-excursion - (save-restriction - (narrow-to-region (or beg (region-beginning)) (or end (region-end))) - (goto-char (point-min)) - (while (re-search-forward (concat "^" string) nil t) - (replace-match "") - (if once (end-of-line))) - )) -) - -(defun cite-file (filename) - "insert the file with citation string." - (interactive "FCite-file: ") - (let* - ((string - (read-string - (format "Citation string (default \"%s\"): " current-comment-prefix) - )) - (ins-tail (car (cdr (insert-file-contents filename))))) - (save-excursion - (cite-region (point) (+ (point) ins-tail)))) -) diff --git a/docs/htmlqa b/docs/htmlqa index ce87fb1..0b7bbab 100644 --- a/docs/htmlqa +++ b/docs/htmlqa @@ -52,6 +52,9 @@ �E�� �F�����Ċ����R�[�h��ݒ肵�ė~�����ȁ[�B + HTML5 �ŏ����̂ł���΂��̍\�����g���̂͂�߁A�����W����UTF-8�� + �i�� �ƋL���܂��傤�B + �����̒��Ƀt�@�C���̃G���R�[�h�@�������Ă�������������META�Ȃ񂿂� ���ǂ߂Ȃ��”\��������̂� charset ��META�Ŏw�肷��͖̂{���� ���҂����ʂ�ɂ͋@�\���܂���B���Ƃ��΁A�����ꕶ���������K�v���o @@ -185,5 +188,4 @@ mode: indented-text fill-column: 72 fill-prefix: " " -buffer-file-coding-system: shift_jis-dos End: diff --git a/docs/qanda b/docs/qanda index 1b2d5d5..f623fd6 100644 --- a/docs/qanda +++ b/docs/qanda @@ -672,7 +672,7 @@ �ɍX�V���s�Ȃ��ĉ������BMercurial���C���X�g�[����A�ȉ��̂悤�� ���ĊJ���łɒǐ����܂��B - hg clone http://www.yatex.org:/hgrepos/yatex + hg clone https://www.yatex.org:/hgrepos/yatex �ŁA���|�W�g���S�̂��擾���܂��B�J���u�����`�� dev �Ȃ̂� @@ -709,5 +709,4 @@ mode: indented-text fill-column: 72 fill-prefix: " " -buffer-file-coding-system: shift_jis-dos End: diff --git a/docs/qanda.eng b/docs/qanda.eng index 3b023b7..685c756 100644 --- a/docs/qanda.eng +++ b/docs/qanda.eng @@ -381,7 +381,7 @@ If you want to catch up to latest version, using yatex-current is inefficient. Use yatex's mercurial repository instead. - hg clone http://www.yatex.org:/hgrepos/yatex + hg clone https://www.yatex.org:/hgrepos/yatex cd yatex hg up -C dev diff --git a/docs/yatexe b/docs/yatexe index 02e9905..570919b 100644 --- a/docs/yatexe +++ b/docs/yatexe @@ -65,9 +65,9 @@ * Semiautomatic replacing of `\includeonly' * Jumping to error line(`C-c '') * Completing-read of LaTeX commands such as `\begin{}', `\section' etc. - (`C-c b', `C-c s', `C-c l', `C-c m') + (`C-c b', `C-c s', `C-c l', `C-c m') * Enclosing text into LaTeX environments or commands (ABOVEKEYSTROKES - after region setting) + after region setting) * Displaying the structure of text at entering sectioning commands * Lump shifting of sectioning commands (*Note view-sectioning::) * Learning unknown/new LaTeX commands for the next completion @@ -76,15 +76,16 @@ * Quick changing or deleting of LaTeX commands(`C-c c', `C-c k') * Jumping from and to inter-file, begin<->end, ref<->label(`C-c g') * Blanket commenting out or uncommenting (`C-c >', `C-c <', `C-c ,', - `C-c .') + `C-c .') * Easy input of accent mark, math-mode's commands and Greek letters - (`C-c a', `;', `:') + (`C-c a', `;', `:') * Online help for the popular LaTeX commands (`C-c ?', `C-c /') * Document files hierarchy browser (`C-c d') * Adding automatically \usepackage corresponding to inputting LaTeX - macro with completion + macro with completion * Allow you to forget creating \label{}s, \ref{} or \cite{} completion - automatically generate labels. + automatically generate labels. + * \includegraphics by Drag&Drop of image file  @@ -130,7 +131,7 @@ ... invoke typesetter on region `[prefix] t e' ... `on-the-fly preview' on current environment or whole - portion of current formulas in math-mode + portion of current formulas in math-mode `[prefix] t d' ... invoke dvipdfmx after successful typesetting `[prefix] t k' @@ -293,12 +294,12 @@ (see *Note Cursor jump::), take described below into consideration. * You can put split texts in sub directory, but not in sub directory of - sub directory. + sub directory. * In the main text, specify the child file name with relative path name - such as \include{chap1/sub}, when you include the file in a - sub-directory. + such as \include{chap1/sub}, when you include the file in a + sub-directory. * In a sub-text, write `%#!latex main.tex' even if `main.tex' is in the - parent directory(not %#!latex ../main.tex). + parent directory(not %#!latex ../main.tex).  @@ -336,7 +337,7 @@  -File: yatexe, Node: Lpr format, Prev: Static region for typesetting, Up: %#notation +File: yatexe, Node: Lpr format, Next: Controlling which command to invoke, Prev: Static region for typesetting, Up: %#notation Lpr format ========== @@ -439,6 +440,7 @@ * Begin-type completion:: * Section-type completion:: +* Label Generation:: * Large-type completion:: * Maketitle-type completion:: * Arbitrary completion:: @@ -533,7 +535,7 @@  -File: yatexe, Node: Section-type completion, Next: Large-type completion, Prev: Begin-type completion, Up: Completion +File: yatexe, Node: Section-type completion, Prev: Begin-type completion, Up: Completion Section-type completion ======================= @@ -655,9 +657,44 @@ ... Hide sectioning commands whose level is lower than n + +File: yatexe, Node: Label Generation, Next: Large-type completion, Prev: Section-type completion, Up: Completion + +Label Generation +================ + +When you want to type-in references of `\ref' or `\cite', all you have to +do is type `[prefix] s ref' without adding labels beforehand. You will +see possible LaTeX-counters in the next window even if some counter does +not have `\label'. Selecting the counter will automatically set the label +to that counter. + +All possible counter list in the buffer tends to be large. You can reduce +the number of list by filtering type of counters by key-commands as +follows. + `M-a' + + ... Show all(disable filtering) + `M-c' + + ... Captions only + `M-e' + + ... equations (with counters) only + `M-i' + + ... numbers items only + `M-s' + + ... sections only + `M-m' + + ... other counters only + +  -File: yatexe, Node: Large-type completion, Next: Maketitle-type completion, Prev: Section-type completion, Up: Completion +File: yatexe, Node: Large-type completion, Next: Maketitle-type completion, Prev: Label Generation, Up: Completion Large-type completion ===================== @@ -720,7 +757,7 @@ ============== YaTeX automatically detects the opened environment and close it with -`\end{environment}'. Though proficient YaTeX users never fail to make +\`\end{environment}'. Though proficient YaTeX users never fail to make environment with begin-type completion, some may begin an environment manually. In that case, type @@ -1256,7 +1293,7 @@ * `tabular', `tabular*', `array' Corresponding number of `&' and `\\'. And `\hline' if - needed. + needed. * `tabbing' @@ -1606,8 +1643,8 @@ -- Variable: YaTeX-fill-inhibit-environments Inhibit fill in these environments (`'("tabular" "tabular*" "array" - picture" "eqnarray" "eqnarray*" "equation" "math" "displaymath" - verbatim" "verbatim*")') + "picture" "eqnarray" "eqnarray*" "equation" "math" "displaymath" + "verbatim" "verbatim*")') -- Variable: YaTeX-uncomment-once T for deleting all preceding `%' (`nil') @@ -2082,10 +2119,11 @@ ---------------- The latter generator is invoked by the next sequence. `M-x -YaTeX-generate-simple' This generator can make both "option add-in" and -argument add-in" (*refer the section add-in functions* *Note How the -add-in function works::), whereas `YaTeX-generate' cannot make "argument -addin". + YaTeX-generate-simple' This generator can make both + "option add-in" and "argument add-in" (*refer the + section add-in functions* *Note How the add-in + function works::), whereas `YaTeX-generate' cannot + make "argument addin". For example, assume you have the LaTeX command as follows. @@ -2249,9 +2287,12 @@ anything as a result of using this software. Adopting code from this program is also free. But I would not do contract act. + This software can be treated with: "The 2-Clause BSD License" (since +2017-09-09, yatex 1.80). + Any reports and suggestions are welcome as long as I feel interests in this software. My possible e-mail address is `yuuji@yatex.org'. (as of -Jan.2004) And there is mailing list for YaTeX. Although the common +Sep.2017) And there is mailing list for YaTeX. Although the common language is Japanese, questions in English will be welcome. To join the ML, send the mail whose subject is `append' to the address `yatex@yatex.org. If you have some question, please ask to @@ -2267,65 +2308,66 @@ Node: Top256 Node: What is YaTeX?1583 Node: Main features1956 -Node: Installation3500 -Node: Typesetting4277 -Node: Calling typesetter5389 -Node: Calling previewer7916 -Node: Printing out8277 -Node: %#notation8569 -Node: Changing typesetter8940 -Node: Splitting input files9304 -Node: Static region for typesetting10729 -Node: Lpr format11858 -Node: Controlling which command to invoke12888 -Node: Editing %# notation13845 -Node: Completion14389 -Node: Begin-type completion14904 -Node: Section-type completion17758 -Node: view-sectioning20179 -Node: Large-type completion21759 -Node: Maketitle-type completion22412 -Node: Arbitrary completion22964 -Node: End completion23354 -Node: Accent completion23823 -Node: Image completion24440 -Node: Greek letters completion26695 -Node: Inserting parentheses27451 -Node: Local dictionaries27858 -Node: Commenting out28795 -Node: Cursor jump30254 -Node: Jump to corresponding object30545 -Node: Invoking image processor31945 -Node: Jump to main file33288 -Node: Jumping around the environment33654 -Node: Jumping to last completion position34072 -Node: Changing and Deleting34581 -Node: Changing LaTeX commands34962 -Node: Killing LaTeX commands36139 -Node: Filling37324 -Node: Updation of includeonly39179 -Node: What column39976 -Node: Intelligent newline41061 -Node: Usepackage checker42714 -Node: Online help43305 -Node: Browsing file hierarchy44980 -Node: Cooperation with other packages46717 -Node: Customizations47422 -Node: Lisp variables47718 -Node: All customizable variables48677 -Node: Sample definitions60640 -Node: Hook variables61153 -Node: Hook file61857 -Node: Add-in functions62196 -Node: How the add-in function works63034 -Node: Defining option-add-in65220 -Node: Defining argument-add-in65942 -Node: Defining enclosing-add-in66823 -Node: How the function is called67679 -Node: Useful functions for creating add-in68355 -Node: Contribution69765 -Node: Add-in generator70039 -Node: Etcetera75499 -Node: Copying76104 +Node: Installation3591 +Node: Typesetting4368 +Node: Calling typesetter5489 +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  End tag table diff --git a/docs/yatexe.tex b/docs/yatexe.tex index 0fa9197..cb6e48f 100644 --- a/docs/yatexe.tex +++ b/docs/yatexe.tex @@ -8,7 +8,7 @@ @iftex @c @syncodeindex fn cp -@c Last modified Fri Feb 13 08:15:26 2015 on firestorm +@c Last modified Sat Sep 9 23:41:37 2017 on firestorm @syncodeindex vr cp @end iftex @@ -18,7 +18,7 @@ @subtitle Yet Another tex-mode for emacs @title Wild Bird @subtitle // YaTeX // -@author @copyright{} 1991-2012 by HIROSE, Yuuji [yuuji@@yatex.org] +@author @copyright{} 1991-2017 by HIROSE, Yuuji [yuuji@@yatex.org] @end titlepage @node Top, What is YaTeX?, (dir), (dir) @@ -29,7 +29,7 @@ @cindex YaTeX @menu -* What is YaTeX?:: +* What is YaTeX?:: * Main features:: What YaTeX can do * Installation:: Guide to install * Typesetting:: Call typesetting processes @@ -96,6 +96,7 @@ macro with completion @item Allow you to forget creating \label@{@}s, \ref@{@} or \cite@{@} completion automatically generate labels. +@item \includegraphics by Drag&Drop of image file @end itemize @node Installation, Typesetting, Main features, Top @@ -171,9 +172,9 @@ @end table @menu -* Calling typesetter:: -* Calling previewer:: -* Printing out:: +* Calling typesetter:: +* Calling previewer:: +* Printing out:: @end menu @node Calling typesetter, Calling previewer, Typesetting, Typesetting @@ -261,12 +262,12 @@ notations in the source text. @menu -* Changing typesetter:: -* Splitting input files:: -* Static region for typesetting:: -* Lpr format:: -* Controlling which command to invoke:: -* Editing %# notation:: +* Changing typesetter:: +* Splitting input files:: +* Static region for typesetting:: +* Lpr format:: +* Controlling which command to invoke:: +* Editing %# notation:: @end menu @node Changing typesetter, Splitting input files, %#notation, %#notation @@ -376,7 +377,7 @@ @code{%#BEGIN} alone at the middle of very long text. Do not forget to erase @code{%#BEGIN} @code{%#END} pair. -@node Lpr format, , Static region for typesetting, %#notation +@node Lpr format, Controlling which command to invoke, Static region for typesetting, %#notation @comment node-name, next, previous, up @section Lpr format @cindex lpr format @@ -481,6 +482,7 @@ @menu * Begin-type completion:: * Section-type completion:: +* Label Generation:: * Large-type completion:: * Maketitle-type completion:: * Arbitrary completion:: @@ -585,7 +587,7 @@ begin-type completion to enclose text into a environment. -@node Section-type completion, Large-type completion, Begin-type completion, Completion +@node Section-type completion, , Begin-type completion, Completion @comment node-name, next, previous, up @section Section-type completion @cindex section-type completion @@ -687,7 +689,7 @@ minibuffer. @menu -* view-sectioning:: +* view-sectioning:: @end menu @node view-sectioning, , Section-type completion, Section-type completion @@ -736,8 +738,38 @@ @dots{} Hide sectioning commands whose level is lower than n @end table +@node Label Generation, Large-type completion, Section-type completion, Completion +@section Label Generation +@comment label generation +@cindex label generation +@cindex ref label cite -@node Large-type completion, Maketitle-type completion, Section-type completion, Completion +When you want to type-in references of @code{\ref} or @code{\cite}, +all you have to do is type @kbd{[prefix] s ref} without adding labels +beforehand. You will see possible La@TeX{}-counters in the next window +even if some counter does not have @code{\label}. Selecting the counter +will automatically set the label to that counter. + +All possible counter list in the buffer tends to be large. +You can reduce the number of list by filtering type of counters by +key-commands as follows. +@table @kbd + @item M-a + @dots{} Show all(disable filtering) + @item M-c + @dots{} Captions only + @item M-e + @dots{} equations (with counters) only + @item M-i + @dots{} numbers items only + @item M-s + @dots{} sections only + @item M-m + @dots{} other counters only +@end table + + +@node Large-type completion, Maketitle-type completion, Label Generation, Completion @comment node-name, next, previous, up @section Large-type completion @@ -1046,11 +1078,11 @@ @menu -* Jump to corresponding object:: -* Invoking image processor:: -* Jump to main file:: -* Jumping around the environment:: -* Jumping to last completion position:: +* Jump to corresponding object:: +* Invoking image processor:: +* Jump to main file:: +* Jumping around the environment:: +* Jumping to last completion position:: @end menu @node Jump to corresponding object, Invoking image processor, Cursor jump, Cursor jump @@ -1194,8 +1226,8 @@ @cindex prefix k @menu -* Changing LaTeX commands:: -* Killing LaTeX commands:: +* Changing LaTeX commands:: +* Killing LaTeX commands:: @end menu @node Changing LaTeX commands, Killing LaTeX commands, Changing and Deleting, Changing and Deleting @@ -1609,9 +1641,9 @@ add-in functions. @menu -* Lisp variables:: -* Add-in functions:: -* Add-in generator:: +* Lisp variables:: +* Add-in functions:: +* Add-in generator:: @end menu @node Lisp variables, Add-in functions, Customizations, Customizations @@ -1634,10 +1666,10 @@ that variable to 1 instead of @code{t}). @menu -* All customizable variables:: -* Sample definitions:: -* Hook variables:: -* Hook file:: +* All customizable variables:: +* Sample definitions:: +* Hook variables:: +* Hook file:: @end menu @node All customizable variables, Sample definitions, Lisp variables, Lisp variables @@ -2077,10 +2109,10 @@ @end enumerate @menu -* How the add-in function works:: -* How the function is called:: -* Useful functions for creating add-in:: -* Contribution:: +* How the add-in function works:: +* How the function is called:: +* Useful functions for creating add-in:: +* Contribution:: @end menu @node How the add-in function works, How the function is called, Add-in functions, Add-in functions @@ -2155,9 +2187,9 @@ @code{/} to @code{@}@{}. @menu -* Defining option-add-in:: -* Defining argument-add-in:: -* Defining enclosing-add-in:: +* Defining option-add-in:: +* Defining argument-add-in:: +* Defining enclosing-add-in:: @end menu @node Defining option-add-in, Defining argument-add-in, How the add-in function works, How the add-in function works @@ -2508,9 +2540,12 @@ anything as a result of using this software. Adopting code from this program is also free. But I would not do contract act. + This software can be treated with: ``The 2-Clause BSD License'' +(since 2017-09-09, yatex 1.80). + Any reports and suggestions are welcome as long as I feel interests in this software. My possible e-mail address is `yuuji@@yatex.org'. (as of -Jan.2004) And there is mailing list for YaTeX. Although the common +Sep.2017) And there is mailing list for YaTeX. Although the common language is Japanese, questions in English will be welcome. To join the ML, send the mail whose subject is `append' to the address `yatex@@yatex.org. If you have some question, please ask to diff --git a/docs/yatexj b/docs/yatexj index 1820dcb..85e6af0 100644 --- a/docs/yatexj +++ b/docs/yatexj Binary files differ diff --git a/docs/yatexj.tex b/docs/yatexj.tex index 26eb794..2254ee8 100644 --- a/docs/yatexj.tex +++ b/docs/yatexj.tex @@ -13,7 +13,7 @@ @c �m�[�h���������� C-l C-u C-n �S���̃m�[�h�X�V C-l C-u C-e @c ���j���[���₵���� C-l C-u C-m �S���̃��j���[�X�V C-l C-u C-a @c �t�H�[�}�b�g����Ƃ��� C-l C-e C-b -@c Last modified Fri Feb 13 08:17:31 2015 on firestorm +@c Last modified Sat Sep 9 23:43:04 2017 on firestorm @syncodeindex vr cp @end iftex @@ -23,7 +23,7 @@ @subtitle Yet Another tex-mode for emacs @title �w�쒹�x @subtitle // YaTeX // -@author @copyright{} 1991-2012 by HIROSE, Yuuji [yuuji@@yatex.org] +@author @copyright{} 1991-2017 by HIROSE, Yuuji [yuuji@@yatex.org] @end titlepage @node Top, Intro, (dir), (dir) @@ -145,6 +145,7 @@ @item �⊮���͂����}�N���ɉ����ĕK�v�� \userpackage �����Ă������� userpackage @item \label��ł‚��Ƃ͂����Y��悤! ref��cite�⊮���͂Ŏ����������܂� +@item �摜�t�@�C���̃h���b�O&�h���b�v�ɂ�鎩�� \includegraphics @end itemize @node Installation, Invocation, Main features, Top @@ -903,6 +904,24 @@ �‚���̂������ւ�ł��B�������x�����ɉ����‚��邩�A���x�����‚��邩�‚��� �����A�ȂǂƂ������Ƃ͖Y��܂��傤! +���x����ł‚ׂ����ڂ̑I���̍ۂɂ́A�”\���̂��邷�ׂẴJ�E���^���\������ +�܂��B������u�����̂݁v�̂悤�Ɏ�ʂōi�肽���Ƃ��͈ȉ��̃L�[�R�}���h�� +���p�ł��܂��B +@table @kbd + @item M-a + @dots{} �i�荞�݂��������Ă��ׂẴJ�E���^��\�� + @item M-c + @dots{} �L���v�V�����݂̂�\�� + @item M-e + @dots{} �ԍ��̂‚������݂̂�\�� + @item M-i + @dots{} �ԍ��‚��ӏ����݂̂�\�� + @item M-s + @dots{} �Z�N�V�����݂̂�\�� + @item M-m + @dots{} ���̑��̃J�E���^�݂̂�\�� +@end table + @node large�^�⊮, maketitle�^�⊮, section�^�⊮, Completion @comment node-name, next, previous, up @section large�^�⊮ @@ -2319,7 +2338,7 @@ ���񂪌_������͎��ނ��܂��B ���A��]�A�o�O�񍐁A���z���͊��}�������܂��B -�A���� yuuji@@yatex.org �܂�(2004�N1������)�B +�A���� yuuji@@yatex.org �܂�(2017�N9������)�B �p���I�Ɏg�p���Ă���������̓��C�����O���X�g�ufj�쒹�̉�v�� ����������Ă��������B�������@�ɂ‚��Ă͖{�p�b�P�[�W�� @file{docs/qanda} �t�@�C���́u���̑��v�̏͂��䗗���������B diff --git a/makefile b/makefile index f9c66b8..b0910af 100644 --- a/makefile +++ b/makefile @@ -225,21 +225,15 @@ ( version=${VERSION}; cd ${TMPDIR}; \ ${TAR} vzcf ${TMPDIR}/yahtml$$version.tar.gz yatex$$version) -ci: - ci -r${VERSION} -sRel -f ${RCSFILE} - ci -u${VERSION} makefile 00readme +tag: + echo hg tag ${VERSION} +# ci: +# ci -r${VERSION} -sRel -f ${RCSFILE} +# ci -u${VERSION} makefile 00readme -co: - co ${RCSFILE} +# co: +# co ${RCSFILE} -co-l: - co -l ${RCSFILE} - -tci: - ci -l${VERSION}.0 -Ncurrent ${RCSFILE} makefile - -dostci: - ci -l${MVER}.0 -Ncurrent @rcsfile RSYNCDIR = ${HOME}/http/yatex/rsync/yatex #sync: diff --git a/yahtml.el b/yahtml.el index cb9867f..6fc2e2c 100644 --- a/yahtml.el +++ b/yahtml.el @@ -1,9 +1,8 @@ ;;; yahtml.el --- Yet Another HTML mode -*- coding: sjis -*- ;;; (c) 1994-2017 by HIROSE Yuuji [yuuji(@)yatex.org] -;;; Last modified Thu Jan 5 17:45:36 2017 on firestorm ;;; $Id$ -(defconst yahtml-revision-number "1.79" +(defconst yahtml-revision-number "1.80" "Revision number of running yahtml.el") ;;; Commentary: @@ -51,7 +50,7 @@ ;;; (setq yahtml-kanji-code 2) ;;; ;HTML�t�@�C���̊����R�[�h��ύX����ꍇ�� ;;; ;1=SJIS�A2=JIS�A3=EUC 4=UTF-8 -;;; ;�Őݒ肵�ĉ������B�f�t�H���g�� 2 �ł��B +;;; ;�Őݒ肵�ĉ������B�f�t�H���g�� 4 �ł��B ;;; ;;; ��K�؂ɏ��������� ~/.emacs �ɑ����ĉ������B ;;; @@ -186,7 +185,7 @@ "*Prefix key stroke of yahtml functions.") (defvar yahtml-image-viewer "display" "*Image viewer program") (defvar yahtml-www-browser "firefox" "*WWW Browser command") -(defvar yahtml-kanji-code 2 +(defvar yahtml-kanji-code 4 "*Kanji coding system number of html file; 1=sjis, 2=jis, 3=euc, 4=UTF-8") ;;(defvar yahtml-coding-system ;; (cdr (assq yahtml-kanji-code YaTeX-kanji-code-alist)) @@ -444,7 +443,7 @@ ("style") ("script") ("noscript") ("div") ("object") ("ins") ("del") ("option") ("datalist") ;;HTML5 - ("video") ("audio") + ("video") ("audio") ("figure") ("iframe") )) (if yahtml-html4-strict @@ -476,7 +475,10 @@ (append '(("dfn") ("em") ("cite") ("code") ("kbd") ("samp") ("caption") ("strong") ("var") ("b") ("i") ("tt") ("big") ("small") - ("sup") ("sub") ("span") ("abbr") ("label")) + ("sup") ("sub") ("span") ("abbr") ("label") + ;; HTML5 + ("figcaption") + ) (if (not yahtml-html4-strict) '(("strike") ("s") ("u") ("font"))) yahtml-env-table) @@ -999,7 +1001,7 @@ (min (if (fboundp 'field-beginning) (field-beginning) (point-min)))) (setq initial (YaTeX-minibuffer-string)) (cond - ((string-match "^http:" initial) + ((string-match "^htt" initial) (setq cmpl (try-completion initial yahtml-urls) listfunc (list 'lambda nil (list 'all-completions initial 'yahtml-urls)) @@ -1135,26 +1137,30 @@ (set-marker e nil)))) ;; ab%defgls/.| -(defun yahtml:a () - "Add-in function for " +(defun yahtml-read-url (prompt) (let ((href "")) (setq yahtml-completing-buffer (current-buffer) yahtml-urls (append yahtml-urls-private yahtml-urls-local) href (yahtml-escape-chars-string (read-from-minibuffer-with-history - "href: " "" yahtml-url-completion-map))) + prompt "" yahtml-url-completion-map))) (prog1 - (concat (yahtml-make-optional-argument - "href" href) - (yahtml-make-optional-argument - "name" (read-string-with-history "name: "))) - (if (and (string-match "^http://" href) + href + (if (and (string-match "^https?://" href) (null (assoc href yahtml-urls-private)) (null (assoc href yahtml-urls-local))) (YaTeX-update-table (list href) 'yahtml-urls-private 'yahtml-urls-private 'yahtml-urls-local))))) +(defun yahtml:a () + "Add-in function for " + (let ((href (yahtml-read-url "href: "))) + (concat (yahtml-make-optional-argument + "href" href) + (yahtml-make-optional-argument + "name" (read-string-with-history "name: "))))) + (defvar yahtml-parameters-completion-alist '(("align" ("top") ("middle") ("bottom") ("left") ("right") ("center")) ("clear" ("left") ("right") ("center") ("all") ("none")) @@ -1167,7 +1173,9 @@ ("rel" . yahtml-link-types-alist) ("type" . yahtml-content-types-alist) ("codetype" . yahtml-content-types-alist) - ("http-equiv" ("Refresh")))) + ("http-equiv" ("Refresh") ("Content-Language") ("Content-Type")) + ("charset" + ("utf-8")("euc-jp")("iso-2022-jp")("iso-8859-1")("shift_jis")))) (defvar yahtml-link-types-alist '(("alternate") ("stylesheet") ("start") ("next") ("prev") @@ -1263,7 +1271,7 @@ (defun yahtml:img () "Add-in function for " (let ((src (yahtml-read-parameter "src")) - (alg (yahtml-read-parameter "align")) + (alg (if yahtml-html4-strict nil (yahtml-read-parameter "align"))) alt (brd (read-string-with-history "border=")) (l yahtml-prefer-upcase-attributes) @@ -1302,7 +1310,7 @@ (cons "align" alg)) (if (string< "" brd) (cons "border" - (format "%dpx" (string-to-int brd)))))))) + (format "%dpx" (YaTeX-str2int brd)))))))) (concat (yahtml-make-optional-argument "border" brd) (yahtml-make-optional-argument "align" alg)))))) @@ -1447,7 +1455,7 @@ (defun yahtml:ol () "Add-in function for
    " - (setq yahtml-last-single-cmd "li") + (setq yahtml-last-typeface-cmd "li") (let ((start (YaTeX-read-string-or-skip "start=")) (type (YaTeX-completing-read-or-skip "type=" '(("1") ("a") ("A") ("i") ("I")) nil t))) @@ -1455,11 +1463,11 @@ (yahtml-make-optional-argument "start" start) (yahtml-make-optional-argument "type" type)))) (defun yahtml:ul () - (setq yahtml-last-single-cmd "li") "") + (setq yahtml-last-typeface-cmd "li") "") (defun yahtml:dl () - (setq yahtml-last-single-cmd "dt") "") + (setq yahtml-last-typeface-cmd "dt") "") (defun yahtml:dt () - (setq yahtml-last-single-cmd "dd") "") + (setq yahtml-last-typeface-cmd "dd") "") (defun yahtml:p () (if yahtml-html4-strict nil @@ -1477,9 +1485,10 @@ (setq name (read-string-with-history "name: ") type (YaTeX-completing-read-or-skip "type (default=text): " yahtml-input-types nil t) - value (YaTeX-read-string-or-skip "value: ") - id (YaTeX-read-string-or-skip "id: ")) - (if (string-match "text\\|password\\|^$" typxe) + value (YaTeX-read-string-or-skip "value: ")) + (or (string-match "submit\\|reset" type) + (setq id (YaTeX-read-string-or-skip "id: "))) + (if (string-match "text\\|password\\|^$" type) (setq size (YaTeX-read-string-or-skip "size: ") maxlength (YaTeX-read-string-or-skip "maxlength: "))) (concat @@ -1524,7 +1533,7 @@ (append (if (string< "" b) (list - (cons "border" (format "%dpx solid" (string-to-int b))) + (cons "border" (format "%dpx solid" (YaTeX-str2int b))) (cons "border-collapse" "collapse"))) (if (string< "" a) (cond @@ -1569,8 +1578,7 @@ (defun yahtml:tr () "Add-in function for `tr'" - (setq ;yahtml-last-begend "td" ;; which do you prefer? - yahtml-last-typeface-cmd "td") + (setq yahtml-last-typeface-cmd "td") "") (defun yahtml:link () @@ -1613,27 +1621,29 @@ (read-from-minibuffer-with-history "href: " "" yahtml-url-completion-map))))))) -(defvar yahtml:meta-names - '(("name" ("keywords")("author")("copyright")("date")("GENERATOR")))) +(defvar yahtml:meta-attrs + '(("charset" value) + ("name" content ("keywords")("author")("copyright")("date")("GENERATOR")) + ("http-equiv" content))) (defun yahtml:meta () - (let ((name (yahtml-make-optional-argument - "name" - (yahtml-read-parameter "name" nil yahtml:meta-names))) - http-equiv content) - (if (string= "" name) - (if (string-match - "Content-type" - (setq http-equiv (yahtml-make-optional-argument - "http-equiv" - (yahtml-read-parameter "http-equiv" nil)))) - (error "It's very bad idea to set Content-type in META. %s" - "See docs/qanda") - (concat http-equiv - (yahtml-make-optional-argument - "content" (yahtml-read-parameter "content")))) + (let ((attr (completing-read-with-history + "Meta Attribute: " yahtml:meta-attrs)) + (case-fold-search t) + (completion-ignore-case t) + todonext name http-equiv content) + (cond + ((string= "" attr) nil) + ((and (setq todonext (cdr-safe (assoc attr yahtml:meta-attrs))) + (eq 'value (car todonext))) + (yahtml-make-optional-argument attr (yahtml-read-parameter attr))) + ((eq 'content (car todonext)) + (setq name (if (cdr todonext) + (completing-read-with-history + (format "%s: " attr) (cdr todonext)) + (yahtml-read-parameter attr))) (concat - name + (yahtml-make-optional-argument attr name) (yahtml-make-optional-argument "content" (cond @@ -1650,7 +1660,14 @@ (if (string-match "yahtml" content) (message "Thank you!")) content) - (t (read-string-with-history (concat name ": "))))))))) + ((string-match "content-type" name) + (if (string-match "http-equiv" attr ) + (error "Use Your browser does not support iframes.

    ")) + ;;; ---------- Marking ---------- (defun yahtml-mark-begend () "Mark current tag" @@ -3095,7 +3127,7 @@ (let ((f (if (string= "" (YaTeX-match-string 1)) YaTeX-current-file-name (YaTeX-match-string 1))) - (l (string-to-int (or (YaTeX-match-string 2) + (l (YaTeX-str2int (or (YaTeX-match-string 2) (YaTeX-match-string 3))))) (if sit (sit-for 1)) (forward-line -1) @@ -3332,5 +3364,4 @@ ; fill-prefix: ";;; " ; paragraph-start: "^$\\| \\|;;;$" ; paragraph-separate: "^$\\| \\|;;;$" -; coding: sjis ; End: diff --git a/yatex.el b/yatex.el index 966ccf4..cd1a3c9 100644 --- a/yatex.el +++ b/yatex.el @@ -1,14 +1,13 @@ ;;; yatex.el --- Yet Another tex-mode for emacs //�쒹// -*- coding: sjis -*- ;;; (c)1991-2017 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Thu Jan 5 23:13:56 2017 on firestorm +;;; Last modified Sun Sep 10 21:19:43 2017 on firestorm ;;; $Id$ ;;; The latest version of this software is always available at; -;;; http://www.yatex.org/ +;;; https://www.yatex.org/ ;;; Code: -(require 'comment) (require 'yatexlib) -(defconst YaTeX-revision-number "1.79.1" +(defconst YaTeX-revision-number "1.80" "Revision number of running yatex.el") ;---------- Local variables ---------- @@ -52,8 +51,9 @@ Overridden with `%#BIBTEX CommandLine...' in the buffer.") (defvar dvi2-command ;previewer command for your site - (if YaTeX-dos "dviout -wait=0" - "xdvi -geo +0+0 -s 4") + (cond (YaTeX-dos "dviout -wait=0") + (YaTeX-macos "open -a Preview") + (t "xdvi -geo +0+0 -s 4")) "*Default previewer command including its option. Overridden with `%#PREVIEW CommandLine...' in the buffer.") @@ -296,7 +296,8 @@ ("tilde") ("hat") ("check") ("bar") ("dot") ("ddot") ("vec") ("widetilde") ("widehat") ("overline") ("overrightarrow") ;; section types in mathmode - ("frac" 2) ("sqrt") ("mathrm") ("mathbf") ("mathit") + ("frac" 2) ("sqrt") ("mathrm") ("mathbf") ("mathit") ("mathbb") + ("mathscr") ("mathrsfs") ;;cleveref ("cref") ("crefrange") ("cpageref") ("labelcref") ("labelcpageref") ;; beamer @@ -338,12 +339,23 @@ ("split") ("split*") ("aligned") ("aligned*") ("alignedat") ("gathered") ("smallmatrix") ("cases") ("subequations"))) ;; Prepare list(not alist) for YaTeX::ref in yatexadd.el +(defvar YaTeX-math-other-env-alist-default + '(("numcases") ("subnumcases")) + "Default alist of additional environments for equations") +(defvar YaTeX-math-other-env-alist-private nil + "*User defined alist of additional environments for equations") +(defvar YaTeX-math-other-env-alist + (append YaTeX-math-other-env-alist-default + YaTeX-math-other-env-alist-private) + "Alist of additional environments for equations") +(defvar YaTeX-math-other-env-list + (mapcar 'car YaTeX-math-other-env-alist)) + (defvar YaTeX-math-begin-list (mapcar 'car YaTeX-ams-math-begin-alist)) (defvar YaTeX-math-gathering-list ;used in yatexadd.el#yatex::ref (mapcar 'car YaTeX-ams-math-gathering-alist)) - (defvar YaTeX-ams-env-table (append YaTeX-ams-math-begin-alist YaTeX-ams-math-gathering-alist) "*Standard AMS-LaTeX(2e) environment completion table.") @@ -370,7 +382,8 @@ ("alltt") ;defined in alltt ("multicols") ;defined in multicol ("breakbox"))) ;defined in eclbkbox - (if YaTeX-use-AMS-LaTeX YaTeX-ams-env-table)) + (if YaTeX-use-AMS-LaTeX YaTeX-ams-env-table) + YaTeX-math-other-env-alist) "Default completion table for begin-type completion.") (defvar user-env-table nil) @@ -582,7 +595,7 @@ "*Initial tex-section completion") (defvar YaTeX-fontsize-name "large" "*Initial fontsize completion") (defvar YaTeX-single-command "maketitle" "*Initial LaTeX single command") -(defvar YaTeX-kanji-code (if YaTeX-dos 1 2) +(defvar YaTeX-kanji-code nil "*File kanji code used by Japanese TeX. nil: Do not care (Preserve coding-system) 0: no-converion (mule) @@ -1298,7 +1311,7 @@ (car (where-is-internal 'YaTeX-make-begin-end)))) (point)) (put 'YaTeX-insert-braces 'begend-guide - (+ 1 (string-to-int ;increment counter of beg-end guidance + (+ 1 (YaTeX-str2int ;increment counter of beg-end guidance (prin1-to-string (get 'YaTeX-insert-braces 'begend-guide))))))))) env macro not-literal b e) @@ -2242,34 +2255,40 @@ it comments out whole environment" (interactive "P") (if (not (YaTeX-on-begin-end-p)) - (comment-out-region + (YaTeX-comment-region-sub (if alt-prefix (read-string-with-history "Insert prefix: ") YaTeX-comment-prefix)) - (YaTeX-comment-uncomment-env 'comment-out-region))) + (YaTeX-comment-uncomment-env 'YaTeX-comment-region-sub))) (defun YaTeX-uncomment-region (alt-prefix) "Uncomment out region by '%'." (interactive "P") (if (not (YaTeX-on-begin-end-p)) - (uncomment-out-region + (YaTeX-uncomment-region-sub (if alt-prefix (read-string-with-history "Remove prefix: ") YaTeX-comment-prefix) (region-beginning) (region-end) YaTeX-uncomment-once) - (YaTeX-comment-uncomment-env 'uncomment-out-region))) + (YaTeX-comment-uncomment-env 'YaTeX-uncomment-region-sub))) (defun YaTeX-comment-uncomment-env (func) "Comment or uncomment out one LaTeX environment switching function by FUNC." - (let (beg (p (point))) + (let (beg beg2 (p (point))) (save-excursion - (beginning-of-line) - (setq beg (point)) - (YaTeX-goto-corresponding-environment) - (beginning-of-line) - (if (> p (point)) (setq beg (1+ beg)) (forward-char 1)) - (funcall func YaTeX-comment-prefix beg (point) YaTeX-uncomment-once))) + (beginning-of-line) + (setq beg (point)) + (save-match-data + (while (and (not (eobp)) + (not (eolp)) + (looking-at YaTeX-comment-prefix)) + (goto-char (match-end 0)))) + (setq beg2 (point)) + (YaTeX-goto-corresponding-environment) + (beginning-of-line) + (if (> p (point)) (setq beg (1+ beg2)) (forward-char 1)) + (funcall func YaTeX-comment-prefix beg (point) YaTeX-uncomment-once))) (message "%sommented out current environment." - (if (eq func 'comment-out-region) "C" "Un-c"))) + (if (string-match "uncom" (symbol-name func)) "Un-c" "C"))) (defun YaTeX-comment-paragraph () "Comment out current paragraph." @@ -2287,7 +2306,7 @@ (t (mark-paragraph) (if (looking-at paragraph-separate) (forward-line 1)) - (comment-out-region "%"))))) + (YaTeX-comment-region-sub "%"))))) (defun YaTeX-uncomment-paragraph () "Uncomment current paragraph." @@ -2309,7 +2328,7 @@ (paragraph-separate paragraph-start)) (mark-paragraph) (if (not (bobp)) (forward-line 1)) - (uncomment-out-region "%" nil nil YaTeX-uncomment-once)) + (YaTeX-uncomment-region-sub "%" nil nil YaTeX-uncomment-once)) (message "This line is not a comment line."))))) (defun YaTeX-remove-prefix (prefix &optional once) @@ -3264,7 +3283,3 @@ ;; `History' was moved to ChangeLog ;----------------------------- End of yatex.el ----------------------------- - -; Local variables: -; coding: sjis -; End: diff --git a/yatex.new b/yatex.new index 9f20e7a..a5224ff 100644 --- a/yatex.new +++ b/yatex.new @@ -1,6 +1,24 @@ What's new in YaTeX/yahtml �쒹/yahtml - �e�o�[�W�����̕ύX�_�ɂ‚��� +1.80 string-to-int���O�Ɠ����� emacs-18 ���T�|�[�g�O�ɁB + 2-Clause BSD�ł�OK�Ƃ������ɏ����Ă݂��B + RCS�Ǘ����O�����B + == yatex == + ���x���⊮�o�b�t�@�� M-e, M-i ���Ń��x����̍i�荞�݉”\�B + dvi����PS�ϊ��R�}���h���������J�ɒT���悤�ɂ����B + mathbb, mathscr, mathrsfs, text, and, onslide, pause + YaTeX-math-other-env-alist-private �Œlj������‹��𑫂��₷�������B + YaTeX-electric-indent-mode �� C-m �ł̎����C���f���g�𐧌�B + %#�L�[���[�h�ɒlj�: DVIPDF, PDFVIEW, IMAGEDPI(�����^�b�`�X�V����)�B + Beamer�p�̕⊮�A�h�C����lj�(���ĒJ������)�B + YaTeX-kanji-code �̃f�t�H���g��nil(����)�ɕύX�B + == yahtml == + figure, iframe �Ή��B + a�v�f�̑����⊮���C���B + meta�v�f�̑����⊮���g�[�A �ɑΉ��B + yahtml-kanji-code �̃f�t�H���g��4(UTF-8)�ɕύX�B + 1.79 �ʃt���[���ɓ���o�b�t�@������Ƃ��̃~�j�o�b�t�@���͂ŁA �|�C���g�ʒu�������Emacs�̖��ւ̑΍����ꂽ�B === yatex === diff --git a/yatex19.el b/yatex19.el index 660674b..75290f4 100644 --- a/yatex19.el +++ b/yatex19.el @@ -1,6 +1,6 @@ ;;; yatex19.el -- YaTeX facilities for Emacs 19 or later -*- coding: sjis -*- ;;; (c)1994-2017 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Thu Jan 5 17:45:46 2017 on firestorm +;;; Last modified Sun Sep 10 09:51:04 2017 on firestorm ;;; $Id$ ;;; Code: @@ -823,5 +823,4 @@ ; fill-prefix: ";;; " ; paragraph-start: "^$\\| \\|;;;$" ; paragraph-separate: "^$\\| \\|;;;$" -; coding: sjis ; End: diff --git a/yatex23.el b/yatex23.el index d9a3320..0e3868c 100644 --- a/yatex23.el +++ b/yatex23.el @@ -1,6 +1,6 @@ ;;; yatex23.el --- YaTeX facilities for Emacs 23 or later -*- coding: sjis -*- ;;; (c)2014-2017 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Thu Jan 5 17:45:48 2017 on firestorm +;;; Last modified Sun Sep 10 09:52:29 2017 on firestorm ;;; $Id$ (require 'yatex19) @@ -105,10 +105,3 @@ "Face of on-the-fly preview image mode") (provide 'yatex23) - -; Local variables: -; fill-prefix: ";;; " -; paragraph-start: "^$\\| \\|;;;$" -; paragraph-separate: "^$\\| \\|;;;$" -; coding: sjis -; End: diff --git a/yatexadd.el b/yatexadd.el index d4cb4d0..750e374 100644 --- a/yatexadd.el +++ b/yatexadd.el @@ -1,6 +1,6 @@ ;;; yatexadd.el --- YaTeX add-in functions -*- coding: sjis -*- ;;; (c)1991-2017 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Thu Jan 5 23:13:23 2017 on firestorm +;;; Last modified Sun Sep 10 09:52:35 2017 on firestorm ;;; $Id$ ;;; Code: @@ -25,7 +25,7 @@ (if (string= YaTeX-env-name "tabular*") (setq width (concat "{" (YaTeX:read-length "Width: ") "}"))) (setq loc (YaTeX:read-position "tb") - bars (string-to-int + bars (YaTeX-str2int (YaTeX-read-string-or-skip "Number of columns(0 for default format): " "3"))) (if (<= bars 0) @@ -404,11 +404,12 @@ (defvar YaTeX-label-menu-other (if YaTeX-japan "':���̃o�b�t�@�̃��x��\n" "':LABEL IN OTHER BUFFER.\n")) (defvar YaTeX-label-menu-repeat - (if YaTeX-japan ".:���O��\\ref�Ɠ���\n" "/:REPEAT LAST \ref{}\n")) + (if YaTeX-japan ".:���O��\\ref�Ɠ���\n" ".:REPEAT LAST \\ref{}\n")) (defvar YaTeX-label-menu-any (if YaTeX-japan "*:�C�ӂ̕�����\n" "*:ANY STRING.\n")) (defvar YaTeX-label-buffer "*Label completions*") -(defvar YaTeX-label-guide-msg "Select label and hit RETURN.") +(defvar YaTeX-label-guide-msg + "[RET] on the Label. M-a)All M-c)Capt M-e)Eqn M-i)Itm M-s)Sec M-m)misc") (defvar YaTeX-label-select-map nil "Key map used in label selection buffer.") (defun YaTeX::label-setup-key-map () @@ -434,6 +435,12 @@ (define-key YaTeX-label-select-map "'" 'YaTeX::label-search-tag) (define-key YaTeX-label-select-map "." 'YaTeX::label-search-tag) (define-key YaTeX-label-select-map "*" 'YaTeX::label-search-tag) + (define-key YaTeX-label-select-map "\M-a" 'YaTeX::label-sel-all) + (define-key YaTeX-label-select-map "\M-c" 'YaTeX::label-sel-cap) + (define-key YaTeX-label-select-map "\M-e" 'YaTeX::label-sel-eqn) + (define-key YaTeX-label-select-map "\M-i" 'YaTeX::label-sel-item) + (define-key YaTeX-label-select-map "\M-s" 'YaTeX::label-sel-sec) + (define-key YaTeX-label-select-map "\M-m" 'YaTeX::label-sel-misc) (message "Setting up label selection mode map...Done") (let ((key ?A)) (while (<= key ?Z) @@ -462,6 +469,38 @@ (goto-char (match-beginning 0)))) (message YaTeX-label-guide-msg))) +(defun YaTeX::label-sel-* (type &optional any) + "Label type filtering out in YaTeX Label completion buffer" + (save-excursion + (let (ov) + (goto-char (point-min)) + (while (not (eobp)) + (goto-char (next-overlay-change (point))) + (if (null (setq ov (car-safe (overlays-at (point))))) + nil ;do nothin if overlays not found + (overlay-put + ov 'invisible (not (or any + (eq (overlay-get ov 'type) type))))))))) + +(defun YaTeX::label-sel-all () + (interactive) + (YaTeX::label-sel-* 'any 'any)) +(defun YaTeX::label-sel-cap () + (interactive) + (YaTeX::label-sel-* 'cap)) +(defun YaTeX::label-sel-eqn () + (interactive) + (YaTeX::label-sel-* 'eqn)) +(defun YaTeX::label-sel-item () + (interactive) + (YaTeX::label-sel-* 'item)) +(defun YaTeX::label-sel-sec () + (interactive) + (YaTeX::label-sel-* 'sec)) +(defun YaTeX::label-sel-misc () + (interactive) + (YaTeX::label-sel-* 'misc)) + ; (defun YaTeX::ref (argp &optional labelcmd refcmd) ; (cond ; ((= argp 1) @@ -571,19 +610,19 @@ (Y (substring ts -4)) (y (substring ts -2)) (b (substring ts 0 3)) - (d (format "%d" (string-to-int (substring ts 4 6)))) + (d (format "%d" (YaTeX-str2int (substring ts 4 6)))) (H (substring ts 7 9)) (M (substring ts 10 12)) (S (substring ts 13 15)) - (HMS (+ (* 10000 (string-to-int H)) - (* 100 (string-to-int M)) - (string-to-int S))) + (HMS (+ (* 10000 (YaTeX-str2int H)) + (* 100 (YaTeX-str2int M)) + (YaTeX-str2int S))) (talphabex (YaTeX::ref-alphabex HMS)) (mnames "JanFebMarAprMayJunJulAugSepOctNovDec") (m (format "%02d" (/ (string-match b mnames) 3))) - (ymd (+ (* 10000 (string-to-int y)) - (* 100 (string-to-int m)) - (string-to-int d))) + (ymd (+ (* 10000 (YaTeX-str2int y)) + (* 100 (YaTeX-str2int m)) + (YaTeX-str2int d))) (dalphabex (YaTeX::ref-alphabex ymd))) (YaTeX-replace-formats (or format YaTeX-ref-default-label-string) @@ -680,7 +719,7 @@ (if (condition-case nil (progn (goto-char curtop) - (YaTeX-goto-corresponding-environment)) + (YaTeX-goto-corresponding-environment nil t 'nonstop)) (error nil)) (setq end (point))) (goto-char inspoint) @@ -814,6 +853,265 @@ "*ref�⊮�Ŏ��W����Z�N�V���j���O�R�}���h�̉������x�� YaTeX-sectioning-level�̐��l�Ŏw��.") +(defun YaTeX::ref-1 (&optional nest-level) + ;; Sub-function of YaTeX::ref() for recursive call + ;; DO NOT CALL FROM OTHER FUNCTIONS but YaTeX:ref() + (setq nest-level (or nest-level 0)) + (let ((labelleader (substring " " 0 nest-level)) + label) + (while (YaTeX-re-search-active-forward + regexp ;;counter + percent nil t) + ;(goto-char (match-beginning 0)) + (setq e0 (match-end 0)) + (cond + ;; + ;;2005/10/21 Skip it if predicate function returns nil + ((and predf + (let ((md (match-data))) + (prog1 + (condition-case nil + (not (funcall predf)) + (error nil)) + (store-match-data md))))) + ((YaTeX-literal-p) nil) + ((YaTeX-match-string 1) + ;;if standard counter commands found + (setq cmd (YaTeX-match-string 2) + m0 (match-beginning 0)) + (setq match-point (match-beginning 0)) + (or initl + (if (< p (point)) (setq initl lnum))) + (cond + ;; In any case, variables e0 should be set + ((and YaTeX-use-AMS-LaTeX + (string-match YaTeX::ref-nestable-counter-regexp cmd)) + (skip-chars-forward "}") + (setq label (buffer-substring + (point) (min (+ 80 (point)) (point-max)))) + ;; to skip (maybe)auto-generated comment + (skip-chars-forward " \t") + (if (looking-at YaTeX-comment-prefix) + (forward-line 1)) + (setq e0 (point)) + (skip-chars-forward " \t\n") + (if (looking-at "\\\\label{\\([^}]+\\)}") + (setq label (format "(labe:%s)" (YaTeX-match-string 1)) + e0 (match-end 1))) + (funcall output + (format "--subequation--%s%s" labelleader label) + e0 'eqn)) + ((string-match mathenvs cmd) ;;if matches mathematical env + (skip-chars-forward "}") + (setq x (point) + envname (substring + cmd (match-beginning 0) (match-end 0))) + (save-restriction + (narrow-to-region + m0 + (save-excursion + (YaTeX-re-search-active-forward + (setq endrx (format "%send{%s}" YaTeX-ec-regexp + (regexp-quote envname))) + percent nil t))) + (catch 'scan + (while (YaTeX-re-search-active-forward + (concat + "\\\\end{\\(" (regexp-quote envname) "\\)" ;;(1) + "\\|\\\\\\(notag\\)" ;;2 + (if (string-match + YaTeX::ref-mathenv-exp1-regexp cmd) + "" "\\|\\(\\\\\\\\\\)$") ;;3 + ) + percent nil t) + (let*((quit (match-beginning 1)) + (notag (match-beginning 2)) + (newln (match-beginning 3)) + (label ".......................") l2 + (e (point)) (m0 (match-beginning 0)) + (ln (YaTeX-string-width label))) + (cond + (notag + (YaTeX-re-search-active-forward + "\\\\\\\\" percent nil 1) + (setq x (point))) ;use x as \label search bound + ((and newln ; `\\' found + (not (equal (YaTeX-inner-environment) + envname))) + (YaTeX-end-of-environment) + (goto-char (match-end 0))) + (t + (if (YaTeX-re-search-active-backward + YaTeX::ref-labeling-regexp + percent x t) + ;; if \label{x} in math-expression, display it + ;; because formula source is hard to recognize + (progn + (goto-char (match-end 0)) + (setq l2 (format "\"label:%s\"" + (buffer-substring + (1- (point)) + (progn (forward-sexp -1) + (1+ (point)))))) + (setq label + (if (< (YaTeX-string-width l2) ln) + (concat + l2 + (substring + label + 0 (- ln (YaTeX-string-width l2)))) + l2)) + (goto-char e))) + (funcall output + (concat + labelleader label " " + (buffer-substring x m0)) + x 'eqn) + (cond + ((YaTeX-quick-in-environment-p + YaTeX-math-gathering-list) + ;; if here is inner split/cases/gathered env., + ;; counter for here is only one. + ;; Go out this environment and, + (YaTeX-end-of-environment) + ;; search next expression unit boundary. + (YaTeX-re-search-active-forward + (concat endrx "\\|\\\\begin{") + percent nil 1) + (end-of-line))) + (if quit (throw 'scan t))))) + (setq x (point))))) + (setq e0 (point))) + ((string-match enums cmd) + ;(skip-chars-forward "} \t\n") + (save-restriction + (narrow-to-region + (point) + (save-excursion + (YaTeX-goto-corresponding-environment nil t 'nonstop) (point))) + (forward-line 1) + (let ((b0 nil) mb0) + (while (not (eobp)) + (setq x (and + (YaTeX-re-search-active-forward + (concat YaTeX-ec-regexp "item\\s ") + percent nil 1) + (match-beginning 0))) + + (if b0 ;Inspect sentence after previous \item + (save-excursion + (save-restriction + (let ((md (match-data))) ;save-match-data + (unwind-protect + (progn + (narrow-to-region b0 (or x (point))) + (goto-char (point-min)) + (let ((x x)) (YaTeX::ref-1 (1+ nest-level))) + (goto-char (point-max))) + (store-match-data md)))))) + (if x ;Output THIS \item line + (funcall + output + (concat + labelleader existlabel + (buffer-substring + (match-beginning 0) + (if (re-search-forward itemsep nil 1) + (progn (goto-char (match-beginning 0)) + (skip-chars-backward " \t") + (1- (point))) + (point-end-of-line)))) + x 'item)) + (setq b0 (point)) + )) + (setq e0 (point-max)))) + ((string-match "bibitem" cmd) ;maybe generated by myself + (setq label "") + (skip-chars-forward " \t") + (if (looking-at "{") ;sure to be true!! + (forward-list 1)) + (let ((list '(30 10 65)) + (delim ";") q lim len l str) + (save-excursion + (setq lim (if (re-search-forward itemsep nil 1) + (match-beginning 0) (point)))) + (while list + (skip-chars-forward " \t\n\\") + (setq q (looking-at "[\"'{]") + len (car list) + str + (buffer-substring + (point) + (progn + (if q (forward-sexp 1) + (search-forward delim lim 1) + (forward-char -1)) + (point)))) + (if (> (setq l (YaTeX-string-width str)) len) + (setq str (concat + (YaTeX-truncate-string-width + str (- len (if q 5 4))) + "... " + (if q (substring str -1))))) + (if (< (setq l (YaTeX-string-width str)) len) + (setq str (concat str (make-string (- len l) ? )))) + (if (looking-at delim) (goto-char (match-end 0))) + (setq label (concat label " " str) + list (cdr list))) + (funcall output (concat labelleader label) match-point 'bib))) + ;;else, simple section-type counter + ((= (char-after (1- (point))) ?{) + (setq label (buffer-substring + (match-beginning 0) + (progn (forward-char -1) + (forward-list 1) + (point)))) + (funcall output (concat labelleader label) match-point + (if (string-match "caption" cmd) 'cap 'sec)) + ;; Skip preceding label if exists + (if (YaTeX::ref-getset-label (current-buffer) match-point t) + (goto-char (get 'YaTeX::ref-getset-label 'foundpoint))) + (if (save-excursion + (skip-chars-forward "\t \n") + (looking-at YaTeX::ref-labeling-regexp)) + (setq e0 (match-end 0)))) + (t + (skip-chars-forward " \t") + (setq label (buffer-substring + (match-beginning 0) + (if (re-search-forward + itemsep + nil t) + (progn + (goto-char (match-beginning 0)) + (skip-chars-backward " \t") + (1- (point))) + (point-end-of-line)))) + (funcall output (concat labelleader label) match-point 'misc) + (if (save-excursion + (skip-chars-forward "\t \n") + (looking-at YaTeX::ref-labeling-regexp)) + (setq e0 (match-end 0))))) + ) ;;put label buffer + ;; + ;; if user defined label found + (t + ;; memorize line number and label into property + (goto-char (match-beginning 0)) + (let ((list YaTeX::ref-labeling-regexp-alist) + (cache (symbol-plist 'YaTeX::ref-labeling-regexp))) + (while list + (if (looking-at (car (car list))) + (progn + (setq label (YaTeX-match-string 0)) + (put 'YaTeX::ref-labeling-regexp lnum + (YaTeX-match-string (cdr (car list)))) + (funcall output (concat labelleader label) 0) ;;0 is dummy + (setq list nil))) + (setq list (cdr list)))) + )) + (goto-char e0)))) + (defun YaTeX::ref (argp &optional labelcmd refcmd predf) (setplist 'YaTeX::ref-labeling-regexp nil) ;erase memory cache (require 'yatexsec) @@ -854,14 +1152,22 @@ (percent (regexp-quote YaTeX-comment-prefix)) (output (function - (lambda (label p) + (lambda (label p &optional type) ;type: 'eqn 'item 'cap 'sec 'misc (while (setq x (string-match "[\n\t]" label)) (aset label x ? )) (while (setq x (string-match " +" label)) (setq label (concat (substring label 0 (1+ (match-beginning 0))) (substring label (match-end 0))))) - (princ (format "%c: <<%s>>\n" (+ (% lnum 26) ?A) label)) + (save-excursion + (set-buffer standard-output) + (overlay-put + (make-overlay + (point) + (progn + (insert (format "%c: <<%s>>\n" (+ (% lnum 26) ?A) label)) + (point))) + 'type type)) (setq point-list (cons p point-list)) (message "Collecting labels... %d" lnum) (setq lnum (1+ lnum))))) @@ -890,238 +1196,10 @@ (goto-char (point-min)) (let ((standard-output (get-buffer YaTeX-label-buffer)) existlabel) (princ (format "=== LABELS in [%s] ===\n" (buffer-name buf))) - (while (YaTeX-re-search-active-forward - regexp ;;counter - percent nil t) - ;(goto-char (match-beginning 0)) - (setq e0 (match-end 0)) - (cond - ;; - ;;2005/10/21 Skip it if predicate function returns nil - ((and predf - (let ((md (match-data))) - (prog1 - (condition-case nil - (not (funcall predf)) - (error nil)) - (store-match-data md))))) - ((YaTeX-literal-p) nil) - ((YaTeX-match-string 1) - ;;if standard counter commands found - (setq cmd (YaTeX-match-string 2) - m0 (match-beginning 0)) - (setq match-point (match-beginning 0)) - (or initl - (if (< p (point)) (setq initl lnum))) - (cond - ;; In any case, variables e0 should be set - ((and YaTeX-use-AMS-LaTeX - (string-match YaTeX::ref-nestable-counter-regexp cmd)) - (let (label) - (skip-chars-forward "}") - (setq label (buffer-substring - (point) (min (+ 80 (point)) (point-max)))) - ;; to skip (maybe)auto-generated comment - (skip-chars-forward " \t") - (if (looking-at YaTeX-comment-prefix) - (forward-line 1)) - (setq e0 (point)) - (skip-chars-forward " \t\n") - (if (looking-at "\\\\label{\\([^}]+\\)}") - (setq label (format "(labe:%s)" (YaTeX-match-string 1)) - e0 (match-end 1))) - (funcall output (format "--subequation--%s" label) e0))) - ((string-match mathenvs cmd) ;;if matches mathematical env - (skip-chars-forward "}") - (setq x (point) - envname (substring - cmd (match-beginning 0) (match-end 0))) - (save-restriction - (narrow-to-region - m0 - (save-excursion - (YaTeX-re-search-active-forward - (setq endrx (format "%send{%s}" YaTeX-ec-regexp - (regexp-quote envname))) - percent nil t))) - (catch 'scan - (while (YaTeX-re-search-active-forward - (concat - "\\\\end{\\(" (regexp-quote envname) "\\)";;(1) - "\\|\\\\\\(notag\\)" ;;2 - (if (string-match - YaTeX::ref-mathenv-exp1-regexp cmd) - "" "\\|\\(\\\\\\\\\\)$") ;;3 - ) - percent nil t) - (let*((quit (match-beginning 1)) - (notag (match-beginning 2)) - (newln (match-beginning 3)) - (label ".......................") l2 - (e (point)) (m0 (match-beginning 0)) - (ln (YaTeX-string-width label))) - (cond - (notag - (YaTeX-re-search-active-forward - "\\\\\\\\" percent nil 1) - (setq x (point))) ;use x as \label search bound - ((and newln ; `\\' found - (not (equal (YaTeX-inner-environment) - envname))) - (YaTeX-end-of-environment) - (goto-char (match-end 0))) - (t - (if (YaTeX-re-search-active-backward - YaTeX::ref-labeling-regexp - percent x t) - ;; if \label{x} in math-expression, display it - ;; because formula source is hard to recognize - (progn - (goto-char (match-end 0)) - (setq l2 (format "\"label:%s\"" - (buffer-substring - (1- (point)) - (progn (forward-sexp -1) - (1+ (point)))))) - (setq label - (if (< (YaTeX-string-width l2) ln) - (concat - l2 - (substring - label - 0 (- ln (YaTeX-string-width l2)))) - l2)) - (goto-char e))) - (funcall output - (concat - label " " - (buffer-substring x m0)) - x) - (cond - ((YaTeX-quick-in-environment-p - YaTeX-math-gathering-list) - ;; if here is inner split/cases/gathered env., - ;; counter for here is only one. - ;; Go out this environment and, - (YaTeX-end-of-environment) - ;; search next expression unit boundary. - (YaTeX-re-search-active-forward - (concat endrx "\\|\\\\begin{") - percent nil 1) - (end-of-line))) - (if quit (throw 'scan t))))) - (setq x (point))))) - (setq e0 (point))) - ((string-match enums cmd) - ;(skip-chars-forward "} \t\n") - (save-restriction - (narrow-to-region - (point) - (save-excursion - (YaTeX-goto-corresponding-environment) (point))) - (forward-line 1) - (while (YaTeX-re-search-active-forward - (concat YaTeX-ec-regexp "item\\s ") - percent nil t) - (setq x (match-beginning 0)) - (funcall - output - (concat - existlabel - (buffer-substring - (match-beginning 0) - (if (re-search-forward itemsep nil t) - (progn (goto-char (match-beginning 0)) - (skip-chars-backward " \t") - (1- (point))) - (point-end-of-line)))) - x)) - (setq e0 (point-max)))) - ((string-match "bibitem" cmd) ;maybe generated by myself - (setq label "") - (skip-chars-forward " \t") - (if (looking-at "{") ;sure to be true!! - (forward-list 1)) - (let ((list '(30 10 65)) - (delim ";") q lim len l str) - (save-excursion - (setq lim (if (re-search-forward itemsep nil 1) - (match-beginning 0) (point)))) - (while list - (skip-chars-forward " \t\n\\") - (setq q (looking-at "[\"'{]") - len (car list) - str - (buffer-substring - (point) - (progn - (if q (forward-sexp 1) - (search-forward delim lim 1) - (forward-char -1)) - (point)))) - (if (> (setq l (YaTeX-string-width str)) len) - (setq str (concat - (YaTeX-truncate-string-width - str (- len (if q 5 4))) - "... " - (if q (substring str -1))))) - (if (< (setq l (YaTeX-string-width str)) len) - (setq str (concat str (make-string (- len l) ? )))) - (if (looking-at delim) (goto-char (match-end 0))) - (setq label (concat label " " str) - list (cdr list))) - (funcall output label match-point))) - ;;else, simple section-type counter - ((= (char-after (1- (point))) ?{) - (setq label (buffer-substring - (match-beginning 0) - (progn (forward-char -1) - (forward-list 1) - (point)))) - (funcall output label match-point) - ;; Skip preceding label if exists - (if (YaTeX::ref-getset-label (current-buffer) match-point t) - (goto-char (get 'YaTeX::ref-getset-label 'foundpoint))) - (if (save-excursion - (skip-chars-forward "\t \n") - (looking-at YaTeX::ref-labeling-regexp)) - (setq e0 (match-end 0)))) - (t - (skip-chars-forward " \t") - (setq label (buffer-substring - (match-beginning 0) - (if (re-search-forward - itemsep - nil t) - (progn - (goto-char (match-beginning 0)) - (skip-chars-backward " \t") - (1- (point))) - (point-end-of-line)))) - (funcall output label match-point) - (if (save-excursion - (skip-chars-forward "\t \n") - (looking-at YaTeX::ref-labeling-regexp)) - (setq e0 (match-end 0))))) - ) ;;put label buffer - ;; - ;; if user defined label found - (t - ;; memorize line number and label into property - (goto-char (match-beginning 0)) - (let ((list YaTeX::ref-labeling-regexp-alist) - (cache (symbol-plist 'YaTeX::ref-labeling-regexp))) - (while list - (if (looking-at (car (car list))) - (progn - (setq label (YaTeX-match-string 0)) - (put 'YaTeX::ref-labeling-regexp lnum - (YaTeX-match-string (cdr (car list)))) - (funcall output label 0) ;;0 is dummy, never used - (setq list nil))) - (setq list (cdr list)))) - )) - (goto-char e0)) + + (YaTeX::ref-1) + + (princ YaTeX-label-menu-other) (princ YaTeX-label-menu-repeat) (princ YaTeX-label-menu-any) @@ -1511,7 +1589,7 @@ command)) ((= argp 2) (let ((argc - (string-to-int + (YaTeX-str2int (read-string-with-history "Number of arguments(Default 0): "))) (def (YaTeX-read-string-or-skip "Definition: ")) (command (get 'YaTeX::newcommand 'command))) @@ -2290,5 +2368,4 @@ ; fill-prefix: ";;; " ; paragraph-start: "^$\\| \\|;;;$" ; paragraph-separate: "^$\\| \\|;;;$" -; coding: sjis ; End: diff --git a/yatexenv.el b/yatexenv.el index 22cc43f..849dd1e 100644 --- a/yatexenv.el +++ b/yatexenv.el @@ -1,6 +1,6 @@ ;;; yatexenv.el --- YaTeX environment-specific functions ;;; (c) 1994-2017 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Thu Jan 5 17:45:53 2017 on firestorm +;;; Last modified Thu May 4 10:19:20 2017 on firestorm ;;; $Id$ ;;; Code: @@ -43,7 +43,7 @@ ((> n 1) (re-search-backward andptn) ;Sure to find! (while (re-search-backward "\\\\multicolumn{\\([0-9]+\\)}" bor t) - (setq n (+ n (string-to-int + (setq n (+ n (YaTeX-str2int (buffer-substring (match-beginning 1) (match-end 1))) -1))))) @@ -101,7 +101,7 @@ (forward-list 1)) ((equal elt ?*) ;*{N}{EXP} -> Repeat EXP N times (skip-chars-forward "^{" end) - (setq cols (* (string-to-int + (setq cols (* (YaTeX-str2int (buffer-substring (1+ (point)) (progn (forward-list 1) (1- (point))))) @@ -136,7 +136,7 @@ ((eq type 'alignat) (max 1 - (* 2 (string-to-int + (* 2 (YaTeX-str2int (buffer-substring (point) (progn (up-list -1) (forward-list 1) (1- (point)))))))) @@ -391,6 +391,11 @@ (fset 'YaTeX-enclose-eqnarray 'YaTeX-enclose-equation) (fset 'YaTeX-enclose-eqnarray* 'YaTeX-enclose-equation) +(mapcar (function ;; Add all AMS LaTeX envs + (lambda (sym) + (fset (intern (concat "YaTeX-enclose-" (car sym))) + 'YaTeX-enclose-equation))) + YaTeX-ams-math-begin-alist) (defun YaTeX-enclose-verbatim (beg end)) ;do nothing when enclose verbatim (fset 'YaTeX-enclose-verbatim* 'YaTeX-enclose-verbatim) diff --git a/yatexgen.el b/yatexgen.el index ee59e90..3086b09 100644 --- a/yatexgen.el +++ b/yatexgen.el @@ -1,6 +1,6 @@ ;;; yatexgen.el --- YaTeX add-in function generator(rev.5) -;;; (c)1991-1995,1999,2000 by HIROSE Yuuji.[yuuji@yatex.org] +;;; (c)1991-1995,1999,2000,2017 by HIROSE Yuuji.[yuuji@yatex.org] ;;; Last modified Sun Dec 21 14:04:49 2014 on firestorm ;;; $Id$ @@ -582,6 +582,6 @@ (YaTeX-generate-option-type command) (YaTeX-generate-argument-type command - (string-to-int (read-string "How many arguments?: ")))) nil)) + (YaTeX-str2int (read-string "How many arguments?: ")))) nil)) (provide 'yatexgen) diff --git a/yatexlib.el b/yatexlib.el index 00399ff..cf7ef9a 100644 --- a/yatexlib.el +++ b/yatexlib.el @@ -1,16 +1,25 @@ ;;; yatexlib.el --- YaTeX and yahtml common libraries -*- coding: sjis -*- ;;; ;;; (c)1994-2017 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Thu Jan 5 17:46:13 2017 on firestorm +;;; Last modified Sun Sep 10 21:16:11 2017 on firestorm ;;; $Id$ ;;; Code: + +;; High-precedence compatible function +(fset 'YaTeX-str2int + (if (fboundp 'string-to-number) + (function + (lambda (string &optional base) + (ceiling (string-to-number string base)))) + 'string-to-int)) + ;; General variables (defvar YaTeX-dos (memq system-type '(ms-dos windows-nt OS/2))) (defvar YaTeX-macos (memq system-type '(darwin))) -(defvar YaTeX-emacs-19 (>= (string-to-int emacs-version) 19)) -(defvar YaTeX-emacs-20 (>= (string-to-int emacs-version) 20)) -(defvar YaTeX-emacs-21 (>= (string-to-int emacs-version) 21)) +(defvar YaTeX-emacs-19 (>= (YaTeX-str2int emacs-version) 19)) +(defvar YaTeX-emacs-20 (>= (YaTeX-str2int emacs-version) 20)) +(defvar YaTeX-emacs-21 (>= (YaTeX-str2int emacs-version) 21)) (defvar YaTeX-user-completion-table (if YaTeX-dos "~/_yatexrc" "~/.yatexrc") "*Default filename in which user completion table is saved.") @@ -559,7 +568,7 @@ (if (numberp height) (+ height 2) (/ (* (YaTeX-screen-height) - (string-to-int height)) + (YaTeX-str2int height)) 100))) (- (YaTeX-screen-height) window-min-height 1)) window-min-height)))) @@ -1037,7 +1046,7 @@ (cons env m0))) ;else, return meaningful values (store-match-data md))))))) -(defun YaTeX-goto-corresponding-environment (&optional allow-mismatch noerr) +(defun YaTeX-goto-corresponding-environment (&optional allow-mismatch noerr bg) "Go to corresponding begin/end enclosure. Optional argument ALLOW-MISMATCH allows mismatch open/clese. Use this for \left(, \right). @@ -1049,14 +1058,14 @@ (m1 (match-beginning 1)) ;environment in \begin{} (m2 (match-beginning 2)) ;environment in \end{} (m3 (match-beginning 3))) ;environment in \[ \] \( \) - ;(setq env (regexp-quote (buffer-substring p (match-beginning 0)))) + ;(setq env (regexp-quote (buffer-substring p (match-beginning 0)))) (if (cond (m1 ;if begin{xxx} (setq env (if allow-mismatch YaTeX-struct-name-regexp (regexp-quote (buffer-substring m1 (match-end 1))))) - ; (setq regexp (concat "\\(\\\\end{" env "}\\)\\|" - ; "\\(\\\\begin{" env "}\\)")) + ; (setq regexp (concat "\\(\\\\end{" env "}\\)\\|" + ; "\\(\\\\begin{" env "}\\)")) (setq regexp (concat "\\(" @@ -1071,8 +1080,8 @@ (setq env (if allow-mismatch YaTeX-struct-name-regexp (regexp-quote (buffer-substring m2 (match-end 2))))) - ; (setq regexp (concat "\\(\\\\begin{" env "}\\)\\|" - ; "\\(\\\\end{" env "}\\)")) + ; (setq regexp (concat "\\(\\\\begin{" env "}\\)\\|" + ; "\\(\\\\end{" env "}\\)")) (setq regexp (concat "\\(" @@ -1110,7 +1119,7 @@ (funcall (if noerr 'message 'error) "Corresponding environment `%s' not found." env) - (sit-for 1) + (or bg (sit-for 1)) nil)))))) (defun YaTeX-end-environment () @@ -1657,6 +1666,37 @@ (/ (nth 2 before) mil)))))) ;;; +;; Moved from comment.el +;;; +(defun YaTeX-comment-region-sub (string &optional beg end once) + "Insert STRING at the beginning of every line between BEG and END." + (if (not (stringp string)) (setq string YaTeX-comment-prefix)) + (let ((b (or beg (region-beginning))) (e (or end (region-end)))) + (save-excursion + (goto-char (max b e)) + (if (bolp) + (forward-line -1)) + (save-restriction + (narrow-to-region (min b e) (point)) + (goto-char (point-min)) + (message "%s" string) + (while (re-search-forward "^" nil t) + (insert string)))))) + +(defun YaTeX-uncomment-region-sub (string &optional beg end once) + "Delete STRING from the beginning of every line between BEG and END. +BEG and END are optional. If omitted, active region used. +Non-nil for optional 4th argument ONCE withholds from removing +successive comment chars at the beggining of lines." + (save-excursion + (save-restriction + (narrow-to-region (or beg (region-beginning)) (or end (region-end))) + (goto-char (point-min)) + (while (re-search-forward (concat "^" string) nil t) + (replace-match "") + (if once (end-of-line)))))) + +;;; ;; Functions for the Installation time ;;; @@ -1694,9 +1734,3 @@ (kill-emacs)))) (provide 'yatexlib) -; Local variables: -; fill-prefix: ";;; " -; paragraph-start: "^$\\| \\|;;;$" -; paragraph-separate: "^$\\| \\|;;;$" -; coding: sjis -; End: diff --git a/yatexmth.el b/yatexmth.el index ca72eb0..14c3bd4 100644 --- a/yatexmth.el +++ b/yatexmth.el @@ -1,7 +1,7 @@ ;;; yatexmth.el --- YaTeX math-mode-specific functions -*- coding: sjis -*- ;;; ;;; (c)1993-2017 by HIROSE Yuuji [yuuji@yatex.org] -;;; Last modified Thu Jan 5 17:46:22 2017 on firestorm +;;; Last modified Tue May 23 11:41:17 2017 on firestorm ;;; $Id$ ;;; Commentary: @@ -321,6 +321,7 @@ ("mi" "mathit" "\\mathit{}") ("mr" "mathrm" "\\mathrm{}") ("mb" "mathbf" "\\mathbf{}") + ("mB" "mathbb" "\\mathbb{}") ("mt" "mathtt" "\\mathtt{}") ("ms" "mathsf" "\\mathsf{}") ("mc" "mathcal" "\\mathcal{}") @@ -346,53 +347,64 @@ ;;) (defvar YaTeX-greek-key-alist-default - '( - ("a" "alpha" ("a" "��")) - ("b" "beta" ("|>\n|>\n|" "��")) - ("g" "gamma" ("~r" "��")) - ("G" "Gamma" ("|~" "��")) - ("d" "delta" ("<~\n<>" "��")) - ("D" "Delta" ("/\\\n~~" "��")) - ("e" "epsilon" "<\n<~") - ("e-" "varepsilon" ("(\n(~" "��")) - ("z" "zeta" ("(~\n >" "��")) - ("et" "eta" ("n\n/" "��")) - ("th" "theta" ("8" "��")) - ("Th" "Theta" ("(8)" "��")) - ("th-" "vartheta" ("-8" "-��")) - ("i" "iota" ("i\n\\_/" "��")) - ("k" "kappa" ("k" "��")) - ("l" "lambda" ("\\n/\\" "��")) - ("L" "Lambda" ("/\\" "��")) - ("m" "mu" (" u_\n/" "��")) - ("n" "nu" ("|/" "��")) - ("x" "xi" ("E\n >" "��")) - ("X" "Xi" ("---\n -\n---" "��")) - ("p" "pi" ("__\n)(" "��")) - ("P" "Pi" ("__\n||" "��")) - ("p-" "varpi" ("_\nw" "__\n��")) - ("r" "rho" ("/O" "��")) - ("r-" "varrho" ("/O\n~~" "��\n~~")) - ("s" "sigma" ("o~" "��")) - ("S" "Sigma" ("\\-+\n >\n/-+" "��")) - ("s-" "varsigma" "(~~ \n>") - ("t" "tau" ("__\n(" "��")) - ("u" "upsilon" ("~v" "��")) - ("y" "upsilon" ("~v" "��")) - ("U" "Upsilon" ("~Y~" "��")) - ("Y" "Upsilon" ("~Y~" "��")) - ("ph" "phi" (" /\n(/)\n/" "��")) - ("Ph" "Phi" (" _\n(|)\n ~" "��")) - ("ph-" "varphi" "\\O\n|") - ("c" "chi" ("x" "��")) - ("ps" "psi" ("\\|/\\n |" "��")) - ("Ps" "Psi" (" ~\n\\|/\\n |" "��")) - ("o" "omega" ("w" "��")) - ("w" "omega" ("w" "��")) - ("O" "Omega" ("(~)\n~ ~" "��")) - ("W" "Omega" ("(~)\n~ ~" "��")) - ("f" "foo") - ) + (append + '(("a" "alpha" ("a" "��")) + ("b" "beta" ("|>\n|>\n|" "��")) + ("g" "gamma" ("~r" "��")) + ("G" "Gamma" ("|~" "��")) + ("d" "delta" ("<~\n<>" "��")) + ("D" "Delta" ("/\\\n~~" "��")) + ("e" "epsilon" "<\n<~") + ("e-" "varepsilon" ("(\n(~" "_��")) + ("z" "zeta" ("(~\n >" "��")) + ("et" "eta" ("n\n/" "��")) + ("th" "theta" ("8" "��")) + ("Th" "Theta" ("(8)" "��")) + ("th-" "vartheta" ("-8" "_��")) + ("i" "iota" ("i\n\\_/" "��")) + ("k" "kappa" ("k" "��")) + ("l" "lambda" ("\\n/\\" "��")) + ("L" "Lambda" ("/\\" "��")) + ("m" "mu" (" u_\n/" "��")) + ("n" "nu" ("|/" "��")) + ("x" "xi" ("E\n >" "��")) + ("X" "Xi" ("---\n -\n---" "��")) + ("p" "pi" ("__\n)(" "��")) + ("P" "Pi" ("__\n||" "��")) + ("p-" "varpi" ("__\n/(" "_��")) + ("r" "rho" ("/O" "��")) + ("r-" "varrho" ("/O\n~~" "��\n~~")) + ("s" "sigma" ("o~" "��")) + ("S" "Sigma" ("\\-+\n >\n/-+" "��")) + ("s-" "varsigma" "/~~ \n /") + ("t" "tau" ("__\n(" "��")) + ("u" "upsilon" ("~v" "��")) + ("y" "upsilon" ("~v" "��")) + ("U" "Upsilon" ("~Y~" "��")) + ("Y" "Upsilon" ("~Y~" "��")) + ("ph" "phi" (" /\n(/)\n/" "��")) + ("Ph" "Phi" (" _\n(|)\n ~" "��")) + ("ph-" "varphi" "\\O\n|") + ("c" "chi" ("x" "��")) + ("ps" "psi" ("\\|/\\n |" "��")) + ("Ps" "Psi" (" ~\n\\|/\\n |" "��")) + ("o" "omega" ("w" "��")) + ("w" "omega" ("w" "��")) + ("O" "Omega" ("(~)\n~ ~" "��")) + ("W" "Omega" ("(~)\n~ ~" "��")) + ("f" "foo")) + (if YaTeX-use-AMS-LaTeX + '( + ("G-" "varGamma" ("/~" "_��")) + ("D-" "varDelta" ("/|\n~~" "_��")) + ("Th-" "varTheta" ("/8/" "_��")) + ("L-" "varLambda" ("/|" "_��")) + ("X-" "varXi" (" --\n -\n-- " "_��")) + ("S-" "varSigma" (" \\-+\n >\n/-+" "_��")) + ("U-" "varUpsilon" ("~~Y~" "_��")) + ("Ph-" "varPhi" (" _\n(|)\n~" "_��")) + ("Ps-" "varPsi" (" ~\n\\//\\n /" "��")) + ("O-" "varOmega" ("/~/\n~ ~" "_��"))))) "Default LaTeX-math-command alist.") (defvar YaTeX-greek-key-alist-private nil @@ -522,7 +534,8 @@ ;; "equation*" "cases" "flalign" "flalign*" ;; "alignat*" "xalignat" "xalignat*" "xxalignat" "xxalignat*" YaTeX-math-begin-list - ))) + ) + YaTeX-math-other-env-list)) (let*((p (point)) (nest 0) me0 r firstp dollar (delim (concat YaTeX-sectioning-regexp "\\|^$\\|^\C-l")) (boundary diff --git a/yatexpkg.el b/yatexpkg.el index 5ecc987..9de2073 100644 --- a/yatexpkg.el +++ b/yatexpkg.el @@ -1,7 +1,7 @@ ;;; yatexpkg.el --- YaTeX package manager -*- coding: sjis -*- ;;; ;;; (c)2003-2017 by HIROSE, Yuuji [yuuji@yatex.org] -;;; Last modified Thu Jan 5 17:46:30 2017 on firestorm +;;; Last modified Tue May 23 11:33:17 2017 on firestorm ;;; $Id$ ;;; Code: @@ -34,7 +34,10 @@ (section "tag" "tag*")) ("amssymb" (maketitle "leqq" "geqq" "mathbb" "mathfrak" "fallingdotseq" "therefore" "because" + "varDelta" "varTheta" "varLambda" "varXi" "varPi" + "varSigma" "varUpsilon" "varPhi" "varPsi" "varOmega" "lll" "ggg")) ;very few. Please tell us! + ("mathrsfs" (section "mathscr")) ("graphicx" (section "includegraphics" "rotatebox" "scalebox" "resizebox" "reflectbox") (option . YaTeX-package-graphics-driver-alist)) @@ -52,6 +55,7 @@ ("labelcpageref" (same-as . "cref")) ("wrapfig" (env "wrapfigure" "wraptable")) ("setspace" (env "spacing") (section "setstretch")) + ("cases" (env "numcases" "subnumcases")) ) "Default package vs. macro list. Alists contains '(PACKAGENAME . MACROLIST) diff --git a/yatexprc.el b/yatexprc.el index a1eeb21..c26bc67 100644 --- a/yatexprc.el +++ b/yatexprc.el @@ -1,7 +1,7 @@ ;;; yatexprc.el --- YaTeX process handler -*- coding: sjis -*- ;;; ;;; (c)1993-2017 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Thu Jan 5 17:46:36 2017 on firestorm +;;; Last modified Sun Feb 26 11:33:27 2017 on firestorm ;;; $Id$ ;;; Code: @@ -1113,7 +1113,7 @@ t) ;for YaTeX-goto-corresponding-* nil))) - (defun YaTeX-set-virtual-error-position (file-sym line-sym) +(defun YaTeX-set-virtual-error-position (file-sym line-sym) "Replace the value of FILE-SYM, LINE-SYM by virtual error position." (cond ((and (get 'dvi2-command 'region) @@ -1131,9 +1131,14 @@ (interactive) (let ((cur-buf (save-excursion (YaTeX-visit-main t) (buffer-name))) (cur-win (selected-window)) + tsb-frame-selwin b0 bound errorp error-line typeset-win error-buffer error-win) (if (null (get-buffer YaTeX-typeset-buffer)) (error "There is no typesetting buffer.")) + (and (fboundp 'selected-frame) + (setq typeset-win (get-buffer-window YaTeX-typeset-buffer t)) + (setq tsb-frame-selwin (frame-selected-window typeset-win))) + (YaTeX-showup-buffer YaTeX-typeset-buffer nil t) (if (and (markerp YaTeX-typeset-marker) (eq (marker-buffer YaTeX-typeset-marker) (current-buffer))) @@ -1149,7 +1154,7 @@ (goto-char (setq b0 (match-beginning 0))) (skip-chars-forward "^0-9" (match-end 0)) (setq error-line - (string-to-int + (YaTeX-str2int (buffer-substring (point) (progn (skip-chars-forward "0-9" (match-end 0)) (point)))) @@ -1157,9 +1162,23 @@ (if (or (null error-line) (equal 0 error-line)) (error "Can't detect error position.")) (YaTeX-set-virtual-error-position 'error-buffer 'error-line) + + (select-window typeset-win) + (skip-chars-backward "0-9") + (recenter (/ (window-height) 2)) + (sit-for 1) + (goto-char b0) + (and tsb-frame-selwin (select-window tsb-frame-selwin)) ;restore selwin + (setq error-win (get-buffer-window error-buffer)) (select-window cur-win) (cond + (t (goto-buffer-window error-buffer) + (if (fboundp 'raise-frame) + (let ((edit-frame (window-frame (selected-window)))) + (raise-frame edit-frame) + (select-frame edit-frame))) + ) (error-win (select-window error-win)) ((eq (get-lru-window) typeset-win) (YaTeX-switch-to-buffer error-buffer)) @@ -1170,11 +1189,6 @@ (message "LaTeX %s in `%s' on line: %d." (if errorp "error" "warning") error-buffer error-line) - (select-window typeset-win) - (skip-chars-backward "0-9") - (recenter (/ (window-height) 2)) - (sit-for 1) - (goto-char b0) (select-window error-win))) (defun YaTeX-jump-error-line () @@ -1189,7 +1203,7 @@ (if (eobp) (insert (this-command-keys)) (error "No line number expression.")) (goto-char (match-beginning 0)) - (setq error-line (string-to-int + (setq error-line (YaTeX-str2int (buffer-substring (match-beginning 1) (match-end 1))) error-file (expand-file-name (YaTeX-get-error-file YaTeX-current-TeX-buffer))) @@ -1251,8 +1265,11 @@ (setq s (buffer-substring (progn (forward-char 1) (point)) - (progn (skip-chars-forward "^ \n" (point-end-of-line)) - (point)))) + (if (re-search-forward + "\\.\\(tex\\|sty\\|ltx\\)\\>" nil (point-end-of-line)) + (match-end 0) + (skip-chars-forward "^ \n" (point-end-of-line)) + (point)))) (if (string= "" s) default s)))) (defun YaTeX-put-nonstopmode () diff --git a/yatexsec.el b/yatexsec.el index 9b3d796..993f98a 100644 --- a/yatexsec.el +++ b/yatexsec.el @@ -1,6 +1,6 @@ ;;; yatexsec.el --- YaTeX sectioning browser ;;; -;;; (c) 1994-2013 by HIROSE Yuuji [yuuji@yatex.org] +;;; (c) 1994-2017 by HIROSE Yuuji [yuuji@yatex.org] ;;; Last modified Sun Dec 21 14:16:35 2014 on firestorm ;;; $Id$ @@ -134,7 +134,7 @@ (and ln (string< "" ln) (progn (goto-char (point-min)) - (forward-line (max 0 (- (string-to-int ln) 2))) + (forward-line (max 0 (- (YaTeX-str2int ln) 2))) (and (search-forward ptn nil t) (goto-char (match-beginning 0))))) @@ -345,7 +345,7 @@ (set-buffer secbuf) (goto-char (point-max)) (while (re-search-backward pattern nil t) - (if (< ln (string-to-int (YaTeX-match-string 1))) nil + (if (< ln (YaTeX-str2int (YaTeX-match-string 1))) nil (beginning-of-line) (search-forward YaTeX-ec) (looking-at YaTeX-TeX-token-regexp)