# HG changeset patch # User HIROSE Yuuji # Date 1436678480 -32400 # Node ID e37af485338a332839b6f04b8524f400538d1801 # Parent 130c104fe22e8e09d356a88f1d9fa4fe8ac31f5f# Parent 8f804c8339bbc176c44058d8142f48f99c3d936e merged with dev diff -r 130c104fe22e -r e37af485338a .hgtags --- a/.hgtags Mon May 14 19:59:12 2012 +0900 +++ b/.hgtags Sun Jul 12 14:21:20 2015 +0900 @@ -4,3 +4,10 @@ 6be1692f81cd35d0ea6022840c9f7e28af6c8e66 start-for-1.75 cb1906082153a03966183a861889f5d96c73d399 start-for-1.76 33c8875f52f9cc99f1f67cbad4e9145171d2d262 yatex-1.75 +784b25b062cc2caba6e75f93e3a2fd6d7ed9d3c7 yatex-1.76 +ef87626ec2f9532850b71eb1609779ec9919b042 yatex-1.77 +ef87626ec2f9532850b71eb1609779ec9919b042 yatex-1.77 +0000000000000000000000000000000000000000 yatex-1.77 +0000000000000000000000000000000000000000 yatex-1.77 +d0c09133ced7fffa1eb5fa4d114fb12580f812ff yatex-1.77 +d69fd7b1ac4d06d7f8633e892dc24eab2bfc23db yatex-1.78 diff -r 130c104fe22e -r e37af485338a docs/qanda --- a/docs/qanda Mon May 14 19:59:12 2012 +0900 +++ b/docs/qanda Sun Jul 12 14:21:20 2015 +0900 @@ -5,9 +5,8 @@ %% (新項目:・RefTeXは使えますか? + ・bibtexとlatexとかを交互にかけるのが面倒なんですけど ・自分で定義したカウンタを\ref補完でのラベル候補対象として認識させたい - ・font-lock はどうやって使えばいいんでしょ? - ・XEmacsでも色は着きますか? ・{\it }内部では斜体に {\bf }では太字になるという噂を聞いたんですが…) ■インストール関連 @@ -36,38 +35,18 @@ ・まだしたっぱなので Info ディレクトリに書き込む権利がないっすう… - rootにしてもらいましょう。それがだめなときは Mule2 をインストー - ルしてもらいましょう。してくれない時は、ホームディレクトリにイン - ストールして、ほーらディスクの無駄遣いだよ〜んといって脅せば入れ - てくれるはずです。Mule2 なら、~/.emacs に + rootにしてもらいましょう。それがだめなときは以下のようにして個人 + 所有の Info ディレクトリをEmacsに認識させましょう。 (setq Info-default-directory-list (cons "自分のInfoディレクトリ" Info-default-directory-list)) - と書くことで、info を起動した時に個人用のファイルもメニューに加 - わります。それでもMule2をなかなか入れてくれない時は、新しいinfo - ファイルを拾って来るたびに管理者に「入れてくださーい。あ、すみま - せーん毎度。でもMule2なら自分のディレクトリを追加できるんですけ - どねぇ…」を繰り返しましょう。 - ・LaTeXのヘルプファイルがないといわれる。 - Nemacs, Mule1 では $EMACS/etc/, Mule2 では $EMACS/site-lisp/ に - 置かれているとみなすようになっています。もし公共の場所に置く権限 - がない時は、ホームディレクトリの下のどこかに置いて、変数 - YaTeX-help-file にそのファイル名を設定して下さい。 - -・Nemacsで info が読めない。 - - Muleでformatしているので、内部日本語処理の異なるNemacs(または - NemacsベースのDemacs)では(バイト数がずれるため)正しく読むことが - できません。Muleで御覧ください。なお、Texinfoファイルのフォーマッ - トには texinfo-3.1.tar.gz にある Emacs-Lisp ファイルを用いてくだ - さい。 - - また、九州大学の井上さんによると、Info の dir 画面で,M-x - Info-tagify とやると info ファイルのコンバートができるそうです。 + もし公共の場所に置く権限がない時は、ホームディレクトリの下のどこ + かに置いて、変数 YaTeX-help-file にそのファイル名を設定して下さ + い。 ■操作関連 ・間違って変なLaTeXコマンドを学習させてしまった。 @@ -174,20 +153,12 @@ ・直前に入れた \foo{引数だよ} の「引数だよ」をもう一回使いたい。 - gmhist というパッケージを導入しましょう。野鳥は gmhist に対応し - ています。ミニバッファで \foo{???}: と聞かれた時に M-p (ESC p)を + ミニバッファで \foo{???}: と聞かれた時に M-p (ESC p)を 押すと今まで入力した文字の履歴を逆方向にたどって表示します。M-n と押すと順方向にたどります。これらの入力履歴は begin 型補完、 section 型補完、プレヴューア起動、プリントアウトコマンド起動それ ぞれに対し独立に設定されます。 - gmhist は多くの Emacs-Lisp アーカイブサイトに置いてあります。 - ftp.ae.keio.ac.jp:pub/emacs-lisp/util/gmhist.tar.gz - にもあります。 - - ただし、Mule2 以降を用いている場合は、gmhistを用いなくてもミニバッ - ファでのヒストリが使えます。 - ・ref←→label間ジャンプで存在するはずのref/labelにジャンプしない。 C-c g とだけ打つと対応するref/labelの前方検索から始めます。 @@ -216,24 +187,30 @@ ・いつも雛型として使っている template.tex を簡単に入れたい - autoinsert.el (Emacs19/Mule2付属)を使いましょう。もしくは、それ - の機能強化版 auto-insert-tkld を使いましょう。後者は、 - ftp://ftp.ae.keio.ac.jp/pub/emacs-lisp/util/auto-inset-tkld.tar.Z - で入手できます。 + ~/work/template.tex に置きましょう。置き場所を変えたい場合は + (setq YaTeX-template-file "~/hogehoge/fugafuga.tex") + のようにして変更できます。 ・bibtexとlatexとかを交互にかけるのが面倒なんですけど - latexmk というスグレもののツールがあります。これは、.tex, - .bib, .idx などのファイル間の依存関係をドキュメントを走査して調 - べ、自動的に bibtex, makeindex, jlatex などを必要な順序で必要な - 回数起動してくれます。これをインストールし、各ドキュメントの先頭 - に - %#!latexmk + yatex1.76からラベルやbibtexでの文献番号不整合を自動的に検知して、 + 再処理が必要なときは自動的に再起動するようになりました(auto rerun)。 + ほとんどの場合、野鳥の auto rerun で対処できるはずです。ただし、 + 以下で述べるlatexmkを利用する場合は重複処理になるため野鳥の + auto rerun を無効化してください。無効化は + (setq YaTeX-typeset-auto-rerun nil) + します。 - などと書いてタイプセッタとして latexmk を指定すれば複雑な依存関 - 係に悩んだ日々とはおさらばです。なお、latexmk は CTAN サイトの - support/latexmk/ ディレクトリに置いてあります。 - (例えば ftp.kdd.lab.kdd.co.jp:/CTAN/) + 同じ目的のツールに latexmk というツールがあります。これは、.tex, + .bib, .idx などのファイル間の依存関係を調べ、自動的に bibtex, + makeindex, platex などを必要な順序で必要な回数起動してくれます。 + これをインストールし、各ドキュメントの先頭に + + %#!latexmk + + などと書いてタイプセッタとして latexmk を指定することで利用でき + ます。なお、latexmk は CTAN サイトにあります。 + (http://www.ctan.org/pkg/latexmk/) ・タイプセットとプレヴューでキーが違うのが面倒ですね? @@ -413,13 +390,6 @@ ん。光らないだけで実害はないので、気にしないか、あるいは次の Meadow が登場するまで hilit19 を利用して下さい。 -・メニューバーの YaTeX をクリックした時にハングしたかと思うほど遅い。 - - わかりません、Emacs のせいです。我慢してください。二回目からは遅 - くありません。ふつ〜メニューなんか使わないでしょ? サルのようにメ - ニューバーを使う友達に野鳥を勧めてはいけません。言いすぎでした、 - ごめんなさいごめんなさい。 - ・\it をイタリック表示できませんか?(Mule2) まず、普段使用しているサイズの斜体フォントを探します。 @@ -611,7 +581,7 @@ 境に括り入れます。 「じゃあpreviewしてみよっか、でもこの部分だけでいいやね」と いってもっぺんcenter環境全体をマーク(ESC C-@)して - [prefix] % b してcenter環境を %#BEGIN〜%#ENDで括ってから + [prefix] % B してcenter環境を %#BEGIN〜%#ENDで括ってから 領域タイプセットします。[prefix] t r。 「さてpreviewじゃ」 といいつつ [prefix] t p します。 @@ -622,22 +592,23 @@ めます。 「はい、次の行」 と言いながら ESC RET します。また適当に埋めて - 領域タイプセットして xdvi をraiseします。muleに戻りcenter環境 - の外に『この表は重要ネ〜』と書きます。 + 今度は [prefix] t e で隣のバッファに on-the-fly preview を出し、 + 表の中味を書き換えては自動的に隣のpreview画像が書き変わる様を + 眺めます。 + 続いて、center環境の外に『この表は重要ネ〜』と書きます。 「うむ、『重要』にはアンダーラインを引こう」 といって『重要』をリジョン指定して [prefix] S(大文字) で - underline を補完入力し、またpreviewします。 + underline を補完入力し、悩んだふりをして 「やっぱアンダーラインはやめ」と言いながら \underline または { か } にカーソルを合わせて [prefix] k して - \underline{} を消します。またpreviewして、 + \underline{} を消します。さらに悩むふりをして 「やっぱセンタリングは要らんかもしれんなあ…」と言いつつ \end{center} にカーソルを合わせて [prefix] . を押します。 - すると \begin{center}, \end{center} に % がつくのでまた - previewします。 + すると \begin{center}, \end{center} に % がつきます。 「うむ、やっぱりセンタリングはぽいっ」と言って \end{center}の行で [prefix] k をおして begin/end 対を消します。 「さて、ファイルがでかくなって来たので分割するか」と言って - \include{foo} などを補完入力します。 + \include{foo} などを [prefix] s で補完入力します。 「じゃあ foo.tex を作らなきゃ…」と言って [prefix] g します。 foo.tex が勝手に作られるので適当にごちゃごちゃ書いて [prefix] t j でタイプセットします。 @@ -649,7 +620,7 @@ こんな感じですかね。 あとは、イメージ補完、数式モード自動判定、先回りusepackageなんて - のもAUCにはありません。 + のもアドバンテージでしょう。 ・なんで構成ファイルがいまさらSJISなの? だっせー。 diff -r 130c104fe22e -r e37af485338a docs/qanda.eng --- a/docs/qanda.eng Mon May 14 19:59:12 2012 +0900 +++ b/docs/qanda.eng Sun Jul 12 14:21:20 2015 +0900 @@ -32,39 +32,25 @@ *I ain't got the privilege to write in the Info directory... - Get yourself made root. If you can't, have them install Mule2 - and add + Get yourself made root. If you can't, write this: (setq Info-default-directory-list (cons "YOUR INFO DIRECTORY" Info-default-directory-list)) to your ~/.emacs. Now your personal files will be added to the - menu when you invoke info. By the way, Mule1 will not release - memories, so processes will pile up and be heavier on the system - compared to Mule2. Nemacs has already become obsolete by the - developers, so no further comments for usage of Nemacs. Get - yourself Mule2 with flying colors :-) + menu when you invoke info. *Emacs can't find the help file. - - The help file is set to be placed in $EMACS/etc/ for Nemacs, - Mule1 and $EMACS/site-lisp/ for Mule2. If you don't have the - privilege to put them in a public location, copy it to your home - directory and set YaTeX-help-file to that file name. -*I can't read info on Nemacs + If you don't have the privilege to put them in a public + location, copy it to your home directory and set YaTeX-help-file + to that file name. - The info file was formatted on Mule, so it can't be read - correctly on Nemacs (or Demacs based on Nemacs) because the - internal Japanese processing is different. Read it on Mule. - Use the Emacs-Lisp package in texinfo-3.1.tar.gz to format the - Texinfo file. - [Operations] ============ -*I accidentally learned in a wrong LaTeX command. +*I accidentally learned in a wrong LaTeX macro in my dictionary. There should be a line with the wrong command in the .yatexrc file in your home or current directory. Erase or fix that line, @@ -209,19 +195,24 @@ *Is it possible to include personal template file template.tex handily? - Try Emacs-19's standard package `autoinsert.el' please. Or its - upper compatible package auto-insert-tkld might also be good. - You can get auto-insert-tkld via anonymous ftp - ftp://ftp.ae.keio.ac.jp/pub/emacs-lisp/util/ - ftp://archive.cis.ohio-state.edu/pub/gnu/elisp-archive/ + Put your template.tex into your ~/work directory where YaTeX + seeks by default. If you change the location to another place, + set the lisp-variable as below. + (setq YaTeX-template-file "~/other/location/template.tex") *It is bothering for me to determine I should call bibtex or latex... - Why don't you try `latexmk' perl script, which is a TeX specific - tool as `make'? It detects the dependency among the TeX-related - files such as .tex, .bib, and so on, and will execute suitable - commands in a suitable sequence. You can find `latexmk' script - in a directory of supports/latexmk in some CTAN ftp directory. + Since version 1.76, YaTeX automatically call bibtex/latex twice + if needed. In most case, you don't have to repeat to call + typesetter or bibtex. If you use `latexmk' described below, + YaTeX's auto rerun functionality should be disabled by setting + like this: + (setq YaTeX-typeset-auto-rerun nil) + + The `latexmk' perl script, which is a TeX specific tool to + automate generation of LaTeX document. You can find `latexmk' + some CTAN ftp directory. + (eg. http://www.ctan.org/pkg/latexmk/) *Can I inhibit auto-filling against very long line? @@ -276,12 +267,6 @@ you are thinking of graduating from hilit19, it might be better to keep old setting about it... -*It's sooo slow when I click YaTeX on the menu bar. - - I don't know why. Probably a problem with Emacs-19. You'll - just have to bear with it. It won't be so slow the second time. - Anyway, you probably won't use the menu at all, do you? - *Is there any way of displaying `\it' strings in the italic font? First, you should find the available italic font on your diff -r 130c104fe22e -r e37af485338a docs/yahtmle --- a/docs/yahtmle Mon May 14 19:59:12 2012 +0900 +++ b/docs/yahtmle Sun Jul 12 14:21:20 2015 +0900 @@ -507,29 +507,30 @@ +  Tag table: -Node: Top259 -Node: Intro836 -Node: Installation1234 -Node: Setting up yahtml1515 -Node: Setting environments for weblint browsers and image viewers2306 -Node: Setting environment variables for WWW pages3002 -Node: Command Invocation3973 -Node: Completion4401 -Node: Jump5917 -Node: Changing and Deleting6397 -Node: Changing tags in pairs6681 -Node: Changing entities7176 -Node: URLencoding of strings within region7712 -Node: td-enclosure/tr-enclosure8013 -Node: CSS Support8979 -Node: CSS-class completion9205 -Node: Reread CSS definition10058 -Node: Customizations10333 -Node: All customizable variables10609 -Node: Hook variables14377 -Node: Copying14503 -Node: Concept Index15294 +Node: Top256 +Node: Intro833 +Node: Installation1231 +Node: Setting up yahtml1512 +Node: Setting environments for weblint browsers and image viewers2303 +Node: Setting environment variables for WWW pages2999 +Node: Command Invocation3970 +Node: Completion4398 +Node: Jump5914 +Node: Changing and Deleting6394 +Node: Changing tags in pairs6678 +Node: Changing entities7173 +Node: URLencoding of strings within region7709 +Node: td-enclosure/tr-enclosure8010 +Node: CSS Support8976 +Node: CSS-class completion9202 +Node: Reread CSS definition10055 +Node: Customizations10330 +Node: All customizable variables10606 +Node: Hook variables14374 +Node: Copying14500 +Node: Concept Index15291  End tag table diff -r 130c104fe22e -r e37af485338a docs/yahtmlj --- a/docs/yahtmlj Mon May 14 19:59:12 2012 +0900 +++ b/docs/yahtmlj Sun Jul 12 14:21:20 2015 +0900 @@ -322,17 +322,17 @@ 力確定のときにリターンキー(またはC-m)ではなく、C-jを押せばclass補完入力を キャンセルできます。たとえば - [prefix] l 行内タグ補完を起動 - (または[prefix] l SPC) + `[prefix] l' 行内タグ補完を起動 + (または`[prefix] l SPC') tt をいれたいのでttと入力 - C-m + `C-m' とした場合は続いて class= と補完プロンプトが出ますが、 - [prefix] l 行内タグ補完を起動 - (または[prefix] l SPC) + `[prefix] l' 行内タグ補完を起動 + (または`[prefix] l SPC') tt をいれたいのでttと入力 - C-j + `C-j' と最後を `C-j' で入力した場合は class 補完プロンプトは出ません。 @@ -511,35 +511,36 @@ * カスタマイズ[かすたまいす]: Customizations. 4. * キーアサイン[きいあさいん]: Customizations. 4. * Demacs: Intro. 4. -* HTML屋[HTMLや]: Intro. 4. +* HTMLョ[HTMLや]: Intro. 4. * LaTeX: Intro. 4. * Mule: Intro. 4. +  Tag table: -Node: Top260 -Node: Intro729 -Node: Installation1008 -Node: yahtml起動のための設定1196 -Node: lintプログラム/ブラウザ/イメージヴューア環境等の設定1850 -Node: WWWページ環境用変数の設定2350 -Node: Command Invocation3121 -Node: Completion3448 -Node: Jump4432 -Node: Changing and Deleting4831 -Node: 対タグの変更5005 -Node: 文字参照への変更5355 -Node: リジョン内文字のURLencode5738 -Node: td括り/tr括り5972 -Node: CSS Support6601 -Node: CSS-class completion6799 -Node: Reread CSS file7783 -Node: Customizations8005 -Node: All customizable variables8229 -Node: Hook variables11227 -Node: Copying11339 -Node: Concept Index11842 +Node: Top257 +Node: Intro726 +Node: Installation1005 +Node: yahtml起動のための設定1193 +Node: lintプログラム/ブラウザ/イメージヴューア環境等の設定1847 +Node: WWWページ環境用変数の設定2347 +Node: Command Invocation3118 +Node: Completion3445 +Node: Jump4429 +Node: Changing and Deleting4828 +Node: 対タグの変更5002 +Node: 文字参照への変更5352 +Node: リジョン内文字のURLencode5735 +Node: td括り/tr括り5969 +Node: CSS Support6598 +Node: CSS-class completion6796 +Node: Reread CSS file7792 +Node: Customizations8014 +Node: All customizable variables8238 +Node: Hook variables11236 +Node: Copying11348 +Node: Concept Index11851  End tag table diff -r 130c104fe22e -r e37af485338a docs/yatex.ref --- a/docs/yatex.ref Mon May 14 19:59:12 2012 +0900 +++ b/docs/yatex.ref Sun Jul 12 14:21:20 2015 +0900 @@ -44,16 +44,18 @@ 【プロセス起動】 + ◆latex起動 [prefix] tj + ◆latex+dvipdfmx起動 [prefix] td + ◆環境の即時プレビュー [prefix] te + ◆latex起動(領域指定) [prefix] tr ◆jbibtex起動 [prefix] tb - ◆jlatex起動 [prefix] tj ◆makeindex起動 [prefix] ti - ◆jlatexのkill [prefix] tk ※ + ◆latexプロセスのkill [prefix] tk ※ ◆プリントアウト [prefix] tl ◆プリントアウト(全ページ) C-u [prefix] tl ◆プレビューア起動 [prefix] tp ◆xdvi上で文字列サーチ [prefix] ts ※※ ◆lpq起動 [prefix] tq - ◆jlatex起動(領域指定) [prefix] tr [prefix] t を押せばメニューが出るので、[prefix] t の次に押すキー は覚えなくて構いません。 @@ -72,7 +74,7 @@ ◆タイプセットエラー箇所へ [prefix] ' タイプセットエラー発生箇所へ(末尾から)遡って順次ジャンプします。 - もちろん jlatex でエラーが生じた場合のみ有効です。 + タイプセット時にエラーが生じた場合のみ有効です。 ◆対応するオブジェクトジャンプ [prefix] g ◆別ウィンドウで 〃 [prefix] 4g @@ -85,6 +87,7 @@ ・\include(only), \input の上 対応するファイルへ ・\ref, \label の上 対応する \label, \ref へ ・\cite, \bibitem の上 対応する \bibitem, \cite へ + ・その他 対応するプレヴューア位置へ ◆メインファイルへジャンプ [prefix] ^ ◆別ウィンドウで 〃 [prefix] 4^ diff -r 130c104fe22e -r e37af485338a docs/yatexe --- a/docs/yatexe Mon May 14 19:59:12 2012 +0900 +++ b/docs/yatexe Sun Jul 12 14:21:20 2015 +0900 @@ -1,7 +1,7 @@ Info file: yatexe, -*-Text-*- produced by `texinfo-format-buffer' from file `yatexe.tex' -using `texinfmt.el' version 2.38 of 3 July 1998. +using `texinfmt.el' version 2.42 of 7 Jul 2006. START-INFO-DIR-ENTRY * YaTeX-e: (yatexe). Yet Another tex-mode for Emacs (English). @@ -16,7 +16,7 @@ * Menu: -* What is YaTeX?:: +* What is YaTeX?:: * Main features:: What YaTeX can do * Installation:: Guide to install * Typesetting:: Call typesetting processes @@ -47,7 +47,8 @@ ************** YaTeX automates typesetting and previewing of LaTeX and enables -completing input of LaTeX mark-up command such as `\begin{}'..`\end{}'. +completing input of LaTeX mark-up command such as +`\begin{}'..`\end{}'. YaTeX also supports Demacs which runs on MS-DOS(386), Mule (Multi Language Enhancement to GNU Emacs), and latex on DOS. @@ -65,8 +66,8 @@ * 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') - * Enclosing text into LaTeX environments or commands (`C-u' - ABOVEKEYSTROKES) + * Enclosing text into LaTeX environments or commands (ABOVEKEYSTROKES + 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 @@ -124,14 +125,14 @@ execute typeset or preview command. `[prefix] t j' - ... invoke latex + ... invoke typesetter `[prefix] t r' - ... invoke latex on region + ... invoke typesetter on region `[prefix] t e' - ... invoke latex on current environment or whole portion of - current formulas in math-mode. + ... `on-the-fly preview' on current environment or whole + portion of current formulas in math-mode `[prefix] t d' - ... invoke dvipdfmx after successful typesetting + ... invoke dvipdfmx after successful typesetting `[prefix] t k' ... kill current typesetting process `[prefix] t b' @@ -149,9 +150,9 @@ * Menu: -* Calling typesetter:: -* Calling previewer:: -* Printing out:: +* Calling typesetter:: +* Calling previewer:: +* Printing out::  @@ -192,14 +193,20 @@ files. The `[prefix] te' key automatically marks current inner environment or -inner math mode and then call typeset-region with marked region. This is -convenient to quick view of current tabular environment or current editing -formulas. Keeping previewer window for `texput.dvi' is handy for -debugging. Since `[prefix] te' selects the inner-most environment as -region, it is not suitable for partial typesetting of doubly or more -composed environment. If you want to do partial typesetting for a nested -environment, use `[prefix] tr' for static-region, which is described in -the section *Note %#notation::. +inner math mode or paragraph, and then call typeset-region with marked +region. This is convenient to quick view of current tabular environment +or current editing formulas. If running Emacs has the ability of +displaying images, typeset image will be shown in the next window. +Further more, if you modify the content within that environment, YaTeX +performs `on-the-fly' preview that automatically update preview image as +you typed. + +If your Emacs does not supply on-the-fly preview, keeping previewer window +for `texput.dvi' is handy for debugging. Since `[prefix] te' selects the +inner-most environment as region, it is not suitable for partial +typesetting of doubly or more composed environment. If you want to do +partial typesetting for a nested environment, use `[prefix] tr' for +static-region, which is described in the section *Note %#notation::.  @@ -238,12 +245,12 @@ * 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::  @@ -329,7 +336,7 @@  -File: yatexe, Node: Lpr format, Next: Controlling which command to invoke, Prev: Static region for typesetting, Up: %#notation +File: yatexe, Node: Lpr format, Prev: Static region for typesetting, Up: %#notation Lpr format ========== @@ -370,12 +377,27 @@ These %# notation below can control which command to invoke for LaTeX related process. + `%#PREVIEW' + + ... Command line for DVI viewing ([prefix] t p) + `%#MAKEINDEX' + + ... Command line for makeindex ([prefix] t i) `%#BIBTEX' - - ... Command line for makeindex ([prefix] t i) - `%#MAKEINDEX' - - ... Command line for bibtex ([prefix] t b) + + ... Command line for bibtex ([prefix] t b) + `%#DVIPDF' + + ... Command line for dvipdf(mx) ([prefix] t b) + `%#LPR' + + ... Command line for printing out([prefix] t l) + `%#PDFVIEW' + + ... Command line for PDF viewing + `%#IMAGEDPI' + + ... DPI value for converting to on-the-fly prewview image If you want to invoke "makeidx hogehoge" to update index, put the next line some upper place in the source, for example. @@ -415,15 +437,16 @@ * Menu: -* Begin-type completion:: -* Section-type completion:: -* Large-type completion:: -* Maketitle-type completion:: -* Arbitrary completion:: -* End completion:: -* Accent completion:: -* Image completion:: -* Greek letters completion:: +* Begin-type completion:: +* Section-type completion:: +* Large-type completion:: +* Maketitle-type completion:: +* Arbitrary completion:: +* End completion:: +* Accent completion:: +* Image completion:: +* Greek letters completion:: +* Inserting parentheses::  @@ -485,7 +508,7 @@ The next message will show up in the minibuffer - Begin environment(default document): + Begin environment(default document): by typing `[prefix] b'. Put the wishing environment with completion in the minibuffer, and `\begin{env}'...\`\end{env}' will be inserted in the @@ -498,21 +521,15 @@ automatically inserted such as `\item' for `itemize' environment. If you don't want the entry, it can be removed by undoing. - If you want to enclose some paragraphs which have already been written, -invoke the begin-type completion with changing the case of `b' of key -sequence upper(or invoke it with universal argument by `C-u' prefix). - - The following example encloses a region with `description' environment. - -`[prefix] B D' -`(or ESC 1 [prefix] b D)' -`(or C-u [prefix] b D)' - - ... begin-type completion for region - - This enclosing holds good for the completing input by `[prefix] b SPC'. -`[prefix] B SPC' enclose a region with the environment selected by -completing-read. + If you want to enclose some paragraphs which have already been written +into environment, invoke the begin-type completion right after region +marking. + +If you set `transient-mark-mode' to `nil' in your `~/.emacs', typing +`C-space' (`set-mark-command') twice turns `transient-mark-mode' on +temporarily. Then, type call begin-type completion to enclose text into a +environment. +  @@ -553,7 +570,7 @@ in your LaTeX source. When you neglect argument such as (C-v for view) \???{} (default section): vspace* - \vspace*{???}: + \vspace*{???}: YaTeX puts @@ -592,7 +609,7 @@ * Menu: -* view-sectioning:: +* view-sectioning::  @@ -615,12 +632,12 @@ `M-x YaTeX-section-overview' ... Generate *Sectioning Lines* buffer -from the LaTeX source buffer. In this listing buffer, typing `u' on the -sectioning command shifts up the corresponding sectioning command in +from the LaTeX source buffer. In this listing buffer, typing `u' on +the sectioning command shifts up the corresponding sectioning command in source text and `d' shifts down. After marking lines in the listing -buffer, typing `U' shifts up all sectioning commands in the region, and -`U' shifts down. Here are all the key bindings of `*Sectioning Lines*' -buffer. +buffer, typing `U' shifts up all sectioning commands in the region, +and `U' shifts down. Here are all the key bindings of +`*Sectioning Lines*' buffer. `SPC' ... Jump to corresponding source line @@ -653,15 +670,14 @@ the message in the minibuffer - {\??? } (default large): + {\??? } (default large): prompts prompts you large-type command with completing-read. There are TeX commands to change fonts or sizes, `it', `huge' and so on, in the completion table. - Region-based completion is also invoked by changing the letter after -prefix key stroke as `[prefix] L'. It encloses the region by braces with -large-type command. + Region-based completion is also invoked by calling completion after +region activated.  @@ -704,7 +720,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 @@ -755,10 +771,11 @@ or not, and change the behavior of key strokes `;' and `:'. By the way, we often express the leftarrow mark by `<-' for example. -Considering such image, you can write `\leftarrow' by typing `<-' after -`;' (semicolon) as a prefix. In the same way, `\longleftarrow' (`<--') is -completed by typing `;<--', infinity mark which is imitated by `oo' is -completed by typing `;oo'. +Considering such image, you can write `\leftarrow' by typing `<-' +after `;' (semicolon) as a prefix. In the same way, +`\longleftarrow' (`<--') is completed by typing `;<--', +infinity mark which is imitated by `oo' is completed by typing +`;oo'. Here are the sample operations in YaTeX math-mode. @@ -772,11 +789,11 @@ In any case, you can quit from image completion and can move to the next editing operation if the LaTeX command you want is shown in the buffer. - `;' itself in math-environment is inserted by `;;'. Typing `TAB' in the -midst of image completion shows all of the LaTeX commands that start with -the same name as string you previously typed in. In this menu buffer, -press `RET' after moving the cursor (by `n', `p', `b', `f') to insert the -LaTeX command. + `;' itself in math-environment is inserted by `;;'. Typing +`TAB' in the midst of image completion shows all of the LaTeX +commands that start with the same name as string you previously typed in. +In this menu buffer, press `RET' after moving the cursor (by `n', +`p', `b', `f') to insert the LaTeX command. To know all of the completion table, type `TAB' just after `;'. And here is the sample menu by `TAB' after `;<'. @@ -784,7 +801,7 @@ KEY LaTeX sequence sign < \leq < ~ - << \ll << + << \ll << <- \leftarrow <- <= \Leftarrow <= @@ -794,7 +811,7 @@  -File: yatexe, Node: Greek letters completion, Prev: Image completion, Up: Completion +File: yatexe, Node: Greek letters completion, Next: Inserting parentheses, Prev: Image completion, Up: Completion Greek letters completion ======================== @@ -804,11 +821,23 @@ `\alpha', `b' makes `\beta' and `g' makes `\gamma' and so on. First, type `:TAB' to know all the correspondence of alphabets vs. Greek letters. - If you will find `;' or `:' doesn't work in correct position of math -environment, it may be a bug of YaTeX. Please send me a bug report with -the configuration of your text, and avoid it temporarily by typing `;' or -`:' after universal-argument(`C-u') which forces `;' and `:' to work as -math-prefix. + If you will find `;' or `:' doesn't work in correct position of +math environment, it may be a bug of YaTeX. Please send me a bug report +with the configuration of your text, and avoid it temporarily by typing +`;' or `:' after universal-argument(`C-u') which forces +`;' and `:' to work as math-prefix. + + + +File: yatexe, Node: Inserting parentheses, Prev: Greek letters completion, Up: Completion + +Inserting parentheses +===================== + + Typing opening parenthesis, one of `(', `{ and `['', automatically +inserts the closing one. If a opening bracket is typed after `\', `\]' is +automatically inserted with computed indentation. If you stop automatic +insertion, type `C-q' before opening parenthesis.  @@ -862,9 +891,10 @@ to `ESC h' by default. It is NOT predictable what will happen when you continuously comment out some paragraph many times. - You can also comment out an environment between `\begin' and `\end', or -a `\begin'-\`\end' pair themselves, by making the following key strokes on -the line where `\begin{}' or `\end{}' exists. + You can also comment out an environment between `\begin' and +`\end', or a `\begin'-\`\end' pair themselves, by making the +following key strokes on the line where `\begin{}' or +`\end{}' exists. `[prefix] >' ... comment out from \begin to \`end' @@ -894,11 +924,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::  @@ -936,9 +966,9 @@ `[prefix] 4 g' ... go to corresponding object in other window -do the same job as `[prefix] g' except it's done in other window. Note -that this function doesn't work on `begin/end', `%#BEGIN/%#END' pairs -because it is meaningless. +do the same job as `[prefix] g' except it's done in other window. +Note that this function doesn't work on `begin/end', +`%#BEGIN/%#END' pairs because it is meaningless.  @@ -982,8 +1012,8 @@ `[prefix] 4^' ... visit main file in other buffer -in a sub text switch the buffer to the main text specified by `%#!' -notation. +in a sub text switch the buffer to the main text specified by +`%#!' notation.  @@ -1031,8 +1061,8 @@ * Menu: -* Changing LaTeX commands:: -* Killing LaTeX commands:: +* Changing LaTeX commands:: +* Killing LaTeX commands::  @@ -1115,9 +1145,9 @@ (setq YaTeX-item-regexp "\\(\\\\\\(sub\\)*item\\)\\|\\(\\\\underlineitem\\)") -in your `~/.emacs'. If you are not familiar with regular expression for -Emacs-Lisp, name a newcommand for `itemize' beginning with `\item' such as -`\itembf', not `\bfitem'. +in your `~/.emacs'. If you are not familiar with regular expression +for Emacs-Lisp, name a newcommand for `itemize' beginning with +`\item' such as `\itembf', not `\bfitem'. This function reformats the `\item' into `hang-indented' style. For example: @@ -1167,9 +1197,10 @@ A)dd R)eplace %)comment? -in the minibuffer. Type `a' if you want to add the current file name to -`\includeonly' list, `r' to replace \`includeonly' list with the current -file, and type `%' to comment out the `\includeonly' line. +in the minibuffer. Type `a' if you want to add the current file name +to `\includeonly' list, `r' to replace \`includeonly' list +with the current file, and type `%' to comment out the +`\includeonly' line.  @@ -1240,8 +1271,8 @@ If you want to apply these trick to other environments, `foo' environment for example, define the function named -`YaTeX-intelligent-newline-foo' to insert corresponding contents. That -function will be called at the beginning of the next line after the +`YaTeX-intelligent-newline-foo' to insert corresponding contents. +That function will be called at the beginning of the next line after the newline is inserted to the current line. Since the function `YaTeX-indent-line' is designed to indent the current line properly, calling this function before your code to insert certain contents must be @@ -1414,9 +1445,9 @@ * Menu: -* Lisp variables:: -* Add-in functions:: -* Add-in generator:: +* Lisp variables:: +* Add-in functions:: +* Add-in generator::  @@ -1440,10 +1471,10 @@ * Menu: -* All customizable variables:: -* Sample definitions:: -* Hook variables:: -* Hook file:: +* All customizable variables:: +* Sample definitions:: +* Hook variables:: +* Hook file::  @@ -1501,6 +1532,51 @@ -- Variable: YaTeX-dvipdf-command Default command name to convert .dvi to PDF (`"dvipdfmx"') + -- Variable: YaTeX-on-the-fly-preview-interval + Interval time in seconds of idle to trigger on-the-fly preview of + environment by `[prefix] t e'(0.9). + `Nil' disables on-the-fly preview. + + -- Variable: YaTeX-on-the-fly-math-preview-engine + Function symbol to use on-the-fly preview of MATH environment started + by `[prefix] t e' (`'YaTeX-typeset-environment-by-lmp' which calls + latex-math-preview-expression function if latex-math-preview is + available, otherwise `'YaTeX-typeset-environment-by-builtin' which + alls built-in function). + + `Nil' disables on-the-fly preview. + + -- Variable: YaTeX-cmd-gimp + Command name of GIMP (code{"gimp"}) + -- Variable: YaTeX-cmd-tgif + Command name of tgif (code{"tgif"}) + -- Variable: YaTeX-cmd-inkscape + Command name of Inkscape (code{"inkscape"}) + -- Variable: YaTeX-cmd-dia + Command name of Dia (code{"dia"}) + -- Variable: YaTeX-cmd-ooo + Command name of OpenOffice.org/LibreOffice (code{"soffice"}) + -- Variable: YaTeX-cmd-gs + Command name of Ghostscript (code{"gs"}) + -- Variable: YaTeX-cmd-dvips + Command name of dvips (code{"dvips"}) + -- Variable: YaTeX-cmd-displayline + Command name of displayline + (code{"/Applications/Skim.app/Contents/SharedSupport/displayline"}) + -- Variable: YaTeX-cmd-edit-ps + Command name for editing PostScript files(Value of + code{"YaTeX-cmd-gimp"}) + -- Variable: YaTeX-cmd-edit-pdf + Command name for editing PDF files(Value of code{"YaTeX-cmd-ooo"}) + -- Variable: YaTeX-cmd-edit-ai + Command name for editing `.ai' files(Value of + code{"YaTeX-cmd-inkscape"}) + -- Variable: YaTeX-cmd-edit-svg + Command name for editing SVG files(Value of + code{"YaTeX-cmd-inkscape"}) + -- Variable: YaTeX-cmd-edit-images + Command name for editing image files(Value of code{"YaTeX-cmd-gimp"}) + -- Variable: YaTeX-need-nonstop Put `\nonstopmode{}' or not (`nil') @@ -1530,8 +1606,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') @@ -1577,7 +1653,7 @@ `YaTeX-display-hierarchy' searches for sectioning command first, and comment line secondary as a file headings. In latter case, ignore lines that match with regular expression of this variable. Default value of - this variable is RCS header expressions and mode specifying line `-*- xxxx + this variable is RCS header expressions and mode specifying line `-*- xxxx -*'. -- Variable: YaTeX-skip-default-reader @@ -1631,8 +1707,8 @@ (`(featurep 'hilit19)' -- Variable: YaTeX-singlecmd-suffix - Suffix which is always inserted after maketitle-type macros. `"{}"' - is recommended. + Suffix which is always inserted after maketitle-type macros. + `"{}"' is recommended. -- Variable: YaTeX-package-alist-private Alist of LaTeX2e-package name vs. lists of macros in it. Set this @@ -1656,6 +1732,12 @@ Regexp of environment names that should begin with no indentation. All verbatime-like environment name should match with. + -- Variable: YaTeX-electric-indent-mode + Emacs 24.4 introduces automatic indentation of current and new lines. + This might be annoying for some people. Pass this value to the + function 'electric-indent-local-mode. If you prefer to stop + electric-indent-mode in yatex-mode, set `-1' to this variable. + -- Variable: YaTeX-ref-default-label-string Default \\ref time string format. This format is like strftime(3) but allowed conversion char are as follows; %y -> Last 2 digit of @@ -1761,10 +1843,10 @@ * 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::  @@ -1822,14 +1904,15 @@ \frac{a/c} -Normally, the expression `a/c' is translated to `\frac{a}{c}'. An -enclosing add-in is useful for modifying `/' to `}{'. +Normally, the expression `a/c' is translated to +`\frac{a}{c}'. An enclosing add-in is useful for modifying +`/' to `}{'. * 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::  @@ -1870,7 +1953,7 @@ (defun YaTeX::newcommand (n) ;n is argument position (cond ((= n 1) ;1st argument is macro name - (read-string "Command: " "\\")) ;initial input `\' + (read-string "Command: " "\\")) ;initial input `\' ((= n 2) "") ;do nothing when reading arg#2 (t nil))) @@ -1898,7 +1981,7 @@ (while (search-forward "/" end t) (goto-char (match-beginning 0)) (if (y-or-n-p "Replace this slash(/) with `}{'") - (throw 'done (replace-match "}{"))) + (throw 'done (replace-match "}{"))) (goto-char (match-end 0))))) @@ -1933,9 +2016,10 @@ `[A]' Character list which can show up in the brackets `[D]' - Return the location specifier such as `[htb]'. When nothing is - entered, omit [] itself. If the possible characters are "htbp", call - this function as `(YaTeX:read-position "htbp")' + Return the location specifier such as `[htb]'. When + nothing is entered, omit [] itself. If the possible characters + are "htbp", call this function as + `(YaTeX:read-position "htbp")' `[F]' YaTeX:read-coordinates @@ -1943,9 +2027,9 @@ Base prompt, X-axis prompt, Y-axis prompt (each optional) `[D]' Read the coordinates with the prompt "BasePrompt X-axisPrompt:" for - X-axis, "BasePrompt Y-axisPrompt:" for Y-axis, and return it in the - form of "(X,Y)". The default prompts are `Dimension', `X', `Y' - respectively. + X-axis, "BasePrompt Y-axisPrompt:" for Y-axis, and return it in the form + of "(X,Y)". The default prompts are `Dimension', `X', + `Y' respectively. `[F]' YaTeX:check-completion-type @@ -1999,24 +2083,24 @@ 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 +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. - \epsinput[t](250,50){hoge.eps}{plain}{Picture of foo} - (A) (B) (1) (2) (3) - (A)Optional parameter to specify the position - One of t(top), b(bottom), l(left), r(right) - (B)Maximum size of frame - (1)1st argument is filename of EPS file - (2)2nd argument indicates - plain do nothing - frame make frame around image - dframe make double-frame around image - for included EPS file. - (3)Caption for the picture + \epsinput[t](250,50){hoge.eps}{plain}{Picture of foo} + (A) (B) (1) (2) (3) + (A)Optional parameter to specify the position + One of t(top), b(bottom), l(left), r(right) + (B)Maximum size of frame + (1)1st argument is filename of EPS file + (2)2nd argument indicates + plain do nothing + frame make frame around image + dframe make double-frame around image + for included EPS file. + (3)Caption for the picture Now get start with generation. Typing `M-x YaTeX-generate-simple' brings the prompt: @@ -2061,7 +2145,7 @@ are t, b, l, and r. To tell these information to generator, operate as follows. - Read type(1).... p + Read type(1).... p Acceptable characters: tblr RET (B) is coordinate. So its completion style is coOrd. We want a prompt @@ -2108,10 +2192,10 @@ Then all the candidates ready to be read. Type single RET after entering all. - Item[1](RET to exit): plain RET - Item[2](RET to exit): frame RET - Item[3](RET to exit): dframe RET - Item[4](RET to exit): RET + Item[1](RET to exit): plain RET + Item[2](RET to exit): frame RET + Item[3](RET to exit): dframe RET + Item[4](RET to exit): RET The following prompt asks whether the entered string must belong to candidates or not. In this case, since the argument must be one of @@ -2181,66 +2265,67 @@  Tag table: Node: Top256 -Node: What is YaTeX?1597 -Node: Main features1970 -Node: Installation3499 -Node: Typesetting4276 -Node: Calling typesetter5406 -Node: Calling previewer7610 -Node: Printing out7971 -Node: %#notation8263 -Node: Changing typesetter8681 -Node: Splitting input files9045 -Node: Static region for typesetting10470 -Node: Lpr format11599 -Node: Controlling which command to invoke12672 -Node: Editing %# notation13265 -Node: Completion13809 -Node: Begin-type completion14369 -Node: Section-type completion17412 -Node: view-sectioning19847 -Node: Large-type completion21427 -Node: Maketitle-type completion22158 -Node: Arbitrary completion22710 -Node: End completion23100 -Node: Accent completion23570 -Node: Image completion24187 -Node: Greek letters completion26444 -Node: Local dictionaries27171 -Node: Commenting out28108 -Node: Cursor jump29567 -Node: Jump to corresponding object29879 -Node: Invoking image processor31280 -Node: Jump to main file32623 -Node: Jumping around the environment32988 -Node: Jumping to last completion position33406 -Node: Changing and Deleting33915 -Node: Changing LaTeX commands34307 -Node: Killing LaTeX commands35484 -Node: Filling36669 -Node: Updation of includeonly38520 -Node: What column39317 -Node: Intelligent newline40402 -Node: Usepackage checker42056 -Node: Online help42647 -Node: Browsing file hierarchy44322 -Node: Cooperation with other packages46059 -Node: Customizations46764 -Node: Lisp variables47098 -Node: All customizable variables48102 -Node: Sample definitions57901 -Node: Hook variables58414 -Node: Hook file59118 -Node: Add-in functions59457 -Node: How the add-in function works60317 -Node: Defining option-add-in62516 -Node: Defining argument-add-in63238 -Node: Defining enclosing-add-in64120 -Node: How the function is called64974 -Node: Useful functions for creating add-in65650 -Node: Contribution67055 -Node: Add-in generator67329 -Node: Etcetera72701 -Node: Copying73306 +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  End tag table diff -r 130c104fe22e -r e37af485338a docs/yatexe.tex --- a/docs/yatexe.tex Mon May 14 19:59:12 2012 +0900 +++ b/docs/yatexe.tex Sun Jul 12 14:21:20 2015 +0900 @@ -8,7 +8,7 @@ @iftex @c @syncodeindex fn cp -@c Last modified Fri May 11 15:40:49 2012 on firestorm +@c Last modified Fri Feb 13 08:15:26 2015 on firestorm @syncodeindex vr cp @end iftex @@ -77,7 +77,7 @@ @code{\section} etc. (@kbd{C-c b}, @kbd{C-c s}, @kbd{C-c l}, @kbd{C-c m}) @item Enclosing text into La@TeX{} environments or commands - (@kbd{C-u} @var{AboveKeyStrokes}) + (@var{AboveKeyStrokes} after region setting) @item Displaying the structure of text at entering sectioning commands @item Lump shifting of sectioning commands (@ref{view-sectioning}) @item Learning unknown/new La@TeX{} commands for the next completion @@ -146,12 +146,12 @@ @table @kbd @item [prefix] t j - @dots{} invoke latex + @dots{} invoke typesetter @item [prefix] t r - @dots{} invoke latex on region + @dots{} invoke typesetter on region @item [prefix] t e - @dots{} invoke latex on current environment or whole - portion of current formulas in math-mode. + @dots{} `on-the-fly preview' on current environment or whole + portion of current formulas in math-mode @item [prefix] t d @dots{} invoke dvipdfmx after successful typesetting @item [prefix] t k @@ -215,9 +215,16 @@ edit splitting files. The @kbd{[prefix] te} key automatically marks current inner environment -or inner math mode and then call typeset-region with marked region. This +or inner math mode or paragraph, and then call typeset-region with marked +region. This is convenient to quick view of current tabular environment or current -editing formulas. Keeping previewer window for @file{texput.dvi} is handy +editing formulas. If running Emacs has the ability of displaying images, +typeset image will be shown in the next window. Further more, +if you modify the content within that environment, YaTeX performs +`on-the-fly' preview that automatically update preview image as you typed. + +If your Emacs does not supply on-the-fly preview, +keeping previewer window for @file{texput.dvi} is handy for debugging. Since @kbd{[prefix] te} selects the inner-most environment as region, it is not suitable for partial typesetting of doubly or more composed environment. If you want to do partial typesetting for a nested @@ -369,7 +376,7 @@ @code{%#BEGIN} alone at the middle of very long text. Do not forget to erase @code{%#BEGIN} @code{%#END} pair. -@node Lpr format, Controlling which command to invoke, Static region for typesetting, %#notation +@node Lpr format, , Static region for typesetting, %#notation @comment node-name, next, previous, up @section Lpr format @cindex lpr format @@ -415,10 +422,20 @@ La@TeX{} related process. @table @code + @item %#PREVIEW + @dots{} Command line for DVI viewing ([prefix] t p) + @item %#MAKEINDEX + @dots{} Command line for makeindex ([prefix] t i) @item %#BIBTEX - @dots{} Command line for makeindex ([prefix] t i) - @item %#MAKEINDEX @dots{} Command line for bibtex ([prefix] t b) + @item %#DVIPDF + @dots{} Command line for dvipdf(mx) ([prefix] t b) + @item %#LPR + @dots{} Command line for printing out([prefix] t l) + @item %#PDFVIEW + @dots{} Command line for PDF viewing + @item %#IMAGEDPI + @dots{} DPI value for converting to on-the-fly prewview image @end table If you want to invoke ``makeidx hogehoge'' to update index, @@ -462,15 +479,16 @@ kinds of completion type, begin-type, section-type, large-type, etc... @menu -* Begin-type completion:: -* Section-type completion:: -* Large-type completion:: -* Maketitle-type completion:: -* Arbitrary completion:: -* End completion:: -* Accent completion:: -* Image completion:: -* Greek letters completion:: +* Begin-type completion:: +* Section-type completion:: +* Large-type completion:: +* Maketitle-type completion:: +* Arbitrary completion:: +* End completion:: +* Accent completion:: +* Image completion:: +* Greek letters completion:: +* Inserting parentheses:: @end menu @node Begin-type completion, Section-type completion, Completion, Completion @@ -557,26 +575,15 @@ automatically inserted such as @code{\item} for @code{itemize} environment. If you don't want the entry, it can be removed by undoing. - If you want to enclose some paragraphs which have already been -written, invoke the begin-type completion with changing the case -of @kbd{b} of key sequence upper(or invoke it with universal argument -by @kbd{C-u} prefix). + If you want to enclose some paragraphs which have already been written +into environment, invoke the begin-type completion right after region marking. @cindex enclose region into environment - The following example encloses a region with `description' -environment. - -@table @kbd -@item [prefix] B D -@itemx (or ESC 1 [prefix] b D) -@itemx (or C-u [prefix] b D) - - @dots{} begin-type completion for region -@end table - - This enclosing holds good for the completing input by @kbd{[prefix] b -SPC}. @kbd{[prefix] B SPC} enclose a region with the environment selected -by completing-read. +If you set @code{transient-mark-mode} to @code{nil} in your +@file{~/.emacs}, typing @kbd{C-space} (@code{set-mark-command}) twice +turns @code{transient-mark-mode} on temporarily. Then, type call +begin-type completion to enclose text into a environment. + @node Section-type completion, Large-type completion, Begin-type completion, Completion @comment node-name, next, previous, up @@ -753,9 +760,8 @@ TeX commands to change fonts or sizes, @code{it}, @code{huge} and so on, in the completion table. - Region-based completion is also invoked by changing the letter after -prefix key stroke as @kbd{[prefix] L}. It encloses the region by braces -with large-type command. + Region-based completion is also invoked by calling completion +after region activated. @node Maketitle-type completion, Arbitrary completion, Large-type completion, Completion @comment node-name, next, previous, up @@ -910,7 +916,7 @@ Emacs-Lisp variable @code{YaTeX-math-sign-alist-private}. See also @file{yatexmth.el} for the information of the structure of this variable. -@node Greek letters completion, , Image completion, Completion +@node Greek letters completion, Inserting parentheses, Image completion, Completion @comment node-name, next, previous, up @section Greek letters completion @cindex Greek letters completion @@ -928,6 +934,15 @@ @kbd{;} or @kbd{:} after universal-argument(@kbd{C-u}) which forces @kbd{;} and @kbd{:} to work as math-prefix. +@node Inserting parentheses, , Greek letters completion, Completion +@section Inserting parentheses + + Typing opening parenthesis, one of @code{(}, @code{@{ and @code{[}}, +automatically inserts the closing one. If a opening bracket is typed +after @code{\}, @code{\]} is automatically inserted with computed +indentation. If you stop automatic insertion, type @kbd{C-q} before +opening parenthesis. + @node Local dictionaries, Commenting out, Completion, Top @comment node-name, next, previous, up @chapter Local dictionaries @@ -1692,6 +1707,63 @@ Default command name to convert .dvi to PDF (@code{"dvipdfmx"}) @end defvar +@defvar YaTeX-on-the-fly-preview-interval +Interval time in seconds of idle to trigger on-the-fly preview of +environment by @kbd{[prefix] t e}(0.9). +@code{Nil} disables on-the-fly preview. +@end defvar + +@defvar YaTeX-on-the-fly-math-preview-engine +Function symbol to use on-the-fly preview of MATH environment +started by @kbd{[prefix] t e} (@code{'YaTeX-typeset-environment-by-lmp} +which calls latex-math-preview-expression function if latex-math-preview +is available, otherwise @code{'YaTeX-typeset-environment-by-builtin} which +alls built-in function). + +@code{Nil} disables on-the-fly preview. +@end defvar + +@defvar YaTeX-cmd-gimp +Command name of GIMP (code{"gimp"}) +@end defvar +@defvar YaTeX-cmd-tgif +Command name of tgif (code{"tgif"}) +@end defvar +@defvar YaTeX-cmd-inkscape +Command name of Inkscape (code{"inkscape"}) +@end defvar +@defvar YaTeX-cmd-dia +Command name of Dia (code{"dia"}) +@end defvar +@defvar YaTeX-cmd-ooo +Command name of OpenOffice.org/LibreOffice (code{"soffice"}) +@end defvar +@defvar YaTeX-cmd-gs +Command name of Ghostscript (code{"gs"}) +@end defvar +@defvar YaTeX-cmd-dvips +Command name of dvips (code{"dvips"}) +@end defvar +@defvar YaTeX-cmd-displayline +Command name of displayline +(code{"/Applications/Skim.app/Contents/SharedSupport/displayline"}) +@end defvar +@defvar YaTeX-cmd-edit-ps +Command name for editing PostScript files(Value of code{"YaTeX-cmd-gimp"}) +@end defvar +@defvar YaTeX-cmd-edit-pdf +Command name for editing PDF files(Value of code{"YaTeX-cmd-ooo"}) +@end defvar +@defvar YaTeX-cmd-edit-ai +Command name for editing `.ai' files(Value of code{"YaTeX-cmd-inkscape"}) +@end defvar +@defvar YaTeX-cmd-edit-svg +Command name for editing SVG files(Value of code{"YaTeX-cmd-inkscape"}) +@end defvar +@defvar YaTeX-cmd-edit-images +Command name for editing image files(Value of code{"YaTeX-cmd-gimp"}) +@end defvar + @defvar YaTeX-need-nonstop Put @code{\nonstopmode@{@}} or not (@code{nil}) @end defvar @@ -1886,6 +1958,13 @@ All verbatime-like environment name should match with. @end defvar +@defvar YaTeX-electric-indent-mode +Emacs 24.4 introduces automatic indentation of current and new lines. +This might be annoying for some people. Pass this value to the function +'electric-indent-local-mode. If you prefer to stop electric-indent-mode +in yatex-mode, set `-1' to this variable. +@end defvar + @defvar YaTeX-ref-default-label-string Default \\ref time string format. This format is like strftime(3) but allowed conversion char are as follows; diff -r 130c104fe22e -r e37af485338a docs/yatexj --- a/docs/yatexj Mon May 14 19:59:12 2012 +0900 +++ b/docs/yatexj Sun Jul 12 14:21:20 2015 +0900 @@ -1,7 +1,7 @@ Info file: yatexj, -*-Text-*- produced by `texinfo-format-buffer' from file `yatexj.tex' -using `texinfmt.el' version 2.38 of 3 July 1998. +using `texinfmt.el' version 2.42 of 7 Jul 2006. START-INFO-DIR-ENTRY * YaTeX: (yatexj). Yet Another tex-mode for Emacs (Japanese). @@ -49,11 +49,11 @@ はじめに ******** - 野鳥は、GNU Emacs で LaTeX 用の文書を作成する時に pLaTeX などのタイプセッ -トコマンドや、プレヴューアの起動を Emacs 編集画面中から行えるようにすると -共に、拡張性の高い種々の補完機能によりソーステキストの編集を支援します。さ -らに LaTeX コマンドのオンラインヘルプによりマニュアルを調べる手間を軽減し -ます。 + 野鳥は、GNU Emacs で LaTeX 用の文書を作成する時に pLaTeX などのタイプ +セットコマンドや、プレヴューアの起動を Emacs 編集画面中から行えるように +すると共に、拡張性の高い種々の補完機能によりソーステキストの編集を支援 +します。さらに LaTeX コマンドのオンラインヘルプによりマニュアルを調べる +手間を軽減します。 English manual *Note Top: (yatexe)Top. @@ -73,23 +73,24 @@ * section型コマンド - `\section{タイトル}'や`\mbox{内容}'のように引数を取るLaTeXコマンドを - 指します。 + `\section{タイトル}'や`\mbox{内容}'のように引数を取るLaTeXコマンド + を指します。 * maketitle型コマンド - `\maketitle'や`\tableofcontents'のように引数を取らないLaTeXコマンドを - 指します。 + `\maketitle'や`\tableofcontents'のように引数を取らないLaTeXコマン + ドを指します。 * large型コマンド - `{\large ...}' や `{\tt ...}' のようなフォント/サイズ指定子を指します。 + `{\large ...}' や `{\tt ...}' のようなフォント/サイズ指定子を指し + ます。 * `[prefix]' - 野鳥の機能を呼び出すためのプリフィクスキー。デフォルトでは`C-c'に割り - 当てられているので、特に変更していない場合本マニュアルの `[prefix]' - という表記は、`C-c' と読み換えてください。 + 野鳥の機能を呼び出すためのプリフィクスキー。デフォルトでは`C-c'に + 割り当てられているので、特に変更していない場合本マニュアルの + `[prefix]' という表記は、`C-c' と読み換えてください。  @@ -102,25 +103,27 @@ * カーソル位置によらない固定リジョンの部分タイプセット * \includeonlyのワンタッチ更新 * エラー箇所への自動ジャンプ(`C-c '') - * `\begin{}, \end{}, \section...' などの LaTeX コマンドの補完入力(`C-c - b', `C-c s', `C-c l', `C-c m') - * 既に入力したテキストを環境やコマンド引数の中に取り込む括り補完(`C-u' - +通常補完キー) + * `\begin{}, \end{}, \section...' などの LaTeXコマンドの補完入力 + (`C-c b', `C-c s', `C-c l', `C-c m') + * 既に入力したテキストを環境やコマンド引数の中に取り込む括り補完(リ + ジョン指定後に通常補完キー) * セクション区切り入力時の文書構造アウトライン表示 * セクションコマンドの一括シフト (*Note view-sectioning::) * 補完辞書の学習 * LaTeX の環境やコマンドに応じたガイド付き引数入力 * 野鳥にないガイド付き引数入力関数の自動生成(`yatexgen.el') * LaTeX コマンドの削除/変更(`C-c k', `C-c c') - * ファイル間、`\begin'<->`\end'間、`\ref'<->`\label'間、 - `\cite'<->`\bibitem'ジャンプ(`C-c g') - * 一括コメントアウト/アンコメントアウト(`C-c >', `C-c <', `C-c ,', `C-c - .') + * ファイル間、`\begin'<->`\end'間、 + `\ref'<->`\label'間、 + `\cite'<->`\bibitem'ジャンプ(`C-c g') + * 一括コメントアウト/アンコメントアウト(`C-c >', `C-c <', `C-c ,', + `C-c .') * アクセント記号/数式環境用コマンド/ギリシャ文字の入力支援(`C-c a', `;', `/') * tabular/array環境のカラム位置ガイド * 標準的 LaTeX コマンドのオンラインヘルプ(`C-c ?', `C-c /') - * ドキュメントのインクルード構造の視覚的表示とバッファ切り替え(`C-c d') + * ドキュメントのインクルード構造の視覚的表示とバッファ切り替え(`C-c + d') * 補完入力したマクロに応じて必要な \userpackage を入れてくれる先回り userpackage * \labelを打つことはもう忘れよう! refやcite補完入力で自動生成します @@ -141,41 +144,42 @@ (cons (cons "\\.tex$" 'yatex-mode) auto-mode-alist)) (autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t) -次に野鳥の emacs-lisp ファイル群を置くディレクトリを load-path に加えます。 -たとえば、 `~/src/emacs/yatex'に置くのであれば、 +次に野鳥の emacs-lisp ファイル群を置くディレクトリを load-path に加えま +す。たとえば、 `~/src/emacs/yatex'に置くのであれば、 (setq load-path (cons (expand-file-name "~/src/emacs/yatex") load-path)) などとします。 - 以上の設定により、拡張子が .tex であるファイルを編集すると自動的に野鳥が -ロードされます。野鳥が正常に起動できたときはモードラインの表示が「やてふ」 -に変わります。 + 以上の設定により、拡張子が .tex であるファイルを編集すると自動的に野 +鳥がロードされます。野鳥が正常に起動できたときはモードラインの表示が +「やてふ」に変わります。 タイプセッタ/プレヴューア環境の設定 =================================== - 利用する外部プログラムに関する以下の変数を確認し、必要なら正しい値に変更 -します。 + 利用する外部プログラムに関する以下の変数を確認し、必要なら正しい値に +変更します。 `tex-command' ... 起動するタイプセッタのコマンド名 `dvi2-command' ... 起動するプレヴューアのコマンド名 `NTT-jTeX' - ... 改行+インデントによって、タイプセット後の字間が空いてしま - うのを抑制する場合にtにする(古いNTT-jTeXで顕著に現れる)。具体的には、 - fillするときに各行の終わりに%を付加するようになる。 + ... 改行+インデントによって、タイプセット後の字間が空いて + しまうのを抑制する場合にtにする(古いNTT-jTeXで顕著に現れる)。具体 + 的には、fillするときに各行の終わりに%を付加するようになる。 `YaTeX-kanji-code' ... 文書を作成する時の漢字コード `dviprint-command-format' ... ファイルの印刷に使われるコマンド列の書式 -`makeindex-command' - ... makeindexコマンド - -これらを変更する場合は、やはり`~/.emacs'にて、たとえば(setq tex-command -"pdflatex") のようにしてください。どのような値をセットすれば良いかについて -は、*Note All customizable variables::を参照してください。 +`YaTeX-dvipdf-command' + ... DVIをPDFに変換するコマンド + +これらを変更する場合は、やはり`~/.emacs'にて、たとえば + (setq tex-command "pdflatex") +のようにしてください。どのような値をセットすれば良いかについては、 +*Note All customizable variables::を参照してください。 @@ -185,16 +189,17 @@ latexコマンド起動 ***************** -LaTeXソースの編集中、次のキー入力により、platex などのタイプセットプログラ -ム(以後タイプセッタと呼ぶ)、プレヴューアなどの起動ができます。 +LaTeXソースの編集中、次のキー入力により、platex などのタイプセットプロ +グラム(以後タイプセッタと呼ぶ)、プレヴューアなどの起動ができます。 `[prefix] t j' ... タイプセッタ(platex)起動 `[prefix] t r' ... タイプセッタ起動(領域指定) `[prefix] t e' - ... タイプセッタ起動(ポイント位置の環境または数式モードのみ対 - 象) + ... 部分タイプセット&プレヴュー(ポイント位置の段落、環境ま + たは数式モードのみをタイプセットして隣のバッファに組版結果の画像を + 出す) `[prefix] t k' ... 動作中のタイプセッタの停止 `[prefix] t b' @@ -202,7 +207,7 @@ `[prefix] t i' ... makeindex起動 `[prefix] t d' - ... タイプセット完了後dvipdfmx起動 + ... タイプセット完了後dvipdfmx起動 `[prefix] t p' ... プレヴューア起動 `[prefix] t l' @@ -223,49 +228,56 @@ タイプセッタ起動 ================ - タイプセッタを起動すると、編集ウィンドウが2つに分割され、片方のウィンド -ウにタイプセット画面が表示されます。出力されるメッセージと連動しタイプセッ -トバッファは自動的にスクロールします。もし、途中でエラーが起こって止まって -しまった場合にはタイプセットバッファに移り、(`C-x o') タイプセッタの出して -いる ? プロンプトに対して、`x' (処理の中断)などの指示を送ることができます。 -エラーを修正する場合は、 + タイプセッタを起動すると、編集ウィンドウが2つに分割され、片方のウィン +ドウにタイプセット画面が表示されます。出力されるメッセージと連動しタイ +プセットバッファは自動的にスクロールします。もし、途中でエラーが起こっ +て止まってしまった場合にはタイプセットバッファに移り、(`C-x o') タイプ +セッタの出している ? プロンプトに対して、`x' (処理の中断)などの指示を送 +ることができます。エラーを修正する場合は、 `[prefix] '' `(prefix+アポストロフィ)' ... 直前のエラー発生行へジャンプ -を入力することにより、タイプセッタがエラーを発生した行に移ることができます。 -また、タイプセッタの出力する overfull hbox などのウォーニング行にも対応し -ていますので、順次 `[prefix] '' を押すことにより、一つ前のウォーニング発生 -行にジャンプしていきます。 - - もし、気になるエラー行があった場合は、タイプセットバッファで、エラーの表 -示されている行にカーソルを合わせスペースキーを押すと LaTeX ソースの対応す -る行にジャンプします。 +を入力することにより、タイプセッタがエラーを発生した行に移ることができ +ます。また、タイプセッタの出力する overfull hbox などのウォーニング行に +も対応していますので、順次 `[prefix] '' を押すことにより、一つ前のウォー +ニング発生行にジャンプしていきます。 + + もし、気になるエラー行があった場合は、タイプセットバッファで、エラー +の表示されている行にカーソルを合わせスペースキーを押すと LaTeX ソースの +対応する行にジャンプします。 領域タイプセット ---------------- - ポイントとマークの間、あるいはテキスト中に埋め込んだ `%#BEGIN' と`%#END' -の間の領域(*Note %#notation::)だけを切り取ってタイプセットすることができま -す。この場合メインファイルのプリアンブルが一時ファイルのプリアンブルとして -使われます。したがってプリアンブルにないマクロ定義が領域内にあるとエラーに -なります。領域タイプセットを使う場合、必ずマクロ定義はプリアンブル -(`\begin{document}'より前)に置くようにして下さい。一時ファイルはメインファ -イルのあるディレクトリの`texput.tex'という名前で出力されるので、上書きには -注意してください。 + ポイントとマークの間、あるいはテキスト中に埋め込んだ `%#BEGIN' と +`%#END'の間の領域(*Note %#notation::)だけを切り取ってタイプセットするこ +とができます。この場合メインファイルのプリアンブルが一時ファイルのプリ +アンブルとして使われます。したがってプリアンブルにないマクロ定義が領域 +内にあるとエラーになります。領域タイプセットを使う場合、必ずマクロ定義 +はプリアンブル(`\begin{document}'より前)に置くようにして下さい。一時ファ +イルはメインファイルのあるディレクトリの`texput.tex'という名前で出力さ +れるので、上書きには注意してください。 環境タイプセット ---------------- - `[prefix] te' を押すと、ポイント位置の最も内側の環境、または数式モード内 -の場合はその数式モード全体が自動的に領域選択されて、領域タイプセットを呼び -出します。tabular環境や数式モードで複雑なものを作っている場合は確かめたい -部分だけを確認できるので便利です。これも `texput.tex' に該当部分を書き出し -ます。プレヴューアで `texput.dvi' を開いたままにしておけば修正と確認が素早 -くできるでしょう。 + `[prefix] te' を押すと、ポイント位置の最も内側の環境、または数式モー +ド内の場合はその数式モード全体、あるいは環境がなければその段落が自動的 +に領域選択されて、領域タイプセットを呼び出します。tabular環境や数式モー +ドで複雑なものを作っている場合は確かめたい部分だけを確認できるので便利 +です。Emacsが画像表示可能な場合は、部分タイプセットの結果を画像化して隣 +のウィンドウに表示します。また、特定の環境で呼び出した場合は、環境内の +文字を書き換える度に自動的にプレビュー画像を更新します(on-the-flyプレ +ヴュー)。自動表示されない場合はプレヴューアで `texput.dvi'を開いたまま +にしておけば修正と確認が素早くできるでしょう。 + + 画像プレヴューの場合の大きさ(解像度)はデフォルトで200dpi(数式は +300dpi)です。dpiを変えたい場合はLaTeXソースのどこかに`%#PREVIEWDPI +150'のようにdpi値を書いてください。  @@ -273,11 +285,11 @@ プレヴューア起動 ================ - `[prefix] t p' によりプレヴューアの起動ができます。さらに、もしあなたが、- -remote 機能つきのxdviを利用している場合は `[prefix] t s' を押すことにより -カーソル位置の文字列を検索してそのページを表示するようにすでに起動中のxdvi -に命令を送ります。これにより、現在編集中の箇所のタイプセット結果を即座に見 -ることができます。 + `[prefix] t p' によりプレヴューアの起動ができます。さらに、もしあなた +が、-remote 機能つきのxdviを利用している場合は `[prefix] t s' を押すこ +とによりカーソル位置の文字列を検索してそのページを表示するようにすでに +起動中のxdviに命令を送ります。これにより、現在編集中の箇所のタイプセッ +ト結果を即座に見ることができます。 @@ -287,8 +299,8 @@ プリントアウト ============== - `[prefix] t l'を押してプリントアウトを指示すると、出力開始/終了ページを -聞いてくるので、それぞれに答えます。これを省略したい時は、 + `[prefix] t l'を押してプリントアウトを指示すると、出力開始/終了ページ +を聞いてくるので、それぞれに答えます。これを省略したい時は、 universal-argument をつけ、 @@ -304,8 +316,8 @@ %#記法 ****** - 本文中に`%#'ではじまるキーワードを埋め込むことでタイプセッタ起動等の制御 -をすることができます。 + 本文中に`%#'ではじまるキーワードを埋め込むことでタイプセッタ起動等の +制御をすることができます。 * Menu: @@ -338,33 +350,34 @@ 入力ファイル分割 ================ -また、章毎に別ファイルの .tex を作成している場合で、`main.tex'から -`sub.tex' を `\include'しているような時は、`sub.tex'の任意の位置に次のよう -な行を埋め込みます。 +また、章毎に別ファイルの .tex を作成している場合で、`main.tex'から +`sub.tex' を `\include'しているような時は、`sub.tex'の任意の位置に次の +ような行を埋め込みます。 %#!platex main.tex -上の例のようにコマンド名だけでなく引数も書いた場合には、全てをそのまま -shell に渡すので次のように書けば、ghostview などをプレヴューアに使う時に便 -利です。 +上の例のようにコマンド名だけでなく引数も書いた場合には、全てをそのまま +shell に渡すので次のように書けば、ghostview などをプレヴューアに使う時 +に便利です。 %#!platex main && dvi2ps main.dvi > main -なお、この行の最後の単語のピリオド以前を「メインファイル」のベースネームで -あると仮定します(上の2つの場合どちらも`main')。この行に記述した、`%f'はメ -インファイル名に、 `%r' はメインファイルの拡張子を取り除いた部分に置換され -ます。ただし、`%f,%r'を利用した場合、初回タイプセット時に必ずメインファイ -ル名の入力を促されます。 - - `[prefix] g' (*Note Cursor jump::参照) でのファイル間ジャンプを有効に機 -能させるため、入力ファイル分割時には次のことに注意して下さい。 - - 1. サブディレクトリを作って、その中にサブファイルを置くことはできるがサ - ブディレクトリのサブディレクトリには置けない。 +なお、この行の最後の単語のピリオド以前を「メインファイル」のベースネー +ムであると仮定します(上の2つの場合どちらも`main')。この行に記述した、 +`%f'はメインファイル名に、 `%r' はメインファイルの拡張子を取り除いた部 +分に置換されます。ただし、`%f,%r'を利用した場合、初回タイプセット時に必 +ずメインファイル名の入力を促されます。 + + `[prefix] g' (*Note Cursor jump::参照) でのファイル間ジャンプを有効に +機能させるため、入力ファイル分割時には次のことに注意して下さい。 + + 1. サブディレクトリを作って、その中にサブファイルを置くことはできるが + サブディレクトリのサブディレクトリには置けない。 2. メインファイルからサブディレクトリ内のファイルを include する時には、 - 相対パス指定を用いて、`\include{chap1/sub}'のように記述。 + 相対パス指定を用いて、 + `\include{chap1/sub}'のように記述。 3. メインファイルが一つ上のディレクトリにある場合も、サブファイルには %#!platex main.tex のように記述する(../mainではない)。 @@ -377,35 +390,36 @@ 領域の固定 ========== - `[prefix] tr' の領域指定のタイプセットでは、とくに指定のないかぎり、 -`C-SPC'でマークした位置と、ポイント(カーソル位置)の間を領域とみなしますが、 -必ず決まった領域をタイプセットしたい場合は、その領域を + `[prefix] tr' の領域指定のタイプセットでは、とくに指定のないかぎり、 +`C-SPC'でマークした位置と、ポイント(カーソル位置)の間を領域とみなします +が、必ず決まった領域をタイプセットしたい場合は、その領域を %#BEGIN <渡したい領域> %#END -のように`%#BEGIN'と`%#END'で囲み、カーソルを「`%#BEGIN'以降」に置いてくだ -さい。この時の領域決定規則をまとめると次のようになります。 - - - 1. カーソル位置よりバッファの先頭方向に`%#BEGIN'というキーワードがある場 - 合 +のように`%#BEGIN'と`%#END'で囲み、カーソルを「`%#BEGIN'以降」に置いてく +ださい。この時の領域決定規則をまとめると次のようになります。 + + + 1. カーソル位置よりバッファの先頭方向に`%#BEGIN'というキーワードがあ + る場合 1. `%#BEGIN'よりバッファの末尾方向に`%#END'というキーワードが見つかっ た場合。 =>`%#BEGIN' から、その `%#END' のある位置まで。 - 2. `%#END' が見つからなかった場合。=>バッファの最後尾まで。 + 2. `%#END' が見つからなかった場合。 + =>バッファの最後尾まで。 2. カーソル位置よりバッファの先頭方向に `%#BEGIN' というキーワードが 見つからなかった場合。 =>マーク(`C-SPC'位置)とポイント(カーソル位置)の間の領域。 - tabular 環境を何度も試行錯誤しているような場合は、`\begin'の前の行に -`%#BEGIN' と書き、`\end' の次の行に `%#END' と書いておくと簡単に作表結果を -テストすることができます。また、長い .tex ファイルの後半に `%#BEGIN' を書 -いておけば、前半の部分は無視できます。このBEGINとEND の消し忘れには十分ご -注意下さい。 + tabular 環境を何度も試行錯誤しているような場合は、`\begin'の前の行に +`%#BEGIN' と書き、`\end' の次の行に `%#END' と書いておくと簡単に作表結 +果をテストすることができます。また、長い .tex ファイルの後半に +`%#BEGIN' を書いておけば、前半の部分は無視できます。このBEGINとENDの消 +し忘れには十分ご注意下さい。 @@ -415,9 +429,9 @@ lprフォーマット =============== - まず、プリントアウト用コマンド列のフォーマットについて説明します。コマン -ド列フォーマットは、3つの Lisp 変数によって表現されます。デフォルトの -dvi2ps 用のフォーマットを例に説明します。 + まず、プリントアウト用コマンド列のフォーマットについて説明します。コ +マンド列フォーマットは、3つの Lisp 変数によって表現されます。デフォルト +の dvi2ps 用のフォーマットを例に説明します。 `(1)dviprint-command-format' `"dvi2ps %f %t %s | lpr"' @@ -428,18 +442,19 @@ `(3)dviprint-to-format' `"-t %e"' -実際にプリントアウトする時は、(1)中の %s がファイル名に置き換えられ、%f が -(2)の内容、%t が(3)の内容に置き換えられます。その際に(2)の文字列中の %b は -「出力開始ページ」、(3)の文字列中の %e は「出力終了ページ」に置き換えられ -ます。もし、ページを指定しない時には、%f, %t 両方とも無視されます。 - - この、dviprint-command-format を臨時に変えたい時は、LaTeX のソーステキス -ト中の任意の場所に、 +実際にプリントアウトする時は、(1)中の %s がファイル名に置き換えられ、 +%f が(2)の内容、%t が(3)の内容に置き換えられます。その際に(2)の文字列中 +の %b は「出力開始ページ」、(3)の文字列中の %e は「出力終了ページ」に置 +き換えられます。もし、ページを指定しない時には、%f, %t 両方とも無視され +ます。 + + この、dviprint-command-format を臨時に変えたい時は、LaTeX のソーステ +キスト中の任意の場所に、 %#LPR dvi2ps %f %t %s | 4up -page 4 | texfix | lpr -Plp2 -のように書いて下さい。プリントアウトするページ範囲をいちいち聞かせないよう -にする時に +のように書いて下さい。プリントアウトするページ範囲をいちいち聞かせない +ようにする時に %#LPR dvi2ps %s | lpr @@ -454,15 +469,30 @@ LaTeX 文書に関連するコマンドは以下の %# 記法で指定することができます。 + `%#PREVIEW' + + ... Command line for DVI viewing ([prefix] t p) `%#BIBTEX' - - ... makeindexを行なうコマンドライン([prefix] t b) + + ... makeindexを行なうコマンドライン([prefix] t b) `%#MAKEINDEX' - - ... bibtexを行なうコマンドライン([prefix] t i) - -行頭がこれらのキーワードで始まる行をLaTeX文書の先頭付近に書いておけば、そ -れで指定したコマンドを起動できます。 + + ... bibtexを行なうコマンドライン([prefix] t i) + `%#DVIPDF' + + ... DVIからPDF変換を行なうコマンドライン([prefix] t d) + `%#LPR' + + ... 印刷用のコマンドライン([prefix] t l) + `%#PDFVIEW' + + ... PDFファイルを見るためのコマンドライン + `%#IMAGEDPI' + + ... 即時プレヴュー(on-the-fly preview)用の画像のDPI + +行頭がこれらのキーワードで始まる行をLaTeX文書の先頭付近に書いておけば、 +それで指定したコマンドを起動できます。  @@ -480,10 +510,11 @@ !)Edit-%#! B)EGIN-END-region L)Edit-%#LPR -というメニューが出て来るので、`%#!'に続くコマンドを変更したい時には`!'を、 -`%#LPR'で lpr フォーマットを変えたい時は`l'を、あらかじめ設定したリジョン -を `%#BEGIN' 〜 `%#END' で括りたい時は、`b'を押します。`b'を選んだ時には、 -それまでバッファ中に置かれていた`%#BEGIN', `%#END' が自動的に消去されます。 +というメニューが出て来るので、`%#!'に続くコマンドを変更したい時には +`!'を、`%#LPR'で lpr フォーマットを変えたい時は`l'を、あらか +じめ設定したリジョンを `%#BEGIN' 〜 `%#END' で括りたい時は、 +`b'を押します。`b'を選んだ時には、それまでバッファ中に置かれていた +`%#BEGIN', `%#END' が自動的に消去されます。  @@ -492,20 +523,21 @@ 補完入力 ******** - LaTeX での環境名などは、野鳥の補完機能を利用して能率的に入力することがで -きます。 + LaTeX での環境名などは、野鳥の補完機能を利用して能率的に入力すること +ができます。 * Menu: -* begin型補完:: -* section型補完:: -* large型補完:: -* maketitle型補完:: +* begin型補完:: +* section型補完:: +* large型補完:: +* maketitle型補完:: * Arbitrary completion:: 随時補完 -* end補完:: +* end補完:: * Accent mark completion:: アクセント記号補完 * Image completion:: 数式記号イメージ補完 * Greek letter completion:: ギリシャ文字補完 +* Inserting parens::  @@ -514,14 +546,14 @@ begin型補完 =========== - `\begin{env}...\end{env}'の様な形式の入力の補完をbegin型補完と呼ぶことに -します。begin 型補完は、 + `\begin{env}...\end{env}'の様な形式の入力の補完をbegin型補完と呼ぶこ +とにします。begin 型補完は、 `[prefix] b' ... begin 型補完開始(標準では `C-c b') -で始まります。頻繁に用いられる次の LaTeX 環境の補完は、[prefix] `b' に続く -次の1文字を入力するだけで、`\begin{xxx}...\end{xxx}'を完成させます。 +で始まります。頻繁に用いられる次の LaTeX 環境の補完は、[prefix] `b'に続 +く次の1文字を入力するだけで、`\begin{xxx}...\end{xxx}'を完成させます。 `[prefix] b c' ... `\begin{center}...\end{center}' @@ -558,8 +590,8 @@ `[prefix] b V' ... `\begin{verse}...\end{verse}' - 上記のもの以外の環境名は Emacs の持つインクリメンタルな補完機能を用いて -入力します(上記の環境名も以下の補完入力可能)。 + 上記のもの以外の環境名は Emacs の持つインクリメンタルな補完機能を用い +て入力します(上記の環境名も以下の補完入力可能)。 `[prefix] b SPC' ... begin 型補完入力 @@ -568,39 +600,43 @@ Begin environment(default document): -と表示されます。ここで、何も入れずにリターンキーのみ押すと、括弧内に出てい -るデフォルトの環境名が入力されますが、適当な環境名を入力すると、`\begin{環 -境名} … \end{環境名}'が文書中に挿入されます。ミニバッファで環境名を入力す -るときに、環境名の頭文字を入力し「スペース」をたたくと、一致する環境名が内 -部テーブルに存在した場合、正しい環境名に補完されるので、入力の手間が省けま -す。内部テーブルに存在しない環境名を入力した時はユーザ専用のテーブルに登録 -され、さらにそのテーブルを自動的に、ユーザ辞書(デフォルトでは -`~/.yatexrc')に保存します。 - -さらに、特定の環境を補完入力した時にはその環境で必ず用いられるエントリを自 -動挿入します(例: `itemize'環境における`\item'など)。挿入されたエントリが不 -要な場合にはundoによって消去して下さい。 +と表示されます。ここで、何も入れずにリターンキーのみ押すと、括弧内に出 +ているデフォルトの環境名が入力されますが、適当な環境名を入力すると、 +`\begin{環境名} … \end{環境名}'が文書中に挿入されます。ミニバッファで +環境名を入力するときに、環境名の頭文字を入力し「スペース」をたたくと、 +一致する環境名が内部テーブルに存在した場合、正しい環境名に補完されるの +で、入力の手間が省けます。内部テーブルに存在しない環境名を入力した時は +ユーザ専用のテーブルに登録され、さらにそのテーブルを自動的に、ユーザ辞 +書(デフォルトでは `~/.yatexrc')に保存します。 + +さらに、特定の環境を補完入力した時にはその環境で必ず用いられるエントリ +を自動挿入します(例: `itemize'環境における`\item'など)。挿入されたエン +トリが不要な場合にはundoによって消去して下さい。 既に書いたテキストを環境で括る ------------------------------ - ところで、最初に書いてしまったブロックを後から、itemize 環境の中に閉じこ -めたいと思うことがありますが、そのようなときは、あらかじめ閉じこめたい段落 -をマークして、begin 型補完の各コマンドの `[prefix]' の次の『小文字の 'b'』 -を『大文字』に変えて起動して下さい。(または、`C-u' を先に打ち、universal -argument をつけても可能です) - - 例えばあるパラグラフを description 環境の中に入れたいときは、そのパラグ -ラフをマークしてから、 - -`[prefix] B D' -`(または ESC 1 [prefix] b D)' -`(または C-u [prefix] b D など)' - -とタイプしてください。これは、`[prefix] b SPC'の補完入力にもあてはまり、 -`b' を大文字に変えて、`[prefix] B SPC' とタイプすれば、あらかじめマークし -ておいたリジョンを、begin と end の環境で括ります。 + ところで、最初に書いてしまったブロックを後から、itemize 環境の中 +に閉じこめたいと思うことがありますが、そのようなときは、あらかじめ +閉じこめたい段落をマークして、begin 型補完の各コマンドの `[prefix]' +の次の『小文字の 'b'』 を『大文字』に変えて起動して下さい。(または、 +`C-u' を先に打ち、universal argument をつけても可能です) + + 例えばあるパラグラフを description 環境の中に入れたいときは、そのパラ +グラフをマークしてから、補完機能を呼び出してください(description環境の +場合は `[prefix] b D')。 + +選択された領域を括ります。ただしこれは `transient-mark-mode' が t +(Emacsの標準)になっている場合のみで、普段 +`transient-mark-mode' を `nil' にしている場合は、 +補完キー前に `universal-argument' 指定(`C-u') +をタイプしてから `[prefix] b D' など、補完キーを +タイプすれば括り補完になります。 +なおEmacs22以降であれば `transient-mark-mode' 無効時も +`set-mark-command' (`C-space')の連打で一時的に +`transient-mark-mode' が有効になります。 +  @@ -609,8 +645,8 @@ section型補完 ============= - `\section{目的}' のような形式の入力の補完を section 型補完と呼ぶことにし -ます。section 型補完は、 + `\section{目的}' のような形式の入力の補完を section 型補完と呼ぶこと +にします。section 型補完は、 `[prefix] s' ... section 型補完 @@ -620,15 +656,15 @@ (C-v for view-section) \???{} (default documentclass): -というプロンプトが現れるので、そこで `section' のような LaTeX コマンド名を -入力します。ここでもリターンキーのみで括弧内のデフォルト値が選択されるほか、 -`chapter'などのような頻度の高い名称入力にはスペースキーによる補完機能が有 -効です。 次に、{}の中身の入力を促す、 +というプロンプトが現れるので、そこで `section' のような LaTeX コマンド +名を入力します。ここでもリターンキーのみで括弧内のデフォルト値が選択さ +れるほか、`chapter'などのような頻度の高い名称入力にはスペースキーによる +補完機能が有効です。 次に、{}の中身の入力を促す、 \section{???}: -というプロンプトが現れるので、セクションのタイトルなどを入力します。たとえ -ば、 +というプロンプトが現れるので、セクションのタイトルなどを入力します。た +とえば、 (C-v for view-section) \???{} (default documentclass): section \section{???}: 目的 @@ -650,7 +686,7 @@ * Menu: -* 2個以上の引数をとる section型コマンド:: +* 2個以上の引数をとる section型コマンド:: * Enclose section-type command:: 括り補完 * Recursive completion:: 再帰補完 * view-sectioning:: セクション区切りのアウトライン表示 @@ -663,10 +699,10 @@ 2個以上の引数をとる section型コマンド ------------------------------------- - ところで、`\addtolength{\topmargin}{8mm}' などのように、引数を二つ以上取 -る LaTeX コマンドがあります。このようなコマンドの補完入力には、 section 型 -補完呼び出しに引数を付けてください。例えば上の`addtolength' の例であれば、 -引数2を指定します。つまり、 + ところで、`\addtolength{\topmargin}{8mm}' などのように、引数を二つ以 +上取る LaTeX コマンドがあります。このようなコマンドの補完入力には、 +section 型補完呼び出しに引数を付けてください。例えば上の`addtolength'の +例であれば、引数2を指定します。つまり、 C-u 2 [prefix] s (または、ESC 2 [prefix] s) @@ -676,12 +712,13 @@ \addtolength{???}: \topmargin Argument 2: 8mm -のように入力してください。最初の addtolength の部分と、第一引数である -\topmargin の入力は当然スペースによる補完入力が可能です。ユーザ辞書に登録 -される LaTeX コマンドには、この引数の数も学習されるので、最初の補完の時引 -数の数を指定して起動しておけば、以後の補完時には、記憶された個数だけ引数を -聞いて来るようになります。あとで引数の個数を変えたい時は、再び `C-u' を用 -いて個数を指定し直すことで、自動的に辞書中の引数の個数の部分を更新します。 +のように入力してください。最初の addtolength の部分と、第一引数である +topmargin の入力は当然スペースによる補完入力が可能です。ユーザ辞書に登 +録される LaTeX コマンドには、この引数の数も学習されるので、最初の補完の +時引数の数を指定して起動しておけば、以後の補完時には、記憶された個数だ +け引数を聞いて来るようになります。あとで引数の個数を変えたい時は、再び +`C-u' を用いて個数を指定し直すことで、自動的に辞書中の引数の個数の部分 +を更新します。 @@ -691,8 +728,11 @@ 既に書いたテキストを括る ------------------------ - また、起動コマンドの`s'を大文字に変えて起動すると、あらかじめ書いた文章 -を section 型コマンドの第一引数として括ります。 + また、section型補完機能の呼び出し時に領域選択状態にしておくと +領域内のテキストを section 型コマンドの第一引数として括ります。 +これも普段 `transient-mark-mode' を `nil' にしている場合は +`C-u' のあとに補完キーをタイプすれば強制的に括り補完になります。 +  @@ -701,10 +741,10 @@ 再帰補完 -------- - 高度な使い方になるかもしれませんが、section型補完の引数の入力時にさらに -補完入力を利用することができます(section/large/maketitle型に限る)。section -型コマンドの引数に更に LaTeX コマンドが来る場合にはミニバッファで野鳥の補 -完キーを再帰的に入力することで引数の入力も効率的に行なえます。 + 高度な使い方になるかもしれませんが、section型補完の引数の入力時にさら +に補完入力を利用することができます(section/large/maketitle型に限る)。 +section型コマンドの引数に更に LaTeX コマンドが来る場合にはミニバッファ +で野鳥の補完キーを再帰的に入力することで引数の入力も効率的に行なえます。  @@ -713,27 +753,28 @@ セクション区切りのアウトライン表示 ---------------------------------- - 通常のsection型補完の時にミニバッファで`C-v'を押すと現在存在するセクショ -ン区切りコマンド全てを `*Sectioning Lines*'というバッファに一覧表示します -(「<<--」のついている行がもっとも近いセクション区切り)。この時ミニバッファ -で`C-p', `C-n' を押すと`part', `chapter', ..., `subparagraph' のコマンドが -論理階層の高さにしたがって上下します。また、`C-v', `M-v' を押すとセクショ -ン区切り一覧バッファがスクロールし、数字の`0'〜`7'を押すとある高さ以上のセ -クション区切りだけを選んで表示します(実際にやって見れば分かります)。 + 通常のsection型補完の時にミニバッファで`C-v'を押すと現在存在するセク +ション区切りコマンド全てを `*Sectioning Lines*'というバッファに一覧表示 +します(「<<--」のついている行がもっとも近いセクション区切り)。この時ミ +ニバッファで`C-p', `C-n' を押すと`part', `chapter', ..., +`subparagraph' のコマンドが論理階層の高さにしたがって上下します。また、 +`C-v', `M-v' を押すとセクション区切り一覧バッファがスクロールし、数字の +`0'〜`7'を押すとある高さ以上のセクション区切りだけを選んで表示します(実 +際にやって見れば分かります)。 `*Sectioning Lines*'バッファは、 `M-x YaTeX-section-overview' ... セクション区切り一覧バッファを生成 -で作成することができます。このバッファを選択し任意の行でスペースを押すと、 -該当するセクション区切りのある本文中の場所にジャンプします。さらに、同バッ -ファで `u' を押すと、ソーステキストの対応するセクションコマンドが一階層上 -がり(例: subsection が section に変わる)、`d'を押すと一階層下がります。 -`*Sectioning Lines*'バッファにあるセクション区切りの行をマークしておいて -`U'を押すとリジョン内のものに対応するソーステキストのセクションコマンドす -べてが一階層上がり、`D'を押すと下がります。セクション区切り一覧バッファで -利用できるキーコマンドには以下のものがあります。 +で作成することができます。このバッファを選択し任意の行でスペースを押す +と、該当するセクション区切りのある本文中の場所にジャンプします。さらに、 +同バッファで `u' を押すと、ソーステキストの対応するセクションコマンドが +一階層上がり(例: subsection が section に変わる)、`d'を押すと一階層下が +ります。`*Sectioning Lines*'バッファにあるセクション区切りの行をマーク +しておいて`U'を押すとリジョン内のものに対応するソーステキストのセクショ +ンコマンドすべてが一階層上がり、`D'を押すと下がります。セクション区切り +一覧バッファで利用できるキーコマンドには以下のものがあります。 `SPC' ... 対応するソース行へジャンプ @@ -758,12 +799,13 @@ ラベル自動生成 -------------- - `\ref{}' や `\cite{}' マクロをsection型補完で入れた場合参照先となり得る -ものを全て探してメニューにして選択できます。参照先には`\label{}'をつけてお -く必要はありません。もしあれば、そのラベルを使い、なければその場で参照先に -`\label{}'を作らせてくれます。ラベル名を考えるのは苦痛に感じるものです。全 -てのカウンタにラベルをつけるのもたいへんです。もうラベル名に何をつけるか、 -ラベルをつけるかつけまいか、などということは忘れましょう! + `\ref{}' や `\cite{}' マクロをsection型補完で入れた場合参照先となり得 +るものを全て探してメニューにして選択できます。参照先には`\label{}'をつ +けておく必要はありません。もしあれば、そのラベルを使い、なければその場 +で参照先に`\label{}'を作らせてくれます。ラベル名を考えるのは苦痛に感じ +るものです。全てのカウンタにラベルをつけるのもたいへんです。もうラベル +名に何をつけるか、ラベルをつけるかつけまいか、などということは忘れましょ +う!  @@ -782,18 +824,17 @@ {\??? } (default large): -と表示されるので、上記のものと同じ要領で補完入力して下さい。補完候補に用意 -されているのは、`footnotesize' や `huge' のような文字サイズ指定子と、`bf' -や`dg'のようなフォント指定子です。 +と表示されるので、上記のものと同じ要領で補完入力して下さい。補完候補に +用意されているのは、`footnotesize' や `huge' のような文字サイズ指定子と、 +`bf'や`dg'のようなフォント指定子です。 既に書いた文字を括る -------------------- - また、begin型補完の時と同様、先に書いてしまった一連の文章の文字のサイズ -を変えたいと思う時がありますが、そのような時は、サイズや大きさを変えたい文 -字の範囲をマークしてから、呼び出しキーを `[prefix] L' と、大文字の L に変 -えて呼び出せば、そのリジョン全体が、ブレースで囲まれます。 + また、begin型補完の時と同様、先に書いてしまった一連の文章の文字のサイ +ズを変えたいと思う時がありますが、そのような時は、サイズや大きさを変え +たい文字の範囲をマークしてからlarge型補完を呼んでください。  @@ -807,8 +848,8 @@ `[prefix] m' ... maketitle 型補完開始 -で、maketitle 型補完を開始します。補完の要領は今までのものとまったく同じで -す。LaTeX 用のコマンド名が補完候補として用意されています。 +で、maketitle 型補完を開始します。補完の要領は今までのものとまったく同 +じです。LaTeX 用のコマンド名が補完候補として用意されています。  @@ -817,15 +858,15 @@ 随時補完 ======== - さて、今まで述べた典型的な LaTeX コマンド形式の補完入力を用いずに、今入 -力しようとしている LaTeX コマンドを文書中の任意の位置で随時補完することも -できます。LaTeX コマンド(先頭が\で始まる)を入力している途中で、 + さて、今まで述べた典型的な LaTeX コマンド形式の補完入力を用いずに、今 +入力しようとしている LaTeX コマンドを文書中の任意の位置で随時補完するこ +ともできます。LaTeX コマンド(先頭が\で始まる)を入力している途中で、 `[prefix] SPC' ... 随時補完 -を入力すれば、全ての補完候補の中から一致するものが選ばれカーソル位置に挿入 -されます。 +を入力すれば、全ての補完候補の中から一致するものが選ばれカーソル位置に +挿入されます。  @@ -835,9 +876,9 @@ ======= 現在開いたままの環境名を自動的に検出し、`\end{環境名}'を挿入します。 -begin 型補完を用いれば環境の閉じ忘れはないのですが、時にはついつい手で -`\begin{環境名}' を入れてしまい、悲しい思いをすることがあります。そのよう -な時には気にせず続けて文章を入力し、しかるのちに +begin 型補完を用いれば環境の閉じ忘れはないのですが、時にはついつい手で +`\begin{環境名}' を入れてしまい、悲しい思いをすることがあります。そのよ +うな時には気にせず続けて文章を入力し、しかるのちに `[prefix] e' ... end 補完 @@ -860,8 +901,8 @@ 1:` 2:' 3:^ 4:" 5:~ 6:= 7:. u v H t c d b -というメニューが出て来るので、数字、または対応する記号/英字を入力して下さ -い。すると編集バッファに、 +というメニューが出て来るので、数字、または対応する記号/英字を入力して下 +さい。すると編集バッファに、 \`{} @@ -879,17 +920,17 @@ ==================== 主に数式モードで使用される、矢印やΣなどの記号を擬似的に表現するキー入力 -で、LaTeX コマンドを入力できます。これは野鳥自身の「数式モード」でのみ動作 -します。野鳥はカーソルがTeXの数式環境の中にある時に`;'や、`:'に特殊な機能 -を持たせます。 - - さて、例えば、←(leftarrow)をASCII文字だけで表現する場合、一般的には「<-」 -のようにしますが、これを利用して、数式記号イメージ入力モードで`\leftarrow' -を入力するには、`;'(セミコロン)を打ってから`<-'と入力します。同様に、長い -矢印←-(long-leftarrow) をASCII文字だけで表現する場合「<--」とするので、 -`\longleftarrow'を入力するためには、`;<--' と入力します。あるいは無限大記 -号をASCII文字だけで表現する時は「oo」のようにすることから、`\infty' を入力 -する時は、`;oo'とキー入力します。 +で、LaTeX コマンドを入力できます。これは野鳥自身の「数式モード」でのみ +動作します。野鳥はカーソルがTeXの数式環境の中にある時に`;'や、 +`:'に特殊な機能を持たせます。 + + さて、例えば、←(leftarrow)をASCII文字だけで表現する場合、一般的には +「<-」のようにしますが、これを利用して、数式記号イメージ入力モードで +`\leftarrow'を入力するには、`;'(セミコロン)を打ってから`<-'と入力します。 +同様に、長い矢印←-(long-leftarrow) をASCII文字だけで表現する場合「<--」 +とするので、`\longleftarrow'を入力するためには、`;<--'と入力します。あ +るいは無限大記号をASCII文字だけで表現する時は「oo」のようにすることから、 +`\infty' を入力する時は、`;oo'とキー入力します。 これらの操作をまとめると次のようになります。 @@ -902,16 +943,18 @@ - いずれの場合も、イメージ入力を行っている途中で望みのものがバッファに表示 -されたなら、そこでイメージ入力を止めて次の編集動作に移っても構いません。 - - 数式環境中で`;'自身を入力するには`;;'のようにします。イメージ入力の途中 -でTABを押すと、それまで入力した文字で始まるもの一覧が表示されます。ここで -目的の LaTeX コマンドまでカーソルを移動し再度TABを押すことでその LaTeX コ -マンドがバッファに挿入されます。 - - どのキー入力にどの記号が対応しているか全て知りたい時は、`;'を押した直後 -にTABを押してください。以下の例は、`;<'と押した後にTABを押したものです。 + いずれの場合も、イメージ入力を行っている途中で望みのものがバッファに +表示されたなら、そこでイメージ入力を止めて次の編集動作に移っても構いま +せん。 + + 数式環境中で`;'自身を入力するには`;;'のようにします。イメージ入力の途 +中でTABを押すと、それまで入力した文字で始まるもの一覧が表示されます。こ +こで目的の LaTeX コマンドまでカーソルを移動し再度TABを押すことでその +LaTeX コマンドがバッファに挿入されます。 + + どのキー入力にどの記号が対応しているか全て知りたい時は、`;'を押した直 +後にTABを押してください。以下の例は、`;<'と押した後にTABを押したもので +す。 KEY LaTeX sequence sign < \leq ≦ @@ -919,35 +962,51 @@ <- \leftarrow ← <= \Leftarrow <= -左から[入力キー]、[対応する LaTeX コマンド]、[(擬似)記号図示]、という順で -メニューが出て来るので、よく使うものを覚えておくと良いでしょう。ものによっ -てはASCII文字で表現することが困難なので、あまり覚えやすいキー並びではない -ものがあるでしょうから、そのような場合は \maketitle 型補完で入力するか、以 -下に述べる対応表の設定を行って単純なキー並びのものを設定すると良いでしょう。 - - 入力キーと LaTeX コマンド、記号の対応表を個人的に設定したい場合は -Emacs-Lisp 変数 `YaTeX-math-sign-alist-private' に定義してください。その内 -容とデフォルトのものを合わせたものが対応表として使用されます(private の方 -が優先される)。なお、この変数の構造については `yatexmth.el' を参照してくだ -さい。 +左から[入力キー]、[対応する LaTeX コマンド]、[(擬似)記号図示]、という順 +でメニューが出て来るので、よく使うものを覚えておくと良いでしょう。もの +によってはASCII文字で表現することが困難なので、あまり覚えやすいキー並び +ではないものがあるでしょうから、そのような場合は \maketitle 型補完で入 +力するか、以下に述べる対応表の設定を行って単純なキー並びのものを設定す +ると良いでしょう。 + + 入力キーと LaTeX コマンド、記号の対応表を個人的に設定したい場合は +Emacs-Lisp 変数 `YaTeX-math-sign-alist-private' に定義してください。そ +の内容とデフォルトのものを合わせたものが対応表として使用されます +(privateの方が優先される)。なお、この変数の構造については +`yatexmth.el' を参照してください。  -File: yatexj, Node: Greek letter completion, Prev: Image completion, Up: Completion +File: yatexj, Node: Greek letter completion, Next: Inserting parens, Prev: Image completion, Up: Completion ギリシャ文字補完 ================ - もう一つ、数式環境中で`:'を押すとギリシャ文字入力モードに入ります。`:'を -押した直後に`a'を押すと`\alpha'が、`g' を押すと `\gamma'が、などアルファベッ -トに対応したギリシャ文字が挿入されます。操作方法は;の数式記号補完とまった -く同じです。まずは`:'の直後にTABを押してどのアルファベットにどのギリシャ文 -字が対応しているか調べてみてください。 - - `;'と`:'を数式環境中で押しているにもかかわらず、イメージ補完が働かない場 -合は、`C-u ;'のように universal-argument をつけてキーを押すことにより、強 -制的にイメージ補完に入ることができます。また、この時にどのような状態で数式 -環境内判定に失敗したかをご連絡下さい。 + もう一つ、数式環境中で`:'を押すとギリシャ文字入力モードに入ります。 +`:'を押した直後に`a'を押すと`\alpha'が、`g' を押すと `\gamma'が、などア +ルファベットに対応したギリシャ文字が挿入されます。操作方法は;の数式記号 +補完とまったく同じです。まずは`:'の直後にTABを押してどのアルファベット +にどのギリシャ文字が対応しているか調べてみてください。 + + `;'と`:'を数式環境中で押しているにもかかわらず、イメージ補完が働かな +い場合は、`C-u ;'のように universal-argument をつけてキーを押すことによ +り、強制的にイメージ補完に入ることができます。また、この時にどのような +状態で数式環境内判定に失敗したかをご連絡下さい。 + + + +File: yatexj, Node: Inserting parens, Prev: Greek letter completion, Up: Completion + +括弧入力補助 +============ + + 3種類ある括弧 () {} [] の開き括弧を入れたときに閉じ括弧を自動的に入れ +ます。`\' の直後にの `[' を入れると行を分けてインデントを揃え、数式入力 +に備えます。その他 LaTeX のマクロに応じて括弧の釣合の取れた状態に導きま +す。開き括弧そのものを1つだけ入れたいときは `C-q' でクォート入力するか、 +`[prefix] w m' で修正モードをOFFにしてください。 + + 領域選択してから開き括弧を入れるとその領域をその種類の括弧で括ります。  @@ -956,23 +1015,23 @@ ローカル辞書 ************ - 補完入力用の候補は三種類の辞書から構成されています。一つは`yatex.el'に組 -み込まれた「標準辞書」、もう一つはユーザが個人的に常用するコマンドを保存す -る「ユーザ辞書」、そしてもうひとつはあるディレクトリでのみ有効なコマンドを -保存する「ローカル辞書」です。 - - 補完入力時に新しい単語を入れた場合に、その単語をどの辞書に入れるか聞いて -来ます。 + 補完入力用の候補は三種類の辞書から構成されています。一つは`yatex.el' +に組み込まれた「標準辞書」、もう一つはユーザが個人的に常用するコマンド +を保存する「ユーザ辞書」、そしてもうひとつはあるディレクトリでのみ有効 +なコマンドを保存する「ローカル辞書」です。 + + 補完入力時に新しい単語を入れた場合に、その単語をどの辞書に入れるか聞 +いて来ます。 `foo' is not in table. Register into: U)serDic L)ocalDic N)one D)iscard -というプロンプトに対し、`u'と答えると「ユーザ辞書」を、`l'と答えるとローカ -ル辞書を更新し、`n'と答えると辞書ファイルは更新せず現在のEmacs セッション -のみ有効な単語とし、`d'と答えると新たな単語を学習せずに捨てることになりま -す。 - - もし、ローカル辞書の機能はいらず、全てユーザ辞書の更新のみでよいと言う場 -合には`~/.emacs'などで、 +というプロンプトに対し、`u'と答えると「ユーザ辞書」を、`l'と答えるとロー +カル辞書を更新し、`n'と答えると辞書ファイルは更新せず現在のEmacsセッショ +ンのみ有効な単語とし、`d'と答えると新たな単語を学習せずに捨てることにな +ります。 + + もし、ローカル辞書の機能はいらず、全てユーザ辞書の更新のみでよいと言 +う場合には`~/.emacs'などで、 (setq YaTeX-nervous nil) @@ -986,8 +1045,8 @@ ************** - LaTeXの編集には試行錯誤がつきものです。ある部分を一括でコメントアウトし -たり、コメントを外したりしたいことがあります。 + LaTeXの編集には試行錯誤がつきものです。ある部分を一括でコメントアウト +したり、コメントを外したりしたいことがあります。 `[prefix] >' ... リジョンを % でコメントアウト @@ -1001,15 +1060,15 @@ `[prefix] ,' ... 現在のパラグラフのコメントを外す -は、カーソルの位置するパラグラフ全体に対しての操作です。なお、ここでいう -「パラグラフ」は (`mark-paragraph') 関数によりマークされる範囲を指します -(標準設定で`ESC h'にバインドされている)。なお、既に`%'でコメントアウトされ -ているパラグラフに対して繰り返しパラグラフのコメントを使用した場合の動作は -保証しませんので御注意ください。 - - さて、文章に対してだけでなく、時には`\begin', `\end' 自体に対してもコメ -ントアウトの操作をしたいときがあります。このようなときは、`\begin{}' ある -いは `\end{}' の行にカーソルを合わせ、 +は、カーソルの位置するパラグラフ全体に対しての操作です。なお、ここでい +う「パラグラフ」は (`mark-paragraph') 関数によりマークされる範囲を指し +ます(標準設定で`ESC h'にバインドされている)。なお、既に`%'でコメントア +ウトされているパラグラフに対して繰り返しパラグラフのコメントを使用した +場合の動作は保証しませんので御注意ください。 + + さて、文章に対してだけでなく、時には`\begin', `\end' 自体に対 +してもコメントアウトの操作をしたいときがあります。このようなときは、 +`\begin{}' あるいは `\end{}' の行にカーソルを合わせ、 `[prefix] >' ... `\begin{}'〜`\end{}' 全てコメントアウト @@ -1023,10 +1082,11 @@ `[prefix] ,' ... `\begin{}' と `\end{}' のコメントを外す -は、対応する `\begin' と `\end' 2行だけを、コメント操作の対象とします。リ -ジョンをコメントアウトしようとして、マークを設定したのちにカーソルを移動し -`[preifx] >' を押してもカーソルが `\begin{}' の上にあると`\begin{}'〜 -`\end{}'モードでコメント機能が働いてしまうので注意して下さい。 +は、対応する `\begin' と `\end' 2行だけを、コメント操作の対象とします。 +リジョンをコメントアウトしようとして、マークを設定したのちにカーソルを +移動し`[preifx] >' を押してもカーソルが `\begin{}' の上にあると +`\begin{}'〜`\end{}'モードでコメント機能が働いてしまうので注意して下さ +い。  @@ -1038,11 +1098,11 @@ * Menu: -* 対応オブジェクトへのジャンプ:: -* お絵描きツール起動:: -* メインファイルへのジャンプ:: -* 環境を単位としたジャンプ:: -* 最後の補完位置へのジャンプ:: +* 対応オブジェクトへのジャンプ:: +* お絵描きツール起動:: +* メインファイルへのジャンプ:: +* 環境を単位としたジャンプ:: +* 最後の補完位置へのジャンプ::  @@ -1056,8 +1116,8 @@ `[prefix] g' ... 対応するオブジェクトにジャンプ -を押すことにより、カーソル位置のLaTeXコマンドに対応する場所にジャンプしま -す。対応関係が存在すると解釈されるコマンドには以下のものがあります。 +を押すことにより、カーソル位置のLaTeXコマンドに対応する場所にジャンプし +ます。対応関係が存在すると解釈されるコマンドには以下のものがあります。 * `\begin{}' ←→ `\end{}' * `%#BEGIN' ←→ `%#END' @@ -1066,22 +1126,23 @@ * `\include(\input)' → 対応するファイル * `\bibitem{}' ←→ `\cite{}' - `\begin{}' か `\end{}' の行で`[prefix] g'を押すことにより、対応する -`end/begin'の行にジャンプします。もちろん対応するものがない場合はエラーに -なります。またこれは、領域固定のための `%#BEGIN' と `%#END' のペアに対して -も同様に動作します。なお、`label/ref'や`cite/bibitem'対応するものが別ファ -イルにある時は、ジャンプ先となるファイルがオープンされていなければなりませ -ん。*Note %#notation::. メインの .tex ファイルの `\include{chap1}' などに -カーソルを合わせ、`[prefix] g' を押すと、`chap1.tex' にジャンプします。 + `\begin{}' か `\end{}' の行で`[prefix] g'を押すことに +より、対応する`end/begin'の行にジャンプします。もちろん対応するものが +ない場合はエラーになります。またこれは、領域固定のための `%#BEGIN' と +`%#END' のペアに対しても同様に動作します。なお、`label/ref'や +`cite/bibitem'対応するものが別ファイルにある時は、ジャンプ先となるファ +イルがオープンされていなければなりません。*Note %#notation::. +メインの .tex ファイルの `\include{chap1}' などにカーソルを合わせ、 +`[prefix] g' を押すと、`chap1.tex' にジャンプします。 また、 `[prefix] 4 g' ... 別ウィンドウで対応オブジェクトにジャンプ -を押すと、対応するオブジェクトへのジャンプを別ウィンドウで行います。ただし、 -この機能は `begin/end', `%#BEGIN/%#END' 間のジャンプに対しては(意味がない -と思われるので)機能しないので注意してください。 +を押すと、対応するオブジェクトへのジャンプを別ウィンドウで行います。た +だし、この機能は `begin/end', `%#BEGIN/%#END' 間のジャンプに対しては(意 +味がないと思われるので)機能しないので注意してください。  @@ -1090,28 +1151,29 @@ お絵描きツール起動 ================== -上記の「画像ファイルの取り込みマクロ」とは、例えば `\epsfile{file=foo}' の -ような挿絵取り込みコマンドのことで、この行にカーソルを合わせて`[prefix] g' -を押すとその画像ファイルの元となったファイルを対応するお絵描きツールを起動 -してオープンします。起動するツールの判定は以下のようになされます。 - - 1. カレント行が変数 `YaTeX-processed-file-regexp-alist' に定義されている - 正規表現のいずれかとマッチしたら、ファイル名に相当する部分を \\(\\)か - ら抜き出して覚えておく(何番目の\\(\\)かは変数の各リストの cdr 部に入 - れておく)。マッチしなければ何もしない。 - 2. 行末に、変数 `YaTeX-file-processor-alist' に登録されているコマンドが - 「%コマンド」 のように書いてあれば強制的に「コマンド ファイル名.拡張 - 子」を起動。 - 3. なければ、変数 `YaTeX-file-processor-alist' の各リストのcdr部に入って - いる拡張子を「ファイル名」の後ろに足したファイルが存在するか順次調べ - て、存在した場合car部に入っているコマンドを起動する。 +上記の「画像ファイルの取り込みマクロ」とは、例えば +`\epsfile{file=foo}' のような挿絵取り込みコマンドのことで、この行にカー +ソルを合わせて`[prefix] g'を押すとその画像ファイルの元となったファイル +を対応するお絵描きツールを起動してオープンします。起動するツールの判定 +は以下のようになされます。 + + 1. カレント行が変数 `YaTeX-processed-file-regexp-alist' に定義されて + いる正規表現のいずれかとマッチしたら、ファイル名に相当する部分を + (\\)から抜き出して覚えておく(何番目の\\(\\)かは変数の各リストの + cdr 部に入れておく)。マッチしなければ何もしない。 + 2. 行末に、変数 `YaTeX-file-processor-alist' に登録されているコマンド + が「%コマンド」 のように書いてあれば強制的に「コマンド ファイル + 名.拡張子」を起動。 + 3. なければ、変数 `YaTeX-file-processor-alist' の各リストのcdr部に入っ + ている拡張子を「ファイル名」の後ろに足したファイルが存在するか順次 + 調べて、存在した場合car部に入っているコマンドを起動する。 4. 以上どれかにマッチしなければあきらめる。 -変数 `YaTeX-file-processor-alist' と変数 `YaTeX-file-processor-alist' の設 -定方法についてはそれぞれの変数について describe-variable して説明を読んで -下さい。うまく設定すると、画像ファイルにかぎらず、任意の形式のファイルを任 -意のプロセッサで処理するコマンドを簡単に呼び出すことができます。 +変数 `YaTeX-file-processor-alist' と変数 `YaTeX-file-processor-alist' +の設定方法についてはそれぞれの変数について describe-variable して説明を +読んで下さい。うまく設定すると、画像ファイルにかぎらず、任意の形式のファ +イルを任意のプロセッサで処理するコマンドを簡単に呼び出すことができます。  @@ -1127,9 +1189,9 @@ `[prefix] 4 ^' ... 別ウィンドウでメインファイルにジャンプ -を押すと、メインファイルの編集バッファに切替えます。もし、メインファイルを -オープンしていない場合は、カレントディレクトリから探して自動的にオープンし -ます。 +を押すと、メインファイルの編集バッファに切替えます。もし、メインファイ +ルをオープンしていない場合は、カレントディレクトリから探して自動的にオー +プンします。  @@ -1147,8 +1209,8 @@ `M-C-@' ... 環境全体をマーク -上記のコマンドは通常の`[prefix]'キーではなく`META'キーをプリフィクスとして -機能するのでご注意下さい。 +上記のコマンドは通常の`[prefix]'キーではなく`META'キーをプリフィクスと +して機能するのでご注意下さい。  @@ -1157,9 +1219,10 @@ 最後の補完位置へのジャンプ ========================== -野鳥は補完入力した位置を常にレジスタ `3'に保存しています。入力途中で如何な -るファイルの如何なる位置に行ったとしても、`C-x j 3'(`jump-to-register')を -使って直ちに最後の補完入力位置に戻ることができます。 +野鳥は補完入力した位置を常にレジスタ `3'に保存しています。入力途中で如 +何なるファイルの如何なる位置に行ったとしても、`C-x j +3'(`jump-to-register')を使って直ちに最後の補完入力位置に戻ることができ +ます。  @@ -1168,8 +1231,8 @@ 変更/削除 ********* - 既に入力されている LaTeX コマンドの変更/削除のために以下の機能が用意され -ています。 + 既に入力されている LaTeX コマンドの変更/削除のために以下の機能が用意 +されています。 `[prefix] c' ... カーソル位置の LaTeX コマンドの変更 @@ -1177,8 +1240,8 @@ ... カーソル位置の LaTeX コマンドの削除 -これらのコマンドは、コマンドを起動する場所によって動作を決定するので注意し -て下さい。 +これらのコマンドは、コマンドを起動する場所によって動作を決定するので注 +意して下さい。 * Menu: @@ -1192,9 +1255,9 @@ LaTeX コマンドの変更 ==================== -変更したい LaTeX コマンドにカーソルを合わせて `[prefix] c' を押すとそのコ -マンドを補完入力などを用いて手軽に変えることができます。`[prefix] c' で変 -更できるコマンドには以下のものがあります。 +変更したい LaTeX コマンドにカーソルを合わせて `[prefix] c' +を押すとそのコマンドを補完入力などを用いて手軽に変えることができます。 +`[prefix] c' で変更できるコマンドには以下のものがあります。 * `begin/end' の環境名 * section型コマンドのコマンド名 @@ -1203,9 +1266,9 @@ * large型コマンド * (イメージ補完で入力可能な)数式モード専用のmaketitle型コマンド - 変えたいsection型コマンドの引数がさらに LaTeX コマンドを含む場合は、その -引数を囲む中括弧の上で `[prefix] c' を押すことで中のコマンドを変更対象判定 -から除外することができます。 + 変えたいsection型コマンドの引数がさらに LaTeX コマンドを含む場合は、 +その引数を囲む中括弧の上で `[prefix] c' を押すことで中のコマンドを変更 +対象判定から除外することができます。 @@ -1226,12 +1289,13 @@ 括弧の上 対をなす括弧の削除 -`\begin, \end' および `%#BEGIN, %#END' を削除する場合、`\begin, \end' や -`%#BEGIN, %#END' の存在する行はまるごと削除されるので、それらの一行に -`\begin' などを二つ以上連ねて書かないように注意してください。上記のものは -すべて本文を囲う「容器」を削除するように働きますが、universal-argument -(`C-u') を打った後で`[prefix] k'をタイプすると、それぞれの「容器」に含まれ -る「中身」も一気に削除します。以下の例を参考にして下さい。 +`\begin, \end' および `%#BEGIN, %#END' を削除する場合、`\begin, \end' +や `%#BEGIN, %#END' の存在する行はまるごと削除されるので、それらの一行 +に `\begin' などを二つ以上連ねて書かないように注意してください。上記の +ものはすべて本文を囲う「容器」を削除するように働きますが、 +universal-argument (`C-u') を打った後で`[prefix] k'をタイプすると、それ +ぞれの「容器」に含まれる「中身」も一気に削除します。以下の例を参考にし +て下さい。 元のテキスト: [prefix] k C-u [prefix] k 本文\footnote{脚注}です。 本文脚注です。 本文です。 @@ -1248,21 +1312,21 @@ itemの桁揃え ============ - itemize 環境中にある`\item'の項目(文章)が複数行に渡る場合に、項目の先頭 -を桁揃えしたい場合には、 + itemize 環境中にある`\item'の項目(文章)が複数行に渡る場合に、項目の先 +頭を桁揃えしたい場合には、 `M-q' ... 桁揃え -によって、その item のインデントの深さに応じて fill されます。なお、古い -NTT jTeX を使用している場合には、Lisp 変数`NTT-jTeX'を`t'にセットして下さ -い。 - - このとき、変数`YaTeX-item-regexp'の値(標準では `"\\\\item"')を項目指定コ -マンドの正規表現として検索に使用します。itemize 環境で、独自のコマンドを定 -義して項目を列挙している場合(例えば`\underlineitem')は、`~/.emacs' で次の -ように指定して下さい。 +によって、その item のインデントの深さに応じて fill されます。なお、古 +いNTT jTeX を使用している場合には、Lisp 変数`NTT-jTeX'を`t'にセットして +下さい。 + + このとき、変数`YaTeX-item-regexp'の値(標準では `"\\\\item"')を +項目指定コマンドの正規表現として検索に使用します。itemize 環境で、独自のコ +マンドを定義して項目を列挙している場合(例えば`\underlineitem')は、 +`~/.emacs' で次のように指定して下さい。 (setq YaTeX-item-regexp "\\(\\\\\\(sub\\)*item\\)\\|\\(\\\\underlineitem\\)") @@ -1271,8 +1335,8 @@ この変数の指定の仕方がよく分からない場合は、独自の項目列挙コマンドの名前を ``"\item"'で始まるものにして下さい(例えば"\itembf"')。 -野鳥の `M-q' では `\item' を環境に応じて以下のように「ハングインデント」し -ます。 +野鳥の `M-q' では `\item' を環境に応じて以下のように「ハングインデント」 +します。 itemize, enumerate環境: >\item[ほげほげ] 英語では、特に意味のない単語を `foo' であらわしま @@ -1287,12 +1351,13 @@ パラグラフの桁揃え ================== - itemize環境以外でのパラグラフの桁揃え(fill)は、基本的に他のモードと同じ -ように機能しますが、verbatim環境や、tabular環境など桁揃えをすると悲惨な状 -況になるような環境中では機能しません。また、\verb で括ってあるものは決して -行分割されません(変数 `YaTeX-verb-regexp' で制御) )。さらに、一時的にイン -デントの深さを変えてある箇所では、そのインデントの先頭で`M-q'を押すことに -より fill-prefix をいちいち変更しなくて桁揃えができます。 + itemize環境以外でのパラグラフの桁揃え(fill)は、基本的に他のモードと同 +じように機能しますが、verbatim環境や、tabular環境など桁揃えをすると悲惨 +な状況になるような環境中では機能しません。また、\verb で括ってあるもの +は決して行分割されません(変数 `YaTeX-verb-regexp' で制御) )。さらに、一 +時的にインデントの深さを変えてある箇所では、そのインデントの先頭で +`M-q'を押すことにより fill-prefix をいちいち変更しなくて桁揃えができま +す。 @@ -1306,22 +1371,23 @@ \includeonly{現在編集中のファイル名} -のように書いておくことで、タイプセットの時間を節約できますが、ちょっと他の -ファイルを手直ししたい時には +のように書いておくことで、タイプセットの時間を節約できますが、ちょっと +他のファイルを手直ししたい時には \includeonly{ちょっと手直ししたいファイル名} -と書き直さなければならず手間がかかります。野鳥では現在編集しているファイル -名がメインファイルの`\includeonly'にない場合には自動的にこれを検出し、次の -指示を仰ぎます。 +と書き直さなければならず手間がかかります。野鳥では現在編集しているファ +イル名がメインファイルの`\includeonly'にない場合には自動的にこれを検出 +し、次の指示を仰ぎます。 A)dd R)eplace %)comment? -現在編集中のファイルを `\includeonly' のリストに加えたい時には`a' を、現在 -編集中のファイルだけを `\includeonly' にしたい時は`r'を、`\includeonly' の -行をコメントアウトして無効化したい時には、`%'をそれぞれ押して下さい。 +現在編集中のファイルを `\includeonly' のリストに加えたい時には`a'を、現 +在編集中のファイルだけを `\includeonly' にしたい時は`r'を、 +`\includeonly' の行をコメントアウトして無効化したい時には、`%'をそれぞ +れ押して下さい。  @@ -1330,9 +1396,9 @@ ここはどこ? *********** - 項目数の多い tabular などをたくさん書いていると下の方の行で、いま書いて -いる桁がどこに対応するのかわからなくなってしまうことがあります。例えば、以 -下のような tabular において、 + 項目数の多い tabular などをたくさん書いていると下の方の行で、いま書い +ている桁がどこに対応するのかわからなくなってしまうことがあります。例え +ば、以下のような tabular において、 \begin{tabular}{|c|c|c|c|c|c|c|c|}\hline 氏名&所属&〒&住所&電話&FAX&帰省先&帰省先電話\\ \hline @@ -1349,10 +1415,10 @@ `[prefix] &' ... 現在のカラム表示 -を押すとカーソル位置のカラムがどの項目に該当するかをミニバッファに表示しま -す。tabular/array環境の第1行目を項目名の並びとみなして対応するものを探しま -す。もし項目名として別のものを表示して欲しい場合は、行頭を`%'にしてダミー -の項目並びを作っておくと良いでしょう。 +を押すとカーソル位置のカラムがどの項目に該当するかをミニバッファに表示 +します。tabular/array環境の第1行目を項目名の並びとみなして対応するもの +を探します。もし項目名として別のものを表示して欲しい場合は、行頭を`%'に +してダミーの項目並びを作っておくと良いでしょう。  @@ -1361,18 +1427,18 @@ おまかせ改行 ************ - tabular[*], array, itemize, enumerate, tabbing 環境をbegin型補完で入力し -た時、または各環境内で + tabular[*], array, itemize, enumerate, tabbing 環境をbegin型補完で入 +力した時、または各環境内で `ESC RET' ... おまかせ改行 -を押すと、その環境に応じた行エントリを次の行に挿入します(begin型補完時に自 -動挿入されたエントリが不要な場合は undo によって消去できます)。例えば、 -tabular環境では、その環境のカラム数に対応した個数の `&' に加え、行末の -`\\' を入れます。この時それ以前に `\hline' があればそれも付け加えます。環 -境とそれに応じて自動入力するものの対応は以下のようになります。 +を押すと、その環境に応じた行エントリを次の行に挿入します(begin型補完時 +に自動挿入されたエントリが不要な場合は undo によって消去できます)。例え +ば、tabular環境では、その環境のカラム数に対応した個数の `&' に加え、行 +末の `\\' を入れます。この時それ以前に `\hline' があればそれも付け加え +ます。環境とそれに応じて自動入力するものの対応は以下のようになります。 * `tabular', `tabular*', `array' @@ -1386,16 +1452,16 @@ `\item' または `item[]' - tabular 環境の例のように、本機能は各環境の一行目の内容を参考にして動作す -るので、なるべく二行目以降で呼び出すようにしてください。 - - もし、その他の環境、例えば `foo'、に対して`おまかせ改行'を動作させたい時 -は、`YaTeX-intelligent-newline-foo' という名前の関数を定義します。定義した -関数は、現在の行に改行を挿入した直後の行頭の位置で呼ばれます。関数 -`YaTeX-indent-line' を呼ぶと現在の環境のネストに応じた深さにインデントされ -るので、これを呼んでから何かを挿入するようなコードを書くとよいでしょう。 -`yatexenv.el'内の関数 `YaTeX-intelligent-newline-itemize' の定義などを参考 -にしてください。 + tabular 環境の例のように、本機能は各環境の一行目の内容を参考にして動 +作するので、なるべく二行目以降で呼び出すようにしてください。 + + もし、その他の環境、例えば `foo'、に対して`おまかせ改行'を動作 +させたい時は、`YaTeX-intelligent-newline-foo' という名前の関数を定義 +します。定義した関数は、現在の行に改行を挿入した直後の行頭の位置で呼ばれま +す。関数 `YaTeX-indent-line' を呼ぶと現在の環境のネストに応じた深さに +インデントされるので、これを呼んでから何かを挿入するようなコードを書くとよ +いでしょう。`yatexenv.el'内の関数 +`YaTeX-intelligent-newline-itemize' の定義などを参考にしてください。 @@ -1405,14 +1471,15 @@ 先回りusepackage **************** - begin型、section型、maketitle型、いずれかのLaTeX2eマクロを補完入力すると、 -そのマクロの利用に外部パッケージを必要とする場合、そのパッケージを本文中で -`\usepackage{}' しているかどうかを調査し、もししていなければプリアンブルに -対応するパッケージを引数にした `\usepackage' 文を(確認後に)挿入します。 - - ただしこの機能が働くためには、パッケージ名とその中で定義されているマクロ -群をalistの形式で変数 `YaTeX-package-alist-private' に設定しておく必要があ -ります。 + begin型、section型、maketitle型、いずれかのLaTeX2eマクロを補完入力す +ると、そのマクロの利用に外部パッケージを必要とする場合、そのパッケージ +を本文中で `\usepackage{}' しているかどうかを調査し、もししていなければ +プリアンブルに対応するパッケージを引数にした `\usepackage' 文を(確認後 +に)挿入します。 + + ただしこの機能が働くためには、パッケージ名とその中で定義されているマ +クロ群をalistの形式で変数 `YaTeX-package-alist-private' に設定しておく +必要があります。  @@ -1429,15 +1496,15 @@ * 修正モード * 野鳥数式モード -修正モードは、開き括弧入力時の処理をコントロールし、修正モードONの時は開き -括弧の入力は開き括弧のみの入力になり、修正モードOFFの時は開き括弧の入力だ -けで閉じ括弧まで入力します。デフォルト(起動時)の設定は*OFF*です。 - - 野鳥数式モードは、変数 `YaTeX-auto-math-mode' が `nil' の時のみ有効で、 -このとき`;'や`:'を押した時(*Note Image completion::参照)に、どのようなイメー -ジ補完を機能させるか、通常のキーとして機能させるかを手動で切り替えます。自 -動判定が遅いマシンでは`YaTeX-auto-math-mode' `nil'にセットし、野鳥数式モー -ドを手動で切り替えると良いでしょう。 +修正モードは、開き括弧入力時の処理をコントロールし、修正モードONの時は +開き括弧の入力は開き括弧のみの入力になり、修正モードOFFの時は開き括弧の +入力だけで閉じ括弧まで入力します。デフォルト(起動時)の設定は*OFF*です。 + + 野鳥数式モードは、変数 `YaTeX-auto-math-mode' が `nil' の時の +み有効で、このとき`;'や`:'を押した時(*Note Image completion::参照)に、 +どのようなイメージ補完を機能させるか、通常のキーとして機能させるかを手動で +切り替えます。自動判定が遅いマシンでは`YaTeX-auto-math-mode' +`nil'にセットし、野鳥数式モードを手動で切り替えると良いでしょう。 @@ -1447,8 +1514,8 @@ オンラインヘルプ **************** - 使おうとする LaTeX コマンドの用法がよく分からない時は、オンラインヘルプ -をひきましょう。ヘルプに関するキーには以下のものがあります。 + 使おうとする LaTeX コマンドの用法がよく分からない時は、オンラインヘル +プをひきましょう。ヘルプに関するキーには以下のものがあります。 `[prefix] ?' ... オンラインヘルプ @@ -1459,28 +1526,29 @@ オンラインヘルプ ================ - 「オンラインヘルプ」は、一般的な LaTeX コマンド(デフォルトでカーソル位置 -のコマンド)に対する説明を隣のバッファに表示します。この時参照されるヘルプ -用ファイルには「グローバルヘルプ」と「プライベートヘルプ」の二種類があり、 -前者は LaTeX の標準コマンドの主なものの説明を含むファイルで、変数 -`YaTeX-help-file'の値で指定されます。このファイルは通常公共の場所(デフォル -トで`$EMACSEXECPATH')に置かれ、誰もがその内容を更新できるように全員に書き -込み権が与えられるべきものです。後者は、非標準もしくは個人的なマクロ定義に -関する説明が書かれているファイルで、変数`YaTeX-help-file-private'の値で指 -定されます。こちらはユーザのホームディレクトリの下などに置かれます。 + 「オンラインヘルプ」は、一般的な LaTeX コマンド(デフォルトでカーソル +位置のコマンド)に対する説明を隣のバッファに表示します。この時参照される +ヘルプ用ファイルには「グローバルヘルプ」と「プライベートヘルプ」の二種 +類があり、前者は LaTeX の標準コマンドの主なものの説明を含むファイルで、 +変数`YaTeX-help-file'の値で指定されます。このファイルは通常公共の場所 +(デフォルトで`$EMACSEXECPATH')に置かれ、誰もがその内容を更新できるよう +に全員に書き込み権が与えられるべきものです。後者は、非標準もしくは個人 +的なマクロ定義に関する説明が書かれているファイルで、変数 +`YaTeX-help-file-private'の値で指定されます。こちらはユーザのホームディ +レクトリの下などに置かれます。 オンラインapropos ================= - 「オンラインapropos」は GNU Emacs の apropos と同様、ユーザが指定したキー -ワードを説明文に含む項目すべてを隣のバッファに表示します。 - - もし、調べようとしたLaTeXコマンドに対する説明がヘルプファイル中に見つか -らなかった場合は、説明文の入力を求めてくるので、可能であれば参考書などを調 -べてそのコマンドの説明を入力してください。もし、なにか標準的なコマンドに対 -する説明を書いたならばぜひ私までその説明をお送り下さい。次回の配布に含めた -いと思います。 + 「オンラインapropos」は GNU Emacs の apropos と同様、ユーザが指定した +キーワードを説明文に含む項目すべてを隣のバッファに表示します。 + + もし、調べようとしたLaTeXコマンドに対する説明がヘルプファイル中に見つ +からなかった場合は、説明文の入力を求めてくるので、可能であれば参考書な +どを調べてそのコマンドの説明を入力してください。もし、なにか標準的なコ +マンドに対する説明を書いたならばぜひ私までその説明をお送り下さい。次回 +の配布に含めたいと思います。  @@ -1494,10 +1562,10 @@ `[prefix] d' ... インクルード構造ブラウズ -を押すと、そのドキュメントの親ファイルを聞いて来ます。ここで全てのファイル -の親となるファイル(デフォルトが示されているので大抵はRETのみ)を入力すると -インクルードしている全てのファイルを解析し、インクルード状況を視覚的に表示 -します。このバッファでは以下のキー操作が有効です。 +を押すと、そのドキュメントの親ファイルを聞いて来ます。ここで全てのファ +イルの親となるファイル(デフォルトが示されているので大抵はRETのみ)を入力 +するとインクルードしている全てのファイルを解析し、インクルード状況を視 +覚的に表示します。このバッファでは以下のキー操作が有効です。 `n' ... 次の行に移動し対応するファイルを隣のバッファに表示 @@ -1542,8 +1610,8 @@ `q' ... 表示前の状態に戻る - ただし、隣のウィンドウのファイルの内容を表示する機能に関しては、対応する -ファイルをクローズしてしまうとうまく働きませんのでご注意ください。 + ただし、隣のウィンドウのファイルの内容を表示する機能に関しては、対応 +するファイルをクローズしてしまうとうまく働きませんのでご注意ください。  @@ -1556,17 +1624,17 @@ gmhist ====== - `gmhist.el'と`gmhist-mh.el' をロードしている場合、プレヴューコマンドの入 -力(`[prefix] tp]')、印刷コマンドの入力(`[prefix] tl')の時に独立したヒスト -リを利用できます。それぞれのプロンプトで、`M-p' を押すと直前に利用したコマ -ンド文字列をくり返し呼び出すことができます。 + `gmhist.el'と`gmhist-mh.el' をロードしている場合、プレヴューコマンド +の入力(`[prefix] tp]')、印刷コマンドの入力(`[prefix] tl')の時に独立した +ヒストリを利用できます。それぞれのプロンプトで、`M-p' を押すと直前に利 +用したコマンド文字列をくり返し呼び出すことができます。 min-out ======= - `min-out.el' (`outline-minor-mode') と野鳥を組み合わせて使うことももちろ -ん可能です。設定の方法に関しては`yatexm-o.el'をご覧ください。 + `min-out.el' (`outline-minor-mode') と野鳥を組み合わせて使うこともも +ちろん可能です。設定の方法に関しては`yatexm-o.el'をご覧ください。  @@ -1575,9 +1643,9 @@ カスタマイズ ************ - 野鳥の動作を制御する種々の変数を独自に設定することにより、補完入力を起動 -するキーアサインを変えたり、環境名の補完候補をさらに充実させることなどがで -きます。 + 野鳥の動作を制御する種々の変数を独自に設定することにより、補完入力を +起動するキーアサインを変えたり、環境名の補完候補をさらに充実させること +などができます。 * Menu: @@ -1591,13 +1659,13 @@ lisp 変数 ========= - 例えば prefix キーを `C-c' 以外のキーにしたい場合は、`YaTeX-prefix'に -prefix キーにしたいシンボルを定義してください。さらに、「`C-c 英字'」とい -うキーバインドは独自の関数が割り当ててあるので使いたくない。このような時は、 -`YaTeX-inhibit-prefix-letter' を `t' に設定することにより、`C-c 英字…'の -バインドが全て、対応する`C-c C-英字…'に変わります(ただし、begin型 large型 -補完の大文字起動によるリジョン指定は可能なままです。これも無効にしたい場合 -は`t'ではなく 1 にセットして下さい。)。 + 例えば prefix キーを `C-c' 以外のキーにしたい場合は、`YaTeX-prefix'に +prefix キーにしたいシンボルを定義してください。さらに、「`C-c 英字'」と +いうキーバインドは独自の関数が割り当ててあるので使いたくない。このよう +な時は、`YaTeX-inhibit-prefix-letter' を `t' に設定することにより、 +`C-c 英字…'のバインドが全て、対応する`C-c C-英字…'に変わります(ただし、 +begin型 large型補完の大文字起動によるリジョン指定は可能なままです。これ +も無効にしたい場合は`t'ではなく 1 にセットして下さい。)。 * Menu: @@ -1613,31 +1681,32 @@ カスタマイズ変数一覧 -------------------- - yatex-mode における次の変数がカスタマイズ可能です。`~/.emacs' で `setq' -しておけば、そちらの定義が優先されます。括弧の中はデフォルト値です。実際に -変数の値を変更する場合は `M-x describe-variable' で変数の詳細な説明を参照 -してください。 + yatex-mode における次の変数がカスタマイズ可能です。`~/.emacs' で +`setq' しておけば、そちらの定義が優先されます。括弧の中はデフォルト値で +す。実際に変数の値を変更する場合は `M-x describe-variable' で変数の詳細 +な説明を参照してください。 -- Variable: YaTeX-prefix yatex-mode 中のプリフィクスキー (`\C-c') -- Variable: YaTeX-inhibit-prefix-letter - prefix キーの直後のキーバインドで `英字' のものを `C-英字' に変更 + prefix キーの直後のキーバインドで `英字' のものを `C-英字' に変更 (`nil') -- Variable: YaTeX-fill-prefix - 本文を書く時の行頭に挿入する接頭辞すなわち fill-prefix (`""(nil)') + 本文を書く時の行頭に挿入する接頭辞すなわち fill-prefix + (`""(nil)') -- Variable: YaTeX-user-completion-table 学習したLaTeXコマンド保存ファイル名 (`"~/.yatexrc"') -- Variable: YaTeX-kanji-code - 文書を作成する時の漢字コードnil=既存のコードのまま 0=no-conversion - 1=Shift JIS, 2=JIS, 3=EUC, 4=UTF-8 (2 (MS-DOSでは1)) + 文書を作成する時の漢字コードnil=既存のコードのまま + 0=no-conversion 1=Shift JIS, 2=JIS, 3=EUC, 4=UTF-8 (2 (MS-DOSでは + 1)) -- Variable: tex-command - LaTeXタイプセッタコマンド名 (`"platex"') - + LaTeXタイプセッタコマンド名 (`"platex"') -- Variable: dvi2-command プレヴューアコマンド名 (`"xdvi -geo +0+0 -s 4"') @@ -1646,12 +1715,12 @@ dviファイルの印刷に使われるコマンド式 (`"dvi2ps %f %t %s | lpr"') -- Variable: dviprint-from-format - 上の`%f'に相当する開始ページ指定書式、`%b' が開始ページ番号に変わる - (`"-f %b"') + 上の`%f'に相当する開始ページ指定書式、`%b' が開始ページ番号に変わ + る (`"-f %b"') -- Variable: dviprint-to-format - `%t' に相当する終了ページ指定書式、`%e'が終了ページ番号に変わる (`"-t - %e"') + `%t' に相当する終了ページ指定書式、`%e'が終了ページ番号に変わる + (`"-t %e"') -- Variable: makeindex-command makeindexコマンド (`"makeindex"' (MS-DOSでは`"makeind"')) @@ -1659,44 +1728,89 @@ -- Variable: YaTeX-dvipdf-command dviをPDFに変換するコマンド (`"dvipdfmx"') + -- Variable: YaTeX-on-the-fly-preview-interval + `[prefix] t e'で環境即時previewをする場合の変換処理までの + 無操作時間(秒) (0.9) + `nil' の場合は即時プレヴューをしない。 + + -- Variable: YaTeX-on-the-fly-math-preview-engine + `[prefix] t e'で数式環境を即時previewする時に用いるエンジン + (latex-math-previewが利用可能なときは + latex-math-preview-expression を呼ぶ + `'YaTeX-typeset-environment-by-lmp'そうでないときは内蔵関数を呼ぶ + `'YaTeX-typeset-environment-by-builtin') + + -- Variable: YaTeX-cmd-gimp + GIMPを起動するコマンド (code{"gimp"}) + -- Variable: YaTeX-cmd-tgif + tgifを起動するコマンド (code{"tgif"}) + -- Variable: YaTeX-cmd-inkscape + Inkscapeを起動するコマンド (code{"inkscape"}) + -- Variable: YaTeX-cmd-dia + Diaを起動するコマンド (code{"dia"}) + -- Variable: YaTeX-cmd-ooo + OpenOffice.orgまたはLibreOfficeを起動するコマンド + (code{"soffice"}) + -- Variable: YaTeX-cmd-gs + Ghostscriptを起動するコマンド (code{"gs"}) + -- Variable: YaTeX-cmd-dvips + dvipsを起動するコマンド(環境によってはpdvipsなど) (code{"dvips"}) + -- Variable: YaTeX-cmd-displayline + displaylineを起動するコマンド + (code{"/Applications/Skim.app/Contents/SharedSupport/displayline"}) + -- Variable: YaTeX-cmd-edit-ps + PostScriptファイルを編集するコマンド (変数code{"YaTeX-cmd-gimp"}の + 値) + -- Variable: YaTeX-cmd-edit-pdf + PDFファイルを編集するコマンド (変数code{"YaTeX-cmd-ooo"}の値) + -- Variable: YaTeX-cmd-edit-ai + .aiファイルを編集するコマンド (変数code{"YaTeX-cmd-inkscape"}の値) + -- Variable: YaTeX-cmd-edit-svg + SVGファイルを編集するコマンド (変数code{"YaTeX-cmd-inkscape"}の値) + -- Variable: YaTeX-cmd-edit-images + その他画像ファイルを編集するコマンド (変数code{"YaTeX-cmd-gimp"}の + 値) + -- Variable: YaTeX-need-nonstop `\nonstopmode{}'を自動的に付加するか (`nil') -- Variable: latex-warning-regexp - latexコマンドの出力するウォーニング行の正規表現 (`"line.* [0-9]*"') + latexコマンドの出力するウォーニング行の正規表現 (`"line.* + [0-9]*"') -- Variable: latex-error-regexp 同じくエラー行の正規表現 (`"l\\.[1-9][0-9]*"') -- Variable: latex-dos-emergency-message - MS-DOS上で動作する latex コマンドが、エラーにより停止するとき出力する - メッセージ (`"Emergency stop"') + MS-DOS上で動作する latex コマンドが、エラーにより停止するとき出力 + するメッセージ (`"Emergency stop"') -- Variable: latex-message-kanji-code - タイプセッタの出力するメッセージの漢字コード.タイプセットバッファの出 - 力が化ける時は、これを設定する (2, Nemacsでのみ有効) + タイプセッタの出力するメッセージの漢字コード.タイプセットバッファ + の出力が化ける時は、これを設定する (2, Nemacsでのみ有効) -- Variable: NTT-jTeX - 古いNTT-jTeX使用時のようにインデントした行の先頭と前の行の(タイプセッ - ト後の)字間が空いてしまうのを嫌う場合は`t'にする(`nil') + 古いNTT-jTeX使用時のようにインデントした行の先頭と前の行の(タイプ + セット後の)字間が空いてしまうのを嫌う場合は`t'にする(`nil') -- Variable: YaTeX-item-regexp itemの桁揃えの時に用いる、itemの正規表現 (`"\\\\(sub\\)*item"') -- Variable: YaTeX-verb-regexp - verbコマンドの正規表現。先頭の\\\\はつけない (`"verb\\*?\\|path"') + verbコマンドの正規表現。先頭の\\\\はつけない + (`"verb\\*?\\|path"') -- Variable: YaTeX-nervous ローカル辞書を用いる時 `t' (`t') -- Variable: YaTeX-sectioning-regexp - セクション区切り設定コマンドの正規表現 + セクション区切り設定コマンドの正規表現 (`"\\(part\\|chapter\\*?\\|\\(sub\\)*\\(section\\|paragraph\\)\\*?\\)\\b"') -- Variable: YaTeX-fill-inhibit-environments fill を抑止する環境名のリスト (`'("tabular" "tabular*" "array" - "picture" "eqnarray" "eqnarray*" "equation" "math" "displaymath" - "verbatim" "verbatim*")') + picture" "eqnarray" "eqnarray*" "equation" "math" "displaymath" + verbatim" "verbatim*")') -- Variable: YaTeX-uncomment-once 領域uncommentで行頭の複数の`%'を全て削除するか (`nil') @@ -1712,8 +1826,8 @@ alist (`nil')。補完テーブルの書き方については`yatexmth.el'を参照。 -- Variable: YaTeX-default-pop-window-height - 1画面の時にタイプセットバッファを初めて作成する時の高さ。数値で行数、 - 数字文字列でEmacsウィンドウに対する百分率 (10) + 1画面の時にタイプセットバッファを初めて作成する時の高さ。数値で行 + 数、数字文字列でEmacsウィンドウに対する百分率 (10) -- Variable: YaTeX-help-file 共用ヘルプファイル (`$doc-directory/../../site-lisp/YATEXHLP.jp') @@ -1722,45 +1836,46 @@ 個人用ヘルプファイル (`"~/YATEXHLP.jp"') -- Variable: YaTeX-no-begend-shortcut - `[prefix] b ??' のショートカットを使わず、`[prefix] b' だけで補完入力 - に入る (`nil') + `[prefix] b ??' のショートカットを使わず、`[prefix] b' だけで補完 + 入力に入る (`nil') -- Variable: YaTeX-hilit-pattern-adjustment-private - 正規表現とそれにマッチするものの論理的意味をシンボルであらわしたもの - のリスト…のリスト。hilit19 を組み込んでいる時のみ有効。詳しくは - `(assq 'yatex-mode hilit-patterns-alist)' した結果と、変数 - `YaTeX-hilit-pattern-adjustment-default' の値(と場合によっては + 正規表現とそれにマッチするものの論理的意味をシンボルであらわしたも + ののリスト…のリスト。hilit19 を組み込んでいる時のみ有効。詳しくは + `(assq 'yatex-mode hilit-patterns-alist)' した結果と、変数 + `YaTeX-hilit-pattern-adjustment-default' の値(と場合によっては hilit19 のドキュメント)を参照せよ。 -- Variable: YaTeX-sectioning-level LaTeXのセクション単位宣言コマンドとその論理的高さのalist。 -- Variable: YaTeX-hierarchy-ignore-heading-regexp - Hierarchy バッファは通常ファイルヘッダとして、LaTeXのセクション宣言コ - マンドの引数を検索し、それがなければコメント行を探すが、その際にヘッ - ダとしては意味を持たないパターンをこの変数に設定する。デフォルトでは - RCS ヘッダとモード指定行(-*- xxx -*-)が設定されている。 + Hierarchy バッファは通常ファイルヘッダとして、LaTeXのセクション宣 + 言コマンドの引数を検索し、それがなければコメント行を探すが、その際 + にヘッダとしては意味を持たないパターンをこの変数に設定する。デフォ + ルトでは RCS ヘッダとモード指定行(-*- xxx -*-)が設定されている。 -- Variable: YaTeX-skip-default-reader - Non-nil に設定するとsection型コマンドの引数入力時、アドイン関数がなけ - ればミニバッファでの読み込みをせずに入力を完了させる (`nil') + Non-nil に設定するとsection型コマンドの引数入力時、アドイン関数が + なければミニバッファでの読み込みをせずに入力を完了させる (`nil') -- Variable: YaTeX-create-file-prefix-g - `\include'などで `prefix g'した時に、ジャンプ先が存在しないファイルで - あってもオープンする (`nil') + `\include'などで `prefix g'した時に、ジャンプ先が存在しないファイ + ルであってもオープンする (`nil') -- Variable: YaTeX-simple-messages 各種補完時のメッセージ出力を簡素化する (`nil') -- Variable: YaTeX-hilit-sectioning-face 色付けが有効な時の `\part' の色 (`'(yellow/dodgerblue - yellow/slateblue)')。リストの第一要素は `hilit-background-mode' が - `'light' の時の、第二要素は `'dark' の時の `\chapter' の色で、文字色/ - 背景色 のように指定する。 + yellow/slateblue)')。リストの第一要素は `hilit-background-mode' が + `'light' の時の、第二要素は `'dark' の時の `\chapter' の色で、文字 + 色/背景色 のように指定する。 -- Variable: YaTeX-hilit-sectioning-attenuation-rate - 色付けが有効な時の、`\subparagraph' の色を `\chapter' の濃度の何%薄く - したものにするか (`'(15 40)') `YaTeX-hilit-sectioning-face' の項参照。 + 色付けが有効な時の、`\subparagraph' の色を `\chapter' の濃度の何% + 薄くしたものにするか (`'(15 40)') `YaTeX-hilit-sectioning-face'の + 項参照。 -- Variable: YaTeX-use-AMS-LaTeX AMS-LaTeX を使用する場合は `t' に設定する (`nil') @@ -1769,59 +1884,66 @@ LaTeX2e を使用する場合は `t' に設定する (`t') -- Variable: YaTeX-template-file - 新規ファイル作成時に自動挿入するファイル名 (`~/work/template.tex') + 新規ファイル作成時に自動挿入するファイル名 + (`~/work/template.tex') -- Variable: YaTeX-search-file-from-top-directory - inputするファイルを探すときの基準ディレクトリをmainファイルのあるディ - レクトリにするか (`t') + inputするファイルを探すときの基準ディレクトリをmainファイルのある + ディレクトリにするか (`t') -- Variable: YaTeX-use-font-lock ソースの色づけパッケージとして font-lock を利用するかどうか (`(featurep 'font-lock)') -- Variable: YaTeX-use-hilit19 - ソースの色づけパッケージとして hilit19 を利用するかどうか(`(featurep - 'hilit19)') + ソースの色づけパッケージとして hilit19 を利用するかどうか + (`(featurep 'hilit19)') -- Variable: YaTeX-use-italic-bold italic, boldフォントを野鳥が探すかどうか (Emacs20以降なら`t') font-lock利用時のみ有効。(`(featurep 'hilit19)' -- Variable: YaTeX-singlecmd-suffix - 全てのmaketitle型コマンドの補完入力直後に挿入する文字列。`"{}"' など - がお勧め。 + 全てのmaketitle型コマンドの補完入力直後に挿入する文字列。 + `"{}"' などがお勧め。 -- Variable: YaTeX-package-alist-private - LaTeX2eのパッケージ名とその中に含まれるマクロのリスト。適切に設定して - おくと本文入力時にマクロを補完入力するとそのマクロに必要なパッケージ - を usepackage するか自動的に検査してくれる。していなければ - \usepackage を自動追加することもできる。リストは'((パッケージ名1 (補 - 完タイプ マクロのリスト……) (補完タイプ マクロのリスト……)) (パッケー - ジ名2 (補完タイプ マクロのリスト……) (補完タイプ マクロのリス - ト……))………) という形式にする。補完タイプは `env, section, - maketitle' のどれか。具体例は変数 `YaTeX-package-alist-default' の値 - 参照。 + LaTeX2eのパッケージ名とその中に含まれるマクロのリスト。適切に設定 + しておくと本文入力時にマクロを補完入力するとそのマクロに必要なパッ + ケージを usepackage するか自動的に検査してくれる。していなければ + usepackage を自動追加することもできる。リストは'((パッケージ名1 + (補完タイプ マクロのリスト……) (補完タイプ マクロのリスト……)) + (パッケージ名2 (補完タイプ マクロのリスト……) (補完タイプ マクロ + のリスト……))………)という形式にする。補完タイプは `env, + section, maketitle' のどれか。具体例は変数 + `YaTeX-package-alist-default'の値参照。 -- Variable: YaTeX-tabular-indentation - tabular/array 環境で現在行の先頭位置が表の第Nカラムのときは標準インデ - ント位置から N*YaTeX-tabular-indentation 桁下げたインデントにする。 + tabular/array 環境で現在行の先頭位置が表の第Nカラムのときは標準イ + ンデント位置から N*YaTeX-tabular-indentation 桁下げたインデントに + する。 -- Variable: YaTeX-noindent-env-regexp 別の環境内にあっても \begin{} が行頭から始まるべき環境名の正規表現。 verbatim環境などを指定する。 + -- Variable: YaTeX-electric-indent-mode + Emacs 24.4 で導入された改行時の、自動インデントをどうするか。 + この値がそのまま electric-indent-local-mode に渡される。 + -1でoff。 + -- Variable: YaTeX-ref-default-label-string - \ref{} のラベル補完でラベル未設定のものに自動的に生成するラベル名の書 - 式。strftime(3)関数に似た日付ベースで指定する。利用できる書式は以下の - とおり。%y -> 西暦下二桁, %b -> 月の英名, %m -> 月(1〜12) %d -> 日, - %H -> 時, %M -> 分, %S -> 秒, %qx -> アルファベットで26進数化した - yymmdd. %qX -> アルファベットで26進数化した HHMMSS. デフォルトは - "%H%M%S_%d%b%y" + \ref{} のラベル補完でラベル未設定のものに自動的に生成するラベル名 + の書式。strftime(3)関数に似た日付ベースで指定する。利用できる書式 + は以下のとおり。%y -> 西暦下二桁, %b -> 月の英名, %m -> 月(1〜12) + %d -> 日, %H -> 時, %M -> 分, %S -> 秒, %qx -> アルファベットで26 + 進数化した yymmdd. %qX -> アルファベットで26進数化した HHMMSS. デ + フォルトは "%H%M%S_%d%b%y" -- Variable: YaTeX-ref-generate-label-function - \ref{}のラベル名自動生成のときに使う関数のシンボル。デフォルトは標準 - の YaTeX::ref-generate-label 関数が割り当ててある。引数を2つ取る関数 - を定義して、この変数にセットするとその関数を呼んだ結果をデフォルトの - ラベル名候補とする。設定例: + \ref{}のラベル名自動生成のときに使う関数のシンボル。デフォルトは標 + 準の YaTeX::ref-generate-label 関数が割り当ててある。引数を2つ取る + 関数を定義して、この変数にセットするとその関数を呼んだ結果をデフォ + ルトのラベル名候補とする。設定例: (setq YaTeX-ref-generate-label-function 'my-yatex-generate-label) (defun my-yatex-generate-label (command value) (and (string= command "caption") @@ -1843,9 +1965,9 @@ カスタマイズ変数設定例 ---------------------- - たとえば、prefix キーとして`ESC'を使用し、新たな補完候補を格納するファイ -ルを、`~/src/emacs/yatexrc' にし、行頭の prefix をタブ文字一つに変えたいと -きは、 + たとえば、prefix キーとして`ESC'を使用し、新たな補完候補を格納するファ +イルを、`~/src/emacs/yatexrc' にし、行頭の prefix をタブ文字一つに変え +たいときは、 (setq YaTeX-prefix "\e" YaTeX-user-completion-table "~/src/emacs/yatexrc" @@ -1860,21 +1982,22 @@ hook変数 -------- - また、hook 変数 `yatex-mode-hook', `yatex-mode-load-hook' を用意していま -す。すべての yatex-mode のバッファで作用させたいものは、`yatex-mode-hook' -に記述し、`yatex.el' をロードする時だけ作用させたいものは -`yatex-mode-load-hook' に記述します。例えば、`outline-minor-mode' を利用す -る場合、それぞれのバッファで `outline-minor-mode' を有効にしたいので、 -`yatex-mode-hook' を次のように設定します。 + また、hook 変数 `yatex-mode-hook', `yatex-mode-load-hook' を用意して +います。すべての yatex-mode のバッファで作用させたいものは、 +`yatex-mode-hook' に記述し、`yatex.el' をロードする時だけ作用させたいも +のは`yatex-mode-load-hook' に記述します。例えば、`outline-minor-mode' +を利用する場合、それぞれのバッファで `outline-minor-mode' を有効にした +いので、`yatex-mode-hook' を次のように設定します。 (setq yatex-mode-hook '(lambda () (outline-minor-mode t))) -逆に、独自のキー定義を行いたい時などは、`yatex-mode-load-hook' を利用しま -す。例えば、begin 型補完において、 document や、enumerate 以外の環境名も -ショートカットキーで入れたいなどという時は、次のようにします。以下の例は、 -`[prefix] ba' で `\begin{abstract}', `\end{abstract}' を挿入します。 +逆に、独自のキー定義を行いたい時などは、`yatex-mode-load-hook' を利用し +ます。例えば、begin 型補完において、 document や、enumerate 以外の環境 +名もショートカットキーで入れたいなどという時は、次のようにします。以下 +の例は、`[prefix] ba' で `\begin{abstract}', `\end{abstract}' を挿入し +ます。 (setq yatex-mode-load-hook '(lambda() (YaTeX-define-begend-key "ba" "abstract"))) @@ -1889,9 +2012,9 @@ hook用ファイル -------------- - 変数 `yatex-mode-load-hook' で定義する内容が多い時は、`yatexhks.el'とい -うファイルを作り、その中に野鳥関連の設定を書く事で、初期化の時に自動的にロー -ドします。 + 変数 `yatex-mode-load-hook' で定義する内容が多い時は、`yatexhks.el'と +いうファイルを作り、その中に野鳥関連の設定を書く事で、初期化の時に自動 +的にロードします。 @@ -1901,9 +2024,9 @@ 付加関数(アドイン関数) ====================== - 各種補完時に、環境名やコマンド名に応じたきめ細やかな補完入力機能を実現す -るための関数を作成することができます。この関数の作成方法や、組み込み方法に -関しては、`yatexadd.doc' をご覧ください。 + 各種補完時に、環境名やコマンド名に応じたきめ細やかな補完入力機能を実 +現するための関数を作成することができます。この関数の作成方法や、組み込 +み方法に関しては、`yatexadd.doc' をご覧ください。  @@ -1912,11 +2035,12 @@ その他 ****** - 野鳥の標準の LaTeX コマンドの辞書には、作者が頻繁に使うものしか登録され -ていません。これは、補完候補に使いそうもないコマンドが存在して、補完したい -コマンドを出すまでのストローク数を増やしてしまう事を防止するためです。標準 -辞書にないコマンドも、できるだけ補完入力方式を利用し、ユーザ辞書を充実させ -ることで、あなたの LaTeX スタイルにあった野鳥へと育っていくことでしょう。 + 野鳥の標準の LaTeX コマンドの辞書には、作者が頻繁に使うものしか登録さ +れていません。これは、補完候補に使いそうもないコマンドが存在して、補完 +したいコマンドを出すまでのストローク数を増やしてしまう事を防止するため +です。標準辞書にないコマンドも、できるだけ補完入力方式を利用し、ユーザ +辞書を充実させることで、あなたの LaTeX スタイルにあった野鳥へと育ってい +くことでしょう。  @@ -1925,23 +2049,23 @@ 取り扱い ******** - 本プログラムはフリーソフトウェアです。本プログラムを使用して生じたいかな -る結果に対しても作者は責任を負わないこととします。転載等に関しては制限いた -しません。常識的に扱ってください。また、本プログラムに含まれるコードを利用 -すること、改造することも自由に行なって構いませんが、流用することにより契約 -締結の必要が生じる場合、私はいかなる契約も締結しません。具体的にはGPLへの -サインはしませんので、GNUに寄贈するものを作っている場合私の作品から取り込 -んだコードを流用すると苦労するかもしれません。いかなるコード流用も拒否しま -せんが契約締結は辞退します。 - - 苦情、希望、バグ報告、感想等は歓迎いたします。連絡は yuuji@yatex.org ま -で(2004年1月現在)。継続的に使用してくださる方はメイリングリスト「fj野鳥の -会」に是非加入してください。加入方法については本パッケージの `docs/qanda' -ファイルの「その他」の章を御覧ください。 + 本プログラムはフリーソフトウェアです。本プログラムを使用して生じたい +かなる結果に対しても作者は責任を負わないこととします。転載等に関しては +制限いたしません。常識的に扱ってください。また、本プログラムに含まれる +コードを利用すること、改造することも自由に行なって構いませんが、流用す +ることにより契約締結の必要が生じる場合、私はいかなる契約も締結しません。 +具体的にはGPLへのサインはしませんので、GNUに寄贈するものを作っている場 +合私の作品から取り込んだコードを流用すると苦労するかもしれません。いか +なるコード流用も拒否しませんが契約締結は辞退します。 + + 苦情、希望、バグ報告、感想等は歓迎いたします。連絡は yuuji@yatex.org +まで(2004年1月現在)。継続的に使用してくださる方はメイリングリスト「fj野 +鳥の会」に是非加入してください。加入方法については本パッケージの +`docs/qanda'ファイルの「その他」の章を御覧ください。 仕様は、予告なく確実に(気分次第で)変更されます:-p。 - 広瀬雄二 + 広瀬雄二  @@ -1952,217 +2076,216 @@ * Menu: -* :: Greek letter completion. 4. -* ;: Image completion. 4. -* Σ[しくま]: Image completion. 4. -* 括る[くくる]: Enclose section-type command. 4. -* 括る[くくる]: large型補完. 22. -* 引数[ひきすう]: 2個以上の引数をとる section型コマンド. 4. -* 欧文[おうふん]: Accent mark completion. 4. -* ;自身[;ししん]: Image completion. 32. -* ∞[むけんたい]: Image completion. 4. -* 矢印[やしるし]: Image completion. 4. -* ブロック[ふろつく]: begin型補完. 81. -* ヒストリ[ひすとり]: Cooperation with other packages. 8. -* 桁揃え[けたそろえ]: Filling. 4. -* やちょう[やちよう]: Intro. 4. -* ジャンプ[しやんふ]: view-sectioning. 42. -* &入力[&にゆうりよく]: Intelligent newline. 4. -* 設定例[せつていれい]: Sample definitions. 4. -* 随時補完[すいしほかん]: Arbitrary completion. 4. -* 閉じ込める[としこめる]: begin型補完. 81. -* 再帰補完[さいきほかん]: Recursive completion. 4. -* ユーザ辞書[ゆうさししよ]: begin型補完. 71. -* 論理階層[ろんりかいそう]: view-sectioning. 42. -* ここはどこ?[ここはとこ?]: What column. 4. -* お絵描きツール起動[おえかきつうるきとう]: お絵描きツール起動. 4. -* 環境の先頭へ[かんきようのせんとうへ]: 環境を単位としたジャンプ. 7. -* 環境の末尾へ[かんきようのまつひへ]: 環境を単位としたジャンプ. 7. -* 環境をマーク[かんきようをまあく]: 環境を単位としたジャンプ. 7. -* カスタマイズ[かすたまいす]: Customizations. 4. -* キーアサイン[きいあさいん]: Customizations. 4. -* 数式モード[すうしきもおと]: Image completion. 4. -* インストール[いんすとおる]: Installation. 4. -* タイプセッタ[たいふせつた]: Invocation. 4. -* プレヴューア[ふれひゆうあ]: Invocation. 4. -* アウトライン[あうとらいん]: view-sectioning. 4. -* 引数の個数を変える[ひきすうのこすうをかえる]: 2個以上の引数をとる section型コマンド. 24. -* アクセント記号補完[あくせんときこうほかん]: Accent mark completion. 4. -* カスタマイズ変数一覧[かすたまいすへんすういちらん]: All customizable variables. 4. -* 環境名の補完[かんきようめいのほかん]: begin型補完. 4. -* エラー修正[えらあしゆうせい]: Calling typesetter. 4. -* タイプセッタ起動[たいふせつたきとう]: Calling typesetter. 4. -* タイプセットエラー[たいふせつとえらあ]: Calling typesetter. 4. -* 環境名の変更[かんきようめいのへんこう]: Changing LaTeX command. 20. -* モード切り替え[もうときりかえ]: Changing mode of YaTeX. 4. -* タイプセッタの使い分け[たいふせつたのつかいわけ]: Changing typesetter. 12. -* 起動するコマンドを変える[きとうするこまんとをかえる]: Changing typesetter. 7. -* コメントアウト[こめんとあうと]: Commenting out. 4. -* その他のコマンド制御[そのたのこまんとせいきよ]: Controlling which command to invoke. 4. -* 他パッケージとの連携[たはつけえしとのれんけい]: Cooperation with other packages. 4. -* コマンドヒストリ[こまんとひすとり]: Cooperation with other packages. 8. -* カーソルジャンプ[かあそるしやんふ]: Cursor jump. 4. -* %#記法自体の編集[%#きほうしたいのへんしゆう]: Editing %# notation. 4. -* パラグラフの桁揃え[はらくらふのけたそろえ]: Filling. 47. -* 領域決定規則[りよういきけつていきそく]: Fix region for typesetting. 25. -* 長いファイルの編集[なかいふあいるのへんしゆう]: Fix region for typesetting. 34. -* 固定領域のタイプセット[こていりよういきのたいふせつと]: Fix region for typesetting. 4. -* ギリシャ文字補完[きりしやもしほかん]: Greek letter completion. 4. -* イメージ補完[いめえしほかん]: Image completion. 4. -* 数式記号イメージ補完[すうしききこういめえしほかん]: Image completion. 4. -* 他のファイルの手直し[ほかのふあいるのてなおし]: Includeonly. 11. -* インクルード構造[いんくるうとこうそう]: Inclusion hierarchy browser. 4. -* おまかせ改行[おまかせかいきよう]: Intelligent newline. 4. -* プリントアウト[ふりんとあうと]: Invocation. 4. -* 環境の削除[かんきようのさくしよ]: Killing LaTeX command. 6. -* ラベル自動生成[らへるしとうせいせい]: label-generation. 4. -* フォント指定子[ふおんとしていし]: large型補完. 18. -* 文字サイズ指定子[もしさいすしていし]: large型補完. 18. -* ローカル辞書[ろおかるししよ]: Local dictionary. 4. -* 変更/削除[へんこう/さくしよ]: Modifying/Deleting. 4. -* グローバルヘルプ[くろおはるへるふ]: Online help. 16. -* オンラインヘルプ[おんらいんへるふ]: Online help. 4. -* キーワード検索[きいわあとけんさく]: Online help. 4. -* プライベートヘルプ[ふらいへえとへるふ]: Online help. 16. -* 入力ファイル分割[にゆうりよくふあいるふんかつ]: Splitting input files. 11. -* セクション区切り一覧バッファ[せくしよんくきりいちらんはつふあ]: view-sectioning. 18. -* セクション区切り[せくしよんくきり]: view-sectioning. 42. -* 現在のカラム表示[けんさいのからむひようし]: What column. 23. -* apropos: Online help. 4. -* autoload: Installation. 4. -* auto-mode-alist: Installation. 4. -* %#BEGIN: Fix region for typesetting. 4. -* begin型補完[beginかたほかん]: begin型補完. 4. -* C-c: Invocation. 4. -* Demacs: Intro. 4. -* .emacs: Installation. 4. -* %#END: Fix region for typesetting. 4. -* end補完[endほかん]: end補完. 4. -* ghostview: Splitting input files. 16. -* gmhist: Cooperation with other packages. 8. -* hook変数[hookへんすう]: Hook variables. 4. -* 出力終了ページ[しゆつりよくしゆうりようへえし]: Print out. 9. -* includeonly: Includeonly. 4. -* Install: Installation. 4. -* itemなどの桁揃え[itemなとのけたそろえ]: Filling. 8. -* 出力開始ページ[しゆつりよくかいしへえし]: Print out. 9. -* jlatex: Invocation. 4. -* large型補完[largeかたほかん]: large型補完. 4. -* LaTeX: Intro. 4. -* leftarrow: Image completion. 4. -* lpr format: lpr format. 4. -* lprフォーマットの変更[lprふおおまつとのへんこう]: Editing %# notation. 18. -* lprふぉーまっと[lprふおおまつと]: lpr format. 4. -* lprフォーマット[lprふおおまつと]: lpr format. 4. -* maketitle型補完[maketitleかたほかん]: maketitle型補完. 4. -* M-C-@: 環境を単位としたジャンプ. 7. -* M-C-a: 環境を単位としたジャンプ. 7. -* M-C-e: 環境を単位としたジャンプ. 7. -* min-out: Cooperation with other packages. 17. -* M-q: Filling. 47. -* Mule: Intro. 4. -* 勝手にincludeonly[かつてにincludeonly]: Includeonly. 4. -* NTT-jTeX[えぬていいていいしえいてつく]: Filling. 15. -* platex: Invocation. 4. -* prefix ,: Commenting out. 4. -* prefix .: Commenting out. 4. -* prefix <: Commenting out. 4. -* prefix >: Commenting out. 4. -* prefix /: Online help. 4. -* prefix ?: Online help. 4. -* prefix &: What column. 4. -* prefix a: Accent mark completion. 4. -* prefix b: begin型補完. 4. -* prefix c: Modifying/Deleting. 4. -* prefix d: Inclusion hierarchy browser. 4. -* prefix e: end補完. 4. -* prefix g: Cursor jump. 4. -* prefix i: Filling. 8. -* prefix k: Modifying/Deleting. 4. -* prefix key: Invocation. 4. -* prefix l: large型補完. 4. -* prefix m: maketitle型補完. 4. -* prefix s: section型補完. 4. -* prefix SPC: Arbitrary completion. 4. -* prefix w: Changing mode of YaTeX. 4. -* prefixキー変更[prefixきいへんこう]: Lisp variables. 4. -* ページ確認省略lpr起動[へえしかくにんしようりやくlprきとう]: Print out. 12. -* section型補完[sectionかたほかん]: section型補完. 4. -* 複雑なtabular[ふくさつなtabular]: What column. 4. -* 先回りusepackage[さきまわり]: Usepackage cheker. 4. -* YaTeX-help-file: Online help. 16. -* YaTeX-help-file-private: Online help. 16. -* YaTeX-item-regexp: Filling. 20. -* YaTeX-math-sign-alist-private: Image completion. 57. -* yatex-mode-hook: Hook variables. 4. -* yatex-mode-load-hook: Hook variables. 4. -* YaTeX-nervous: Local dictionary. 22. -* .yatexrc: Local dictionary. 4. - - - +* :: Greek letter completion. (line 5) +* ;: Image completion. (line 5) +* Σ[しくま]: Image completion. (line 5) +* 括る[くくる]: Enclose section-type command. (line 5) +* 括る[くくる]: large伍補完. (line 23) +* 引数[ひきすう]: 2個以上の引数をとるsection伍υン. (line 5) +* 欧文[おうふん]: Accent mark completion. (line 5) +* ∞[むけんたい]: Image completion. (line 5) +* 矢印[やしるし]: Image completion. (line 5) +* ;ゥ千[;ししん]: Image completion. (line 34) +* ロ窿ホ[ふろつく]: begin伍補完. (line 82) +* リ辜骸ひすとり]: Cooperation with other packages. (line 9) +* 桁揃え[けたそろえ]: Filling. (line 5) +* やちょう[やちよう]: Intro. (line 5) +* ラャン[しやんふ]: view-sectioning. (line 44) +* &入力[&にゆうりよく]: Intelligent newline. (line 5) +* 設定例[せつていれい]: Sample definitions. (line 5) +* 随時補完[すいしほかん]: Arbitrary completion. (line 5) +* 閉じ込める[としこめる]: begin伍補完. (line 82) +* 再驚補完[さいきほかん]: Recursive completion. (line 5) +* ユ⊥ψォ書ロゆうさししよ]: begin伍補完. (line 72) +* 倚理翰濁[ろんりかいそう]: view-sectioning. (line 44) +* ここはどこ?[ここはとこ?]: What column. (line 5) +* μリ゙εル[かすたまいす]: Customizations. (line 5) +* ξ⊥γχεン[きいあさいん]: Customizations. (line 5) +* 数ョモ⊥鐚すうしきもおと]: Image completion. (line 5) +* εンリ轣ロル[いんすとおる]: Installation. (line 5) +* ゙εレ窿゙[たいふせつた]: Invocation. (line 5) +* レヴュ⊥γ[ふれひゆうあ]: Invocation. (line 5) +* お管歩き縺ロル勤動[おえかきつうるきとう]: お管歩き縺ロル勤動. (line 5) +* 環境の先頭へ[かんきようのせんとうへ]: 環境を漬位としたラャン. (line 8) +* 環境の末尾へ[かんきようのまつひへ]: 環境を漬位としたラャン. (line 8) +* 環境を⊥π[かんきようをまあく]: 環境を漬位としたラャン. (line 8) +* γη辜宴テン[あうとらいん]: view-sectioning. (line 5) +* 引数の個数を変える[ひきすうのこすうをかえる]: 2個以上の引数をとるsection伍υン. (line 26) +* γπレン迢フ号補完[あくせんときこうほかん]: Accent mark completion. (line 5) +* μリ゙εル変数一覧[かすたまいすへんすういちらん]: All customizable variables. (line 5) +* 環境名の補完[かんきようめいのほかん]: begin伍補完. (line 5) +* ιラ⊥湘衰zえらあしゆうせい]: Calling typesetter. (line 5) +* ゙εレ窿゙勤動[たいふせつたきとう]: Calling typesetter. (line 5) +* ゙εレ窿辜ヌラ⊥[たいふせつとえらあ]: Calling typesetter. (line 5) +* 環境名の変菜[かんきようめいのへんこう]: Changing LaTeX command. (line 21) +* モ⊥關リり替え[もうときりかえ]: Changing mode of YaTeX. (line 5) +* 勤動するυン閧変える[きとうするこまんとをかえる]: Changing typesetter. (line 8) +* ゙εレ窿゙の守い分け[たいふせつたのつかいわけ]: Changing typesetter. (line 13) +* υメン辜チη躰こめんとあうと]: Commenting out. (line 5) +* その他のυン關ァ御[そのたのこまんとせいきよ]: Controlling which command to invoke. (line 5) +* 他窿ミ⊥ラとの价檎[たはつけえしとのれんけい]: Cooperation with other packages. (line 5) +* υン閭リ辜骸こまんとひすとり]: Cooperation with other packages. (line 9) +* μ⊥ワルラャン[かあそるしやんふ]: Cursor jump. (line 5) +* %#粁迷ゥ体の編 %#きほうしたいのへんしゆう]: Editing %# notation. (line 5) +* ラρラの桁揃え[はらくらふのけたそろえ]: Filling. (line 48) +* 固定領域の゙εレ窿躰こていりよういきのたいふせつと]: Fix region for typesetting. (line 5) +* 領域決定桐則[りよういきけつていきそく]: Fix region for typesetting. (line 27) +* 長いβεルの編 なかいふあいるのへんしゆう]: Fix region for typesetting. (line 36) +* οリωャ文字補完[きりしやもしほかん]: Greek letter completion. (line 5) +* εメ⊥ラ補完[いめえしほかん]: Image completion. (line 5) +* 数ョ粁号εメ⊥ラ補完[すうしききこういめえしほかん]: Image completion. (line 5) +* 他のβεルの手直し[ほかのふあいるのてなおし]: Includeonly. (line 12) +* εンπル⊥闕ワ造[いんくるうとこうそう]: Inclusion hierarchy browser. (line 5) +* 括弧入力補助ロかつこにゆうりよくほしよ]: Inserting parens. (line 5) +* おまかせ改窄[おまかせかいきよう]: Intelligent newline. (line 5) +* リン辜チη躰ふりんとあうと]: Invocation. (line 5) +* 環境の削除ロかんきようのさくしよ]: Killing LaTeX command. (line 7) +* ラルゥ動生成[らへるしとうせいせい]: label-generation. (line 5) +* κン邇定首[ふおんとしていし]: large伍補完. (line 19) +* 文字χεル樹定首[もしさいすしていし]: large伍補完. (line 19) +* ロ⊥μルォ書ロろおかるししよ]: Local dictionary. (line 5) +* 変菜/削除ロへんこう/さくしよ]: Modifying/Deleting. (line 5) +* λンラεンル[おんらいんへるふ]: Online help. (line 5) +* ξ⊥ワ⊥闌沚[きいわあとけんさく]: Online help. (line 5) +* ρロ⊥ルル[くろおはるへるふ]: Online help. (line 17) +* ラε⊥辜ル[ふらいへえとへるふ]: Online help. (line 17) +* 入力βεル分割[にゆうりよくふあいるふんかつ]: Splitting input files. (line 12) +* レπωョン区切り一覧窿β[せくしよんくきりいちらんはつふあ]: view-sectioning. (line 20) +* レπωョン区切り[せくしよんくきり]: view-sectioning. (line 44) +* 現在のμラム舗ヲ[けんさいのからむひようし]: What column. (line 24) +* apropos: Online help. (line 5) +* autoload: Installation. (line 5) +* auto-mode-alist: Installation. (line 5) +* %#BEGIN: Fix region for typesetting. (line 5) +* begin伍補完[beginかたほかん]: begin伍補完. (line 5) +* C-c: Invocation. (line 5) +* Demacs: Intro. (line 5) +* .emacs: Installation. (line 5) +* %#END: Fix region for typesetting. (line 5) +* end補完[endほかん]: end補完. (line 5) +* ghostview: Splitting input files. (line 17) +* gmhist: Cooperation with other packages. (line 9) +* hook変数[hookへんすう]: Hook variables. (line 5) +* 擾力終了⊥ラ[しゆつりよくしゆうりようへえし]: Print out. (line 10) +* includeonly: Includeonly. (line 5) +* Install: Installation. (line 5) +* itemなどの桁揃え[itemなとのけたそろえ]: Filling. (line 9) +* 擾力開腫⊥ラ[しゆつりよくかいしへえし]: Print out. (line 10) +* jlatex: Invocation. (line 5) +* large伍補完[largeかたほかん]: large伍補完. (line 5) +* LaTeX: Intro. (line 5) +* leftarrow: Image completion. (line 5) +* lpr format: lpr format. (line 5) +* lprκ⊥窿轤フ変菜[lprふおおまつとのへんこう]: Editing %# notation. (line 20) +* lprふぉ⊥まっと[lprふおおまつと]: lpr format. (line 5) +* lprκ⊥窿躰lprふおおまつと]: lpr format. (line 5) +* maketitle伍補完[maketitleかたほかん]: maketitle伍補完. (line 5) +* M-C-@: 環境を漬位としたラャン. (line 8) +* M-C-a: 環境を漬位としたラャン. (line 8) +* M-C-e: 環境を漬位としたラャン. (line 8) +* min-out: Cooperation with other packages. (line 18) +* M-q: Filling. (line 48) +* Mule: Intro. (line 5) +* 勝手u穎cludeonly[かつてにincludeonly]: Includeonly. (line 5) +* NTT-jTeX[えぬていいていいしえいてつく]: Filling. (line 16) +* platex: Invocation. (line 5) +* prefix ,: Commenting out. (line 5) +* prefix .: Commenting out. (line 5) +* prefix <: Commenting out. (line 5) +* prefix >: Commenting out. (line 5) +* prefix /: Online help. (line 5) +* prefix ?: Online help. (line 5) +* prefix &: What column. (line 5) +* prefix a: Accent mark completion. (line 5) +* prefix b: begin伍補完. (line 5) +* prefix c: Modifying/Deleting. (line 5) +* prefix d: Inclusion hierarchy browser. (line 5) +* prefix e: end補完. (line 5) +* prefix g: Cursor jump. (line 5) +* prefix i: Filling. (line 9) +* prefix k: Modifying/Deleting. (line 5) +* prefix key: Invocation. (line 5) +* prefix l: large伍補完. (line 5) +* prefix m: maketitle伍補完. (line 5) +* prefix s: section伍補完. (line 5) +* prefix SPC: Arbitrary completion. (line 5) +* prefix w: Changing mode of YaTeX. (line 5) +* prefixξ⊥変菜[prefixきいへんこう]: Lisp variables. (line 5) +* ⊥ラ器犯省羅麪r勤動[へえしかくにんしようりやくlprきとう]: Print out. (line 13) +* section伍補完[sectionかたほかん]: section伍補完. (line 5) +* 複ヌなtabular[ふくさつなtabular]: What column. (line 5) +* 先回りusepackage[さきまわり]: Usepackage cheker. (line 5) +* YaTeX-help-file: Online help. (line 17) +* YaTeX-help-file-private: Online help. (line 17) +* YaTeX-item-regexp: Filling. (line 21) +* YaTeX-math-sign-alist-private: Image completion. (line 61) +* yatex-mode-hook: Hook variables. (line 5) +* yatex-mode-load-hook: Hook variables. (line 5) +* YaTeX-nervous: Local dictionary. (line 23) +* .yatexrc: Local dictionary. (line 5)  Tag table: Node: Top257 Node: Intro1311 Node: Terminology1614 -Node: Main features2249 -Node: Installation3282 -Node: Invocation4500 -Node: Calling typesetter5319 -Node: Calling previewer6556 -Node: Print out6872 -Node: %#notation7138 -Node: Changing typesetter7566 -Node: Splitting input files7824 -Node: Fix region for typesetting8776 -Node: lpr format9677 -Node: Controlling which command to invoke10486 -Node: Editing %# notation10887 -Node: Completion11344 -Node: begin型補完11817 -Node: section型補完14401 -Node: 2個以上の引数をとる section型コマンド15496 -Node: Enclose section-type command16314 -Node: Recursive completion16551 -Node: view-sectioning16857 -Node: label-generation18053 -Node: large型補完18402 -Node: maketitle型補完18982 -Node: Arbitrary completion19281 -Node: end補完19594 -Node: Accent mark completion19936 -Node: Image completion20361 -Node: Greek letter completion22178 -Node: Local dictionary22638 -Node: Commenting out23243 -Node: Cursor jump24402 -Node: 対応オブジェクトへのジャンプ24639 -Node: お絵描きツール起動25627 -Node: メインファイルへのジャンプ26547 -Node: 環境を単位としたジャンプ26883 -Node: 最後の補完位置へのジャンプ27240 -Node: Modifying/Deleting27477 -Node: Changing LaTeX command27883 -Node: Killing LaTeX command28434 -Node: Filling29305 -Node: Includeonly30634 -Node: What column31195 -Node: Intelligent newline31974 -Node: Usepackage cheker33007 -Node: Changing mode of YaTeX33433 -Node: Online help34009 -Node: Inclusion hierarchy browser34985 -Node: Cooperation with other packages36263 -Node: Customizations36718 -Node: Lisp variables37015 -Node: All customizable variables37622 -Node: Sample definitions44923 -Node: Hook variables45357 -Node: Hook file46251 -Node: Add-in functions46457 -Node: Etc46684 -Node: Copying46968 -Node: Concept Index47599 +Node: Main features2254 +Node: Installation3316 +Node: Invocation4546 +Node: Calling typesetter5406 +Node: Calling previewer6867 +Node: Print out7183 +Node: %#notation7449 +Node: Changing typesetter7877 +Node: Splitting input files8135 +Node: Fix region for typesetting9091 +Node: lpr format9999 +Node: Controlling which command to invoke10809 +Node: Editing %# notation11523 +Node: Completion11981 +Node: begin型補完12392 +Node: section型補完15141 +Node: 2個以上の引数をとる section型コマンド16234 +Node: Enclose section-type command17048 +Node: Recursive completion17372 +Node: view-sectioning17677 +Node: label-generation18873 +Node: large型補完19223 +Node: maketitle型補完19757 +Node: Arbitrary completion20056 +Node: end補完20369 +Node: Accent mark completion20710 +Node: Image completion21135 +Node: Greek letter completion22950 +Node: Inserting parens23434 +Node: Local dictionary23782 +Node: Commenting out24386 +Node: Cursor jump25546 +Node: 対応オブジェクトへのジャンプ25763 +Node: お絵描きツール起動26749 +Node: メインファイルへのジャンプ27664 +Node: 環境を単位としたジャンプ28000 +Node: 最後の補完位置へのジャンプ28357 +Node: Modifying/Deleting28594 +Node: Changing LaTeX command29000 +Node: Killing LaTeX command29550 +Node: Filling30422 +Node: Includeonly31752 +Node: What column32313 +Node: Intelligent newline33092 +Node: Usepackage cheker34124 +Node: Changing mode of YaTeX34551 +Node: Online help35126 +Node: Inclusion hierarchy browser36103 +Node: Cooperation with other packages37381 +Node: Customizations37836 +Node: Lisp variables38133 +Node: All customizable variables38739 +Node: Sample definitions47710 +Node: Hook variables48144 +Node: Hook file49038 +Node: Add-in functions49244 +Node: Etc49471 +Node: Copying49756 +Node: Concept Index50380  End tag table diff -r 130c104fe22e -r e37af485338a docs/yatexj.tex --- a/docs/yatexj.tex Mon May 14 19:59:12 2012 +0900 +++ b/docs/yatexj.tex Sun Jul 12 14:21:20 2015 +0900 @@ -13,7 +13,7 @@ @c ノードいじったら C-l C-u C-n 全部のノード更新 C-l C-u C-e @c メニュー増やしたら C-l C-u C-m 全部のメニュー更新 C-l C-u C-a @c フォーマットするときは C-l C-e C-b -@c Last modified Fri May 11 15:40:21 2012 on firestorm +@c Last modified Fri Feb 13 08:17:31 2015 on firestorm @syncodeindex vr cp @end iftex @@ -124,7 +124,7 @@ コマンドの補完入力 (@kbd{C-c b}, @kbd{C-c s}, @kbd{C-c l}, @kbd{C-c m}) @item 既に入力したテキストを環境やコマンド引数の中に取り込む括り補完 -(@kbd{C-u} +通常補完キー) +(リジョン指定後に通常補完キー) @item セクション区切り入力時の文書構造アウトライン表示 @item セクションコマンドの一括シフト (@ref{view-sectioning}) @item 補完辞書の学習 @@ -196,8 +196,8 @@ @dots{} 文書を作成する時の漢字コード @item dviprint-command-format @dots{} ファイルの印刷に使われるコマンド列の書式 -@item makeindex-command - @dots{} makeindexコマンド +@item YaTeX-dvipdf-command + @dots{} DVIをPDFに変換するコマンド @end table これらを変更する場合は、やはり@file{~/.emacs}にて、たとえば @@ -228,8 +228,9 @@ @item [prefix] t r @dots{} タイプセッタ起動(領域指定) @item [prefix] t e - @dots{} タイプセッタ起動 - (ポイント位置の環境または数式モードのみ対象) + @dots{} 部分タイプセット&プレヴュー + (ポイント位置の段落、環境または数式モードのみをタイプセットして + 隣のバッファに組版結果の画像を出す) @item [prefix] t k @dots{} 動作中のタイプセッタの停止 @item [prefix] t b @@ -296,11 +297,20 @@ @subsection 環境タイプセット @kbd{[prefix] te} を押すと、ポイント位置の最も内側の環境、または数式モー -ド内の場合はその数式モード全体が自動的に領域選択されて、領域タイプセットを -呼び出します。tabular環境や数式モードで複雑なものを作っている場合は確かめた -い部分だけを確認できるので便利です。これも @file{texput.tex} に該当部分を -書き出します。プレヴューアで @file{texput.dvi} を開いたままにしておけば -修正と確認が素早くできるでしょう。 +ド内の場合はその数式モード全体、あるいは環境がなければその段落が自動的に +領域選択されて、領域タイプセットを呼び出します。 +tabular環境や数式モードで複雑なものを作っている場合は確かめたい部分だけを +確認できるので便利です。Emacsが画像表示可能な場合は、 +部分タイプセットの結果を画像化して隣のウィンドウに表示します。また、 +特定の環境で呼び出した場合は、環境内の文字を書き換える度に自動的に +プレビュー画像を更新します(on-the-flyプレヴュー)。 +自動表示されない場合はプレヴューアで @file{texput.dvi} +を開いたままにしておけば修正と確認が素早くできるでしょう。 + + 画像プレヴューの場合の大きさ(解像度)はデフォルトで200dpi(数式は300dpi)です。 +dpiを変えたい場合はLaTeXソースのどこかに +@code{%#PREVIEWDPI 150} +のようにdpi値を書いてください。 @node Calling previewer, Print out, Calling typesetter, Invocation @comment node-name, next, previous, up @@ -524,10 +534,20 @@ La@TeX{} 文書に関連するコマンドは以下の %# 記法で指定することができます。 @table @code + @item %#PREVIEW + @dots{} Command line for DVI viewing ([prefix] t p) @item %#BIBTEX @dots{} makeindexを行なうコマンドライン([prefix] t b) @item %#MAKEINDEX @dots{} bibtexを行なうコマンドライン([prefix] t i) + @item %#DVIPDF + @dots{} DVIからPDF変換を行なうコマンドライン([prefix] t d) + @item %#LPR + @dots{} 印刷用のコマンドライン([prefix] t l) + @item %#PDFVIEW + @dots{} PDFファイルを見るためのコマンドライン + @item %#IMAGEDPI + @dots{} 即時プレヴュー(on-the-fly preview)用の画像のDPI @end table 行頭がこれらのキーワードで始まる行をLa@TeX{}文書の先頭付近に書いておけば、 @@ -568,15 +588,16 @@ ができます。 @menu -* begin型補完:: -* section型補完:: -* large型補完:: -* maketitle型補完:: +* begin型補完:: +* section型補完:: +* large型補完:: +* maketitle型補完:: * Arbitrary completion:: 随時補完 -* end補完:: +* end補完:: * Accent mark completion:: アクセント記号補完 * Image completion:: 数式記号イメージ補完 * Greek letter completion:: ギリシャ文字補完 +* Inserting parens:: @end menu @node begin型補完, section型補完, Completion, Completion @@ -676,17 +697,19 @@ @cindex 閉じ込める[としこめる] 例えばあるパラグラフを description 環境の中に入れたいときは、 -そのパラグラフをマークしてから、 - -@table @kbd -@item [prefix] B D -@itemx (または ESC 1 [prefix] b D) -@itemx (または C-u [prefix] b D など) -@end table - -とタイプしてください。これは、@kbd{[prefix] b SPC}の補完入力にもあてはまり、 -@kbd{b} を大文字に変えて、@kbd{[prefix] B SPC} とタイプすれば、あらかじめ -マークしておいたリジョンを、begin と end の環境で括ります。 +そのパラグラフをマークしてから、補完機能を呼び出してください(description +環境の場合は @kbd{[prefix] b D})。 + +選択された領域を括ります。ただしこれは @code{transient-mark-mode} が t +(Emacsの標準)になっている場合のみで、普段 +@code{transient-mark-mode} を @code{nil} にしている場合は、 +補完キー前に @code{universal-argument} 指定(@kbd{C-u}) +をタイプしてから @kbd{[prefix] b D} など、補完キーを +タイプすれば括り補完になります。 +なおEmacs22以降であれば @code{transient-mark-mode} 無効時も +@code{set-mark-command} (@kbd{C-space})の連打で一時的に +@code{transient-mark-mode} が有効になります。 + @node section型補完, large型補完, begin型補完, Completion @comment node-name, next, previous, up @@ -799,8 +822,11 @@ @subsection 既に書いたテキストを括る @cindex 括る[くくる] - また、起動コマンドの@kbd{s}を大文字に変えて起動すると、あらかじめ書 -いた文章を section 型コマンドの第一引数として括ります。 + また、section型補完機能の呼び出し時に領域選択状態にしておくと +領域内のテキストを section 型コマンドの第一引数として括ります。 +これも普段 @code{transient-mark-mode} を @code{nil} にしている場合は +@kbd{C-u} のあとに補完キーをタイプすれば強制的に括り補完になります。 + @node Recursive completion, view-sectioning, Enclose section-type command, section型補完 @comment node-name, next, previous, up @@ -909,8 +935,7 @@ また、begin型補完の時と同様、先に書いてしまった一連の文章の文字のサイズ を変えたいと思う時がありますが、そのような時は、サイズや大きさを変えたい文 -字の範囲をマークしてから、呼び出しキーを @kbd{[prefix] L} と、大文字の L -に変えて呼び出せば、そのリジョン全体が、ブレースで囲まれます。 +字の範囲をマークしてからlarge型補完を呼んでください。 @node maketitle型補完, Arbitrary completion, large型補完, Completion @comment node-name, next, previous, up @@ -1080,7 +1105,7 @@ 照してください。 @cindex YaTeX-math-sign-alist-private -@node Greek letter completion, , Image completion, Completion +@node Greek letter completion, Inserting parens, Image completion, Completion @comment node-name, next, previous, up @section ギリシャ文字補完 @cindex ギリシャ文字補完[きりしやもしほかん] @@ -1098,6 +1123,18 @@ とにより、強制的にイメージ補完に入ることができます。また、この時にどのよう な状態で数式環境内判定に失敗したかをご連絡下さい。 +@node Inserting parens, , Greek letter completion, Completion +@section 括弧入力補助 +@cindex 括弧入力補助[かつこにゆうりよくほしよ] + + 3種類ある括弧 () {} [] の開き括弧を入れたときに閉じ括弧を自動的に入れます。 +@code{\} の直後にの @code{[} を入れると行を分けてインデントを揃え、 +数式入力に備えます。その他 La@TeX{} のマクロに応じて括弧の釣合の取れた +状態に導きます。開き括弧そのものを1つだけ入れたいときは @kbd{C-q} で +クォート入力するか、@kbd{[prefix] w m} で修正モードをOFFにしてください。 + + 領域選択してから開き括弧を入れるとその領域をその種類の括弧で括ります。 + @node Local dictionary, Commenting out, Completion, Top @comment node-name, next, previous, up @chapter ローカル辞書 @@ -1895,6 +1932,60 @@ dviをPDFに変換するコマンド (@code{"dvipdfmx"}) @end defvar +@defvar YaTeX-on-the-fly-preview-interval +@kbd{[prefix] t e}で環境即時previewをする場合の変換処理までの +無操作時間(秒) (0.9) +@code{nil} の場合は即時プレヴューをしない。 +@end defvar + +@defvar YaTeX-on-the-fly-math-preview-engine +@kbd{[prefix] t e}で数式環境を即時previewする時に用いるエンジン +(latex-math-previewが利用可能なときは latex-math-preview-expression を呼ぶ +@code{'YaTeX-typeset-environment-by-lmp} +そうでないときは内蔵関数を呼ぶ @code{'YaTeX-typeset-environment-by-builtin}) +@end defvar + +@defvar YaTeX-cmd-gimp +GIMPを起動するコマンド (code{"gimp"}) +@end defvar +@defvar YaTeX-cmd-tgif +tgifを起動するコマンド (code{"tgif"}) +@end defvar +@defvar YaTeX-cmd-inkscape +Inkscapeを起動するコマンド (code{"inkscape"}) +@end defvar +@defvar YaTeX-cmd-dia +Diaを起動するコマンド (code{"dia"}) +@end defvar +@defvar YaTeX-cmd-ooo +OpenOffice.orgまたはLibreOfficeを起動するコマンド (code{"soffice"}) +@end defvar +@defvar YaTeX-cmd-gs +Ghostscriptを起動するコマンド (code{"gs"}) +@end defvar +@defvar YaTeX-cmd-dvips +dvipsを起動するコマンド(環境によってはpdvipsなど) (code{"dvips"}) +@end defvar +@defvar YaTeX-cmd-displayline +displaylineを起動するコマンド +(code{"/Applications/Skim.app/Contents/SharedSupport/displayline"}) +@end defvar +@defvar YaTeX-cmd-edit-ps +PostScriptファイルを編集するコマンド (変数code{"YaTeX-cmd-gimp"}の値) +@end defvar +@defvar YaTeX-cmd-edit-pdf +PDFファイルを編集するコマンド (変数code{"YaTeX-cmd-ooo"}の値) +@end defvar +@defvar YaTeX-cmd-edit-ai +.aiファイルを編集するコマンド (変数code{"YaTeX-cmd-inkscape"}の値) +@end defvar +@defvar YaTeX-cmd-edit-svg +SVGファイルを編集するコマンド (変数code{"YaTeX-cmd-inkscape"}の値) +@end defvar +@defvar YaTeX-cmd-edit-images +その他画像ファイルを編集するコマンド (変数code{"YaTeX-cmd-gimp"}の値) +@end defvar + @defvar YaTeX-need-nonstop @code{\nonstopmode@{@}}を自動的に付加するか (@code{nil}) @end defvar @@ -2094,6 +2185,12 @@ verbatim環境などを指定する。 @end defvar +@defvar YaTeX-electric-indent-mode +Emacs 24.4 で導入された改行時の、自動インデントをどうするか。 +この値がそのまま electric-indent-local-mode に渡される。 +-1でoff。 +@end defvar + @defvar YaTeX-ref-default-label-string \ref@{@} のラベル補完でラベル未設定のものに自動的に生成する ラベル名の書式。strftime(3)関数に似た日付ベースで指定する。 diff -r 130c104fe22e -r e37af485338a docs/yatexref.eng --- a/docs/yatexref.eng Mon May 14 19:59:12 2012 +0900 +++ b/docs/yatexref.eng Sun Jul 12 14:21:20 2015 +0900 @@ -47,15 +47,16 @@ [Process invoking] + *invoke latex [prefix] tj + *invoke latex (on region) [prefix] tr + *on-the-fly preview environment [prefix] te *invoke bibtex [prefix] tb - *invoke latex [prefix] tj *invoke makeindex [prefix] ti *kill current typesetting process [prefix] tk ** *lpr dvi-file [prefix] tl *lpr dvi-file (all pages) C-u [prefix] tl *invoke previewer [prefix] tp *invoke lpq [prefix] tq - *invoke jlatex (on region) [prefix] tr Hitting [prefix] t will get you the menu, so there is no need to remember the key after [prefix] t. @@ -71,7 +72,7 @@ *To the typeset error [prefix] ' Will jump to the position where the typeset error occurred from the - end. Only effective when there was a error returned from latex. + end. Only effective when there was a error returned from typesetter. *Jump to corresponding object [prefix] g *Jump to corresponding object (in another her window) [prefix] 4g @@ -84,6 +85,7 @@ -on a \include(only) or \input to the matching file -on a \ref or \label to the matching \label or \ref -on a \cite or \bibitem to the matching \bibitem or \cite + -other to the matching line in previewer *Jump to the main file [prefix] ^ *Jump to the main file in another window [prefix] 4^ @@ -153,6 +155,7 @@ enumerate, list and description environments. *Browse included structure [prefix] d + *Force re-highlight font-lock [prefix] u HIROSE Yuuji yuuji@yatex.org diff -r 130c104fe22e -r e37af485338a help/YATEXHLP.eng --- a/help/YATEXHLP.eng Mon May 14 19:59:12 2012 +0900 +++ b/help/YATEXHLP.eng Sun Jul 12 14:21:20 2015 +0900 @@ -1722,8 +1722,9 @@ \end{figure*} includegraphics -\usepackage{graphicx} ... \includegraphics[Options]{graphicfile.eps} +\usepackage[DRIVER]{graphicx} ... \includegraphics[Options]{graphicfile.eps} Include graphics$B!#(BRequires `graphicx' package. +Typical [DRIVER] is [dvipdfmx]. Possible [Options] are as follows. scale=X width=W @@ -1735,6 +1736,36 @@ viewport=llx lly urx ury (Rerative to BoundingBox) trim=left bottom right top +[Example] +% Preamble +\usepackage[dvipdfmx]{graphicx} +% document body +\begin{figure}[h]\centering + \includegraphics[width=0.4\columnwidth,bb=0 0 400 300]{foo.jpg} + \caption{foo image}\label{foo-fig} +\end{figure} +Figure \ref{foo-fig} says that foo is foo. +% YaTeX automatically inserts `bb=' line when you input \includegraphics{} +% with completion. + +wrapfigure +\begin{wrapfigure}[LINES]{POS}[OVH]{WIDTH} ...Images... \end{wrapfigure} +LINES(Optional) Number of narrow lines +POS One of `r l i o' (Right, Left, Inside, Outside) + R L I O for float +OVH(Optional) Overhangs for margin +WIDTH Width of figure + +[Example] +% Preamble +\usepackage{wrapfig} +% body of document +\begin{wrapfigure}{r}{4cm} + \includegraphics[width=3cm,bb=0 0 640 480,clip]{foo.jpg} + \caption{foo image}\label{foo-jpg} +\end{wrapfigure} + + abstract \begin{abstract} ... \end{abstract} Output abstract diff -r 130c104fe22e -r e37af485338a help/YATEXHLP.jp --- a/help/YATEXHLP.jp Mon May 14 19:59:12 2012 +0900 +++ b/help/YATEXHLP.jp Sun Jul 12 14:21:20 2015 +0900 @@ -1738,8 +1738,9 @@ \end{figure*} includegraphics -\usepackage{graphicx} ... \includegraphics[オプション]{graphicfile.eps} +\usepackage[ドライバ]{graphicx} ... \includegraphics[オプション]{IMG.eps} 画像を取り込む。要 graphicx パッケージ。 +「ドライバ」は dvipdfmx 等。 「オプション」は以下のものが指定可能。 scale=拡大率 width=幅 @@ -1751,6 +1752,34 @@ viewport=llx lly urx ury (BoundingBox内の相対的座標で切り取る) trim=left bottom right top (指定した幅を切り取る) +【使用例】 +% プリアンブル +\usepackage[dvipdfmx]{graphicx} +% 本文 +\begin{figure}[h]\centering + \includegraphics[width=0.4\columnwidth,bb=0 0 400 300]{hoge.jpg} + \caption{hogeの仕組}\label{hoge-fig} +\end{figure} +図\ref{hoge-fig}にあるとおり、ほげはほげなのだ。 +% \includegraphics{} を補完入力するとbb=行はyatexが勝手に調べて入れる。 + +wrapfigure +\begin{wrapfigure}[LINES]{POS}[OVH]{WIDTH} ...画像... \end{wrapfigure} +LINES(省略可) 回り込みする行数(デフォルトは画像の高さ分) +POS r l i o のどれか(右、左、見開き内側、外側) + 大文字 R L I O は画像フロート +OVH(省略可) 画像の張り出しマージン(\wrapoverhang 通常0) +WIDTH 回り込みする(画像込みの)幅 + +【使用例】 +% プリアンブル +\usepackage{wrapfig} +% 本文 +\begin{wrapfigure}{r}{4cm} + \includegraphics[width=3cm,bb=0 0 640 480,clip]{hoge.jpg} + \caption{ほげほげ}\label{hoge-jpg} +\end{wrapfigure} + abstract \begin{abstract} ... \end{abstract} 抄録(アブストラクト)を出力する。 diff -r 130c104fe22e -r e37af485338a install --- a/install Mon May 14 19:59:12 2012 +0900 +++ b/install Sun Jul 12 14:21:20 2015 +0900 @@ -3,59 +3,32 @@ Installation of YaTeX / 野鳥のインストール ****************************************** -Put these expressions into your ~/.emacs -まず ~/.emacsに下の2項目を加えます。 - - (setq auto-mode-alist - (cons (cons "\\.tex$" 'yatex-mode) auto-mode-alist)) - (autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t) - -Then, add certain path name where you put files of YaTeX to your -load-path. If you want to put them in `~/src/emacs', write -次に野鳥の emacs-lisp ファイル群を置くディレクトリを load-path に加えます。 -たとえば、`~/src/emacs/yatex'に置くのであれば、 - - (setq load-path (cons (expand-file-name "~/src/emacs/yatex") load-path)) - -in your ~/.emacs. -などとします。 - -Then edit makefile and set your environment variable `DISPLAY' correctly, -exec the next. -続いて makefile を編集し、環境変数 DISPLAY の値を正しくセットしてから +First, take a look at makefile to confirm or modify EMACS= and PREFIX= +lines and exec the next command. +このディレクトリにある makefile の EMACS= と PREFIX= の行を確認し、 +必要なら修正した後に以下のコマンドを起動してください。 % make install + (or "sudo make install") -でインストールを行ってください。 +Then, type `make show-init' on the shell in this directory as below +and ou will get elisp expressions. Add the expressions to your ~/.emacs. +続いて以下のようにコマンドを起動し、得られた結果出力を ~/.emacs +に足してください。 - If `make install' fails, do as follows; - もし `make install' でうまく行かない時は下記のように手動でインストール -を行ってください。 + % make show-init -First, copy `*.el' to suitable directory. -最初に、野鳥の emacs-lisp ファイル群を適当なディレクトリにコピーします。 +After copying output from make command to your ~/.emacs, you will be able to +use yatex-mode for *.tex files. +以上で、初期設定は終わりです。 -Then copy `help/YATEXHLP.eng' to $EMACS/etc directory, which is -displayed by typin `exec-directory C-j' in the *scratch* buffer -(on Emacs19, $exec-directory/../../site-lisp). -つぎに、help/YATEXHLP.jp を Emacs の etc ディレクトリに入れます。 -(*scratch* バッファで「exec-directory C-j」とうって示されるところです - Emacs19以降の場合 doc-directory の ../../site-lisp) +Without installing to default-dir, you can use yatex by adding the elisp +obtained by below to ~/.emacs. +インストールしなくても以下のコマンド出力を ~/.emacs に追加すれば +普通に使えます。 -Finally, copy `docs/yatexe' and `docs/yahtmle' to Info directory and -append the contents of `dir' in this directory to `dir' of Info directory. -最後に、info ディレクトリに docs/yatexj, docs/yatexe, docs/yahtmlj, -docs/yahtmle をコピーし、info ディレクトリの dir というファイルにこのディ -レクトリの dir ファイルの中身を追加します。 - -Note that when you byte-compile yatex19.el, do it on window system. -This file cannot be compiled on terminal Emacs because it requires -hilit19.el, which cannot be loaded on terminal Emacs. But you don't -have to byte-compile it. -注意: yatex19.el をバイトコンパイルする時はウィンドウシステム上の emacs -で行って下さい。emacs -nw では、hilit19.el がロードできず、正常にコンパ -イルできません。うまくいかない場合はバイトコンパイルしなくて構いません。 + % make show-init2 About yahtml / yahtmlについて diff -r 130c104fe22e -r e37af485338a makefile --- a/makefile Mon May 14 19:59:12 2012 +0900 +++ b/makefile Sun Jul 12 14:21:20 2015 +0900 @@ -3,13 +3,13 @@ # # Edit these variables to be suitable for your site -PREFIX = /usr/local +EMACS = emacs +#EMACS = mule +PREFIX = `${EMACS} -batch --eval '(princ (expand-file-name "../../../.." data-directory))'` +# PREFIX = /usr/local -## mule2 -#EMACS = mule #EMACSDIR= ${PREFIX}/lib/${EMACS} ## emacs20 or later -EMACS = emacs EMACSDIR= ${PREFIX}/share/${EMACS} ## XEmacs #EMACS = xemacs @@ -17,7 +17,7 @@ ## Meadow (Sample) #EMACS = meadow #EMACSDIR = c:/usr/local/meadow -## CarbonEmacs on Darwin (Sample) +## Cocoa(or Carbon)Emacs on Darwin (Sample) #EMACS = /Applications/Emacs.app/Contents/MacOS/Emacs #PREFIX = /Applications/Emacs.app/Contents/Resources #EMACSDIR = ${PREFIX} @@ -25,8 +25,8 @@ LISPDIR = ${EMACSDIR}/site-lisp/yatex # LISPDIR = ${EMACSDIR}/site-packages/lisp/yatex DOCDIR = ${LISPDIR}/docs -HELPDIR = ${EMACSDIR}/site-lisp -INFODIR = ${PREFIX}/info +HELPDIR = ${LISPDIR}/help +INFODIR = ${PREFIX}/share/info TAR = tar INSTALL = install -c -m 444 @@ -41,7 +41,6 @@ # Do not edit below ################### # make install to install YaTeX into public space -# make install-nw same as above, but -nw mode, or Emacs18(Nemacs) # make ajimi to feel taste # make ajimi-nw same as above, but -nw mode # make package to create package for relase @@ -49,8 +48,8 @@ # make clean to delete all producted files # make ci to check in all # make co to check out all -MVER = 1.76 -LISP = ${LISP18} ${LISP19} +MVER = 1.78 +LISP = ${LISP18} ${LISP19} ${LISP23} YAHTML = yahtml.el COMMON = yatexlib.el yatexprc.el LISP18 = comment.el yatex.el yatexadd.el yatexgen.el yatexenv.el \ @@ -58,6 +57,7 @@ yatexmth.el yatexhks.el yatexhlp.el \ yatexm-o.el yatexsec.el yatexhie.el yatexpkg.el ${YAHTML} LISP19 = yatex19.el +LISP23 = yatex23.el DOCS = ${DOCSRC} ${DOCOBJ} ${NEWS} NEWS = yatex.new DOCHTML = docs/htmlqa docs/htmlqa.eng docs/yahtmlj.tex docs/yahtmle.tex @@ -75,18 +75,18 @@ YAHTMLDIST = ${YAHTMLLISP} install 00readme makefile newpage.rb PACK = `ls ${DISTRIB}` TMPDIR = /tmp -VERSION = `head yatex.el|awk '/rev\./{print $$4}'` +VERSION = `head -20 yatex.el|awk -F'"' '/revision/{print $$2}'` PACKDIR = ${TMPDIR}/yatex${VERSION} all: @echo "Edit this makefile first." - @echo 'Type "make install" to install YaTeX.' - @echo 'Type "make install-yahtml" to install yahtml.' - @echo 'If you cling to elc files. type "make elc" before make install' + @echo 'Type "${MAKE} install" to install YaTeX.' + @echo 'Type "${MAKE} install-yahtml" to install yahtml.' + @echo 'If you love elc files, type "${MAKE} elc" before ${MAKE} install' # @echo "If you don't use X-clinet of Emacs," # @echo 'type "make install-nw" instead.' -install: install-real +install: install-real install-message #install-yahtml: bytecompile-yahtml install-yahtml: [ -d ${LISPDIR} ] || mkdir ${LISPDIR} @@ -97,9 +97,10 @@ ${INSTALL} *.el* ${LISPDIR} install-real: - if [ ! -d ${LISPDIR} ]; then ${MKDIR} ${LISPDIR}; fi - if [ ! -d ${DOCDIR} ]; then ${MKDIR} ${DOCDIR}; fi - if [ ! -d ${INFODIR} ]; then ${MKDIR} ${INFODIR}; fi + [ -d ${LISPDIR} ] || ${MKDIR} ${LISPDIR} + [ -d ${HELPDIR} ] || ${MKDIR} ${HELPDIR} + [ -d ${DOCDIR} ] || ${MKDIR} ${DOCDIR} + [ -d ${INFODIR} ] || ${MKDIR} ${INFODIR} for f in *.el; do \ rm -f ${LISPDIR}/$${f}c; \ done @@ -107,10 +108,24 @@ ${INSTALL} ${DOCSRC} ${DOCDIR} ${INSTALL} ${DOCOBJ} ${INFODIR} ${INSTALL} ${HELP} ${HELPDIR} + +install-message: @echo "--------------------------------" - @echo "If you have install-info command, type 'make install-info'." + @echo "If you have install-info command, type '${MAKE} install-info'." @echo "If not, add next lines into your site's info dir manually." @cat dir + @echo "--------------------------------" + @echo "=== INSTALLATION DONE ===" + @echo " You might need to add these expression below to your ~/.emacs" + @echo " エーホサ. ~/.emacs ナ、ヒーハイシ、トノイテ、ケ、ノャヘラ、ャ、「、、ォ、筅キ、、゙、サ、." + @echo + @echo ";;; ------ Startup definitions for YaTeX ------ ;;;" + @${MAKE} show-init + @echo ";;; ------------------------------------------- ;;;" + @echo + @echo " To get elisp above again, call ${MAKE} command as below." + @echo " セ蠏ュelisp、コニナルニタ、、ヒ、マーハイシ、ホ、隍ヲ、ヒ${MAKE}、オッニー、キ、ニ、ッ、タ、オ、、." + @echo " % ${MAKE} $${PREFIX:+PREFIX=$$PREFIX }show-init" install-info: for f in ${DOCOBJ}; do \ @@ -119,6 +134,31 @@ --section=Emacs $${f} ${INFODIR}/dir; \ done +show-init: + @printf '%s\n' \ + '(setq auto-mode-alist' \ + " (cons (cons \"\\.tex$$\" 'yatex-mode) auto-mode-alist))" \ + "(autoload 'yatex-mode \"yatex\" \"Yet Another LaTeX mode\" t)" \ + "(add-to-list 'load-path \"${LISPDIR}\")" \ + "(setq YaTeX-help-file \"${LISPDIR}/help/YATEXHLP.eng\")" + @printf '(setq tex-command "%s")\n' \ + `CMDS='platex pdflatex ptex2pdf lualatex' DFLT=latex \ + ${MAKE} -s search-cmd` + @printf '(setq dvi2-command "%s")\n' \ + `CMDS='pxdvi xdvik kxdvi dviout texworks' DFLT=xdvi \ + ${MAKE} -s search-cmd` + @printf '(setq tex-pdfview-command "%s")\n' \ + `CMDS='evince mupdf xpdf kpdf texworks sumatrapdf' \ + DFLT=acroread \ + ${MAKE} -s search-cmd` + +show-init2: + @${MAKE} LISPDIR=$$PWD show-init + +search-cmd: + @for f in $$CMDS; do \ + type $$f >/dev/null 2>&1 && echo $$f && exit 0; done; echo $$DFLT + install-nw: bytecompile-nw install-real elc: bytecompile diff -r 130c104fe22e -r e37af485338a manifest --- a/manifest Mon May 14 19:59:12 2012 +0900 +++ b/manifest Sun Jul 12 14:21:20 2015 +0900 @@ -25,6 +25,7 @@ yatex.el 野鳥・主 Emacs-Lisp ファイル yatex.new 各バージョンの変更履歴 yatex19.el Emacs-19(Mule2)用の設定 +yatex23.el Emacs-23以降用の設定 yatexadd.el 付加関数の定義例 yatexenv.el LaTeX 環境依存の関数 yatexgen.el 野鳥用付加関数自動作成モード diff -r 130c104fe22e -r e37af485338a yahtml.el --- a/yahtml.el Mon May 14 19:59:12 2012 +0900 +++ b/yahtml.el Sun Jul 12 14:21:20 2015 +0900 @@ -1,11 +1,13 @@ -;;; -*- Emacs-Lisp -*- -;;; (c) 1994-2012 by HIROSE Yuuji [yuuji(@)yatex.org] -;;; Last modified Thu May 10 11:06:39 2012 on firestorm +;;; yahtml.el --- Yet Another HTML mode -*- coding: sjis -*- +;;; (c) 1994-2015 by HIROSE Yuuji [yuuji(@)yatex.org] +;;; Last modified Wed Feb 11 12:17:03 2015 on firestorm ;;; $Id$ -(defconst yahtml-revision-number "1.76" +(defconst yahtml-revision-number "1.78.1" "Revision number of running yahtml.el") +;;; Commentary: + ;;;[Installation] ;;; ;;; First, you have to install YaTeX and make sure it works fine. Then @@ -176,6 +178,7 @@ ;;; (というかほとんどやってもらった ^^;) ;;; +;;; Code: (require 'yatexlib) ;;; --- customizable variable starts here --- @@ -283,6 +286,10 @@ "*Non-nil means editing HTML 4.01 Strict. Completing read for obsoleted attributes disabled.") +(defvar yahtml-electric-indent-mode -1 + "*(Emacs 24.4+) Pass this value to electric-indent-local-mode. +-1 means `off'.") + ;;; --- customizable variable ends here --- (defvar yahtml-prefix-map nil) (defvar yahtml-mode-map nil "Keymap used in yahtml-mode.") @@ -341,8 +348,8 @@ (YaTeX-define-key "l" 'yahtml-insert-tag map) (YaTeX-define-key "L" 'yahtml-insert-tag-region map) (YaTeX-define-key "m" 'yahtml-insert-single map) - (YaTeX-define-key "n" '(lambda () (interactive) (insert (if yahtml-prefer-upcases "
" "
"))) map) - (YaTeX-define-key "-" '(lambda () (interactive) (insert (if yahtml-prefer-upcases "
" "
") "\n")) map) + (YaTeX-define-key "n" (function(lambda () (interactive) (insert (if yahtml-prefer-upcases "
" "
")))) map) + (YaTeX-define-key "-" (function(lambda () (interactive) (insert (if yahtml-prefer-upcases "
" "
") "\n"))) map) (YaTeX-define-key "p" 'yahtml-insert-p map) (if YaTeX-no-begend-shortcut (progn @@ -434,6 +441,7 @@ ("h1") ("h2") ("h3") ("h4") ("h5") ("h6") ;; ("p") ;This makes indentation screwed up! ("style") ("script") ("noscript") ("div") ("object") ("ins") ("del") + ("option") )) (if yahtml-html4-strict @@ -657,14 +665,22 @@ (font-lock-mode 1) ;;Why should I fontify again??? ;; in yatex-mode, there's no need to refontify... (font-lock-fontify-buffer))))) + ;; +dnd for X11 w/ emacs23+ + (and window-system (featurep 'dnd) + (set (make-local-variable 'dnd-protocol-alist) + (cons (cons "^\\(file\\|https?\\):" 'yahtml-dnd-handler) + dnd-protocol-alist))) + (set-syntax-table yahtml-syntax-table) (use-local-map yahtml-mode-map) (YaTeX-read-user-completion-table) (yahtml-css-scan-styles) - (turn-on-auto-fill) ;Sorry, this is prerequisite + ;(turn-on-auto-fill) ;Sorry, this is prerequisite (and (= 0 (buffer-size)) (file-exists-p yahtml-template-file) (y-or-n-p (format "Insert %s?" yahtml-template-file)) (insert-file-contents (expand-file-name yahtml-template-file))) + (if (fboundp 'electric-indent-local-mode) + (electric-indent-local-mode yahtml-electric-indent-mode)) (run-hooks 'text-mode-hook 'yahtml-mode-hook) ;; This warning should be removed after a while(2000/12/2) @@ -808,18 +824,20 @@ (cons "typeface" yahtml-menu-map-typeface))))) (if (featurep 'xemacs) (add-hook 'yahtml-mode-hook - '(lambda () + (function + (lambda () (or (assoc "yahtml" current-menubar) (progn (set-buffer-menubar (copy-sequence current-menubar)) - (add-submenu nil yahtml-menu-map)))))))) + (add-submenu nil yahtml-menu-map))))))))) ;;; ----------- Completion ---------- (defvar yahtml-last-begend "html") (defun yahtml-insert-begend (&optional region env) "Insert ... ." (interactive "P") - (setq yahtml-current-completion-type 'multiline) + (setq yahtml-current-completion-type 'multiline + region (or region (YaTeX-region-active-p))) (let*((completion-ignore-case t) (cmd (or env @@ -883,14 +901,16 @@ (save-excursion (insert (format "" form)))) (if (search-backward "\"\"" p t) (forward-char 1)))) -(defun yahtml-read-css (alist) +(defun yahtml-read-css (alist &optional element) (let ((completion-ignore-case t) (delim " ") - (minibuffer-completion-table alist)) - (read-from-minibuffer - (substitute-command-keys - (if YaTeX-japan - "クラス(複数指定は\\[quoted-insert] SPCで区切る): " - "class(or class list delimited by \\[quoted-insert] SPC): ")) + (minibuffer-completion-table alist) + (quotekey (substitute-command-keys "\\[quoted-insert]"))) + (read-from-minibuffer-with-history + (if YaTeX-japan + (format "%sクラス(複数指定は%s SPCで区切る): " + (if element (concat element "の") "") quotekey) + (format "class%s(multiple class can be delimited by %s SPC): " + (if element (concat " for " element) "") quotekey)) nil YaTeX-minibuffer-completion-map nil))) (defvar yahtml-newpage-command "newpage.rb" @@ -918,11 +938,11 @@ (let ((addin (concat "yahtml:" (downcase form))) s a) (concat (and (setq a (yahtml-css-get-element-completion-alist form)) - (not (equal last-command-char ?\C-j)) + (not (equal (YaTeX-last-key) ?\C-j)) (memq yahtml-current-completion-type '(multiline inline)) (not (string-match "#" form)) (yahtml-make-optional-argument ;should be made generic? - "class" (yahtml-read-css a))) + "class" (yahtml-read-css a form))) (if (and (intern-soft addin) (fboundp (intern-soft addin)) (stringp (setq s (funcall (intern addin)))) (string< "" s)) @@ -1007,7 +1027,7 @@ (with-output-to-temp-buffer "*Completions*" (princ "Possible completinos are:\n") (princ - (mapconcat '(lambda (x) x) (funcall listfunc) "\n"))) + (mapconcat (function(lambda (x) x)) (funcall listfunc) "\n"))) (delete-region (point) beg) (insert cmpl))) ((null cmpl) @@ -1113,12 +1133,13 @@ (setq yahtml-completing-buffer (current-buffer) yahtml-urls (append yahtml-urls-private yahtml-urls-local) href (yahtml-escape-chars-string - (read-from-minibuffer "href: " "" yahtml-url-completion-map))) + (read-from-minibuffer-with-history + "href: " "" yahtml-url-completion-map))) (prog1 (concat (yahtml-make-optional-argument "href" href) (yahtml-make-optional-argument - "name" (read-string "name: "))) + "name" (read-string-with-history "name: "))) (if (and (string-match "^http://" href) (null (assoc href yahtml-urls-private)) (null (assoc href yahtml-urls-local))) @@ -1167,13 +1188,14 @@ ((eq alist 'command) (if (fboundp 'read-shell-command) (read-shell-command prompt) - (read-string prompt))) + (read-string-with-history prompt))) ((and alist (symbolp alist)) - (completing-read prompt (symbol-value alist) nil nil default)) + (completing-read-with-history + prompt (symbol-value alist) nil nil default)) (alist - (completing-read prompt alist nil nil default)) + (completing-read-with-history prompt alist nil nil default)) (t - (read-string prompt default))))) + (read-string-with-history prompt default))))) (defun yahtml-make-optional-argument (opt arg) "Make optional argument string." @@ -1199,11 +1221,11 @@ (cond (yahtml-html4-strict nil) (t - (let ((b (read-string "bgcolor=")) + (let ((b (read-string-with-history "bgcolor=")) (bg (yahtml-read-parameter "background" "")) - (x (read-string "text color=")) - (l (read-string "link color=")) - (v (read-string "vlink color="))) + (x (read-string-with-history "text color=")) + (l (read-string-with-history "link color=")) + (v (read-string-with-history "vlink color="))) (concat (yahtml-make-optional-argument "bgcolor" b) (yahtml-make-optional-argument "background" bg) @@ -1214,8 +1236,8 @@ (defun yahtml-make-style-parameter (proplist) "Make CSS property definitions in style attribute." (mapconcat - '(lambda (x) (if (and (cdr x) (string< "" (cdr x))) - (format "%s: %s;" (car x) (cdr x)))) + (function (lambda (x) (if (and (cdr x) (string< "" (cdr x))) + (format "%s: %s;" (car x) (cdr x))))) (delq nil proplist) " ")) @@ -1224,7 +1246,7 @@ (let ((src (yahtml-read-parameter "src")) (alg (yahtml-read-parameter "align")) alt - (brd (read-string "border=")) + (brd (read-string-with-history "border=")) (l yahtml-prefer-upcase-attributes) info width height bytes comments) (and (stringp src) (string< "" src) (file-exists-p src) @@ -1382,21 +1404,21 @@ "Add-in function `form' input format" (concat " " (if yahtml-prefer-upcase-attributes "METHOD" "method") "=\"" - (completing-read "Method: " '(("POST") ("GET")) nil t) + (completing-read-with-history "Method: " '(("POST") ("GET")) nil t) "\"" (yahtml-make-optional-argument (if yahtml-prefer-upcase-attributes "ENCTYPE" "enctype") - (completing-read + (completing-read-with-history "Enctype: " '(("application/x-www-form-urlencoded") ("multipart/form-data")))) " " (if yahtml-prefer-upcase-attributes "ACTION" "action") "=\"" - (read-string "Action: ") "\"")) + (read-string-with-history "Action: ") "\"")) (defun yahtml:select () "Add-in function for `select' input format" (setq yahtml-last-single-cmd "option") (concat " " (if yahtml-prefer-upcase-attributes "NAME" "name") "=\"" - (read-string "name: ") "\"")) + (read-string-with-history "name: ") "\"")) (defun yahtml:ol () "Add-in function for
    " @@ -1427,7 +1449,7 @@ "Add-in function for `input' form" (let ((size "") name type value checked (maxlength "") (l yahtml-prefer-upcase-attributes)) - (setq name (read-string "name: ") + (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: ")) @@ -1445,9 +1467,9 @@ "Add-in function for `textarea'" (interactive) (let (name rows cols) - (setq name (read-string "Name: ") - cols (read-string "Columns: ") - rows (read-string "Rows: ")) + (setq name (read-string-with-history "Name: ") + cols (read-string-with-history "Columns: ") + rows (read-string-with-history "Rows: ")) (concat (concat (if yahtml-prefer-upcase-attributes "NAME=" "name=") "\"" name "\"") @@ -1456,7 +1478,7 @@ (defun yahtml:table () "Add-in function for `table'" - (let ((b (read-string "border=")) + (let ((b (read-string-with-history "border=")) (a (yahtml-read-parameter "align" nil '(("align" ("right")("center")))))) (if yahtml-html4-strict @@ -1494,13 +1516,13 @@ (defun yahtml:font () "Add-in function for `font'" (concat - (yahtml-make-optional-argument "color" (read-string "color=")) - (yahtml-make-optional-argument "size" (read-string "size=")))) + (yahtml-make-optional-argument "color" (read-string-with-history "color=")) + (yahtml-make-optional-argument "size" (read-string-with-history "size=")))) (defun yahtml:style () "Add-in function for `style'" (yahtml-make-optional-argument - "type" (read-string "type=" "text/css"))) + "type" (read-string-with-history "type=" "text/css"))) (defun yahtml:script () "Add-in function for `script'" @@ -1535,7 +1557,8 @@ "type" (yahtml-read-parameter "type" "text/css")) (progn (setq href - (read-from-minibuffer "href: " "" yahtml-url-completion-map)) + (read-from-minibuffer-with-history + "href: " "" yahtml-url-completion-map)) (if (string< "" href) (progn (if (and (file-exists-p (yahtml-url-to-path href)) @@ -1552,7 +1575,8 @@ "type" (yahtml-read-parameter "type" "text/css")) (yahtml-make-optional-argument "href" - (read-from-minibuffer "href: " "" yahtml-url-completion-map))))))) + (read-from-minibuffer-with-history + "href: " "" yahtml-url-completion-map))))))) (defvar yahtml:meta-names '(("name" ("keywords")("author")("copyright")("date")("GENERATOR")))) @@ -1579,18 +1603,19 @@ "content" (cond ((string-match "date" name) - (read-string "Date: " (current-time-string))) + (read-string-with-history "Date: " (current-time-string))) ((string-match "author" name) - (read-string "Author: " + (read-string-with-history "Author: " (if (and (user-full-name) (string< "" (user-full-name))) (user-full-name) (user-login-name)))) ((string-match "GENERATOR" name) - (setq content (read-string "Generator: " "User-agent: ")) + (setq content (read-string-with-history + "Generator: " "User-agent: ")) (if (string-match "yahtml" content) (message "Thank you!")) content) - (t (read-string (concat name ": "))))))))) + (t (read-string-with-history (concat name ": "))))))))) (defun yahtml:br () (yahtml-make-optional-argument "clear" (yahtml-read-parameter "clear"))) @@ -1635,7 +1660,8 @@ (defun yahtml-insert-tag (region-mode &optional tag) "Insert and put cursor inside of them." (interactive "P") - (setq yahtml-current-completion-type 'inline) + (setq yahtml-current-completion-type 'inline + region-mode (or region-mode (YaTeX-region-active-p))) (or tag (let ((completion-ignore-case t)) (setq tag @@ -1707,7 +1733,8 @@ (while l (setq mess (format "%s %c" mess (car (car l)) (cdr (car l))) l (cdr l))) - (message "Char-entity reference: %s SPC=& RET=&; Other=&#..;" mess) + (message "Char-entity reference: %s SPC=& RET=&; BS=%s Other=&#..;" + mess (if YaTeX-japan "直前の文字" "Preceding-Char")) (setq c (read-char)) (cond ((equal c (car-safe (assoc c list))) @@ -1717,7 +1744,11 @@ (forward-char -1)) ((equal c ? ) (insert ?&)) - (t (insert (format "&#%d;" c)))))) + ((and (memq c '(127 8)) + (setq c (preceding-char)) + (delete-backward-char 1) + nil)) ;Fall through to the next 't block + (t (insert (format "&#x%x;" c)))))) (defun yahtml:!--\#include () (let ((file (yahtml-read-parameter "file" ""))) @@ -2121,7 +2152,7 @@ (if (and (equal attr "class") ;treat "class" attribute specially (setq css (yahtml-css-get-element-completion-alist tag))) - (setq new (yahtml-read-css css)) + (setq new (yahtml-read-css css tag)) ;;other than "class", read parameter normally (setq new (yahtml-read-parameter attr))) (goto-char (car (get 'yahtml-on-assignment-p 'region))) @@ -2358,7 +2389,8 @@ (let ((e (cond ((null e) "td") ((stringp e) e) - (t (read-string "Enclose with(`thd' means th td td..): " "th")))) + (t (read-string-with-history + "Enclose with(`thd' means th td td..): " "th")))) (ws "[ \t]") elm p i) (if (string= delim "") (setq delim " \t\n")) @@ -2390,8 +2422,8 @@ "Enclose lines in a form tab-sv/csv with ..." (interactive "P\nsDelimiter(s): \nr") (setq e (if (and e (listp e)) - (read-string "Enclose with(td or th, `thd' -> th td td td...: " - "th"))) + (read-string-with-history + "Enclose with(td or th, `thd' -> th td td td...: " "th"))) (save-excursion (save-restriction (narrow-to-region (point) (mark)) @@ -2477,17 +2509,62 @@ (match-beginning 0)))) (fset 'move-to-column yahtml-saved-move-to-column))))) -;(defun yahtml-indent-new-commnet-line () -; (unwind-protect -; (progn -; (fset 'move-to-column 'yahtml-move-to-column) -; (apply 'YaTeX-saved-indent-new-comment-line (if soft (list soft)))) -; (fset 'move-to-column yahtml-saved-move-to-column))) +;;; +;;; ---------- move forward/backward field ---------- +;;; +(defun yahtml-element-path () + "Return the element path from at point as a list" + (let (path elm) + (save-excursion + (while (and (YaTeX-beginning-of-environment) + (looking-at (concat "<\\(" yahtml-command-regexp "\\)\\>")) + (not (string= (setq elm (downcase (YaTeX-match-string 1))) + "body"))) + (setq path (cons elm path) + elm nil)) + (and elm (setq path (cons elm path))) + path))) + +(defun yahtml-forward-field (arg) + "Move ARGth forward cell to table element. +ENVINFO is a cons of target element name and its beginning point." + (interactive "p") + (let (inenv elm path sibs) + (cond + ((< arg 0) (yahtml-backward-field (- arg))) + ((= arg 0) nil) + ((and (setq path (nreverse (yahtml-element-path))) + (catch 'sibling + (while path + (if (setq elm (car-safe + (member (car path) '("td" "th" "li" "dt" "dd")))) + (throw 'sibling elm)) + (setq path (cdr path))))) + (setq inenv (YaTeX-in-environment-p elm) + sibs (cdr (assoc elm '(("td" . "td\\|th") + ("th" . "td\\|th") + ("li" . "li") + ("dt" . "dt\\|dd") + ("dd" . "dt\\|dd"))))) + (goto-char (cdr inenv)) + (while (>= (setq arg (1- arg)) 0) + (yahtml-goto-corresponding-begend) + (if (looking-at "<") (forward-list 1)) + (skip-chars-forward "^<")) + (while (looking-at "\\s \\|\\(")) + (forward-list 1)) + )))) + ;;; ;;; ---------- indentation ---------- ;;; -(defun yahtml-indent-line () +(defun yahtml-indent-line-1 () "Indent a line (faster wrapper)" (interactive) (let (indent) @@ -2510,6 +2587,18 @@ (and (bolp) (skip-chars-forward " \t"))) (yahtml-indent-line-real)))) +(defun yahtml-indent-line () + "Indent a line (Second level wrapper). +See also yahtml-indent-line-1 and yahtml-indent-line-real." + (interactive) + (let ((cc (current-column)) (p (point))) + (yahtml-indent-line-1) + (and (= cc (current-column)) + (= p (point)) + (equal last-command 'yahtml-indent-line) + (yahtml-forward-field 1)))) + + (defun yahtml-this-indent () (let ((envs "[uod]l\\|table\\|[ht][rhd0-6]\\|select\\|blockquote\\|center\\|menu\\|dir\\|d[td]\\|li") (itemizing-envs "^\\([uod]l\\|menu\\|dir\\|li\\|d[td]\\)$") @@ -2772,7 +2861,7 @@ (defun yahtml-intelligent-newline-select () (interactive) - (insert "<" (if yahtml-prefer-upcases "OPTION" "option") "> ") + (yahtml-insert-single (if yahtml-prefer-upcases "OPTION" "option")) (yahtml-indent-line)) (defun yahtml-intelligent-newline-style () @@ -2792,7 +2881,7 @@ (YaTeX-reindent c)))) (defun yahtml-intelligent-newline-head () - (let ((title (read-string "Document title: ")) + (let ((title (read-string-with-history "Document title: ")) (b "") (e "") p) (yahtml-indent-line) (insert (format "%s" (if yahtml-prefer-upcases (upcase b) b))) @@ -2853,7 +2942,8 @@ (setq line (concat line (if (and (= i 0) th) "" "")) th nil i (1+ i))) - (setq fmt (read-string "`th' or `td' format: " "th td td")) + (setq fmt (read-string-with-history + "`th' or `td' format: " "th td td")) (while (string-match "t\\(h\\)\\|td" fmt i) (setq line (concat line (if (match-beginning 1) "" "")) @@ -2943,7 +3033,8 @@ (skip-chars-forward "^\"")(point))))) (if (file-exists-p f) (setq alist - (append alist (yahtml-css-collect-classes-file f))))) + (append alist (yahtml-css-collect-classes-file + f initial))))) (setq e (point)) (goto-char b) (while (re-search-forward ;ちょといい加減なREGEXP @@ -3118,6 +3209,33 @@ (font-lock-mode -1) ;is stupid, but sure. (font-lock-mode 1)) +;;; +;; Drag-n-Drop +;;; +(defun yahtml-dnd-handler (uri action) + "DnD handler for yahtml mode +Convert image URI to img-src and others to a-href." + (let*((file (dnd-get-local-file-name uri)) + (path (if file (file-relative-name file) uri)) + (case-fold-search t) + (geom "")) + (cond + ((memq action '(copy link move private)) + (cond + ((string-match "\\.\\(jpe?g\\|png\\|gif\\|bmp\\|tiff?\\)$" path) + (if file + (setq geom (yahtml-get-image-info path) + geom (if (car geom) + (apply 'format " width=\"%s\" height=\"%s\"" geom) + ""))) + (insert (format "\"%s\"%s" + path (file-name-nondirectory path) geom))) + + (t (insert (format "" path)) + (forward-char -4)))) + (t (message "No handler for action `%s'" action)))) + action) + (run-hooks 'yahtml-load-hook) (provide 'yahtml) diff -r 130c104fe22e -r e37af485338a yatex.el --- a/yatex.el Mon May 14 19:59:12 2012 +0900 +++ b/yatex.el Sun Jul 12 14:21:20 2015 +0900 @@ -1,15 +1,14 @@ -;;; -*- Emacs-Lisp -*- -;;; Yet Another tex-mode for emacs - //野鳥// -;;; yatex.el rev. 1.76 -;;; (c)1991-2012 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Sat May 12 14:53:03 2012 on firestorm +;;; yatex.el --- Yet Another tex-mode for emacs //野鳥// -*- coding: sjis -*- +;;; (c)1991-2015 by HIROSE Yuuji.[yuuji@yatex.org] +;;; Last modified Wed Jul 8 13:41:17 2015 on duke ;;; $Id$ ;;; The latest version of this software is always available at; ;;; http://www.yatex.org/ +;;; Code: (require 'comment) (require 'yatexlib) -(defconst YaTeX-revision-number "1.76" +(defconst YaTeX-revision-number "1.78.9" "Revision number of running yatex.el") ;---------- Local variables ---------- @@ -38,37 +37,62 @@ return to the editing paragraph by calling register-to-point with argument YaTeX-current-position-register.") -;;(defvar YaTeX-tmp-dic-unit 'main-file -;; "*Default switching unit of temporary dictionary. -;;There are two switching unit: -;;'main-file : switch tmp-dic according to main-file directory. -;;'directory : switch tmp-dic dir by dir." -;;) -(defvar YaTeX-use-LaTeX2e t "*Use LaTeX2e or not. Nil meas latex 2.09") +(defvar YaTeX-use-LaTeX2e t "*Use LaTeX2e or not. Nil means latex 2.09") (defvar tex-command (cond (YaTeX-use-LaTeX2e "platex") (YaTeX-japan "jlatex") (t "latex")) - "*Default command for typesetting LaTeX text.") + "*Default command for typesetting LaTeX text. +Overridden with `%#! CommandLine...' in the buffer.") (defvar bibtex-command (if YaTeX-japan "jbibtex" "bibtex") - "*Default command of BibTeX.") + "*Default command of BibTeX. +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") "*Default previewer command including its option. -This default value is for X window system.") +Overridden with `%#PREVIEW CommandLine...' in the buffer.") + +(defvar YaTeX-cmd-gimp "gimp") +(defvar YaTeX-cmd-tgif "tgif") +(defvar YaTeX-cmd-inkscape "inkscape") +(defvar YaTeX-cmd-dia "dia") +(defvar YaTeX-cmd-ooo "soffice") +(defvar YaTeX-cmd-gs "gs") +(defvar YaTeX-cmd-dvips + (if (YaTeX-executable-find "pdvips") "pdvips" "dvips")) +(defvar YaTeX-cmd-displayline + "/Applications/Skim.app/Contents/SharedSupport/displayline") +(defvar YaTeX-cmd-edit-ps YaTeX-cmd-gimp) +(defvar YaTeX-cmd-edit-pdf YaTeX-cmd-ooo) +(defvar YaTeX-cmd-edit-ai YaTeX-cmd-inkscape) +(defvar YaTeX-cmd-edit-svg YaTeX-cmd-inkscape) +(defvar YaTeX-cmd-edit-images YaTeX-cmd-gimp) +(defvar YaTeX-cmd-view-images "display -geometry +0+0") + +(defvar tex-pdfview-command ;previewer command for your site + (cond + (YaTeX-dos "acroread") + (YaTeX-macos (cond + ((file-executable-p YaTeX-cmd-displayline) "open -a Skim") + (t "open"))) + (t "evince")) + "*Default PDF viewer command including its option. +Overridden with `%#PDFVIEW CommandLine...' in the buffer.") (defvar makeindex-command (if YaTeX-dos "makeind" "makeindex") - "*Default makeindex command.") + "*Default makeindex command. +Overridden with `%#MAKEINDEX CommandLine...' in the buffer.") (defvar dviprint-command-format (if YaTeX-dos "dviprt %s %f%t" "dvi2ps %f %t %s | lpr") "*Command line string to print out current file. +Overridden with `%#LPR CommandLine...' in the buffer. Format string %s will be replaced by the filename. Do not forget to specify the `from usage' and `to usage' with their option by format string %f and %t. @@ -84,10 +108,11 @@ (defvar YaTeX-dvipdf-command "dvipdfmx" - "*Command name to convert dvi file to PDF.") + "*Command name to convert dvi file to PDF. +Overridden with `%#DVIPDF CommandLine...' in the buffer.") (defvar YaTeX-default-document-style - (concat (if YaTeX-japan "j") "article") + (concat (if YaTeX-japan "js") "article") "*Default LaTeX Documentstyle for YaTeX-typeset-region.") (defvar YaTeX-need-nonstop nil @@ -157,6 +182,7 @@ "*Regexp of verb family. Do not contain preceding \\\\ nor \\(\\).") (defvar YaTeX-fill-inhibit-environments (append '("tabular" "tabular*" "array" "picture" "eqnarray" "eqnarray*" + "longtable" "equation" "equation*" "math" "displaymath") YaTeX-verbatim-environments) "*In these environments, YaTeX inhibits fill-paragraph from formatting. @@ -171,6 +197,7 @@ (defvar YaTeX-array-env-regexp (concat "array\\*?\\|eqnarray\\*?\\|tabbing\\|tabular\\*?\\|" ;LaTeX + "longtable\\|" ;LaTeX2e "matrix\\|pmatrix\\|bmatrix\\|vmatrix\\|Vmatrix\\|" ;AMS-LaTeX "align\\*?\\|split\\*?\\|aligned\\*?\\|alignat\\*?\\|" ;AMS-LaTeX "[bpvV]?matrix\\|smallmatrix\\|cases\\|" ;AMS-LaTeX @@ -188,7 +215,7 @@ (defvar YaTeX-auto-math-mode t "*T for changing YaTeX-math mode automatically.") -(defvar YaTeX-use-AMS-LaTeX nil +(defvar YaTeX-use-AMS-LaTeX t "*T for using AMS-LaTeX") (defvar yatex-mode-hook nil @@ -210,6 +237,10 @@ (defvar YaTeX-tabular-indentation 4 "*Indentation column-depth of continueing line in tabular environment.") +(defvar YaTeX-electric-indent-mode -1 + "*(for Emacs 24.4+) Pass this value to electric-indent-local-mode. +-1 means `off'.") + ;;-- Math mode values -- (defvar YaTeX-math-key-list-default @@ -266,7 +297,8 @@ ("widetilde") ("widehat") ("overline") ("overrightarrow") ;; section types in mathmode ("frac" 2) ("sqrt") ("mathrm") ("mathbf") ("mathit") - + ;;cleveref + ("cref") ("crefrange") ("cpageref") ("labelcref") ("labelcpageref") ) (if YaTeX-use-LaTeX2e '(("documentclass") ("usepackage") @@ -326,6 +358,7 @@ ("thebibliography") ("theindex") ("flushleft") ("flushright") ("minipage") ("supertabular") + ("wrapfigure") ("wraptable") ) (if YaTeX-use-LaTeX2e '(("comment") ;defined in version @@ -368,7 +401,7 @@ (defvar singlecmd-table (append - '(("maketitle") ("makeindex") ("sloppy") ("protect") ("par") + '(("maketitle") ("makeindex") ("sloppy") ("protect") ("par") ("and") ("LaTeX") ("TeX") ("item") ("item[]") ("appendix") ("hline") ("kill") ;;("rightarrow") ("Rightarrow") ("leftarrow") ("Leftarrow") ("pagebreak") ("nopagebreak") ("tableofcontents") @@ -461,8 +494,8 @@ (YaTeX-define-key "$" 'YaTeX-insert-dollars-region) (YaTeX-define-key "i" 'YaTeX-fill-item) (YaTeX-define-key "\\" - '(lambda () (interactive) - (insert (if (YaTeX-in-math-mode-p) "\\backslash" "\\textbackslash")))) + (function(lambda () (interactive) + (insert (if (YaTeX-in-math-mode-p) "\\backslash" "\\textbackslash"))))) (if YaTeX-no-begend-shortcut (progn (YaTeX-define-key "B" 'YaTeX-make-begin-end-region) @@ -506,12 +539,12 @@ (YaTeX-define-key "d" 'YaTeX-display-hierarchy) (YaTeX-define-key "x" YaTeX-user-extensional-map) (YaTeX-define-key "n" - '(lambda () (interactive) - (insert "\\" (if (YaTeX-on-section-command-p "o?oalign") "crcr" "\\")))) + (function(lambda () (interactive) + (insert "\\" (if (YaTeX-on-section-command-p "o?oalign") "crcr" "\\"))))) (if YaTeX-dos (define-key YaTeX-prefix-map "\C-r" - '(lambda () (interactive) - (YaTeX-set-screen-height YaTeX-saved-screen-height) (recenter))))) + (function(lambda () (interactive) + (YaTeX-set-screen-height YaTeX-saved-screen-height) (recenter)))))) (defvar YaTeX-section-completion-map nil "*Key map used at YaTeX completion in the minibuffer.") @@ -579,6 +612,18 @@ (modify-syntax-entry ?\\ "/" YaTeX-mode-syntax-table) (modify-syntax-entry ?~ " " YaTeX-mode-syntax-table)) +(defvar YaTeX-mode-syntax-table-nonparen nil + "Syntax table for yatex-mode with normal parentheses treated white spaces") +(if YaTeX-mode-syntax-table-nonparen nil + (setq YaTeX-mode-syntax-table-nonparen + (make-syntax-table YaTeX-mode-syntax-table)) + (let ((zenparens "()()「」『』【】[]{}《》〈〉〔〕") (i 0) s) + (while (string-match "." zenparens i) + (setq s (substring zenparens (match-beginning 0) (match-end 0)) + i (1+ i)) + (modify-syntax-entry + (string-to-char s) " " YaTeX-mode-syntax-table-nonparen)))) + ;---------- Provide YaTeX-mode ---------- ;;; ;; Major mode definition @@ -654,22 +699,7 @@ YaTeX-math-mode indent-line-function comment-line-break-function comment-start comment-start-skip )) - (cond ((null YaTeX-kanji-code) - nil) - ((boundp 'MULE) - (set-file-coding-system YaTeX-coding-system)) - ((and YaTeX-emacs-20 (boundp 'buffer-file-coding-system)) - (setq buffer-file-coding-system - (or (and (fboundp 'set-auto-coding) buffer-file-name - (save-excursion - (goto-char (point-min)) - (set-auto-coding buffer-file-name (buffer-size)))) - YaTeX-coding-system))) - ((featurep 'mule) - (set-file-coding-system YaTeX-coding-system)) - ((boundp 'NEMACS) - (make-local-variable 'kanji-fileio-code) - (setq kanji-fileio-code YaTeX-kanji-code))) + (YaTeX-set-file-coding-system YaTeX-kanji-code YaTeX-coding-system) (setq fill-column YaTeX-fill-column fill-prefix YaTeX-fill-prefix paragraph-start YaTeX-paragraph-start @@ -681,6 +711,10 @@ local-abbrev-table yatex-mode-abbrev-table) (if (fboundp 'comment-indent-new-line) ;for Emacs21 (setq comment-line-break-function 'YaTeX-comment-line-break)) + ;; +dnd for X11 w/ emacs23+ + (and window-system (featurep 'dnd) (require 'yatex23 nil t) + (set (make-local-variable 'dnd-protocol-alist) + (cons (cons "^file:" 'YaTeX-dnd-handler) dnd-protocol-alist))) (if (and YaTeX-use-font-lock (featurep 'font-lock)) (progn @@ -697,7 +731,9 @@ (YaTeX-read-user-completion-table) (and (fboundp 'YaTeX-hilit-setup-alist) (YaTeX-hilit-setup-alist)) (makunbound 'inenv) - (turn-on-auto-fill) ;1.63 + ;(turn-on-auto-fill) ;1.63 -> 1.79off + (if (fboundp 'electric-indent-local-mode) + (electric-indent-local-mode YaTeX-electric-indent-mode)) (and (= 0 (buffer-size)) (file-exists-p YaTeX-template-file) (y-or-n-p (format "Insert %s?" YaTeX-template-file)) (insert-file-contents (expand-file-name YaTeX-template-file))) @@ -739,6 +775,7 @@ (autoload 'YaTeX-get-builtin "yatexprc" "Get %# built-in." t) (autoload 'YaTeX-system "yatexprc" "Call system command" t) (autoload 'YaTeX-save-buffers "yatexprc" "Save buffers of same major mode" t) +(autoload 'YaTeX-goto-corresponding-viewer "yatexprc" "Viewer jump line" t) ;;autoload from yatexmth.el (autoload 'YaTeX-math-insert-sequence "yatexmth" "Image input." t) @@ -852,16 +889,18 @@ you can put REGION into that environment between \\begin and \\end." (interactive "P") (let* - ((mode (if arg " region" "")) + ((region-p (or arg (YaTeX-region-active-p))) + (mode (if region-p " region" "")) (env - (YaTeX-read-environment - (format "Begin environment%s(default %s): " mode YaTeX-env-name)))) + (save-excursion ;for Emacs24 work-around to avoid point warp + (YaTeX-read-environment + (format "Begin environment%s(default %s): " mode YaTeX-env-name))))) (if (string= env "") (setq env YaTeX-env-name)) (setq 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 arg))) + (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." @@ -880,7 +919,7 @@ "ref") ((and (looking-at "[a-z \t]") (progn (skip-chars-backward "a-z \t") - (looking-at "table\\|figure\\|formula"))) + (looking-at "table\\|figure\\|formula\\|eq\\(\\.\\|uation\\)"))) "ref") ((save-excursion (skip-chars-backward "[^ア-ン]") @@ -916,7 +955,8 @@ Optional 4th arg CMD is LaTeX command name, for non-interactive use." (interactive "P") (setq YaTeX-current-completion-type 'section) - (if (equal arg '(4)) (setq beg (region-beginning) end (region-end))) + (if (or (equal arg '(4)) (YaTeX-region-active-p)) + (setq beg (region-beginning) end (region-end))) (unwind-protect (let* ((source-window (selected-window)) @@ -957,7 +997,7 @@ (addin-args (funcall arg-reader j)) (YaTeX-skip-default-reader "") (t - (read-string + (read-string-with-history (format "Argument %d of %s: " j section))))) (insert (concat ;to allow nil return value @@ -1016,7 +1056,9 @@ \(key binding for universal-argument is \\[universal-argument]\)" (interactive "P") (YaTeX-sync-local-table 'tmp-fontsize-table) - (let* ((mode (if arg "region" "")) + (let* ((region-p (if (or arg (YaTeX-region-active-p)) + (cons (region-beginning) (region-end)))) + (mode (if region-p "region" "")) (fontsize (or fontsize (YaTeX-read-fontsize @@ -1038,12 +1080,14 @@ (setq fontsize (cdr (assoc YaTeX-fontsize-name LaTeX2e-fontstyle-alist))) (setq YaTeX-fontsize-name fontsize)) - (if arg - (save-excursion - (if (> (point) (mark)) (exchange-point-and-mark)) + (if region-p + (let ((b (car region-p)) + (e (set-marker (make-marker) (cdr region-p)))) + (goto-char b) (insert "{\\" YaTeX-fontsize-name " ") - (exchange-point-and-mark) - (insert "}")) + (goto-char e) + (insert "}") + (set-marker e nil)) (insert (concat "{\\" YaTeX-fontsize-name " }")) (forward-char -1) (if YaTeX-current-position-register @@ -1255,6 +1299,8 @@ (get 'YaTeX-insert-braces 'begend-guide))))))))) env macro not-literal b e) (cond + ((YaTeX-region-active-p) + (YaTeX-insert-braces-region (region-beginning) (region-end))) ((YaTeX-jmode) (YaTeX-self-insert arg)) ((not (YaTeX-closable-p)) (YaTeX-self-insert arg)) ((save-excursion @@ -1364,7 +1410,7 @@ (setplist 'YaTeX-jmode nil)) (defun YaTeX-self-insert (arg) - (call-interactively (global-key-binding (char-to-string last-command-char)))) + (call-interactively (global-key-binding (char-to-string (YaTeX-last-key))))) (defun YaTeX-insert-inherit (&rest args) (apply (if (fboundp 'insert-and-inherit) 'insert-and-inherit 'insert) args)) @@ -1374,6 +1420,8 @@ (interactive "p") (let ((col (1- (current-column)))) (cond + ((YaTeX-region-active-p) + (YaTeX-insert-brackets-region (region-beginning) (region-end))) ((YaTeX-jmode) (YaTeX-self-insert arg)) ((not (YaTeX-closable-p)) (YaTeX-self-insert arg)) @@ -1399,7 +1447,7 @@ ((and (= (preceding-char) ?\\ ) (/= (char-after (- (point) 2)) ?\\ ) (not (YaTeX-in-math-mode-p))) - (YaTeX-insert-inherit last-command-char "\n") + (YaTeX-insert-inherit (YaTeX-last-key) "\n") (indent-to (max 0 col)) (YaTeX-insert-inherit "\\]") (beginning-of-line) @@ -1420,6 +1468,8 @@ "Insert parenthesis pair." (interactive "p") (cond + ((YaTeX-region-active-p) + (YaTeX-insert-parens-region (region-beginning) (region-end))) ((YaTeX-jmode) (YaTeX-self-insert arg)) ((not (YaTeX-closable-p)) (YaTeX-self-insert arg)) ((save-excursion @@ -1507,7 +1557,9 @@ ; (backward-char 1)) (t (YaTeX-self-insert arg)))) -(defvar YaTeX-use-jmode-hook (not (and (fboundp 'skk-mode) (boundp 'skk-mode))) +(defvar YaTeX-use-jmode-hook + (and (featurep 'canna) (boundp 'canna:*initialized*) canna:*initialized*) + ;; (not (and (fboundp 'skk-mode) (boundp 'skk-mode))) "*Non-nil means activate automatic jmode switcher within/out math mode. Hopefully, change default to t in the next version of 1.75.") (defun YaTeX-jmode-hook (old new) @@ -1615,7 +1667,8 @@ (require 'yatexprc) ;for Nemacs's bug (select-window sw) (cond - ((= c ?j) (YaTeX-typeset-buffer)) + ((memq c '(?j ?\C-j)) (YaTeX-typeset-buffer) ; memq for usability test + (put 'dvi2-command 'format 'dvi)) ((= c ?r) (YaTeX-typeset-region)) ((= c ?e) (YaTeX-typeset-environment)) ((= c ?b) (YaTeX-call-builtin-on-file @@ -1624,12 +1677,13 @@ "MAKEINDEX" makeindex-command arg)) ((= c ?k) (YaTeX-kill-typeset-process YaTeX-typeset-process)) ((= c ?p) (call-interactively 'YaTeX-preview)) - ((= c ?q) (YaTeX-system "lpq" "*Printer queue*")) - ((= c ?d) (YaTeX-typeset-buffer YaTeX-dvipdf-command)) + ((= c ?q) (YaTeX-system "lpq" "Printer queue")) + ((= c ?d) (YaTeX-typeset-buffer + (or (YaTeX-get-builtin "DVIPDF") YaTeX-dvipdf-command)) + (put 'dvi2-command 'format 'pdf)) ((= c ?v) (YaTeX-view-error)) ((= c ?l) (YaTeX-lpr arg)) ((= c ?m) (YaTeX-switch-mode-menu arg)) - ((= c ?b) (YaTeX-insert-string "\\")) ((= c ?s) (YaTeX-xdvi-remote-search arg))))) (if (fboundp 'wrap-function-to-control-ime) @@ -1640,20 +1694,23 @@ "Operate %# notation." ;;Do not use interactive"r" for the functions which require no mark (interactive) - (message "!)Edit-%%#! B)EGIN-END-region P)review L)Edit-%%#LPR make(I)ndex B)ibtex") + (message "!)Edit-%%#! D)VIPDF B)EGIN-END P)review pdf(V)iew L)PR M)akeidx b)ibtex dp(I)") (let ((c (or char (read-char))) (string "") key (b (make-marker)) (e (make-marker))) (save-excursion (cond - ((rindex "!plib" c) ;Edit %#xxx + ((rindex "!plmibdv" c) ;Edit %#xxx (setq key (cdr (assq c '((?! . "!") (?p . "PREVIEW") (?l . "LPR") - (?i . "MAKEINDEX") + (?m . "MAKEINDEX") + (?d . "DVIPDF") + (?v . "PDFVIEW") + (?i . "IMAGEDPI") (?b . "BIBTEX"))))) (YaTeX-getset-builtin key t)) - ((= c ?b) ;%#BEGIN %#END region + ((= c ?B) ;%#BEGIN %#END region (or end (setq beg (min (point) (mark)) end (max (point) (mark)))) (set-marker b beg) (set-marker e end) @@ -1668,8 +1725,7 @@ (goto-char e) (insert "%#END\n") (set-marker b nil) - (set-marker e nil)) - )))) + (set-marker e nil)))))) (defvar YaTeX-refcommand-def-regexp-default "label\\|bibitem") @@ -1681,9 +1737,13 @@ YaTeX-refcommand-def-regexp-default)) (defvar YaTeX-refcommand-ref-regexp-default - "\\(page\\|eq\\|fig\\)?ref\\|cite") + "\\(page\\|eq\\|fig\\)?ref\\|cite" + "Regexp of LaTeX's label-referring macros. +Searching for this will be done without `\\\\'. +So you need not add patterns if new referring macro ends with \"ref\".") (defvar YaTeX-refcommand-ref-regexp-private nil - "*Regexp of referring label commands") + "*Regexp of referring label commands. +See documentation of `YaTeX-refcommand-ref-regexp-default'.") (defvar YaTeX-refcommand-ref-regexp (concat (if YaTeX-refcommand-ref-regexp-private (concat YaTeX-refcommand-ref-regexp-private "\\|")) @@ -1902,17 +1962,24 @@ See also the documentation of YaTeX-processed-file-regexp-alist.") (defvar YaTeX-file-processor-alist-default - '(("tgif" . ".obj") - ("gimp" . ".xcf") ("gimp" . ".xcf.gz") ("gimp" . ".xcf.bz2") - ("inkscape" . ".svg") ("inkscape" . ".svgz") ("inkscape" . ".ai") - ("soffice" . ".odg") - ("gimp" . ".jpeg") ("gimp" . ".jpg") ("gimp" . ".png") - ("evince" . ".ps") - ("evince" . ".eps") - ("soffice" . ".pdf") - (t . ".tex") - (t . ".sty") - (t . "")) + (list (cons YaTeX-cmd-tgif ".obj") + (cons YaTeX-cmd-gimp ".xcf") + (cons YaTeX-cmd-gimp ".xcf.gz") + (cons YaTeX-cmd-gimp ".xcf.bz2") + (cons YaTeX-cmd-edit-svg ".svg") + (cons YaTeX-cmd-edit-svg ".svgz") + (cons YaTeX-cmd-edit-ai ".ai") + '("dia" . ".dia") + (cons YaTeX-cmd-ooo ".odg") + (cons YaTeX-cmd-edit-images ".jpeg") + (cons YaTeX-cmd-edit-images ".jpg") + (cons YaTeX-cmd-edit-images ".png") + (cons YaTeX-cmd-edit-ps ".ps") + (cons YaTeX-cmd-edit-ps ".eps") + (cons YaTeX-cmd-edit-pdf ".pdf") + '(t . ".tex") + '(t . ".sty") + '(t . "")) "See the documentation of YaTeX-file-processor-alist.") (defun YaTeX-goto-corresponding-file-processor (&optional other) @@ -1964,9 +2031,8 @@ (let ((default-directory basedir)) (cond ((stringp cmd) - (let ((buf (concat "* " cmd " " src " *"))) - (YaTeX-system (concat cmd " " src) buf) - t)) + (YaTeX-system (concat cmd " " src) cmd) + t) ((eq t cmd) (let ((parent buffer-file-name)) (funcall @@ -2010,9 +2076,14 @@ (goto-char (match-beginning 0)) (throw 'found t)) ;;If inside of parentheses, try to escape. - (while (condition-case err - (progn (up-list -1) t) - (error nil))) + (unwind-protect + (progn + (set-syntax-table YaTeX-mode-syntax-table-nonparen) + (while (and (not (= (preceding-char) ?\])) ;skip optional arg + (condition-case err + (progn (up-list -1) t) + (error nil))))) + (set-syntax-table YaTeX-mode-syntax-table)) (while (equal (preceding-char) ?\]) (backward-list)) ;;(2) search command directly (skip-chars-forward "^{}[]") @@ -2104,7 +2175,7 @@ (concat "\\(" YaTeX-struct-name-regexp "\\)") "" "" "") "\\|\\(" YaTeX-ec-regexp ;;"[][()]\\)" - "[][]\\)" + "[\\]\\[]\\)" ) (point-end-of-line) t))) @@ -2148,6 +2219,7 @@ ;; YaTeX-equation-env-regexp ;to delay loading ;; (or (YaTeX-inner-environment t) "document")) ;; (YaTeX-goto-corresponding-leftright))) + ((YaTeX-goto-corresponding-viewer)) (t (message "I don't know where to go."))))) (defun YaTeX-goto-corresponding-*-other-window (arg) @@ -2168,7 +2240,7 @@ (if (not (YaTeX-on-begin-end-p)) (comment-out-region (if alt-prefix - (read-string "Insert prefix: ") + (read-string-with-history "Insert prefix: ") YaTeX-comment-prefix)) (YaTeX-comment-uncomment-env 'comment-out-region))) @@ -2177,7 +2249,7 @@ (interactive "P") (if (not (YaTeX-on-begin-end-p)) (uncomment-out-region - (if alt-prefix (read-string "Remove prefix: ") + (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))) @@ -2544,7 +2616,8 @@ (progn (setq maketitle (substring (YaTeX-match-string 0) 1)) (setq memberp (YaTeX-math-member-p maketitle)))) - (let ((last-command-char (string-to-char (car memberp)))) + (let*((last-command-char (string-to-char (car memberp))) + (last-command-event last-command-char)) (setq beg (match-beginning 0) end (match-end 0)) (delete-region beg end) (YaTeX-math-insert-sequence t (cdr memberp)))))) @@ -2561,6 +2634,9 @@ ((YaTeX-on-section-command-p YaTeX-command-token-regexp);on any command (YaTeX-kill-section-command (match-beginning 0) arg)) ((YaTeX-kill-paren arg)) + ((and (fboundp 'overlays-at) + (member YaTeX-on-the-fly-overlay (overlays-at (point)))) + (YaTeX-on-the-fly-cancel)) (t (message "I don't know what to kill.")))) (defun YaTeX-change-* () @@ -2637,64 +2713,6 @@ YaTeX-verbatim-environments)))))) (store-match-data md)))) -(defun YaTeX-in-environment-p (env) - "Return if current LaTeX environment is ENV. -ENV is given in the form of environment's name or its list." - (let ((md (match-data)) (nest 0) p envrx) - (cond - ((atom env) - (setq envrx - (concat "\\(" - (regexp-quote - (YaTeX-replace-format-args - YaTeX-struct-begin env "" "")) - "\\)\\|\\(" - (regexp-quote - (YaTeX-replace-format-args - YaTeX-struct-end env "" "")) - "\\)")) - (save-excursion - (setq p (catch 'open - (while (YaTeX-re-search-active-backward - envrx YaTeX-comment-prefix nil t) - (if (match-beginning 2) - (setq nest (1+ nest)) - (setq nest (1- nest))) - (if (< nest 0) - (throw 'open (cons env (match-beginning 0))))))))) - ((listp env) - (setq p - (or (YaTeX-in-environment-p (car env)) - (and (cdr env) (YaTeX-in-environment-p (cdr env))))))) - (store-match-data md) - p;(or p (YaTeX-in-verb-p (match-beginning 0))) - )) - -(defun YaTeX-quick-in-environment-p (env) - "Check quickly but unsure if current environment is ENV. -ENV is given in the form of environment's name or its list. -This function returns correct result only if ENV is NOT nested." - (save-excursion - (let ((md (match-data)) m0 (p (point)) rc clfound) - (cond - ((listp env) - (or (YaTeX-quick-in-environment-p (car env)) - (and (cdr env) (YaTeX-quick-in-environment-p (cdr env))))) - (t - (unwind-protect - (if (prog1 - (YaTeX-search-active-backward - (YaTeX-replace-format-args YaTeX-struct-begin env "" "") - YaTeX-comment-prefix nil t) - (setq m0 (match-beginning 0))) - (if (YaTeX-search-active-forward - (YaTeX-replace-format-args - YaTeX-struct-end env) - YaTeX-comment-prefix p t nil) - nil ;if \end{env} found, return nil - (cons env m0))) ;else, return meaningful values - (store-match-data md))))))) - ;; Filling \item (defun YaTeX-remove-trailing-comment (start end) "Remove trailing comment from START to end." @@ -2984,6 +3002,44 @@ (if (string= c "t") (insert (YaTeX-read-accent-char c))) (forward-char 1)))) +;; Field skip in tabular +(defun YaTeX-forward-field (arg) + "Move forward to the ARGth next column field of table." + (interactive "p") + (if (< arg 0) + (YaTeX-backward-field (- arg)) + (let ((ep (save-excursion (YaTeX-end-of-environment) (point))) + (wc (car (YaTeX-array-what-column-internal)))) + (while (>= (setq arg (1- arg)) 0) + (skip-chars-forward "^&\\\\") + (while (and (not (eobp)) + (> ep (point)) + (looking-at "\\&\\|\\\\") + (= wc (car (YaTeX-array-what-column-internal)))) + (skip-chars-forward "&" ep) + (while (looking-at "[\n\t ]+\\|\\\\\\\\\\|\\\\.line\\>") + (goto-char (match-end 0)) + )))))) + +(defun YaTeX-backward-field (arg) + "Move backward to the ARGth next column field of table." + (interactive "p") + (if (< arg 0) + (YaTeX-forward-field (- arg)) + (let ((bp (save-excursion + (YaTeX-beginning-of-environment) + (point-end-of-line))) + (wc (car (YaTeX-array-what-column-internal)))) + (while (>= (setq arg (1- arg)) 0) + (skip-chars-backward "^&\\\\" bp) + (while (and (not (bobp)) + (< bp (point)) + (memq (preceding-char) '(?& ?\\)) + (= wc (car (YaTeX-array-what-column-internal)))) + (skip-chars-backward "&\\\\" bp) + (skip-chars-backward "\n\t " bp)) + (if (eolp) (skip-chars-forward "^&\\\\")))))) + ;; Indentation (defun YaTeX-current-indentation () "Return the indentation of current environment." @@ -3087,7 +3143,7 @@ ((YaTeX-literal-p) ;verbatims (tab-to-tab-stop)) ((string-match "\\(tabular\\|array\\)" inenv) ;1.73 - (let ((n 1)) + (let ((n 1) (cc (current-column)) (p (point))) (condition-case err (save-excursion (beginning-of-line) @@ -3099,7 +3155,12 @@ (YaTeX-reindent (+ (YaTeX-current-indentation) YaTeX-environment-indent - (* (1- n) YaTeX-tabular-indentation))))) + (* (1- n) YaTeX-tabular-indentation))) + (and (= cc (current-column)) + (= p (point)) + (equal last-command 'YaTeX-indent-line) + ;; if NO indent action occured, move to the next column + (YaTeX-forward-field 1)))) ((and inenv (not (equal "document" inenv))) (funcall indent-relative)) ((YaTeX-on-section-command-p YaTeX-sectioning-regexp) diff -r 130c104fe22e -r e37af485338a yatex.new --- a/yatex.new Mon May 14 19:59:12 2012 +0900 +++ b/yatex.new Sun Jul 12 14:21:20 2015 +0900 @@ -1,6 +1,38 @@ What's new in YaTeX/yahtml 野鳥/yahtml - 各バージョンの変更点について +1.79 別フレームに同一バッファがあるときのミニバッファ入力で、 + ポイント位置がずれるEmacsの問題への対策を入れた。 + === yatex === + 数式環境など特定環境内の [prefix] t e で On-the-fly preview 発動。 + 環境に対する On-the-fly preview は編集中持続する。 + 持続中の On-the-fly preview の無効化は何もない場所で [prefix] k。 + YaTeX-help-file のデフォルト位置を site-lisp/yatex/help/ に変更。 + 領域活性時に呼び出す補完は領域括りになるようにした。 + タイプセットでPDF出力がありそうなときは次回previewをPDFヴューアに。 + === yahtml === + 領域活性時に呼び出す補完は領域括りになるようにした。 + ... + + +1.78 Drag&Dropサポートを追加。 + tabular環境内で2連続以上Tabで、1カラム進む機能を追加。 + === yatex === + 主な外部コマンド名を変数化。 + [prefix] t d の直後のデフォルトヴューアはPDF用のものに。 + 「%#!コマンド -オプション」のときは親ファイル指定なしと判定。 + 地の段落での [prefix] t g でヴューアの forward-search を試みる。 + [prefix] t e の環境タイプセットの結果を可能なら画像に。 + [prefix] t e を環境外で呼んだ場合はパラグラフをタイプセット。 + [prefix] t e を領域活性状態で呼んだらその領域をタイプセット。 + === yahtml === + table, ul, ol, dl 内で2連続以上Tabで、1カラム進む機能を追加。 + +1.77 last-command-char 廃止対策を追加。 + === yatex === + %#DVIPDF でdviからpdfへの変換コマンドを指定可能に。 + PDFヴューアに xpdf, pdfopen, mupdf, zathura, okular を追加。 + 1.76 === yatex === タイプセットでラベル未定義があったら自動的にrerunする。 自動rerun無効化は YaTeX-typeset-auto-rerun を nil に。 @@ -18,7 +50,7 @@ M-C-SPC で環境だけでなく数式環境もマークする。 [prefix] t d でタイプセッタ起動成功のあと dvipdfmx を起動。 \label{}でラベル名を入れたときは \ref{NAME} を自動的にkill-ringに追加。 - [prefix] t c で\label{NAME} の NAME を変えたら \ref のNAMEも変える。 + [prefix] c で\label{NAME} の NAME を変えたら \ref のNAMEも変える。 同上のことを \cite/\bibitem にも。 \bibitem{}を入れたときは \cite{TAG} を自動的にkill-ringに追加。 \end 補完のお節介検査の精度を少し上げた。 diff -r 130c104fe22e -r e37af485338a yatex19.el --- a/yatex19.el Mon May 14 19:59:12 2012 +0900 +++ b/yatex19.el Sun Jul 12 14:21:20 2015 +0900 @@ -1,9 +1,9 @@ -;;; -*- Emacs-Lisp -*- -;;; YaTeX facilities for Emacs 19 or later -;;; (c)1994-2012 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Sun Jan 29 23:00:52 2012 on firestorm +;;; yatex19.el -- YaTeX facilities for Emacs 19 or later -*- coding: sjis -*- +;;; (c)1994-2015 by HIROSE Yuuji.[yuuji@yatex.org] +;;; Last modified Fri Jan 16 15:03:58 2015 on firestorm ;;; $Id$ +;;; Code: ;(require 'yatex) (and (boundp 'YaTeX-use-hilit19) @@ -15,10 +15,10 @@ (defvar YaTeX-background-mode (or (if (fboundp 'get-frame-background-mode) (get-frame-background-mode (selected-frame))) + (if (boundp 'frame-background-mode) + frame-background-mode) (if (fboundp 'frame-parameters) (cdr (assq 'background-mode (frame-parameters)))) - (if (boundp 'frame-background-mode) - frame-background-mode) (if (boundp 'hilit-background-mode) hilit-background-mode) (if (face-background 'default) @@ -54,11 +54,11 @@ (list (if YaTeX-auto-math-mode nil (cons 'math (cons "Toggle math-mode" - '(lambda () (interactive) - (YaTeX-switch-mode-menu nil ?t))))) + (function(lambda () (interactive) + (YaTeX-switch-mode-menu nil ?t)))))) (cons 'mod (cons "Toggle Modify Mode" - '(lambda () (interactive) - (YaTeX-switch-mode-menu nil ?m)))))))) + (function(lambda () (interactive) + (YaTeX-switch-mode-menu nil ?m))))))))) (defvar YaTeX-mode-menu-map-percent (make-sparse-keymap "percent")) (YaTeX-define-menu 'YaTeX-mode-menu-map-percent @@ -227,11 +227,12 @@ (and (featurep 'xemacs) (add-hook 'yatex-mode-hook - '(lambda () + (function + (lambda () (or (assoc "YaTeX" current-menubar) (progn (set-buffer-menubar (copy-sequence current-menubar)) - (add-submenu nil YaTeX-mode-menu-map)))))) + (add-submenu nil YaTeX-mode-menu-map))))))) ;; Other key bindings for window-system ;(YaTeX-define-key [?\C- ] 'YaTeX-do-completion) @@ -483,6 +484,14 @@ (defun YaTeX-19-create-face (sym fgcolor &optional bgcolor) "Create face named SYM with face of FGCOLOR/BGCOLOR." + (if (consp fgcolor) + (setq fgcolor (if (eq YaTeX-background-mode 'light) + (car fgcolor) + (cdr fgcolor)))) + (if (consp bgcolor) + (setq bgcolor (if (eq YaTeX-background-mode 'light) + (car bgcolor) + (cdr bgcolor)))) (cond ((and YaTeX-use-font-lock (fboundp 'defface)) (custom-declare-face @@ -631,7 +640,8 @@ (if single (list single 0 'macro)))))))))) ;;2006/6/23 new face, `delimiter' introduced -(YaTeX-19-create-face 'delimiter "saddlebrown" "ivory") +(YaTeX-19-create-face + 'delimiter '("saddlebrown" . "lightyellow") '("ivory". "navy")) ;;(YaTeX-19-collect-macros) ;causes an error (defun YaTeX-hilit-setup-alist () diff -r 130c104fe22e -r e37af485338a yatex23.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yatex23.el Sun Jul 12 14:21:20 2015 +0900 @@ -0,0 +1,113 @@ +;;; yatex23.el --- YaTeX facilities for Emacs 23 or later -*- coding: sjis -*- +;;; (c)2014-2015 by HIROSE Yuuji.[yuuji@yatex.org] +;;; Last modified Sun Jan 18 21:12:27 2015 on firestorm +;;; $Id$ + +;;; Code: +(defvar YaTeX-dnd-auto-figure "figure" + "*If set, include dropped \\includegraphcs{} into that environment. +The value should be string. Set this `nil' to disable enclosing.") +(defvar YaTeX-dnd-auto-figure-package + (cons "graphicx" + (cond ((string-match "pdflatex" tex-command) "pdftex") + (t "dvipdfmx"))) + "*Default LaTeX package and its option for \\includegraphics") + +(defun YaTeX-dnd-handler (uri action) + "DnD handler for yatex-mode +Convert local image URI to \\includegraphcis{} and +.tex file names to \\include{}." + (let*((file (dnd-get-local-file-name uri t)) + (path (save-excursion + (YaTeX-visit-main t) + (file-relative-name file))) + (insert-file-directory nil) + (case-fold-search t) + (b nil) p1 p2 (cc (current-column)) envstart) + (cond + ((memq action '(copy link move private)) + (cond + ((string-match "\\.\\(jpe?g\\|png\\|gif\\|bmp\\|tiff?\\|e?ps\\|pdf\\)$" path) + (if (and (stringp YaTeX-dnd-auto-figure) + (not (YaTeX-in-environment-p YaTeX-dnd-auto-figure)) + (not (string-match "figure" + (or (YaTeX-inner-environment t) "body"))) + YaTeX-dnd-auto-figure) + (setq b (format "\\begin{%s}[htbp] %%\\centering\n" + YaTeX-dnd-auto-figure))) + (unwind-protect + (progn + (setq envstart (point-marker)) + (insert "\\includegraphics") + (insert "{" (YaTeX::includegraphics 1 path t) "}") + (save-excursion + (YaTeX-package-auto-usepackage + "includegraphics" 'section + (car YaTeX-dnd-auto-figure-package) + (cdr YaTeX-dnd-auto-figure-package))) + (cond + (b + (undo-boundary) + (save-excursion + (goto-char envstart) + (insert b)) + (YaTeX-indent-line) + (insert "\n") + (indent-to (1+ cc)) + (setq p1 (point)) + (insert "\\caption{") + (setq p2 (point)) + (insert (format "}\\label{%s}\n" path)) + (indent-to cc) + (insert (format "\\end{%s}\n" YaTeX-dnd-auto-figure)) + (goto-char p2) + (undo-boundary) + (insert (file-name-nondirectory path)) + (undo-boundary) + (goto-char p1) + (insert "%") + (end-of-line) + (or (get 'YaTeX-dnd-auto-figure 'guide) + (progn + (newline 1) + (indent-to (1+ cc)) + (insert (format + (if YaTeX-japan + "%% Undo(%s)するとcaptionが活きます。2度押しで空欄 3度押しで無環境" + "%% TYPE undo(%s) to ACTIVATE caption. Twice to clear caption. 3 to no-env") + (key-description + (car (where-is-internal 'undo))))) + (put 'YaTeX-dnd-auto-figure 'guide t))))) + (YaTeX-help "includegraphics")) + (set-marker envstart nil) ;;sure to reset marker + action)) + ((string-match "\\(.*\\)\\.tex$" path) + (insert "\\include{" (match-string 1 path) "}")) + ((string-match "\\(.*\\)\\.bib$" path) + (insert "\\bibliography{" (match-string 1 path) "}")) + ((string-match "\\.ind$" path) + (insert "\\input{" path "}")))) + (t (message "%s" action))))) + +(defvar YaTeX-on-the-fly-bg-face '("#f0f0c0" . "#706868") + "Background color of on-the-fly preview image activated environment.") +(defvar YaTeX-on-the-fly-overlay nil + "Overlay of on-the-fly preview image") +(defface YaTeX-on-the-fly-activated-face + (list + (list (list '(class color) '(min-colors 65536)) + (list ':background + (if (eq YaTeX-background-mode 'light) + (car YaTeX-on-the-fly-bg-face) + (cdr YaTeX-on-the-fly-bg-face)))) + (list t (list ':bold t))) + "Face of on-the-fly preview image mode") + +(provide 'yatex23) + +; Local variables: +; fill-prefix: ";;; " +; paragraph-start: "^$\\| \\|;;;$" +; paragraph-separate: "^$\\| \\|;;;$" +; coding: sjis +; End: diff -r 130c104fe22e -r e37af485338a yatexadd.el --- a/yatexadd.el Mon May 14 19:59:12 2012 +0900 +++ b/yatexadd.el Sun Jul 12 14:21:20 2015 +0900 @@ -1,10 +1,9 @@ -;;; -*- Emacs-Lisp -*- -;;; YaTeX add-in functions. -;;; yatexadd.el rev.20 -;;; (c)1991-2012 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Fri Mar 9 21:19:09 2012 on firestorm +;;; yatexadd.el --- YaTeX add-in functions -*- coding: sjis -*- +;;; (c)1991-2015 by HIROSE Yuuji.[yuuji@yatex.org] +;;; Last modified Wed Jul 8 09:15:15 2015 on firestorm ;;; $Id$ +;;; Code: ;;; ;;Sample functions for LaTeX environment. ;;; @@ -24,10 +23,11 @@ YaTeX-make-begin-end." (let ((width "") bars (rule "") (and "") (j 1) loc ans (hline "\\hline")) (if (string= YaTeX-env-name "tabular*") - (setq width (concat "{" (read-string "Width: ") "}"))) + (setq width (concat "{" (YaTeX:read-length "Width: ") "}"))) (setq loc (YaTeX:read-position "tb") bars (string-to-int - (read-string "Number of columns(0 for default format): " "3"))) + (YaTeX-read-string-or-skip + "Number of columns(0 for default format): " "3"))) (if (<= bars 0) (setq ;if 0, simple format rule YaTeX:tabular-default-rule @@ -41,7 +41,7 @@ (setq ans (read-char)) (cond ((or (equal ans ?t) (equal ans ?T)) - (setq ans (read-string "Rule width: " "1pt") + (setq ans (read-string-with-history "Rule width: " "1pt") rule (concat "@{" (format YaTeX:tabular-thick-vrule ans) "}" rule @@ -50,7 +50,7 @@ (t (setq rule (concat "|" rule "|") hline "\\hline")))) - (setq rule (read-string "rule format: " rule)) + (setq rule (YaTeX-read-string-or-skip "rule format: " rule)) (setq YaTeX-single-command "hline") (format "%s%s{%s}" width loc rule))) @@ -58,10 +58,10 @@ (fset 'YaTeX:tabular* 'YaTeX:tabular) (fset 'YaTeX:supertabular 'YaTeX:tabular) (defun YaTeX:alignat () - (concat "{" (read-string "Number of columns: ") "}")) + (concat "{" (read-string-with-history "Number of columns: ") "}")) (defun YaTeX:array () (concat (YaTeX:read-position "tb") - "{" (read-string "Column format: ") "}")) + "{" (read-string-with-history "Column format: ") "}")) (defun YaTeX:subequations () (message (if YaTeX-japan "分かりやすいコメントに変えるとref補完が楽よ" "Changing comment string reduces effort at `ref' completion")) @@ -99,6 +99,15 @@ (let ((pos (YaTeX:read-oneof oneof))) (if (string= pos "") "" (concat "[" pos "]")))) +(defun YaTeX:read-length (prompt) + "Read a LaTeX dimensional parameter with magnifying numerics prepend." + (let ((minibuffer-local-completion-map YaTeX-minibuffer-completion-map) + (delim "-0-9*+/.") + (tbl (append YaTeX:style-parameters-local + YaTeX:style-parameters-private + YaTeX:style-parameters-default))) + (YaTeX-completing-read-or-skip prompt tbl nil))) + ;;; ;; Functions for figure environemnt ;;; @@ -160,32 +169,38 @@ (if (fboundp 'YaTeX-toggle-math-mode) (YaTeX-toggle-math-mode t))) ;force math-mode ON. -(mapcar '(lambda (f) (fset f 'YaTeX:equation)) +(mapcar (function (lambda (f) (fset f 'YaTeX:equation))) '(YaTeX:eqnarray YaTeX:eqnarray* YaTeX:align YaTeX:align* YaTeX:split YaTeX:multline YaTeX:multline* YaTeX:gather YaTeX:gather* YaTeX:aligned* YaTeX:gathered YaTeX:gathered* YaTeX:alignat YaTeX:alignat* YaTeX:xalignat YaTeX:xalignat* YaTeX:xxalignat YaTeX:xxalignat*)) -(defun YaTeX:alignat () - (YaTeX:equation) - (concat "{" (read-string "Number of cols: ") "}")) - - - (defun YaTeX:list () "%\n{} %default label\n{} %formatting parameter") (defun YaTeX:minipage () (concat (YaTeX:read-position "cbt") - "{" (read-string "Width: ") "}")) + "{" (YaTeX:read-length "Width: ") "}")) (defun YaTeX:thebibliography () (setq YaTeX-section-name "bibitem") - (concat "{" (read-string "Longest label: ") "}")) + (concat "{" (read-string-with-history "Longest label: ") "}")) (defun YaTeX:multicols () - (concat "{" (read-string "Number of columns: ") "}")) + (concat "{" (read-string-with-history "Number of columns: ") "}")) + + +;; wrapfig.sty +(defun YaTeX:wrapfigure () + (YaTeX-help "wrapfigure") + (concat + (let ((lines (YaTeX-read-string-or-skip "Wrap Lines(Optional): "))) + (if (string< "" lines) + (concat "[" lines "]"))) + "{" (YaTeX:read-oneof "rlioRLIO" t) "}" + "{" (YaTeX:read-length "Image width: ") "}")) + ;;; ;;Sample functions for section-type command. @@ -193,7 +208,7 @@ (defun YaTeX:multiput () (concat (YaTeX:read-coordinates "Pos") (YaTeX:read-coordinates "Step") - "{" (read-string "How many times: ") "}")) + "{" (read-string-with-history "How many times: ") "}")) (defun YaTeX:put () (YaTeX:read-coordinates "Pos")) @@ -204,7 +219,7 @@ (concat (YaTeX:read-coordinates "Dimension") (YaTeX:read-position "lsrtb"))) (t - (let ((width (read-string "Width: "))) + (let ((width (YaTeX:read-length "Width: "))) (if (string< "" width) (progn (or (equal (aref width 0) ?\[) @@ -221,17 +236,17 @@ (YaTeX:read-position "tbc")) (defun YaTeX::parbox (argp) (cond - ((= argp 1) (read-string "Width: ")) - ((= argp 2) (read-string "Text: ")))) + ((= argp 1) (YaTeX:read-length "Width: ")) + ((= argp 2) (YaTeX-read-string-or-skip "Text: ")))) (defun YaTeX::dashbox () - (concat "{" (read-string "Dash dimension: ") "}" + (concat "{" (read-string-with-history "Dash dimension: ") "}" (YaTeX:read-coordinates "Dimension"))) (defun YaTeX::savebox (argp) (cond - ((= argp 1) (read-string "Saved into name: " "\\")) - ((= argp 2) (read-string "Text: ")))) + ((= argp 1) (read-string-with-history "Saved into name: " "\\")) + ((= argp 2) (YaTeX-read-string-or-skip "Text: ")))) (defvar YaTeX-minibuffer-quick-map nil) (if YaTeX-minibuffer-quick-map nil @@ -280,13 +295,15 @@ (defun YaTeX:read-coordinates (&optional mes varX varY) (concat "(" - (read-string (format "%s %s: " (or mes "Dimension") (or varX "X"))) + (read-string-with-history + (format "%s %s: " (or mes "Dimension") (or varX "X"))) "," - (read-string (format "%s %s: " (or mes "Dimension") (or varY "Y"))) + (read-string-with-history + (format "%s %s: " (or mes "Dimension") (or varY "Y"))) ")")) (defun YaTeX:itembox () - (concat "{" (read-string "Item heading string: ") "}")) + (concat "{" (YaTeX-read-string-or-skip "Item heading string: ") "}")) ;;; ;;Sample functions for maketitle-type command. @@ -301,9 +318,9 @@ (defun YaTeX:lim () "Insert limit notation of \\lim." (YaTeX:check-completion-type 'maketitle) - (let ((var (read-string "Variable: ")) limit) + (let ((var (read-string-with-history "Variable: ")) limit) (if (string= "" var) "" - (setq limit (read-string "Limit ($ means infinity): ")) + (setq limit (read-string-with-history "Limit ($ means infinity): ")) (if (string= "$" limit) (setq limit "\\infty")) (concat "_{" var " \\rightarrow " limit "}")))) @@ -314,15 +331,16 @@ (defun YaTeX:read-boundary (ULchar) "Read boundary usage by _ or ^. _ or ^ is indicated by argument ULchar." - (let ((bndry (read-string (concat ULchar "{???} ($ for infinity): ")))) + (let ((bndry (read-string-with-history + (concat ULchar "{???} ($ for infinity): ")))) (if (string= bndry "") "" (if (string= bndry "$") (setq bndry "\\infty")) (concat ULchar "{" bndry "}")))) (defun YaTeX:verb () "Enclose \\verb's contents with the same characters." - (let ((quote-char (read-string "Quoting char: " "|")) - (contents (read-string "Quoted contents: "))) + (let ((quote-char (read-string-with-history "Quoting char: " "|")) + (contents (YaTeX-read-string-or-skip "Quoted contents: "))) (concat quote-char contents quote-char))) (fset 'YaTeX:verb* 'YaTeX:verb) @@ -332,12 +350,12 @@ nil) (defun YaTeX:cite () - (let ((comment (read-string "Comment for citation: "))) + (let ((comment (YaTeX-read-string-or-skip "Comment for citation: "))) (if (string= comment "") "" (concat "[" comment "]")))) (defun YaTeX:bibitem () - (let ((label (read-string "Citation label for bibitem: "))) + (let ((label (YaTeX-read-string-or-skip "Citation label for bibitem: "))) (if (string= label "") "" (concat "[" label "]")))) @@ -432,7 +450,7 @@ (defun YaTeX::label-search-tag () (interactive) (let ((case-fold-search t) - (tag (regexp-quote (char-to-string last-command-char)))) + (tag (regexp-quote (char-to-string (YaTeX-last-key))))) (cond ((save-excursion (forward-char 1) @@ -588,7 +606,7 @@ (let ((default (condition-case nil (YaTeX::ref-default-label) (error (substring (current-time-string) 4))))) - (read-string "Give a label for this line: " + (YaTeX-read-string-or-skip "Give a label for this line: " (if YaTeX-emacs-19 (cons default 1) default)))) (defun YaTeX::ref-getset-label (buffer point &optional noset) @@ -1235,7 +1253,7 @@ (let*((chmode (boundp (intern-soft "old"))) (dlab (if chmode old ;if called via YaTeX-change-section (tricky...) (YaTeX::ref-default-label))) - (label (read-string + (label (read-string-with-history (format "New %s name: " (or labname "label")) (cons dlab 1)))) (if (string< "" label) @@ -1248,6 +1266,7 @@ (fset 'YaTeX::pageref 'YaTeX::ref) +(fset 'YaTeX::cref 'YaTeX::ref) (defun YaTeX::tabref (argp) ; For the style file of IPSJ journal (YaTeX::ref argp nil nil @@ -1378,7 +1397,7 @@ (hilit-auto-highlight nil) (pcnt (regexp-quote YaTeX-comment-prefix)) (bibrx (concat YaTeX-ec-regexp "bibliography{\\([^}]+\\)}")) - (bibptn (read-string "Pattern: ")) + (bibptn (YaTeX-read-string-or-skip "Pattern: ")) (bbuf (get-buffer-create " *bibitems*")) (standard-output bbuf) (me 'YaTeX::cite) ;shuld set this for using YaTeX::ref @@ -1485,13 +1504,14 @@ (defun YaTeX::newcommand (&optional argp) (cond ((= argp 1) - (let ((command (read-string "Define newcommand: " "\\"))) + (let ((command (read-string-with-history "Define newcommand: " "\\"))) (put 'YaTeX::newcommand 'command (substring command 1)) command)) ((= argp 2) (let ((argc - (string-to-int (read-string "Number of arguments(Default 0): "))) - (def (read-string "Definition: ")) + (string-to-int + (read-string-with-history "Number of arguments(Default 0): "))) + (def (YaTeX-read-string-or-skip "Definition: ")) (command (get 'YaTeX::newcommand 'command))) ;;!!! It's illegal to insert string in the add-in function !!! (if (> argc 0) (insert (format "[%d]" argc))) @@ -1518,7 +1538,7 @@ (defun YaTeX::newcounter (&optional argp) (cond ((= argp 1) - (read-string "New counter name: ")) + (read-string-with-history "New counter name: ")) (t ""))) ;; @@ -1575,6 +1595,7 @@ ("\\tabcolsep") ("\\textheight") ("\\textwidth") + ("\\columnwidth") ("\\topmargin") ("\\topsep") ("\\topskip") @@ -1600,7 +1621,7 @@ nil nil "\\") ) ((equal 2 argp) - (read-string-with-history "Length: " nil 'YaTeX:length-history)))) + (YaTeX-read-string-or-skip "Length: " nil 'YaTeX:length-history)))) (fset 'YaTeX::addtolength 'YaTeX::setlength) @@ -1615,13 +1636,13 @@ 'YaTeX:style-parameters-local nil nil "\\")) ((equal 2 argp) - (read-string "Text: ")))) + (YaTeX-read-string-or-skip "Text: ")))) (defun YaTeX::newlength (&optional argp) "YaTeX add-in function for arguments of \\newlength" (cond ((equal argp 1) - (let ((length (read-string "Length variable: " "\\"))) + (let ((length (read-string-with-history "Length variable: " "\\"))) (if (string< "" length) (YaTeX-update-table (list length) @@ -1635,11 +1656,11 @@ "YaTeX add-in function for arguments of \\multicolumn." (cond ((equal 1 argp) - (read-string "Number of columns: ")) + (read-string-with-history "Number of columns: ")) ((equal 2 argp) (YaTeX:read-oneof "|lrc" nil t)) ((equal 3 argp) - (read-string "Item: ")))) + (YaTeX-read-string-or-skip "Item: ")))) (defvar YaTeX:documentstyles-default '(("article") ("jarticle") ("j-article") @@ -1708,7 +1729,9 @@ (save-excursion (YaTeX-visit-main t) (let*((insert-default-directory) - (file (read-file-name (or prompt "Input file: ") ""))) + (default (and (boundp 'old) (stringp old) old)) + (file (read-file-name (or prompt "Input file: ") "" + default nil default))) (setq file (substring file 0 (string-match "\\.tex$" file)))))))) (fset 'YaTeX::input 'YaTeX::include) @@ -1784,12 +1807,12 @@ YaTeX-default-documentclass sname))))) (defun YaTeX::title (&optional argp) - (prog1 (read-string "Document Title: ") + (prog1 (YaTeX-read-string-or-skip "Document Title: ") (setq YaTeX-section-name "author" YaTeX-single-command "maketitle"))) (defun YaTeX::author (&optional argp) - (prog1 (read-string "Document Author: ") + (prog1 (YaTeX-read-string-or-skip "Document Author: ") (setq YaTeX-section-name "date" YaTeX-single-command "maketitle"))) @@ -1843,7 +1866,7 @@ "Add-in for \\color's argument" (cond ((= argp 1) (YaTeX::color-completing-read "Color: ")) - ((= argp 2) (read-string "Colored string: ")))) + ((= argp 2) (YaTeX-read-string-or-skip "Colored string: ")))) (fset 'YaTeX:color 'YaTeX:textcolor) (fset 'YaTeX::color 'YaTeX::textcolor) @@ -1857,14 +1880,13 @@ (cond ((= argp 1) (YaTeX::color-completing-read "Frame color: ")) ((= argp 2) (YaTeX::color-completing-read "Inner color: ")) - ((= argp 3) (read-string "Colored string: ")))) + ((= argp 3) (YaTeX-read-string-or-skip "Colored string: ")))) (defun YaTeX:scalebox () "Add-in for \\scalebox" - (let ((vmag (read-string - (if YaTeX-japan "倍率(負で反転): " + (let ((vmag (YaTeX-read-string-or-skip (if YaTeX-japan "倍率(負で反転): " "Magnification(Negative for flipped): "))) - (hmag (read-string (if YaTeX-japan "縦倍率(省略可): " + (hmag (YaTeX-read-string-or-skip (if YaTeX-japan "縦倍率(省略可): " "Vertical magnification(Optional): ")))) (if (and hmag (string< "" hmag)) (format "{%s}[%s]" vmag hmag) @@ -1879,9 +1901,11 @@ (if (string< "" (setq r (YaTeX:read-oneof "htbpB"))) (concat "[origin=" r "]"))) ((memq c '(?X ?x ?Y ?y)) - (setq r (read-string "" (if YaTeX-emacs-19 (cons defx 3) defx)) + (setq r (read-string-with-history + "" (if YaTeX-emacs-19 (cons defx 3) defx)) x (if (string< "x=" r) r) - r (read-string "" (if YaTeX-emacs-19 (cons defy 3) defy)) + r (read-string-with-history + "" (if YaTeX-emacs-19 (cons defy 3) defy)) y (if (string< "y=" r) r) something (or x y)) (format "%s%s%s%s%s" @@ -1895,16 +1919,16 @@ "Argument add-in for \\rotatebox" (cond ((= argp 1) - (read-string (if YaTeX-japan "回転角(度; 左回り): " + (read-string-with-history (if YaTeX-japan "回転角(度; 左回り): " "Angle in degree(unclockwise): "))) ((= argp 2) - (read-string (if YaTeX-japan "テキスト: " "Text: "))))) + (YaTeX-read-string-or-skip (if YaTeX-japan "テキスト: " "Text: "))))) (defun YaTeX:includegraphics () "Add-in for \\includegraphics's option" (let (width height (scale "") angle str) - (setq width (YaTeX-read-string-or-skip "Width: ") - height (YaTeX-read-string-or-skip "Height: ")) + (setq width (YaTeX:read-length "Width: ") + height (YaTeX:read-length "Height: ")) (or (string< "" width) (string< "" height) (setq scale (YaTeX-read-string-or-skip "Scale: "))) (setq angle (YaTeX-read-string-or-skip "Angle(0-359): ")) @@ -1912,28 +1936,59 @@ (mapconcat 'concat (delq nil - (mapcar '(lambda (s) + (mapcar (function (lambda (s) (and (stringp (symbol-value s)) (string< "" (symbol-value s)) - (format "%s=%s" s (symbol-value s)))) + (format "%s=%s" s (symbol-value s))))) '(width height scale angle))) ",")) (if (string= "" str) "" (concat "[" str "]")))) -(defun YaTeX::includegraphics (argp) +(defvar YaTeX::get-boundingbox-cmd YaTeX-cmd-gs + "Command to get bounding box from PDF files. +Possible values are `gs' and `extractbb'.") + +(defun YaTeX::get-boundingbox (file) + "Return the bound box as a string +This function relies on gs(ghostscript) command installed." + (let ((str (YaTeX-command-to-string + (format + (cond + ((string-match "extractbb" YaTeX::get-boundingbox-cmd) + "%s -O %s") + ((string-match "gs" YaTeX::get-boundingbox-cmd) + "%s -sDEVICE=bbox -dBATCH -dNOPAUSE %s") + (t "echo %s %s")) + YaTeX::get-boundingbox-cmd file)))) + (if (string-match + "%%BoundingBox:\\s \\([0-9]+\\s [0-9]+\\s [0-9]+\\s [0-9]+\\)" + str) + (substring str (match-beginning 1) (match-end 1))))) + +(defun YaTeX::includegraphics (argp &optional file doclip) "Add-in for \\includegraphics" - (let ((imgfile (YaTeX::include argp "Image File: ")) + (let*((imgfile (or file (YaTeX::include argp "Image File: "))) + (imgfilepath + (save-excursion + (YaTeX-visit-main t) + (expand-file-name imgfile default-directory))) (case-fold-search t) info bb noupdate needclose c) - (and (string-match "\\.\\(jpe?g\\|png\\|gif\\|bmp\\)$" imgfile) - (file-exists-p imgfile) + (and (string-match "\\.\\(jpe?g\\|png\\|gif\\|bmp\\|pdf\\)$" imgfile) + (file-exists-p imgfilepath) (or (fboundp 'yahtml-get-image-info) (progn (load "yahtml" t) (featurep 'yahtml))) ;(require 'yahtml nil t) - (setq info (yahtml-get-image-info imgfile)) - (car info) ;if has width value - (car (cdr info)) ;if has height value - (setq bb (format "bb=%d %d %d %d" 0 0 (car info) (car (cdr info)))) + (if (string-match "\\.pdf" imgfile) + (and + (setq info (YaTeX::get-boundingbox imgfilepath)) + (stringp info) + (string< "" info) + (setq bb (format "bb=%s" info))) + (setq info (yahtml-get-image-info imgfilepath)) + (car info) ;if has width value + (car (cdr info)) ;if has height value + (setq bb (format "bb=%d %d %d %d" 0 0 (car info) (car (cdr info))))) (save-excursion (cond ((and (save-excursion @@ -1947,17 +2002,25 @@ (replace-match bb)) (noupdate nil) ((and (match-beginning 1) - (prog2 - (message "Insert `%s'? Y)es N)o C)yes+`clip': " bb) - (memq (setq c (read-char)) '(?y ?Y ?\ ?c ?C)) - (message ""))) + (or doclip + (prog2 + (message "Insert `%s'? Y)es N)o C)yes+`clip': " bb) + (memq (setq c (read-char)) '(?y ?Y ?\ ?c ?C)) + (setq doclip (memq c '(?c ?C))) + (message "")))) (goto-char (match-end 0)) - (message "") + (message "`bb=' %s" + (format + (if YaTeX-japan + "の値はファイル名の上で `%s' を押してファイル名を再入力して更新できます。" + "values can be update by typing `%s' on file name.") + (key-description + (car (where-is-internal 'YaTeX-change-*))))) (if (looking-at "\\[") (forward-char 1) (insert-before-markers "[") (setq needclose t)) (insert-before-markers bb) - (if (memq c '(?c ?C)) (insert-before-markers ",clip")) + (if doclip (insert-before-markers ",clip")) (if needclose (insert-before-markers "]") (or (looking-at "\\]") (insert-before-markers ",")))) (t (YaTeX-push-to-kill-ring bb))))) @@ -1977,9 +2040,9 @@ '(("version") ("plext") ("url") ("fancybox") ("pifont") ("longtable") ("ascmac") ("bm") ("graphics") ("graphicx") ("alltt") ("misc") ("eclbkbox") ("amsmath") ("amssymb") ("xymtex") ("chemist") - ("a4j") ("array") ("epsf") ("color") ("epsfig") ("floatfig") + ("a4j") ("array") ("epsf") ("color") ("xcolor") ("epsfig") ("floatfig") ("landscape") ("path") ("supertabular") ("twocolumn") - ("latexsym") ("times") ("makeidx")) + ("latexsym") ("times") ("makeidx") ("geometry") ("type1cm")) "Default completion table for arguments of \\usepackage") (defvar YaTeX::usepackage-alist-private nil @@ -2004,7 +2067,7 @@ (defun YaTeX::mask (argp) (cond ((equal argp 1) - (read-string "String: ")) + (YaTeX-read-string-or-skip "String: ")) ((equal argp 2) (let (c) (while (not (memq c '(?A ?B ?C ?D ?E ?F ?G ?H ?I ?J ?K))) @@ -2015,9 +2078,9 @@ (defun YaTeX::maskbox (argp) (cond ((equal argp 1) - (read-string "Width: ")) + (YaTeX:read-length "Width: ")) ((equal argp 2) - (read-string "Height: ")) + (YaTeX:read-length "Height: ")) ((equal argp 3) (let (c) (while (not (memq c '(?A ?B ?C ?D ?E ?F ?G ?H ?I ?J ?K))) @@ -2027,12 +2090,12 @@ ((equal argp 4) (YaTeX:read-oneof "lcr" 'quick)) ((equal argp 5) - (read-string "String: ")))) + (YaTeX-read-string-or-skip "String: ")))) (defun YaTeX::textcircled (argp) (cond ((equal argp 1) - (let ((char (read-string "Circled char: ")) + (let ((char (read-string-with-history "Circled char: ")) (left "") (right "") c) (setq c (read-char "Enclose also with (s)mall (t)iny s(C)riptsize (N)one:")) @@ -2129,7 +2192,7 @@ (defun YaTeX::DeclareMathOperator (argp) (cond ((equal argp 1) - (read-string "Operator: " "\\")))) + (YaTeX-read-string-or-skip "Operator: " "\\")))) ;;; ;; Add-in functions for large-type command. diff -r 130c104fe22e -r e37af485338a yatexenv.el --- a/yatexenv.el Mon May 14 19:59:12 2012 +0900 +++ b/yatexenv.el Sun Jul 12 14:21:20 2015 +0900 @@ -1,10 +1,9 @@ -;;; -*- Emacs-Lisp -*- -;;; YaTeX environment-specific functions. -;;; yatexenv.el -;;; (c) 1994-2012 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Sun Feb 12 11:15:33 2012 on firestorm +;;; yatexenv.el --- YaTeX environment-specific functions +;;; (c) 1994-2013 by HIROSE Yuuji.[yuuji@yatex.org] +;;; Last modified Mon Dec 22 12:49:03 2014 on firestorm ;;; $Id$ +;;; Code: ;;; ;; Functions for tabular environment ;;; @@ -13,24 +12,27 @@ (defun YaTeX-array-what-column-internal () "Return the cons of matching column and its title of array environment. When calling from a program, make sure to be in array/tabular environment." - (let ((p (point)) beg eot bor (nlptn "\\\\\\\\") (andptn "[^\\]&") + (let ((p (point)) bot beg eot bor eoll (nlptn "\\\\\\\\") (andptn "[^\\]&") (n 0) j (firsterr "This line might be the first row.")) (save-excursion (YaTeX-beginning-of-environment) + (setq eoll (save-excursion ;end of logical line + (YaTeX-goto-corresponding-environment) (point))) (search-forward "{" p) (up-list 1) (search-forward "{" p) (up-list 1) ;;(re-search-forward andptn p) - (while (progn (search-forward "&" p) + (setq bot (point)) ;beginning of tabular + (while (progn (search-forward "&" eoll) (equal (char-after (1- (match-beginning 0))) ?\\ ))) (setq beg (1- (point))) ;beg is the point of the first & - (or (re-search-forward nlptn p t) + (or (re-search-forward nlptn eoll t) (error firsterr)) (setq eot (point)) ;eot is the point of the first \\ (goto-char p) - (or (re-search-backward nlptn beg t) - (error firsterr)) - (setq bor (point)) ;bor is the beginning of this row. + (setq bor (if (re-search-backward nlptn bot 1) + (point) ;bor is the beginning of this row. + bot)) (while (< (1- (point)) p) (if (equal (following-char) ?&) (forward-char 1) @@ -55,8 +57,8 @@ (setq j (1- j))) (skip-chars-forward "\\s ") (list n - (buffer-substring - (point) + (YaTeX-buffer-substring + (progn (skip-chars-forward "\n \t") (point)) (progn (re-search-forward (concat andptn "\\|" nlptn) eot) (goto-char (match-beginning 0)) @@ -171,6 +173,7 @@ (fset 'YaTeX-intelligent-newline-array 'YaTeX-intelligent-newline-tabular) (fset 'YaTeX-intelligent-newline-supertabular 'YaTeX-intelligent-newline-tabular) +(fset 'YaTeX-intelligent-newline-longtable 'YaTeX-intelligent-newline-tabular) (defun YaTeX-intelligent-newline-align () "Intelligent newline function for align. @@ -198,10 +201,11 @@ (YaTeX-indent-line))) (mapcar - '(lambda (s) + (function + (lambda (s) (fset (intern (concat "YaTeX-intelligent-newline-" (symbol-name s))) - 'YaTeX-intelligent-newline-align)) + 'YaTeX-intelligent-newline-align))) '(align* flalign flalign* matrix pmatrix bmatrix Bmatrix vmatrix Vmatrix cases eqnarray eqnarray* alignat alignat*)) diff -r 130c104fe22e -r e37af485338a yatexgen.el --- a/yatexgen.el Mon May 14 19:59:12 2012 +0900 +++ b/yatexgen.el Sun Jul 12 14:21:20 2015 +0900 @@ -1,16 +1,15 @@ -;;; -*- Emacs-Lisp -*- -;;; YaTeX add-in function generator. -;;; yatexgen.el rev.5 +;;; yatexgen.el --- YaTeX add-in function generator(rev.5) + ;;; (c)1991-1995,1999,2000 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Fri Jun 27 12:09:37 2003 on firestorm +;;; Last modified Sun Dec 21 14:04:49 2014 on firestorm ;;; $Id$ +;;; Code: (require 'yatex) (defmacro YaTeX-setq (var japanese english) (list 'setq var - (if YaTeX-japan japanese english)) -) + (if YaTeX-japan japanese english))) (put 'YaTeX-setq 'lisp-indent-hook 1) @@ -29,8 +28,7 @@ reading my messages *carefully*, or you'll fail to generate appropriate function. - Hit return key!" -) + Hit return key!") (YaTeX-setq YaTeX-generate-start-message "さぁはじめるよ.\n1.登録したい補完をやってみて. @@ -40,33 +38,27 @@ "Let's begin completion for which you want to make add-in function. If you want to make add-in function for \\documentstyle input only `\\documentstyle{}' *with* completion of yatex-mode. -If you finish this, please press RET." -) +If you finish this, please press RET.") (YaTeX-setq YaTeX-generate-abort-message "やめた、やめた〜いめんどくせ〜" - "Aborted." -) + "Aborted.") (YaTeX-setq YaTeX-generate-same-message "それじゃ、なにも変わってねぇだろーが! やめた。" - "I found no difference between them. So I'm quitting." -) + "I found no difference between them. So I'm quitting.") (YaTeX-setq YaTeX-generate-invalid-message "それは、ちと無理というものじゃ." - "It's impossible." -) + "It's impossible.") (YaTeX-setq YaTeX-generate-idontknow-message "う〜ん、難しくてよくわからないなぁ。ばかでごめんねェ〜" - "Sorry I can't tell your adding method." -) + "Sorry I can't tell your adding method.") (YaTeX-setq YaTeX-generate-confirm-message "ということは、付け足したい部分はこれでいいのね" - "Is it additional string of add-in function?" -) + "Is it additional string of add-in function?") (YaTeX-setq YaTeX-generate-output-message "2.じゃ、それにくっつけたいものを *カーソルの位置に* 足してみて. @@ -75,8 +67,7 @@ で、またおわったらりたーん!!" "2.Then input additional string *at CURSOR POSITION* According to last example \\documentstyle{}, -modify it \\documentstyle[12pt]{}. RET to finish." -) +modify it \\documentstyle[12pt]{}. RET to finish.") (YaTeX-setq YaTeX-generate-put-arg-message "3.このうち、キーボードから読み込んで欲しい文字列を順に入れて。 @@ -86,8 +77,7 @@ "3.In this string, extract string which you want to input from key board with quiry afterwards. For example, though additional string is \\documentstyle[12pt]{}, but you want enter only `12pt' by hand. -RET to finish!" -) +RET to finish!") (YaTeX-setq YaTeX-generate-read-prompt-message "4.では、あとでこれらの文字列を読み込む時に、どういうプロンプトを @@ -95,8 +85,7 @@ さっきの 12pt の部分だったら、『サイズは』とかがおすすめ。" "4.When you use this add-in function afterwards, what message do you like to be prompted with to enter these values. In last -example `12pt', typical prompt string may be `Size?: '." -) +example `12pt', typical prompt string may be `Size?: '.") (YaTeX-setq YaTeX-generate-done-message "よし! これが、君の作りたかった関数だ。~/.emacs にでも入れてせいぜい @@ -109,34 +98,29 @@ for testing of this function please. But you can see this function quite easy, can't you? You had better write your most favorite add-in function yourself! -" -) +") (YaTeX-setq YaTeX-generate-nomatch-message "こらこら、そんな文字列どこにもねーぞ!!" - "No such string in additional string." -) + "No such string in additional string.") + (YaTeX-setq YaTeX-generate-buffer "*付加関数生成バッファ*" - "*Generate-add-in-function*" -) + "*Generate-add-in-function*") (YaTeX-setq YaTeX-generate-message-buffer "*ご案内*" - "*Guide*" -) + "*Guide*") (YaTeX-setq YaTeX-generate-bug-message "ごめ〜ん!! ちょっと、このアドイン関数つくるの失敗しちゃったみたい!! 作者まで連絡してくださ〜〜〜い!" "Sorry I failed to make add-in function for you... -Send bug report to me." -) +Send bug report to me.") (YaTeX-setq YaTeX-generate-narrow-message "画面がせますぎるような気がします。" - "Too narrow screen height." -) + "Too narrow screen height.") (defvar YaTeX-generate-message-height 10 "Window height of YaTeX-generate-message-buffer") @@ -249,8 +233,7 @@ (condition-case error (eval-current-buffer) (error (insert YaTeX-generate-bug-message))) - (pop-to-buffer YaTeX-generate-message-buffer) -) + (pop-to-buffer YaTeX-generate-message-buffer)) (defun YaTeX-generate-parse-add-in (args add-in) "Parse add-in string and extract argument for it. @@ -261,7 +244,8 @@ func-name (string "")) ;;Phase 1. extract argument from add-in string. (mapcar - '(lambda (arg) + (function + (lambda (arg) (let ((index 0) (match 0) beg end (carg (car arg))) (YaTeX-generate-display-message YaTeX-generate-read-prompt-message) @@ -282,7 +266,7 @@ ((YaTeX-generate-ask-match-position) (YaTeX-generate-register-match)))) (setq index end)) - (setq i (1+ i)))) + (setq i (1+ i))))) args) ;;Phase 2. Generate function!! (setq i 0) @@ -304,17 +288,17 @@ "(defun " func-name " ()\n" " (let (") (mapcar - '(lambda (arg) + (function + (lambda (arg) (insert (format "(arg%d (read-string \"%s: \"))\n" i (aref prompt (1- i)))) - (setq i (1+ i))) + (setq i (1+ i)))) args) (delete-region (point) (progn (forward-line -1) (end-of-line) (point))) (insert ")\n(concat " (YaTeX-generate-lisp-quote string) ")))\n") (indent-region (point-min) (point) nil) - used) -) + used)) (defun YaTeX-generate-ask-match-position () "Ask user whether match-position is in his expectation, @@ -331,14 +315,12 @@ (insert "\n" (if YaTeX-japan "ここにも対応してるの?" "this underlined part too?")) (other-window -1) - (y-or-n-p (if YaTeX-japan "下線部はあってますか" "Is underline right")) -) + (y-or-n-p (if YaTeX-japan "下線部はあってますか" "Is underline right"))) (defun YaTeX-generate-register-match () (nconc arg (list (list beg end))) (let ((x beg)) - (while (< x end) (aset used x i)(setq x (1+ x)))) -) + (while (< x end) (aset used x i)(setq x (1+ x))))) (defun YaTeX-generate-display-message (mes &optional bottom) "Display message to generation buffer." @@ -347,8 +329,7 @@ (insert "\n\n") (if bottom (recenter (1- bottom)) (recenter 0)) (insert mes) - (other-window -1) -) + (other-window -1)) (defun YaTeX-generate-move-to-add-in-position () "Move cursor where add-in function should insert string." @@ -366,9 +347,7 @@ ((eq YaTeX-current-completion-type 'maketitle) (goto-char (point-max)) (if (= (preceding-char) ? ) - (forward-char -1))) - ) -) + (forward-char -1))))) (defun YaTeX-generate-function-name () (concat @@ -376,8 +355,7 @@ (cond ((eq YaTeX-current-completion-type 'begin) YaTeX-env-name) ((eq YaTeX-current-completion-type 'section) YaTeX-section-name) - ((eq YaTeX-current-completion-type 'maketitle) YaTeX-single-command))) -) + ((eq YaTeX-current-completion-type 'maketitle) YaTeX-single-command)))) (defun YaTeX-generate-lisp-quote (str) (let ((len (length str))(i 0) (quote "")) @@ -388,8 +366,7 @@ (setq quote (concat quote "\"")) (setq quote (concat quote (substring str i (1+ i))))) (setq i (1+ i))) - quote) -) + quote)) (defun YaTeX-generate-quote-quote (str) (let ((len (length str))(i 0) (quote "")) @@ -398,15 +375,13 @@ (setq quote (concat quote (char-to-string 127)))) (setq quote (concat quote (substring str i (1+ i)))) (setq i (1+ i))) - quote) -) + quote)) (defun YaTeX-suppress-sparse-keymap (map) (let ((i ? )) (while (< i 127) (define-key map (char-to-string i) 'undefined) - (setq i (1+ i)))) -) + (setq i (1+ i))))) ;;; ;; Auto-generate Function for Lispers. @@ -423,8 +398,8 @@ ((= c ?p) 'oneof) ((= c ?o) 'coord) ;;((= c ?m) 'macro) - (t 'quit))) - ) + (t 'quit)))) + (defun YaTeX-generate-read-completion-table () (let ((i 1) cand (cands "(") (cb (current-buffer)) (buf (get-buffer-create " *Candidates*"))) @@ -441,8 +416,8 @@ (insert cand "\n")) (kill-buffer buf))) ;;(set-buffer cb) - (setq YaTeX-generate-current-completion-table (concat cands ")"))) -) + (setq YaTeX-generate-current-completion-table (concat cands ")")))) + (defun YaTeX-generate-corresponding-paren (left) (cond ((equal left "{") "}") @@ -450,16 +425,16 @@ ((equal left "(") ")") ((equal left "<") ">") ((equal left "\\begin{") "}") - (t left)) -) + (t left))) + (defun YaTeX-generate-create-read-string (&optional nth) (concat "(read-string \"" (read-string (if nth (format "Prompt for argument#%d: " nth) "Prompt: ")) ": \"\n" "\"" (read-string "Default: ") "\"" - ")\n") -) + ")\n")) + (defun YaTeX-generate-create-completing-read (&optional nth) (prog1 (concat @@ -475,21 +450,21 @@ (cons (cons (format "YaTeX-%s-%d" command (or nth 0)) YaTeX-generate-current-completion-table) - YaTeX-generate-variables-for-learning)))) -) + YaTeX-generate-variables-for-learning))))) + (defun YaTeX-generate-create-read-file-name (&optional nth) (concat "(read-file-name \"" (read-string (if nth (format "Prompt for argument#%d: " nth) "Prompt: ")) - ": \" "" \"\" t \"\")\n") -) + ": \" "" \"\" t \"\")\n")) + (defun YaTeX-generate-create-read-oneof (&optional nth readpos) (concat (if readpos "(YaTeX:read-position \"" "(YaTeX:read-oneof \"") - (read-string "Acceptable characters: " "lcr") "\")\n") -) + (read-string "Acceptable characters: " "lcr") "\")\n")) + (defun YaTeX-generate-option-type (command) (let ((func (format "YaTeX:%s" command)) leftp (buf (get-buffer-create YaTeX-generate-buffer)) type (n 1)) @@ -546,8 +521,8 @@ (goto-char (point-min)) (while (not (eobp)) (lisp-indent-line) (forward-line 1)) (eval-current-buffer) - buf) -) + buf)) + (defun YaTeX-generate-argument-type (command argc) "Create an argument-type add-in function." (interactive) @@ -581,8 +556,8 @@ (YaTeX-update-table (if (> argc 1) (list command argc) (list command)) 'section-table 'user-section-table 'tmp-section-table) - buf) -) + buf)) + (defun YaTeX-generate-simple (&optional command) "Simple but requiring some elisp knowledge add-in generator." (interactive) @@ -607,6 +582,6 @@ (YaTeX-generate-option-type command) (YaTeX-generate-argument-type command - (string-to-int (read-string "How many arguments?: ")))) nil) -) + (string-to-int (read-string "How many arguments?: ")))) nil)) + (provide 'yatexgen) diff -r 130c104fe22e -r e37af485338a yatexhie.el --- a/yatexhie.el Mon May 14 19:59:12 2012 +0900 +++ b/yatexhie.el Sun Jul 12 14:21:20 2015 +0900 @@ -1,10 +1,10 @@ -;;; -*- Emacs-Lisp -*- -;;; YaTeX hierarchy browser. -;;; yatexhie.el -;;; (c)1995-2012 by HIROSE Yuuji [yuuji@yatex.org] -;;; Last modified Mon Jan 9 20:19:06 2012 on firestorm +;;; yatexhie.el --- YaTeX hierarchy browser +;;; +;;; (c)1995-2013 by HIROSE Yuuji [yuuji@yatex.org] +;;; Last modified Sun Dec 21 14:05:20 2014 on firestorm ;;; $Id$ +;;; Code: ;; ----- Customizable variables ----- (defvar YaTeX-hierarchy-ignore-heading-regexp "\\$[A-Z][a-z]+: .* \\$\\|-\\*- .* -\\*-" @@ -75,8 +75,9 @@ (YaTeX-get-builtin "!") (setq YaTeX-parent-file parent)))) (cons (buffer-file-name (current-buffer)) - (mapcar '(lambda (f) ;return value - (YaTeX-document-hierarchy f basedir)) + (mapcar (function ;return value + (lambda (f) + (YaTeX-document-hierarchy f basedir))) (YaTeX-all-included-files)))))) (message "Parsing [%s]...done" (file-name-nondirectory file)))) diff -r 130c104fe22e -r e37af485338a yatexhks.el --- a/yatexhks.el Mon May 14 19:59:12 2012 +0900 +++ b/yatexhks.el Sun Jul 12 14:21:20 2015 +0900 @@ -13,41 +13,56 @@ ;;97/1/27 (define-key YaTeX-user-extensional-map "v" 'YaTeX-section-overview) ;;initial version -(define-key YaTeX-user-extensional-map "0" - '(lambda () (interactive) (YaTeX-make-section nil nil nil "part"))) -(define-key YaTeX-user-extensional-map "1" - '(lambda () (interactive) (YaTeX-make-section nil nil nil "chapter"))) -(define-key YaTeX-user-extensional-map "2" - '(lambda () (interactive) (YaTeX-make-section nil nil nil "section"))) -(define-key YaTeX-user-extensional-map "3" - '(lambda () (interactive) (YaTeX-make-section nil nil nil "subsection"))) -(define-key YaTeX-user-extensional-map "4" - '(lambda () (interactive) (YaTeX-make-section nil nil nil "subsubsection"))) -(define-key YaTeX-user-extensional-map "5" - '(lambda () (interactive) (YaTeX-make-section nil nil nil "paragraph"))) -(define-key YaTeX-user-extensional-map "6" - '(lambda () (interactive) (YaTeX-make-section nil nil nil "subparagraph"))) -(define-key YaTeX-user-extensional-map "r" - '(lambda () (interactive) (YaTeX-make-section nil nil nil "ref"))) -(define-key YaTeX-user-extensional-map "i" - '(lambda () (interactive) (YaTeX-make-singlecmd "item"))) -(define-key YaTeX-user-extensional-map "\C-b" - '(lambda () (interactive) (YaTeX-make-singlecmd "leftarrow"))) -(define-key YaTeX-user-extensional-map "l" - '(lambda () (interactive) (YaTeX-make-section nil nil nil "label"))) -(define-key YaTeX-user-extensional-map "f" - '(lambda () (interactive) (YaTeX-make-section nil nil nil "frac"))) -(define-key YaTeX-user-extensional-map "S" - '(lambda () (interactive) (YaTeX-make-section nil nil nil "setlength"))) -(define-key YaTeX-user-extensional-map "b" - '(lambda () (interactive) (YaTeX-make-fontsize nil "bf"))) -(define-key YaTeX-user-extensional-map "I" 'YaTeX-browse-info) +(let ((map YaTeX-user-extensional-map)) + (define-key map "0" + (function (lambda () (interactive) + (YaTeX-make-section nil nil nil "part")))) + (define-key map "1" + (function (lambda () (interactive) + (YaTeX-make-section nil nil nil "chapter")))) + (define-key map "2" + (function (lambda () (interactive) + (YaTeX-make-section nil nil nil "section")))) + (define-key map "3" + (function (lambda () (interactive) + (YaTeX-make-section nil nil nil "subsection")))) + (define-key map "4" + (function (lambda () (interactive) + (YaTeX-make-section nil nil nil "subsubsection")))) + (define-key map "5" + (function (lambda () (interactive) + (YaTeX-make-section nil nil nil "paragraph")))) + (define-key map "6" + (function (lambda () (interactive) + (YaTeX-make-section nil nil nil "subparagraph")))) + (define-key map "r" + (function (lambda () (interactive) + (YaTeX-make-section nil nil nil "ref")))) + (define-key map "i" + (function (lambda () (interactive) + (YaTeX-make-singlecmd "item")))) + (define-key map "\C-b" + (function (lambda () (interactive) + (YaTeX-make-singlecmd "leftarrow")))) + (define-key map "l" + (function (lambda () (interactive) + (YaTeX-make-section nil nil nil "label")))) + (define-key map "f" + (function (lambda () (interactive) + (YaTeX-make-section nil nil nil "frac")))) + (define-key map "S" + (function (lambda () (interactive) + (YaTeX-make-section nil nil nil "setlength")))) + (define-key map "b" + (function (lambda () (interactive) + (YaTeX-make-fontsize nil "bf")))) + (define-key map "I" 'YaTeX-browse-info)) (defun YaTeX-browse-info () - "Browse YaTeX's info" - (interactive) - (require 'info) - (Info-goto-node (if YaTeX-japan "(yatexj)Top" "(yatexe)Top"))) + "Browse YaTeX's info" + (interactive) + (require 'info) + (Info-goto-node (if YaTeX-japan "(yatexj)Top" "(yatexe)Top"))) ; diff -r 130c104fe22e -r e37af485338a yatexhlp.el --- a/yatexhlp.el Mon May 14 19:59:12 2012 +0900 +++ b/yatexhlp.el Sun Jul 12 14:21:20 2015 +0900 @@ -1,10 +1,10 @@ -;;; -*- Emacs-Lisp -*- -;;; YaTeX helper with LaTeX commands and macros. -;;; yatexhlp.el -;;; (c)1994,1998,2004 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Tue Oct 19 01:13:21 2004 on firestorm +;;; yatexhlp.el --- YaTeX helper for LaTeX -*- coding: sjis -*- +;;; +;;; (c)1994,1998,2004,2014,2015 by HIROSE Yuuji.[yuuji@yatex.org] +;;; Last modified Fri Jan 16 10:31:49 2015 on firestorm ;;; $Id$ +;;; Code: (let ((help-file (concat "YATEXHLP." (cond (YaTeX-japan "jp") (t "eng")))) @@ -12,8 +12,9 @@ (cond ((and (boundp 'site-directory) site-directory) site-directory) ((string-match "\\.app/" doc-directory) ;For Emacs.app(Darwin) - (expand-file-name "../site-lisp" doc-directory)) - (YaTeX-emacs-19 (expand-file-name "../../site-lisp" doc-directory)) + (expand-file-name "../site-lisp/yatex" doc-directory)) + (YaTeX-emacs-19 + (expand-file-name "../../site-lisp/yatex" doc-directory)) (t exec-directory)))) (defvar YaTeX-help-file (expand-file-name help-file help-dir) @@ -45,8 +46,8 @@ (setq YaTeX-help-mode-map (make-sparse-keymap)) (let ((map YaTeX-help-mode-map)) (suppress-keymap map) - (define-key map "j" '(lambda () (interactive) (scroll-up 1))) - (define-key map "k" '(lambda () (interactive) (scroll-up -1))) + (define-key map "j" (function (lambda () (interactive) (scroll-up 1)))) + (define-key map "k" (function (lambda () (interactive) (scroll-up -1)))) (define-key map "n" 'next-line) (define-key map "p" 'previous-line) (define-key map " " 'scroll-up) @@ -159,7 +160,7 @@ (concat "^" (regexp-quote YaTeX-help-delimiter)) nil 1) (- (point) (length YaTeX-help-delimiter)))) (YaTeX-showup-buffer - hbuf (function (lambda (x) (nth 3 (window-edges x)))) t) + hbuf 'YaTeX-showup-buffer-bottom-most t) (set-buffer hbuf) (setq buffer-read-only nil) (if append (goto-char (point-max)) (erase-buffer)) @@ -226,7 +227,7 @@ (let ((buf (get-buffer-create "**Description**")) (conf (current-window-configuration))) (YaTeX-showup-buffer - buf (function (lambda (x) (nth 3 (window-edges x)))) t) + buf 'YaTeX-showup-buffer-bottom-most t) (make-local-variable 'YaTeX-help-file-current) (make-local-variable 'YaTeX-help-command-current) (make-local-variable 'YaTeX-help-saved-config) @@ -266,8 +267,7 @@ (sw (selected-window)) (head (concat "^" (regexp-quote YaTeX-help-delimiter))) pt command) - (YaTeX-showup-buffer - ab (function (lambda (x) (nth 3 (window-edges x))))) + (YaTeX-showup-buffer ab 'YaTeX-showup-buffer-bottom-most) (select-window (get-buffer-window ab)) (set-buffer ab) ;assertion (setq buffer-read-only nil) @@ -302,8 +302,9 @@ (message "No matches found."))) ;;;###autoload -(defun YaTeX-help () - "Show help buffer of LaTeX/TeX commands or macros." +(defun YaTeX-help (&optional macro) + "Show help buffer of LaTeX/TeX commands or macros. +Optional argument MACRO, if supplied, is directly selected to keyword." (interactive) (let (p beg end command) (save-excursion @@ -311,6 +312,7 @@ (goto-char (match-end 0))) (setq p (point)) ;remember current position. (cond + (macro nil) ((YaTeX-on-begin-end-p) ;;if on \begin or \end, extract its environment. (setq command @@ -331,10 +333,11 @@ (search-forward "}" (point-end-of-line)) (setq command (buffer-substring beg (match-beginning 0))))) (setq command - (completing-read - "Describe (La)TeX command: " - YaTeX-help-entries nil nil command)) - );end excursion + (or macro + (completing-read + "Describe (La)TeX command: " + YaTeX-help-entries nil nil command))));end excursion + (setq YaTeX-help-saved-config (current-window-configuration)) (or (YaTeX-refer-help command YaTeX-help-file) (YaTeX-refer-help command YaTeX-help-file-private) diff -r 130c104fe22e -r e37af485338a yatexinf.el --- a/yatexinf.el Mon May 14 19:59:12 2012 +0900 +++ b/yatexinf.el Sun Jul 12 14:21:20 2015 +0900 @@ -1,8 +1,8 @@ -;;; -*- Emacs-Lisp -*- -;;; YaTeX interfaces for Texinfo mode. -;;; (c)1994-2012 by HIROSE, Yuuji [yuuji@yatex.org] -;;; Last modified Mon Jan 9 20:19:55 2012 on firestorm +;;; yatexinf.el -- YaTeX interfaces for Texinfo mode +;;; (c)1994-2013 by HIROSE, Yuuji [yuuji@yatex.org] +;;; Last modified Mon Apr 1 22:43:58 2013 on firestorm +;;; Code: (require 'yatex) (or (boundp 'texinfo-mode-map) (load "texinfo")) diff -r 130c104fe22e -r e37af485338a yatexlib.el --- a/yatexlib.el Mon May 14 19:59:12 2012 +0900 +++ b/yatexlib.el Sun Jul 12 14:21:20 2015 +0900 @@ -1,10 +1,10 @@ -;;; -*- Emacs-Lisp -*- -;;; YaTeX and yahtml common libraries, general functions and definitions -;;; yatexlib.el -;;; (c)1994-2012 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Wed Feb 29 09:49:30 2012 on firestorm +;;; yatexlib.el --- YaTeX and yahtml common libraries -*- coding: sjis -*- +;;; +;;; (c)1994-2015 by HIROSE Yuuji.[yuuji@yatex.org] +;;; Last modified Fri Jan 16 10:32:31 2015 on firestorm ;;; $Id$ +;;; Code: ;; General variables (defvar YaTeX-dos (memq system-type '(ms-dos windows-nt OS/2))) (defvar YaTeX-macos (memq system-type '(darwin))) @@ -287,8 +287,8 @@ (delete-region (point) (progn (forward-sexp) (point))) (delete-blank-lines) (insert "(setq " name " '(\n") - (mapcar '(lambda (s) - (insert (format "%s\n" (prin1-to-string s)))) + (mapcar (function (lambda (s) + (insert (format "%s\n" (prin1-to-string s))))) value) (insert "))\n\n") (delete-blank-lines) @@ -481,7 +481,7 @@ (defun point-end-of-line () (save-excursion (end-of-line)(point))) - +(defun YaTeX-showup-buffer-bottom-most (x) (nth 3 (window-edges x))) ;;;###autoload (defun YaTeX-showup-buffer (buffer &optional func select) "Make BUFFER show up in certain window (but current window) @@ -514,6 +514,9 @@ ;(other-window 1);This does not work properly on Emacs-19 (select-window (get-lru-window)) (switch-to-buffer buffer) + (if (< (window-height) (/ YaTeX-default-pop-window-height 2)) + (enlarge-window (- YaTeX-default-pop-window-height + (window-height)))) (or select (select-window window))) (t ;if one-window (cond @@ -729,7 +732,8 @@ (if (fboundp 'completing-read-with-history-in) (completing-read-with-history-in minibuffer-history-symbol prompt table predicate must-match initial) - (completing-read prompt table predicate must-match initial)) + (save-excursion ;work around to avoid cursor warp + (completing-read prompt table predicate must-match initial))) (if (and YaTeX-emacs-19 hsym) (set hsym minibuffer-history))))) ;;;###autoload @@ -737,7 +741,8 @@ "Read from minibuffer with general history: gmhist, Emacs-19." (cond (YaTeX-emacs-19 - (read-from-minibuffer prompt init map read hsym)) + (save-excursion ;work around to avoid cursor warp + (read-from-minibuffer prompt init map read hsym))) (t (let ((minibuffer-history-symbol hsym)) (read-from-minibuffer prompt init map read))))) @@ -747,7 +752,8 @@ "Read string with history: gmhist(Emacs-18) and Emacs-19." (cond (YaTeX-emacs-19 - (read-from-minibuffer prompt init minibuffer-local-map nil hsym)) + (save-excursion ;work around to avoid cursor warp + (read-from-minibuffer prompt init minibuffer-local-map nil hsym))) ((featurep 'gmhist-mh) (read-with-history-in hsym prompt init)) (t (read-string prompt init)))) @@ -755,15 +761,19 @@ (defvar YaTeX-skip-next-reader-char ?\C-j) (defun YaTeX-read-string-or-skip (&rest args) "Read string, or skip if last input char is \C-j." - (if (equal last-input-char YaTeX-skip-next-reader-char) + (if (equal (if (boundp 'last-input-event) last-input-event last-input-char) + YaTeX-skip-next-reader-char) "" - (apply 'read-string args))) + (save-excursion ;work around to avoid cursor warp + (apply 'read-string args)))) (defun YaTeX-completing-read-or-skip (&rest args) "Do completing-read, or skip if last input char is \C-j." - (if (equal last-input-char YaTeX-skip-next-reader-char) + (if (equal (if (boundp 'last-input-event) last-input-event last-input-char) + YaTeX-skip-next-reader-char) "" - (apply 'completing-read args))) + (save-excursion ;work around to avoid cursor warp + (apply 'completing-read args)))) ;;;###autoload (fset 'YaTeX-rassoc @@ -778,6 +788,25 @@ (throw 'found (car l))) (setq l (cdr l))))))))) +(defun YaTeX-set-file-coding-system (code coding) + "Set current buffer's coding system according to symbol." + (cond ((null code) + nil) + ((boundp 'MULE) + (set-file-coding-system coding)) + ((and YaTeX-emacs-20 (boundp 'buffer-file-coding-system)) + (setq buffer-file-coding-system + (or (and (fboundp 'set-auto-coding) buffer-file-name + (save-excursion + (goto-char (point-min)) + (set-auto-coding buffer-file-name (buffer-size)))) + coding))) + ((featurep 'mule) + (set-file-coding-system coding)) + ((boundp 'NEMACS) + (make-local-variable 'kanji-fileio-code) + (setq kanji-fileio-code code)))) + (defun YaTeX-insert-file-contents (file visit &optional beg end) (cond ((and (string< "19" emacs-version) (not (featurep 'xemacs))) @@ -839,11 +868,18 @@ ;; Interface function for windows.el ;;; ;;;###autoload +(fset 'YaTeX-last-key + (if (fboundp 'win:last-key) + 'win:last-key + (function (lambda () (if (boundp 'last-command-char) + last-command-char + last-command-event))))) (defun YaTeX-switch-to-window () "Switch to windows.el's window decided by last pressed key." (interactive) (or (featurep 'windows) (error "Why don't you use `windows.el'?")) - (win-switch-to-window 1 (- last-command-char win:base-key))) + (win-switch-to-window 1 (- (YaTeX-last-key) win:base-key))) + ;;;###autoload (defun YaTeX-command-to-string (cmd) @@ -860,6 +896,19 @@ (buffer-string)) (kill-buffer tbuf)))))) +;;; (defun YaTeX-executable-find(cmd)...) +(fset 'YaTeX-executable-find + (if (fboundp 'executable-find) + 'executable-find + (function (lambda (cmd) + (let ((list exec-path) path) + (catch 'exec + (while list + (if (file-executable-p + (setq path (expand-file-name cmd (car list)))) + (throw 'exec path)) + (setq list (cdr list))))))))) + ;;;###autoload (defun YaTeX-reindent (col) "Remove current indentation and reindento to COL column." @@ -930,6 +979,64 @@ (progn (skip-chars-forward open) (1+ (point))) (progn (skip-chars-forward close) (point))))))) +(defun YaTeX-in-environment-p (env) + "Return if current LaTeX environment is ENV. +ENV is given in the form of environment's name or its list." + (let ((md (match-data)) (nest 0) p envrx) + (cond + ((atom env) + (setq envrx + (concat "\\(" + (regexp-quote + (YaTeX-replace-format-args + YaTeX-struct-begin env "" "")) + "\\>\\)\\|\\(" + (regexp-quote + (YaTeX-replace-format-args + YaTeX-struct-end env "" "")) + "\\)")) + (save-excursion + (setq p (catch 'open + (while (YaTeX-re-search-active-backward + envrx YaTeX-comment-prefix nil t) + (if (match-beginning 2) + (setq nest (1+ nest)) + (setq nest (1- nest))) + (if (< nest 0) + (throw 'open (cons env (match-beginning 0))))))))) + ((listp env) + (setq p + (or (YaTeX-in-environment-p (car env)) + (and (cdr env) (YaTeX-in-environment-p (cdr env))))))) + (store-match-data md) + p;(or p (YaTeX-in-verb-p (match-beginning 0))) + )) + +(defun YaTeX-quick-in-environment-p (env) + "Check quickly but unsure if current environment is ENV. +ENV is given in the form of environment's name or its list. +This function returns correct result only if ENV is NOT nested." + (save-excursion + (let ((md (match-data)) m0 (p (point)) rc clfound) + (cond + ((listp env) + (or (YaTeX-quick-in-environment-p (car env)) + (and (cdr env) (YaTeX-quick-in-environment-p (cdr env))))) + (t + (unwind-protect + (if (prog1 + (YaTeX-search-active-backward + (YaTeX-replace-format-args YaTeX-struct-begin env "" "") + YaTeX-comment-prefix nil t) + (setq m0 (match-beginning 0))) + (if (YaTeX-search-active-forward + (YaTeX-replace-format-args + YaTeX-struct-end env) + YaTeX-comment-prefix p t nil) + nil ;if \end{env} found, return nil + (cons env m0))) ;else, return meaningful values + (store-match-data md))))))) + (defun YaTeX-goto-corresponding-environment (&optional allow-mismatch noerr) "Go to corresponding begin/end enclosure. Optional argument ALLOW-MISMATCH allows mismatch open/clese. Use this @@ -1075,7 +1182,7 @@ (goto-char curp) (error "Cannot found the end of current environment.")) (YaTeX-goto-corresponding-environment) - (beginning-of-line) ;for confirmation + ;;(beginning-of-line) ;for confirmation ;OUT 2015/1/4 (if (< curp (point)) (progn (message "Mark this environment?(y or n): ") @@ -1084,8 +1191,10 @@ (error "Abort. Please call again at more proper position.")))) (set-mark-command nil) (YaTeX-goto-corresponding-environment) - (end-of-line) - (if (eobp) nil (forward-char 1)))))) + (goto-char (match-end 0)) + ;;(end-of-line) ;OUT 2015/1/5 + ;;(if (eobp) nil (forward-char 1)) ;OUT 2015/1/5 + )))) (defun YaTeX-kill-buffer (buffer) "Make effort to show parent buffer after kill." @@ -1253,6 +1362,9 @@ 'buffer-substring-no-properties 'buffer-substring)) +(defun YaTeX-region-active-p () + (and (fboundp 'region-active-p) (region-active-p))) + ;;; ;; hilit19 vs. font-lock ;;; @@ -1384,7 +1496,7 @@ '((((class static-color)) (:bold t)) (((type tty)) (:bold t)) (((class color) (background dark)) (:foreground "khaki" :bold t)) - (((class color) (background light)) (:foreground "Goldenrod")) + (((class color) (background light)) (:foreground "DarkGoldenrod4")) (t (:bold t :underline t))) "Font Lock mode face used to highlight formula." :group 'font-lock-faces) @@ -1394,7 +1506,7 @@ '((((class static-color)) (:bold t)) (((type tty)) (:bold t)) (((class color) (background dark)) - (:foreground "saddlebrown" :background "ivory" :bold t)) + (:foreground "lightyellow3" :background "navy" :bold t)) (((class color) (background light)) (:foreground "red")) (t (:bold t :underline t))) "Font Lock mode face used to highlight delimiters." @@ -1407,7 +1519,7 @@ (((class color) (background dark)) (:foreground "khaki" :bold t :underline t)) (((class color) (background light)) - (:foreground "Goldenrod" :underline t)) + (:foreground "DarkGoldenrod4" :underline t)) (t (:bold t :underline t))) "Font Lock mode face used to highlight subscripts in formula." :group 'font-lock-faces) @@ -1419,7 +1531,7 @@ (((class color) (background dark)) (:bold nil :foreground "ivory" :background "lightyellow4")) (((class color) (background light)) - (:underline t :foreground "gold")) + (:underline t :foreground "DarkGoldenrod3")) (t (:bold t :underline t))) "Font Lock mode face used to highlight superscripts in formula." :group 'font-lock-faces) @@ -1455,9 +1567,10 @@ (face-font 'bold) "giveup!")) sz medium-i bold-r) - (string-match - "^-[^-]*-[^-]*-[^-]*-[^-]*-[^-]*-[^-]*-\\(\\([0-9]+\\)\\)" df) - (setq sz (or (match-string 1 df) "16")) + (if (string-match + "^-[^-]*-[^-]*-[^-]*-[^-]*-[^-]*-[^-]*-\\(\\([0-9]+\\)\\)" df) + (setq sz (or (match-string 1 df) "16")) + (setq sz "16")) (setq medium-i (format "-medium-i-[^-]+--%s" sz) bold-r (format "-bold-r-[^-]+--%s" sz)) (while flist diff -r 130c104fe22e -r e37af485338a yatexm-o.el --- a/yatexm-o.el Mon May 14 19:59:12 2012 +0900 +++ b/yatexm-o.el Sun Jul 12 14:21:20 2015 +0900 @@ -1,8 +1,9 @@ -;;; -*- Emacs-Lisp -*- -;;; Sample startup file to invoke yatex-mode with outline-minor mode. +;;; yatexm-o.el --- Sample to invoke yatex-mode with outline-minor mode + ;;; (c)1993 by HIROSE Yuuji [yuuji@yatex.org] -;;; Last modified Fri Jun 27 12:10:15 2003 on firestorm +;;; Last modified Sun Dec 21 14:15:47 2014 on firestorm +;;; Code: ;;; ;; outline-minor-mode(使用しない場合は不要です) ;;; @@ -25,12 +26,14 @@ (autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t) ;;↓min-outを使用しない場合、;;@ の行は不要です。 (defvar yatex-mode-hook - '(lambda () + (function + (lambda () (setq outline-regexp LaTeX-outline-regexp) ;;@ (outline-minor-mode 1) ;;@ - )) + ))) (defvar yatex-mode-load-hook - '(lambda () + (function + (lambda () (setq-default outline-prefix-char (concat YaTeX-prefix "\C-o"));;@ (require 'min-out) ;;@ ;;auctex 付属の min-out.el の場合これ↓ @@ -38,4 +41,4 @@ ;;Emacs 付属の outline.el の場合これ↓ (define-key outline-mode-prefix-map "\C-?" 'hide-subtree) (YaTeX-define-begend-key "ba" "abstract") - )) + ))) diff -r 130c104fe22e -r e37af485338a yatexmth.el --- a/yatexmth.el Mon May 14 19:59:12 2012 +0900 +++ b/yatexmth.el Sun Jul 12 14:21:20 2015 +0900 @@ -1,10 +1,10 @@ -;;; -*- Emacs-Lisp -*- -;;; YaTeX math-mode-specific functions. -;;; yatexmth.el -;;; (c)1993-2012 by HIROSE Yuuji [yuuji@yatex.org] -;;; Last modified Tue Jan 24 08:58:56 2012 on firestorm +;;; yatexmth.el --- YaTeX math-mode-specific functions -*- coding: sjis -*- +;;; +;;; (c)1993-2015 by HIROSE Yuuji [yuuji@yatex.org] +;;; Last modified Sun Jul 12 10:02:36 2015 on firestorm ;;; $Id$ +;;; Commentary: ;;; [Customization guide] ;;; ;;; By default, you can use two completion groups in YaTeX math @@ -84,6 +84,7 @@ ;;; これらを ~/.emacs に書いておけば、math-mode で自分専用のイメージ ;;; 補完が利用できます。 +;;; Code: (defvar YaTeX-jisold (and (boundp 'dos-machine-type) (eq dos-machine-type 'pc98))) @@ -309,6 +310,8 @@ ("[]" "Box" "[]") ("no" "notag" "\\notag") (":" "colon" ":") + (".'." "therefore" (".'." "∴")) + ("'.'" "because" ("'.'" "∵")) ("Diamond" "Diamond" "/\\\n\\/") ("3" "triangle" "/\\\n~~") ("C" "clubsuit" " o\no+o\n |") @@ -450,7 +453,7 @@ ;;; ;;YaTeX math-mode functions ;;; -;;;###autoload from yatex.el +;;;###autoload (defun YaTeX-toggle-math-mode (&optional arg) (interactive "P") (or (memq 'YaTeX-math-mode mode-line-format) nil @@ -657,7 +660,6 @@ (kill-buffer YaTeX-math-menu-buffer)) command))) -; (defun YaTeX-math-show-image (image &optional exit-char) "Momentarily display IMAGE at the beginning of the next line; erase it on the next keystroke. The window is recentered if necessary @@ -687,7 +689,9 @@ 2)))) (let ((char (read-char))) (or (eq char exit-char) - (setq unread-command-char char)))) + (if (boundp 'unread-command-events) + (setq unread-command-events (list char)) + (setq unread-command-char char))))) (if insert-end (save-excursion (delete-region insert-start insert-end))) @@ -699,7 +703,7 @@ (interactive "P") (let*((key (or initial "")) regkey str last-char list i (case-fold-search nil) match sign - (this-key (char-to-string last-command-char)) + (this-key (char-to-string (YaTeX-last-key))) (alistsym (cdr (assoc this-key YaTeX-math-key-list))) (alistname (symbol-name alistsym)) (alist (symbol-value alistsym)) @@ -779,7 +783,9 @@ (cond ((memq result '(t select)) (if (eq result t) - (setq unread-command-char last-char) + (if (boundp 'unread-command-events) + (setq unread-command-events (list last-char)) + (setq unread-command-char last-char)) (message "Done.")) (if (assoc YaTeX-single-command section-table) (YaTeX-make-section nil nil nil YaTeX-single-command) diff -r 130c104fe22e -r e37af485338a yatexpkg.el --- a/yatexpkg.el Mon May 14 19:59:12 2012 +0900 +++ b/yatexpkg.el Sun Jul 12 14:21:20 2015 +0900 @@ -1,10 +1,10 @@ -;;; -*- Emacs-Lisp -*- -;;; YaTeX package manager -;;; yatexpkg.el -;;; (c)2003-2012 by HIROSE, Yuuji [yuuji@yatex.org] -;;; Last modified Mon Jan 9 20:13:53 2012 on firestorm +;;; yatexpkg.el --- YaTeX package manager -*- coding: sjis -*- +;;; +;;; (c)2003-2015 by HIROSE, Yuuji [yuuji@yatex.org] +;;; Last modified Fri Feb 13 22:45:46 2015 on firestorm ;;; $Id$ +;;; Code: (defvar YaTeX-package-ams-envs (mapcar 'car YaTeX-ams-env-table)) @@ -32,16 +32,26 @@ ("amsmath" (env . YaTeX-package-ams-envs) (section "tag" "tag*")) ("amssymb" (maketitle "leqq" "geqq" "mathbb" "mathfrak" - "fallingdotseq" + "fallingdotseq" "therefore" "because" "lll" "ggg")) ;very few. Please tell us! ("graphicx" (section "includegraphics" "rotatebox" "scalebox" "resizebox" "reflectbox") (option . YaTeX-package-graphics-driver-alist)) ("color" (section "textcolor" "colorbox" "pagecolor" "color") - (option . YaTeX-package-graphics-driver-alist)) + (option . YaTeX-package-graphics-driver-alist) + (default-option . "usenames,dvipsnames")) + ("xcolor" (same-as . "color")) ("ulem" (section "uline" "uuline" "uwave") (option ("normalem"))) - ("multicol" (env "multicols"))) + ("multicol" (env "multicols")) + ("cref" (section "cleveref")) + ("crefrange" (same-as . "cref")) + ("cpageref" (same-as . "cref")) + ("labelcref" (same-as . "cref")) + ("labelcpageref" (same-as . "cref")) + ("wrapfig" (env "wrapfigure" "wraptable")) + ("setspace" (env "spacing") (section "setstretch")) + ) "Default package vs. macro list. Alists contains '(PACKAGENAME . MACROLIST) PACKAGENAME Basename of package(String). @@ -55,7 +65,8 @@ An good example is the value of YaTeX-package-alist-default.") (defvar YaTeX-package-graphics-driver-alist - '(("dvips") ("xdvi") ("dvipdf") ("pdftex") ("dvipsone") ("dviwindo") + '(("dvips") ("dvipsnames") ("usenames") + ("xdvi") ("dvipdfmx") ("pdftex") ("dvipsone") ("dviwindo") ("emtex") ("dviwin") ("oztex") ("textures") ("pctexps") ("pctexwin") ("pctexhp") ("pctex32") ("truetex") ("tcidvi") ("vtex")) "Drivers alist of graphics/color stylefile's supporting deveces. @@ -72,11 +83,14 @@ Optional second argument TYPE limits the macro type. TYPE is a symbol, one of 'env, 'section, 'maketitle." (let ((list (append YaTeX-package-alist-private YaTeX-package-alist-default)) - element x val pkg pkglist r) + origlist element x sameas val pkg pkglist r) + (setq origlist list) (while list (setq element (car list) pkg (car element) element (cdr element)) + (if (setq sameas (assq 'same-as element)) ;non-recursive retrieval + (setq element (cdr (assoc (cdr sameas) origlist)))) (if (setq r (catch 'found (while element (setq x (car element) @@ -91,20 +105,26 @@ (setq list (cdr list))) pkglist)) -(defun YaTeX-package-option-lookup (pkg) +(defun YaTeX-package-option-lookup (pkg &optional key) "Look up options for specified pkg and returne them in alist form. -Just only accocing against the alist of YaTeX-package-alist-*" - (let ((l (cdr (assq 'option - (assoc pkg (append YaTeX-package-alist-private - YaTeX-package-alist-default)))))) - (if (symbolp l) (symbol-value l) l))) +Just only associng against the alist of YaTeX-package-alist-*" + (let*((list (append YaTeX-package-alist-private YaTeX-package-alist-default)) + (l (cdr (assq (or key 'option) (assoc pkg list)))) + (recur (cdr (assq 'same-as (assoc pkg list))))) + (cond + (recur (YaTeX-package-option-lookup recur key)) + ((symbolp l) (symbol-value l)) + (t l)))) (defvar YaTeX-package-resolved-list nil "List of macros whose package is confirmed to be loaded.") -(defun YaTeX-package-auto-usepackage (macro type) +(defun YaTeX-package-auto-usepackage (macro type &optional autopkg autoopt) "(Semi)Automatically add the \\usepackage line to main-file. -Search the usepackage for MACRO of the TYPE." +Search the usepackage for MACRO of the TYPE. +Optional second and third argument AUTOPKG, AUTOOPT are selected +without query. Thus those two argument (Full)automatically add +a \\usepackage line." (let ((cb (current-buffer)) (wc (current-window-configuration)) (usepackage (concat YaTeX-ec "usepackage")) @@ -112,9 +132,10 @@ (usepkgrx (concat YaTeX-ec-regexp "\\(usepackage\\|include\\)\\b")) - (register '(lambda () (set-buffer cb) + (register (function + (lambda () (set-buffer cb) (set (make-local-variable 'YaTeX-package-resolved-list) - (cons macro YaTeX-package-resolved-list)))) + (cons macro YaTeX-package-resolved-list))))) (begdoc (concat YaTeX-ec "begin{document}")) pb pkg optlist (option "") mb0 uspkgargs) (if (or (YaTeX-member macro YaTeX-package-resolved-list) @@ -154,29 +175,38 @@ ;;corresponding \usepackage found (funcall register) ;; not found, insert it. - (if (y-or-n-p - (format "`%s' requires package. Put \\usepackage now?" macro)) + (if (or + autopkg + (y-or-n-p + (format "`%s' requires package. Put \\usepackage now?" + macro))) (progn (require 'yatexadd) (setq pkg - (completing-read - "Load which package?(TAB for list): " - pkglist nil nil - ;;initial input - (if (= (length pkglist) 1) - (let ((w (car (car pkglist)))) - (if YaTeX-emacs-19 (cons w 0) w)))) + (or autopkg + (completing-read + "Load which package?(TAB for list): " + pkglist nil nil + ;;initial input + (if (= (length pkglist) 1) + (let ((w (car (car pkglist)))) + (if YaTeX-emacs-19 (cons w 0) w))))) optlist (YaTeX-package-option-lookup pkg)) (if optlist (let ((minibuffer-completion-table optlist) - (delim ",") (w (car (car optlist)))) + (delim ",") (w (car (car optlist))) + (dflt (YaTeX-package-option-lookup + pkg 'default-option))) (setq option - (read-from-minibuffer - (format "Any option for {%s}?: " pkg) - (if (= (length optlist) 1) - (if YaTeX-emacs-19 (cons w 0) w)) - YaTeX-minibuffer-completion-map) + (or + autoopt + (read-from-minibuffer + (format "Any option for {%s}?: " pkg) + (let ((v (or dflt + (and (= (length optlist) 1) w)))) + (and v (if YaTeX-emacs-19 (cons v 0) v))) + YaTeX-minibuffer-completion-map)) option (if (string< "" option) (concat "[" option "]") "")))) diff -r 130c104fe22e -r e37af485338a yatexprc.el --- a/yatexprc.el Mon May 14 19:59:12 2012 +0900 +++ b/yatexprc.el Sun Jul 12 14:21:20 2015 +0900 @@ -1,18 +1,18 @@ -;;; -*- Emacs-Lisp -*- -;;; YaTeX process handler. -;;; yatexprc.el -;;; (c)1993-2012 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Fri Feb 17 22:35:38 2012 on firestorm +;;; yatexprc.el --- YaTeX process handler -*- coding: sjis -*- +;;; +;;; (c)1993-2015 by HIROSE Yuuji.[yuuji@yatex.org] +;;; Last modified Fri Feb 13 08:07:20 2015 on firestorm ;;; $Id$ +;;; Code: ;(require 'yatex) (require 'yatexlib) (defvar YaTeX-typeset-process nil - "Process identifier for jlatex") + "Process identifier for latex") (defvar YaTeX-typeset-buffer "*YaTeX-typesetting*" - "Process buffer for jlatex") + "Process buffer for latex") (defvar YaTeX-typeset-buffer-syntax nil "*Syntax table for typesetting buffer") @@ -59,11 +59,12 @@ (defvar YaTeX-typeset-consumption nil) (make-variable-buffer-local 'YaTeX-typeset-consumption) (defun YaTeX-typeset (command buffer &optional prcname modename ppcmd) - "Execute jlatex (or other) to LaTeX typeset." + "Execute latex command (or other) to LaTeX typeset." (interactive) (save-excursion (let ((p (point)) (window (selected-window)) execdir (cb (current-buffer)) (map YaTeX-typesetting-mode-map) + (background (string-match "\\*bg:" buffer)) (outcode (cond ((eq major-mode 'yatex-mode) YaTeX-coding-system) ((eq major-mode 'yahtml-mode) yahtml-kanji-code)))) @@ -78,8 +79,10 @@ (setq execdir default-directory) ;;Select lower-most window if there are more than 2 windows and ;;typeset buffer not seen. - (YaTeX-showup-buffer - buffer (function (lambda (x) (nth 3 (window-edges x))))) + (if background + nil ;do not showup + (YaTeX-showup-buffer + buffer 'YaTeX-showup-buffer-bottom-most)) (set-buffer (get-buffer-create buffer)) (setq default-directory execdir) (cd execdir) @@ -133,21 +136,25 @@ (setq YaTeX-typeset-marker (make-marker))) (point)) (insert (format "Call `%s'\n" command)) - (if YaTeX-dos (message "Done.") + (cond + ((fboundp 'start-process) (insert " ") (set-marker (process-mark YaTeX-typeset-process) (1- (point)))) + (t (message "Done."))) (if (bolp) (forward-line -1)) ;what for? - (if (and YaTeX-emacs-19 window-system) - (let ((win (get-buffer-window buffer t)) owin) - (select-frame (window-frame win)) - (setq owin (selected-window)) - (select-window win) - (goto-char (point-max)) - (recenter -1) - (select-window owin)) - (select-window (get-buffer-window buffer)) - (goto-char (point-max)) - (recenter -1)) + (cond + (background nil) + ((and YaTeX-emacs-19 window-system) + (let ((win (get-buffer-window buffer t)) owin) + (select-frame (window-frame win)) + (setq owin (selected-window)) + (select-window win) + (goto-char (point-max)) + (recenter -1) + (select-window owin))) + (t (select-window (get-buffer-window buffer)) + (goto-char (point-max)) + (recenter -1))) (select-window window) (switch-to-buffer cb) (YaTeX-remove-nonstopmode)))) @@ -250,7 +257,7 @@ (setq tobecalled thiscmd shortname "+typeset")) (t nil)) ;no need to call any process - (progn + (progn ;;Something occurs to call next command (insert (format "===!!! %s !!!===\n" @@ -272,6 +279,10 @@ (put 'YaTeX-typeset-process 'thiscmd thiscmd))) ;; If ppcmd is active, call it. (cond + ((and ppcmd (symbolp ppcmd) (fboundp ppcmd)) + ;; If ppcmd is set and it is a function symbol, + ;; call it whenever command succeeded or not + (funcall ppcmd)) ((and ppcmd (string-match "finish" mes)) (insert (format "=======> Success! Calling %s\n" ppcmd)) (setq mode-name ; set process name @@ -286,7 +297,23 @@ shell-file-name YaTeX-shell-command-option ppcmd) 'YaTeX-typeset-sentinel)) - (t ;pull back original mode-name + (t + (if (equal 0 (process-exit-status proc)) + ;; Successful typesetting done + (if (save-excursion + (re-search-backward + (concat + "^Output written on .*\\.pdf (.*page," + "\\|\\.dvi -> .*\\.pdf$") + nil t)) + ;; If PDF output log found in buffer, + ;; set next default previewer to 'pdf viewer + (put 'dvi2-command 'format 'pdf)) + ;;Confirm process buffer to be shown when error + (YaTeX-showup-buffer + pbuf 'YaTeX-showup-buffer-bottom-most) + (message "Command FAILED!")) + ;;pull back original mode-name (setq mode-name "typeset")))) (forward-char 1)) (setq YaTeX-typeset-process nil) @@ -299,7 +326,7 @@ (defvar YaTeX-texput-file "texput.tex" "*File name for temporary file of typeset-region.") -(defun YaTeX-typeset-region () +(defun YaTeX-typeset-region (&optional pp) "Paste the region to the file `texput.tex' and execute typesetter. The region is specified by the rule: (1)If keyword `%#BEGIN' is found in the upper direction from (point). @@ -310,17 +337,21 @@ (2)If no `%#BEGIN' usage is found before the (point), ->Assume the text between current (point) and (mark) as region. DON'T forget to eliminate the `%#BEGIN/%#END' notation after editing -operation to the region." +operation to the region. +Optional second argument PP specifies post-processor command which will be +called with one argument of current file name whitout extension." (interactive) (save-excursion (let* ((end "") typeout ;Type out message that tells the method of cutting. (texput YaTeX-texput-file) + (texputroot (substring texput 0 (string-match "\\.tex$" texput))) (cmd (concat (YaTeX-get-latex-command nil) " " texput)) (buffer (current-buffer)) opoint preamble (subpreamble "") main (hilit-auto-highlight nil) ;for Emacs19 with hilit19 + ppcmd reg-begin reg-end lineinfo) - + (setq ppcmd (if (stringp pp) (concat pp " " texputroot) pp)) (save-excursion (if (search-backward "%#BEGIN" nil t) (progn @@ -368,9 +399,11 @@ (set-buffer (find-file-noselect texput))) ;;(find-file YaTeX-texput-file) (erase-buffer) + (YaTeX-set-file-coding-system YaTeX-kanji-code YaTeX-coding-system) (if (and (eq major-mode 'yatex-mode) YaTeX-need-nonstop) (insert "\\nonstopmode{}\n")) - (insert preamble "\n" subpreamble "\n") + (insert preamble "\n" subpreamble "\n" + "\\pagestyle{empty}\n\\thispagestyle{empty}\n") (setq lineinfo (list (count-lines 1 (point-end-of-line)) lineinfo)) (insert-buffer-substring buffer reg-begin reg-end) (insert "\\typeout{" typeout end "}\n") ;Notice the selected method. @@ -378,18 +411,324 @@ (basic-save-buffer) (kill-buffer (current-buffer)) (set-buffer main) ;return to parent file or itself. - (YaTeX-typeset cmd YaTeX-typeset-buffer) + (YaTeX-typeset cmd YaTeX-typeset-buffer nil nil ppcmd) (switch-to-buffer buffer) ;for Emacs-19 (put 'dvi2-command 'region t) (put 'dvi2-command 'file buffer) (put 'dvi2-command 'offset lineinfo)))) +(defvar YaTeX-use-image-preview "png" + "*Nil means not using image preview by [prefix] t e. +Acceptable value is one of \"jpg\" or \"png\", which specifies +format of preview image. NOTE that if your system has /usr/bin/sips +while not having convert(ImageMagick), jpeg format is automatically taken +for conversion.") +(defvar YaTeX-preview-image-mode-map nil + "Keymap used in YaTeX-preview-image-mode") +(defun YaTeX-preview-image-mode () + (interactive) + (if YaTeX-preview-image-mode-map + nil + (let ((map (setq YaTeX-preview-image-mode-map (make-sparse-keymap)))) + (define-key map "q" (lambda()(interactive) + (kill-buffer) + (select-window + (or (get 'YaTeX-typeset-process 'win) + (selected-window))))) + (define-key map "j" (lambda()(interactive) (scroll-up 1))) + (define-key map "k" (lambda()(interactive) (scroll-up -1))))) + (use-local-map YaTeX-preview-image-mode-map)) + +(defvar YaTeX-typeset-pdf2image-chain + (cond + ((YaTeX-executable-find "pdfcrop") ;Mac OS X + (list + "pdfcrop --clip %b.pdf tmp.pdf" + (if (YaTeX-executable-find "convert") + "convert -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"))) + "*Pipe line of command as a list to create image file from PDF. +See also doc-string of YaTeX-typeset-dvi2image-chain.") + +(defvar YaTeX-typeset-dvi2image-chain + (cond + ((YaTeX-executable-find YaTeX-cmd-dvips) + (list + (format "%s -E -o %%b.eps %%b.dvi" YaTeX-cmd-dvips) + "convert -alpha off -density %d %b.eps %b.%f")) + ((and (equal YaTeX-use-image-preview "png") + (YaTeX-executable-find "dvipng")) + (list "dvipng %b.dvi"))) + "*Pipe line of command as a list to create png file from DVI or PDF. +%-notation rewritten list: + %b basename of target file(\"texput\") + %f Output format(\"png\") + %d DPI +") + +(defvar YaTeX-typeset-conv2image-chain-alist + (list (cons 'pdf YaTeX-typeset-pdf2image-chain) + (cons 'dvi YaTeX-typeset-dvi2image-chain)) + "Default alist for creating image files from DVI/PDF. +The value is generated from YaTeX-typeset-pdf2image-chain and +YaTeX-typeset-dvi2image-chain.") + +(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)) + (prevname (process-name proc)) + (texput "texput") + (format YaTeX-use-image-preview) + (target (concat texput "." format)) + (math (get 'YaTeX-typeset-conv2image-chain 'math)) + (dpi (get 'YaTeX-typeset-conv2image-chain 'dpi)) + (srctype (or (get 'YaTeX-typeset-conv2image-chain 'srctype) + (if (file-newer-than-file-p + (concat texput ".pdf") + (concat texput ".dvi")) + 'pdf 'dvi))) + (chain (cdr (assq srctype YaTeX-typeset-conv2image-chain-alist))) + ;; This function is the first evaluation code. + ;; If you find these command line does not work + ;; on your system, please tell the author + ;; which commands should be taken to achieve + ;; one-shot png previewing on your system + ;; before publishing patch on the Web. + ;; Please please please please please. + (curproc (member prevname chain)) + (w (get 'YaTeX-typeset-conv2image-chain 'win)) + (pwd default-directory) + img) + (if (not (= (process-exit-status proc) 0)) + (progn + (YaTeX-showup-buffer ;never comes here(?) + (current-buffer) 'YaTeX-showup-buffer-bottom-most) + (message "Region typesetting FAILED")) + (setq command + (if curproc (car (cdr-safe curproc)) (car chain))) + (if command + (let ((cmdline (YaTeX-replace-formats + command + (list (cons "b" "texput") + (cons "f" format) + (cons "d" dpi))))) + (insert (format "Calling `%s'...\n" cmdline)) + (set-process-sentinel + (setq YaTeX-typeset-conv2image-process + (start-process + command + (current-buffer) + shell-file-name YaTeX-shell-command-option + cmdline)) + 'YaTeX-typeset-sentinel) + (put 'YaTeX-typeset-process 'ppcmd + (cons (cons (get-buffer-process (current-buffer)) + '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) + ) + ))))) + + +(defvar YaTeX-typeset-environment-timer nil) +(defun YaTeX-typeset-environment-timer () + "Update preview image in the +Plist: '(buf begPoint endPoint precedingChar 2precedingChar Substring time)" + (let*((plist (get 'YaTeX-typeset-environment-timer 'laststate)) + (b (nth 0 plist)) + (s (nth 1 plist)) + (e (nth 2 plist)) + (p (nth 3 plist)) + (q (nth 4 plist)) + (st (nth 5 plist)) + (tm (nth 6 plist)) + (overlay YaTeX-on-the-fly-overlay) + (thresh (* 2 (or (get 'YaTeX-typeset-conv2image-chain 'elapse) 1)))) + (cond + ;; In minibuffer, do nothing + ((minibuffer-window-active-p (selected-window)) nil) + ;; If point went out from last environment, cancel timer + ;;;((and (message "s=%d, e=%d, p=%d" s e (point)) nil)) + ((null (buffer-file-name)) nil) ;;At momentary-string-display, it's nil. + ((or (not (eq b (window-buffer (selected-window)))) + (< (point) s) + (not (overlayp overlay)) + (not (eq (overlay-buffer overlay) (current-buffer))) + (> (point) (overlay-end overlay))) + (YaTeX-typeset-environment-cancel-auto)) + ;;;((and (message "e=%d, p=%d t=%s" e (point) (current-time)) nil)) + ;; If recently called, hold + ;;; ((< (YaTeX-elapsed-time tm (current-time)) thresh) nil) + ;; If condition changed from last call, do it + ((not (string= st (YaTeX-buffer-substring s (overlay-end overlay)))) + (YaTeX-typeset-environment))))) + + +(defun YaTeX-typeset-environment-by-lmp () + (save-excursion + (let ((sw (selected-window))) + (goto-char opoint) + (latex-math-preview-expression) + (select-window sw)))) + +(defun YaTeX-typeset-environment-by-builtin () + (save-excursion + (YaTeX-typeset-region 'YaTeX-typeset-conv2image-chain))) + +(defvar YaTeX-on-the-fly-math-preview-engine + (if (fboundp 'latex-math-preview-expression) + 'YaTeX-typeset-environment-by-lmp + 'YaTeX-typeset-environment-by-builtin) + "Function symbol to use math-preview. +'YaTeX-typeset-environment-by-lmp for using latex-math-preview, +'YaTeX-typeset-environment-by-builtin for using yatex-builtin.") + +(defun YaTeX-typeset-environment-1 () + (let*((math (YaTeX-in-math-mode-p)) + (dpi (or (YaTeX-get-builtin "IMAGEDPI") (if math "300" "200"))) + (opoint (point)) + usetimer) + (cond + ((and YaTeX-on-the-fly-overlay (overlayp YaTeX-on-the-fly-overlay) + (member YaTeX-on-the-fly-overlay (overlays-at (point)))) + ;; If current position is in on-the-fly overlay, + ;; use that region again + (setq math (get 'YaTeX-typeset-conv2image-chain 'math)) + (push-mark (overlay-start YaTeX-on-the-fly-overlay)) + (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)) + ((equal (or (YaTeX-inner-environment t) "document") "document") + (mark-paragraph)) + (t (setq usetimer t) (YaTeX-mark-environment))) + (if YaTeX-use-image-preview + (let ((YaTeX-typeset-buffer (concat "*bg:" YaTeX-typeset-buffer)) + (b (region-beginning)) (e (region-end))) + (put 'YaTeX-typeset-conv2image-chain 'math math) + (put 'YaTeX-typeset-conv2image-chain 'dpi dpi) + (put 'YaTeX-typeset-conv2image-chain 'srctype nil) + (put 'YaTeX-typeset-conv2image-chain 'win (selected-window)) + (put 'YaTeX-typeset-conv2image-chain 'start (current-time)) + (put 'YaTeX-typeset-environment-timer 'laststate + (list (current-buffer) b e (preceding-char) + (char-after (- (point) 2)) + (YaTeX-buffer-substring b e) + (current-time))) + (if math (funcall YaTeX-on-the-fly-math-preview-engine) + (YaTeX-typeset-region 'YaTeX-typeset-conv2image-chain)) + (if usetimer (YaTeX-typeset-environment-auto b e))) + (YaTeX-typeset-region)))) + (defun YaTeX-typeset-environment () - "Typeset current math environment" + "Typeset current environment or paragraph. +If region activated, use it." (interactive) - (save-excursion - (YaTeX-mark-environment) - (YaTeX-typeset-region))) + (let ((md (match-data))) + (unwind-protect + (save-excursion + (YaTeX-typeset-environment-1)) + (store-match-data md)))) + + +(defvar YaTeX-on-the-fly-preview-interval (string-to-number "0.9") + "*Control the on-the-fly update of preview environment by an image. +Nil disables on-the-fly update. Otherwise on-the-fly update is enabled +with update interval specified by this value.") + +(defun YaTeX-typeset-environment-auto (beg end) + "Turn on on-the-fly preview-image" + (if YaTeX-typeset-environment-timer + (cancel-timer YaTeX-typeset-environment-timer)) + (if YaTeX-on-the-fly-overlay + (move-overlay YaTeX-on-the-fly-overlay beg end) + (overlay-put + (setq YaTeX-on-the-fly-overlay (make-overlay beg end)) + 'face 'YaTeX-on-the-fly-activated-face)) + (setq YaTeX-typeset-environment-timer + (run-with-idle-timer + (max (string-to-number "0.1") + (cond + ((numberp YaTeX-on-the-fly-preview-interval) + YaTeX-on-the-fly-preview-interval) + ((stringp YaTeX-on-the-fly-preview-interval) + (string-to-number YaTeX-on-the-fly-preview-interval)) + (t 1))) + t 'YaTeX-typeset-environment-timer))) + +(defun YaTeX-typeset-environment-activate-onthefly () + (if (get-text-property (point) 'onthefly) + (save-excursion + (if YaTeX-typeset-environment-timer + (progn + (cancel-timer YaTeX-typeset-environment-timer) + (setq YaTeX-typeset-environment-timer nil))) + (if (YaTeX-on-begin-end-p) + (if (or (match-beginning 1) (match-beginning 3)) ;on beginning + (goto-char (match-end 0)) + (goto-char (match-beginning 0)))) + (YaTeX-typeset-environment)))) + +(defun YaTeX-on-the-fly-cancel () + "Reset on-the-fly stickiness" + (interactive) + (YaTeX-typeset-environment-cancel-auto 'stripoff) + t) ;t for kill-* + +(defun YaTeX-typeset-environment-cancel-auto (&optional stripoff) + "Cancel typeset-environment timer." + (interactive) + (if YaTeX-typeset-environment-timer + (cancel-timer YaTeX-typeset-environment-timer)) + (setq YaTeX-typeset-environment-timer + (run-with-idle-timer + (string-to-number "0.1") + t + 'YaTeX-typeset-environment-activate-onthefly)) + (let ((ov YaTeX-on-the-fly-overlay)) + (if stripoff + (remove-text-properties (overlay-start ov) + (1- (overlay-end ov)) + '(onthefly)) + (put-text-property (overlay-start YaTeX-on-the-fly-overlay) + (1- (overlay-end YaTeX-on-the-fly-overlay)) + 'onthefly + t)) + (delete-overlay ov) + (message "On-the-fly preview deactivated"))) (defun YaTeX-typeset-buffer (&optional pp) "Typeset whole buffer. @@ -505,14 +844,21 @@ (format "%s %s" default mainroot)) 'YaTeX-call-command-history)) (if (or update (null b-in)) - (if (y-or-n-p "Use this command line in the future? ") + (if (y-or-n-p "Memorize this command line in this file? ") (YaTeX-getset-builtin builtin-type command) ;keep in a file (setq YaTeX-call-builtin-on-file ;keep in memory (cons (cons builtin-type command) - (delete (assoc builtin-type alist) alist))))))) + (delete (assoc builtin-type alist) alist))) + (message "`%s' kept in memory. Type `%s %s' to override." + command + (key-description + (car (where-is-internal 'universal-argument))) + (key-description (this-command-keys))) + (sit-for 2))))) (YaTeX-typeset command - (format " *YaTeX-%s*" (downcase builtin-type))))) + (format " *YaTeX-%s*" (downcase builtin-type)) + builtin-type builtin-type))) (defun YaTeX-kill-typeset-process (proc) "Kill process PROC after sending signal to PROC. @@ -537,28 +883,36 @@ (interrupt-process proc) (delete-process proc)))))) -(defun YaTeX-system (command buffer) - "Execute some command on buffer. Not a official function." +(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." (save-excursion - (YaTeX-showup-buffer - buffer (function (lambda (x) (nth 3 (window-edges x))))) - (let ((df default-directory)) ;preserve current buf's pwd - (set-buffer (get-buffer-create buffer)) ;1.61.3 - (setq default-directory df) - (cd df)) - (erase-buffer) - (if (not (fboundp 'start-process)) - (call-process - shell-file-name nil buffer nil YaTeX-shell-command-option command) - (if (and (get-buffer-process buffer) - (eq (process-status (get-buffer-process buffer)) 'run) - (not - (y-or-n-p (format "Process %s is running. Continue?" buffer)))) - nil - (set-process-buffer - (start-process - "system" buffer shell-file-name YaTeX-shell-command-option command) - (get-buffer buffer)))))) + (let ((df default-directory) + (buffer (get-buffer-create (format " *%s*" name))) + proc status) + (set-buffer buffer) + (setq default-directory (cd (or basedir df))) + (erase-buffer) + (insert (format "Calling `%s'...\n" command) + "==Kill this buffer to STOP process==") + (YaTeX-showup-buffer buffer 'YaTeX-showup-buffer-bottom-most) + (if (not (fboundp 'start-process)) + (call-process + shell-file-name nil buffer nil YaTeX-shell-command-option command) + (if (and (setq proc (get-buffer-process buffer)) + (setq status (process-status proc)) + (eq status 'run) + (not noask) + (not + (y-or-n-p (format "Process %s is running. Continue?" buffer)))) + nil + (if (eq status 'run) + (progn (interrupt-process proc) (delete-process proc))) + (set-process-buffer + (start-process + name buffer shell-file-name YaTeX-shell-command-option command) + (get-buffer buffer))))))) (defvar YaTeX-default-paper-type "a4" "*Default paper type.") @@ -602,33 +956,50 @@ (defvar YaTeX-preview-file-history nil "Holds minibuffer history of file to preview.") (put 'YaTeX-preview-file-history 'no-default t) -(defun YaTeX-preview (preview-command preview-file) +(defun YaTeX-preview-default-previewer () + "Return default previewer for this document" + (YaTeX-replace-format + (if (eq (get 'dvi2-command 'format) 'pdf) + (or (YaTeX-get-builtin "PDFVIEW") + tex-pdfview-command) + (or (YaTeX-get-builtin "PREVIEW") + dvi2-command)) + "p" (format (cond + (YaTeX-dos "-y:%s") + (t "-paper %s")) + (YaTeX-get-paper-type)))) +(defun YaTeX-preview-default-main (command) + "Return default preview target file" + (if (get 'dvi2-command 'region) + (substring YaTeX-texput-file + 0 (rindex YaTeX-texput-file ?.)) + (YaTeX-get-preview-file-name command))) +(defun YaTeX-preview (preview-command preview-file &optional as-default) "Execute xdvi (or other) to tex-preview." (interactive - (let* ((command (read-string-with-history - "Preview command: " - (YaTeX-replace-format - (or (YaTeX-get-builtin "PREVIEW") dvi2-command) - "p" (format (cond - (YaTeX-dos "-y:%s") - (t "-paper %s")) - (YaTeX-get-paper-type))) - 'YaTeX-preview-command-history)) - (file (read-string-with-history - "Preview file: " - (if (get 'dvi2-command 'region) - (substring YaTeX-texput-file - 0 (rindex YaTeX-texput-file ?.)) - (YaTeX-get-preview-file-name command)) - 'YaTeX-preview-file-history))) + (let* ((previewer (YaTeX-preview-default-previewer)) + (as-default current-prefix-arg) + (command (if as-default + previewer + (read-string-with-history + "Preview command: " + previewer + 'YaTeX-preview-command-history))) + (target (YaTeX-preview-default-main command)) + (file (if as-default + target + (read-string-with-history + "Preview file: " + target + 'YaTeX-preview-file-history)))) (list command file))) - (setq dvi2-command preview-command) ;`dvi2command' is buffer local + (setq dvi2-command preview-command) ;`dvi2-command' is buffer local (save-excursion (YaTeX-visit-main t) (if YaTeX-dos (setq preview-file (expand-file-name preview-file))) (let ((pbuffer "*dvi-preview*") (dir default-directory)) (YaTeX-showup-buffer - pbuffer (function (lambda (x) (nth 3 (window-edges x))))) + pbuffer 'YaTeX-showup-buffer-bottom-most) (set-buffer (get-buffer-create pbuffer)) (erase-buffer) (setq default-directory dir) ;for 18 @@ -683,7 +1054,64 @@ (concat (YaTeX-get-preview-file-name) ".dvi"))) (message "Searching `%s'...Done" str)))) -(defun YaTeX-set-virtual-error-position (file-sym line-sym) +(defun YaTeX-preview-jlfmt-xdvi () + "Call xdvi -sourceposition to DVI corresponding to current main file" + (interactive)) + +(defun YaTeX-preview-jump-line () + "Call jump-line function of various previewer on current main file" + (interactive) + (save-excursion + (save-restriction + (widen) + (let*((pf (or YaTeX-parent-file + (save-excursion (YaTeX-visit-main t) (buffer-file-name)))) + (pdir (file-name-directory pf)) + (bnr (substring pf 0 (string-match "\\....$" pf))) + (cf (file-relative-name (buffer-file-name) pdir)) + (buffer (get-buffer-create " *preview-jump-line*")) + (line (count-lines (point-min) (point-end-of-line))) + (previewer (YaTeX-preview-default-previewer)) + (cmd (cond + ((string-match "xdvi" previewer) + (format "%s -nofork -sourceposition '%d %s' %s.dvi" + YaTeX-xdvi-remote-program + line cf bnr)) + ((string-match "Skim" previewer) + (format "%s %d '%s.pdf' '%s'" + YaTeX-cmd-displayline line bnr cf)) + ((string-match "evince" previewer) + (format "%s '%s.pdf' %d '%s'" + "fwdevince" bnr line cf)) + ;; + ;; These lines below for other PDF viewer is not confirmed + ;; yet. If you find correct command line, PLEASE TELL + ;; IT TO THE AUTHOR before publishing patch on the web. + ;; ..PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE.. + ((string-match "sumatra" previewer) ;;?? + (format "%s \"%s.pdf\" -forward-search \"%s\" %d" + ;;Send patch to the author, please + previewer bnr cf line)) + ((string-match "qpdfview" previewer) ;;?? + (format "%s '%s.pdf#src:%s:%d:0'" + ;;Send patch to the author, please + previewer bnr cf line)) + ((string-match "okular" previewer) ;;?? + (format "%s '%s.pdf#src:%d' '%s'" + ;;Send patch to the author, please + previewer bnr line cf)) + ))) + (YaTeX-system cmd "jump-line" 'noask pdir))))) + +(defun YaTeX-goto-corresponding-viewer () + (let ((cmd (or (YaTeX-get-builtin "!") tex-command))) + (if (string-match "-src\\|synctex=" cmd) + (progn + (YaTeX-preview-jump-line) + t) ;for YaTeX-goto-corresponding-* + nil))) + + (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) @@ -847,9 +1275,9 @@ (widen)))) (defvar YaTeX-dvi2-command-ext-alist - '(("[agx]dvi\\|dviout" . ".dvi") + '(("[agxk]dvi\\|dviout" . ".dvi") ("ghostview\\|gv" . ".ps") - ("acroread\\|pdf\\|Preview\\|TeXShop\\|Skim\\|evince" . ".pdf"))) + ("acroread\\|[xk]pdf\\|pdfopen\\|Preview\\|TeXShop\\|Skim\\|evince\\|mupdf\\|zathura\\|okular" . ".pdf"))) (defun YaTeX-get-preview-file-name (&optional preview-command) "Get file name to preview by inquiring YaTeX-get-latex-command" @@ -859,6 +1287,9 @@ (fname (if rin (substring latex-cmd (1+ rin)) "")) (r (YaTeX-assoc-regexp preview-command YaTeX-dvi2-command-ext-alist)) (ext (if r (cdr r) ""))) + (and (null r) + (eq (get 'dvi2-command 'format) 'pdf) + (setq ext "pdf")) (concat (if (string= fname "") (setq fname (substring (file-name-nondirectory @@ -873,12 +1304,12 @@ strings are assumed to be the latex-command and arguments. The default value of latex-command is: tex-command FileName -and if you write \"%#!jlatex\" in the beginning of certain line. - \"jlatex \" FileName +and if you write \"%#!platex\" in the beginning of certain line. + \"platex \" FileName will be the latex-command, -and you write \"%#!jlatex main.tex\" on some line and argument SWITCH +and you write \"%#!platex main.tex\" on some line and argument SWITCH is non-nil, then - \"jlatex main.tex\" + \"platex main.tex\" will be given to the shell." (let (parent tparent magic) @@ -896,9 +1327,9 @@ (cond (magic (cond - (switch (if (string-match "\\s " magic) magic + (switch (if (string-match "\\s [^-]\\S *$" magic) magic (concat magic " " parent))) - (t (concat (substring magic 0 (string-match "\\s " magic)) " ")))) + (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 ?.))))))) @@ -956,7 +1387,7 @@ (YaTeX-visit-main t) ;;change execution directory (setq dir default-directory) (YaTeX-showup-buffer - lbuffer (function (lambda (x) (nth 3 (window-edges x))))) + lbuffer 'YaTeX-showup-buffer-bottom-most) (set-buffer (get-buffer-create lbuffer)) (erase-buffer) (cd dir) ;for 19 @@ -997,7 +1428,7 @@ (let ((ff (function (lambda (f) (if setbuf (set-buffer (find-file-noselect f)) (find-file f))))) - b-in main-file YaTeX-create-file-prefix-g + b-in main-file mfa YaTeX-create-file-prefix-g (hilit-auto-highlight (not setbuf))) (if (setq b-in (YaTeX-get-builtin "!")) (setq main-file (YaTeX-guess-parent b-in))) @@ -1022,14 +1453,14 @@ ((and main-file (file-exists-p (setq main-file (concat "../" main-file))) (or b-in - (y-or-n-p (concat (expand-file-name main-file) + (y-or-n-p (concat (setq mfa (expand-file-name main-file)) " is main file?:")))) - (setq YaTeX-parent-file main-file) + (setq YaTeX-parent-file mfa) ;(YaTeX-switch-to-buffer main-file setbuf) (funcall ff main-file) ) (t (setq main-file (read-file-name "Enter your main text: " nil nil 1)) - (setq YaTeX-parent-file main-file) + (setq YaTeX-parent-file (expand-file-name main-file)) ; (YaTeX-switch-to-buffer main-file setbuf)) (funcall ff main-file)) ))) @@ -1037,8 +1468,8 @@ (defun YaTeX-guess-parent (command-line) (setq command-line - (if (string-match ".*\\s " command-line) - (substring command-line (match-end 0)) + (if (string-match "\\s \\([^-]\\S *\\)$" command-line) + (substring command-line (match-beginning 1)) (file-name-nondirectory (buffer-file-name))) command-line (concat (if (string-match "\\(.*\\)\\." command-line) @@ -1058,13 +1489,14 @@ (basic-save-buffer) (let ((cmm major-mode)) (save-excursion - (mapcar '(lambda (buf) + (mapcar (function + (lambda (buf) (set-buffer buf) (if (and (buffer-file-name buf) (eq major-mode cmm) (buffer-modified-p buf) (y-or-n-p (format "Save %s" (buffer-name buf)))) - (save-buffer buf))) + (save-buffer buf)))) (buffer-list))))) (provide 'yatexprc) diff -r 130c104fe22e -r e37af485338a yatexsec.el --- a/yatexsec.el Mon May 14 19:59:12 2012 +0900 +++ b/yatexsec.el Sun Jul 12 14:21:20 2015 +0900 @@ -1,10 +1,10 @@ -;;; -*- Emacs-Lisp -*- -;;; YaTeX sectioning browser. -;;; yatexsec.el -;;; (c) 1994-2012 by HIROSE Yuuji [yuuji@yatex.org] -;;; Last modified Mon Jan 9 20:20:32 2012 on firestorm +;;; yatexsec.el --- YaTeX sectioning browser +;;; +;;; (c) 1994-2013 by HIROSE Yuuji [yuuji@yatex.org] +;;; Last modified Sun Dec 21 14:16:35 2014 on firestorm ;;; $Id$ +;;; Code: (defvar YaTeX-sectioning-level '(("part" . 0) ("chapter" . 1) @@ -55,9 +55,9 @@ (define-key YaTeX-sectioning-minibuffer-map "\C-r" 'YaTeX-sectioning-scroll-down) (define-key YaTeX-sectioning-minibuffer-map "\C-w" - '(lambda () (interactive) (YaTeX-sectioning-scroll-down 1))) + (function (lambda () (interactive) (YaTeX-sectioning-scroll-down 1)))) (define-key YaTeX-sectioning-minibuffer-map "\C-z" - '(lambda () (interactive) (YaTeX-sectioning-scroll-up 1))) + (function (lambda () (interactive) (YaTeX-sectioning-scroll-up 1)))) (define-key YaTeX-sectioning-minibuffer-map "\C-l" 'YaTeX-sectioning-recenter) (define-key YaTeX-sectioning-minibuffer-map "?" @@ -181,7 +181,7 @@ (defun YaTeX-sectioning-hide () "Call YaTeX-sectioning-hide-under with argument according to pressed key." (interactive) - (YaTeX-sectioning-hide-under (- last-command-char ?0))) + (YaTeX-sectioning-hide-under (- (YaTeX-last-key) ?0))) (defun YaTeX-sectioning-help () "Show help of sectioning."