# HG changeset patch # User yuuji # Date 787957221 0 # Node ID b0371b6ed799cdbe0acbfa6ff8c1a742d003d5e7 # Parent b1e036697b20d731958d41bd0857dcbff5f907e4 Created `ChangeLog'. Log hereafter will be written in `ChangeLog'. diff -r b1e036697b20 -r b0371b6ed799 docs/yatex.ref --- a/docs/yatex.ref Fri Nov 25 08:26:13 1994 +0000 +++ b/docs/yatex.ref Tue Dec 20 21:00:21 1994 +0000 @@ -141,7 +141,7 @@ ◆おまかせ改行 ESC RET 「おまかせ改行」は tabular, array, itemize, enumerate, list, - description 環境でで有効です。 + description 環境で有効です。 広瀬雄二 yuuji@ae.keio.ac.jp diff -r b1e036697b20 -r b0371b6ed799 docs/yatexe.tex --- a/docs/yatexe.tex Fri Nov 25 08:26:13 1994 +0000 +++ b/docs/yatexe.tex Tue Dec 20 21:00:21 1994 +0000 @@ -25,25 +25,25 @@ @cindex YaTeX @menu -* What is YaTeX?:: -* Main features:: -* Installation:: -* Typesetting:: -* %# notation:: -* Completion:: -* Local dictionaries:: -* Commenting out:: -* Cursor jump:: -* Changing and Deleting:: -* Filling an item:: -* Updation of @code{\includeonly}:: -* What column?:: -* Intelligent newline:: -* Online help:: -* Cooperation with other packages:: -* Customizations:: -* Etcetera:: -* Copying:: +* What is YaTeX?:: Introduction +* Main features:: What YaTeX can do +* Installation:: Guide to install +* Typesetting:: Call typesetting processes +* %# notation:: Quick notation of controlling YaTeX +* Completion:: Input LaTeX commands with completion +* Local dictionaries:: Directory dependent completion +* Commenting out:: Commenting/uncommenting text +* Cursor jump:: Jumping to related position +* Changing and Deleting:: Changing/deleting certain unit of text +* Filling:: Filling an item or paragraph +* Updation of @code{\includeonly}:: Maintaining @code{\includeonly} +* What column?:: Column position guide in tabular +* Intelligent newline:: Guess requisites of new line +* Online help:: On-line documentation of LaTeX +* Cooperation with other packages:: Work well with gmhist, min-out +* Customizations:: How to breed `Wild Bird' +* Etcetera:: YaTeX is acquisitive. +* Copying:: Redistribution --- The Detailed Node Listing --- @@ -265,7 +265,13 @@ @end example @noindent -anywhere in the source text. And if you split the source text and +anywhere in the source text. This is useful for changing +typesetter. + +@node Splitting input files, Static region for typesetting, Changing typesetter, %# notation +@comment node-name, next, previous, up + + And if you split the source text and edit subfile that should be included from main text. @example @@ -285,13 +291,14 @@ Note that YaTeX assumes the component before the last period of the last word in this line as base name of the main La@TeX{} source. - Here are the restrictions on splitting sources. + To make best use of the feature of inter-file jumping by +@kbd{[prefix] g} (see @ref{Cursor jump}), take described below into +consideration. @itemize -@item All the file name should be different. @item You can put split texts in sub directory, but not in sub directory of sub directory. -@item In the main text,specify the file with relative path name +@item In the main text, specify the child file name with relative path name such as \include{chap1/sub}, when you include the file in a sub-directory. @item In a sub-text, write @code{%#!latex main.tex} even if @file{main.tex} @@ -864,12 +871,14 @@ minibuffer, YaTeX asks you with the following prompt; @example - `foo' is not in table. Register into: U)serTable L)ocal N)one + `foo' is not in table. Register into: U)serDic L)ocalDic N)one D)iscad @end example @noindent -In this menu, typing `u' updates your `user dictionary', `l' updates your -local dictionary, and `n' updates no dictionary and throws the word away. +In this menu, typing @kbd{u} updates your `user dictionary', @kbd{l} +updates your local dictionary, @kbd{n} updates only on-memory dictionary +which go through only current Emacs session, and @kbd{d} updates no +dictionary and throws the new word away. If you find this switching feature meaningless and bothersome, put the next expression into your @file{~/.emacs} @@ -948,6 +957,8 @@ @cindex cursor jump @cindex prefix g +@section Jump to corresponding object + Typing @table @kbd @@ -970,14 +981,27 @@ On a @code{\begin},@code{\end} line, typing @kbd{[prefix] g} moves the cursor to the corresponding @code{\end},@code{\begin} line, if its partner -really exists. The behaviour on the line @code{%#BEGIN} and @code{%#END} +really exists. The behavior on the line @code{%#BEGIN} and @code{%#END} are the same. Note that if the correspondent of @code{label/ref} or -@code{cite/bibitem} exists in another file, that file have to be opend to +@code{cite/bibitem} exists in another file, that file have to be opened to make a round trip between references by @kbd{[prefix] g}. If you type @code{[prefix] g} on the line of @code{\include@{chap1@}}, typically in the main text, YaTeX switches buffer to @file{chap1.tex}. -The key strokes below work to the contrary. Typing + +@table @kbd +@item [prefix] 4 g + @dots{} go to corresponding object in other window +@end table + +@noindent +do the same job as @kbd{[prefix] g} except it's done in other window. +Note that this function doesn't work on @code{begin/end}, +@code{%#BEGIN/%#END} pairs because it is meaningless. + +@section Jump to main file + + Typing @table @kbd @item [prefix] ^ @@ -991,6 +1015,8 @@ in a sub text switch the buffer to the main text specified by @code{%#!} notation. +@section Other jumping features + And these are the functions which work on the current La@TeX{} environment: @@ -1006,7 +1032,7 @@ @cindex M-C-e @cindex M-C-@@ -@node Changing and Deleting, Filling an item, Cursor jump, Top +@node Changing and Deleting, Filling, Cursor jump, Top @comment node-name, next, previous, up @chapter Changing and Deleting @@ -1084,13 +1110,16 @@ ~(cursor) @end example -@node Filling an item, Updation of @code{\includeonly}, Changing and Deleting, Top +@node Filling, Updation of @code{\includeonly}, Changing and Deleting, Top @comment node-name, next, previous, up -@chapter Filling an item +@chapter Filling +@cindex filling + +@section Filling an item @cindex filling an item @cindex prefix i - To fill a term (sentence) of @code{\item}, type + To fill a term (descriptive sentences) of @code{\item}, type @table @kbd @item [prefix] i @@ -1102,7 +1131,7 @@ YaTeX uses the value of the variable @code{YaTeX-item-regexp} as the regular expression to search item header in itemize environment. -If you make a newcommand to itemize terms(eg. @code{\underlineitem}), put +If you make a newcommand to itemize terms(e.g. @code{\underlineitem}), put @lisp (setq YaTeX-item-regexp @@ -1114,7 +1143,42 @@ for Emacs-Lisp, name a newcommand for `itemize' beginning with @code{\item} such as @code{\itembf}, not @code{\bfitem}. -@node Updation of @code{\includeonly}, What column?, Filling an item, Top + This function -- YaTeX-fill-item -- reformats the @code{\item} into +`hang-indented' style. When you separate the topic word and its +description, use @kbd{M-q} instead. For example: + +@example +Hang indentation: + > + >\item[foo] `foo' is the typical word for describing an + > arbitrarily written.... + +Normal indentation: + > + > \item bar + > + > When the word `for' is used as an arbitrarily word, `bar' + > is bound to follow it. +@end example + + Note that the indent depth of the @code{\item} and its descriptive +paragraph are the same in latter case. If you want to use different +depth, invoke fill-paragraph at the beginning of non-whitespace +character(see below). + +@section Filling paragraph +@cindex Filling paragraph +@cindex M-q + + Fill-paragraph is little bit adapted for La@TeX{} sources. It retains from +filling in certain environments where formatting leads to a disaster such +as verbatim, tabular, or so. And it protects @code{\verb} expressions +from being folded (The variable @code{YaTeX-verb-regexp} controls this). +Besides, putting cursor on the first occurrence of non-whitespace +character on a line changes the fill-prefix temporarily to the depth of +the line. + +@node Updation of @code{\includeonly}, What column?, Filling, Top @comment node-name, next, previous, up @chapter Updation of @code{\includeonly} @cindex includeonly @@ -1448,6 +1512,11 @@ Regexp of La@TeX{} itemization command (@code{"\\\\(sub\\)*item"}) @end defvar +@defvar YaTeX-verb-regexp + Regexp of La@TeX{} verb command family. Omit \\\\. + (@code{"verb\\*?\\|path"}) +@end defvar + @defvar YaTeX-nervous T for using local dictionary (@code{t}) @end defvar @@ -1475,6 +1544,12 @@ Switch math-mode automatically(@code{t}) @end defvar +@defvar YaTeX-math-key-list-private + User defined alist, math-mode-prefix vs completion alist + used in image completion(@code{nil}). See @file{yatexmth.el} + for the information about how to define a completion alist. +@end defvar + @defvar YaTeX-default-pop-window-height Initial height of typesetting buffer when one-window. Number for the lines of the buffer, numerical string for @@ -1624,7 +1699,7 @@ concatenating `YaTeX::' and section-type command, is called automatically with an integer argument which indicates which argument of section-type command is being read. Thus the add-in should determine the -job refering the value of its argument. +job referring the value of its argument. @menu * Defining `option add-in':: @@ -1718,13 +1793,13 @@ @itemx [A] Base prompt, X-axis prompt, Y-axis prompt (each optional) @itemx [D] - Read the coodinates with the prompt ``BasePrompt X-axisPrompt:'' for + 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 @code{Dimention}, @code{X}, +of ``(X,Y)''. The default prompts are @code{Dimension}, @code{X}, @code{Y} respectively. @item [F] -YaTeX:check-comletion-type +YaTeX:check-completion-type @itemx [A] One of the symbols: 'begin, 'section, or 'maketitle @itemx [D] @@ -1831,9 +1906,9 @@ @item Position read positional option (like [htbp]) @item Coord. -read coodinates +read coordinates @item Quit -quit from genarating +quit from generating @end table Since (A) is the optional argument to specify the location of included @@ -1930,7 +2005,7 @@ @subsection Contribution If you get your own pretty function and you let it be in public, please -steel yourself in the happy atomospher and do not send me the function. +steel yourself in the happy atmosphere and do not send me the function. I do know it is not fine because it is generated by yatexgen:-p. @node Etcetera, Copying, Customizations, Top @@ -1944,6 +2019,8 @@ use completion in order to enrich your dictionary, and you will also find `Wild Bird' growing suitable for your La@TeX{} style. + The package name `Wild Bird' is the English translation of Japanese +title `Yachou', which is a trick on words of Japanese. @node Copying, , Etcetera, Top @comment node-name, next, previous, up diff -r b1e036697b20 -r b0371b6ed799 docs/yatexj.tex --- a/docs/yatexj.tex Fri Nov 25 08:26:13 1994 +0000 +++ b/docs/yatexj.tex Tue Dec 20 21:00:21 1994 +0000 @@ -24,23 +24,74 @@ * Intro:: はじめに * Main features:: 主な機能 * Installation:: インストール -* Invocation:: 外部コマンドの起動 +* Invocation:: プロセス起動 * %#notation :: %#記法 * Completion:: 補完入力 * Local dictionary:: ローカル辞書 * Commenting out:: コメントアウト * Cursor jump:: カーソルジャンプ -* Modifying/Deleting:: 変更/削除 -* Filling item:: itemの桁揃え -* Includeonly:: 勝手にincludeonly -* What column:: ここはどこ? +* Modifying/Deleting:: LaTeXコマンドの変更/削除 +* Filling:: 桁揃え +* Includeonly:: 勝手に includeonly +* What column:: カラム位置ガイド * Intelligent newline:: おまかせ改行 -* Online help:: オンラインヘルプ +* Online help:: LaTeXオンラインヘルプ * Cooperation with other packages:: 他パッケージとの連携 * Customizations:: カスタマイズ * Etc:: その他 * Copying:: 取り扱い * Concept Index:: 索引 + + --- The Detailed Node Listing --- + +latexコマンド起動 + +* Calling typesetter:: タイプセッタ起動 +* Print out:: プリントアウト用コマンドの起動 + +%#記法 + +* Changing typesetter:: タイプセット用コマンドの変更 +* Splitting input files:: 入力ファイル分割 +* Fix region for typesetting:: 領域の固定 +* lpr format:: プリントアウトコマンド用フォーマット +* Editing %# notation:: %#記法の編集 + +補完入力 + +* begin型補完:: +* section型補完:: +* large型補完:: +* maketitle型補完:: +* Arbitrary completion:: 随時補完 +* end補完:: +* Accent mark completion:: アクセント記号補完 +* Image completion:: 数式記号イメージ補完 +* Greek letter completion:: ギリシャ文字補完 + +section型補完 + +* 2個以上の引数をとる section型コマンド:: +* Enclose region-type command:: +* Recursive completion:: 再帰補完 +* view-sectioning:: セクション区切りのアウトライン表示 + +変更/削除 + +* Changing LaTeX command:: La@TeX{} コマンドの変更 +* Killing LaTeX command:: La@TeX{} コマンドの削除 + +カスタマイズ + +* Lisp variables:: lisp 変数 +* Add-in functions:: 付加関数(アドイン関数) + +lisp 変数 + +* All customizable variables:: カスタマイズ変数一覧 +* Sample definitions:: カスタマイズ変数設定例 +* Hook variables:: hook変数 +* Hook file:: hook用ファイル @end menu @node Intro, Main features, Top, Top @@ -233,7 +284,7 @@ @cindex 起動するコマンドを変える[きとうするこまんとをかえる] @example - %#!jlatex-ntt example + %#!jlatex-ntt @end example NTT jTeX と、ASCII jTeX を使い分けたいような場合に便利でしょう。 @@ -267,12 +318,12 @@ なお、この行の最後の単語のピリオド以前を「メインファイル」のベース ネームであると仮定します(上の2つの場合どちらも@file{main})。 - 入力ファイル分割時には次のことに注意して下さい。 + @kbd{[prefix] g} (@ref{Cursor jump}参照) での +ファイル間ジャンプを有効に機能させるため、入力ファイル分割時には次のことに +注意して下さい。 @enumerate @item -同時に編集するファイル群の名前は重複のないようにする。 -@item サブディレクトリを作って、その中にサブファイルを置くことはできるが サブディレクトリのサブディレクトリには置けない。 @item @@ -904,7 +955,6 @@ @chapter ローカル辞書 @cindex ローカル辞書[ろおかるししよ] @cindex .yatexrc -@cindex 変な単語[へんなたんこ] 補完入力用の候補は三種類の辞書から構成されています。一つは @file{yatex.el}に組み込まれた「標準辞書」、もう一つはユーザが個人的に常用 @@ -915,13 +965,14 @@ 来ます。 @example - `foo' is not in table. Register into: U)serTable L)ocal N)one + `foo' is not in table. Register into: U)serDic L)ocalDic N)one D)iscard @end example @noindent というプロンプトに対し、@kbd{u}と答えると「ユーザ辞書」を、@kbd{l}と答える -とローカル辞書を更新することになり、@kbd{n}と答えると新たな単語を学習せず -に捨てることになります。 +とローカル辞書を更新し、@kbd{n}と答えると辞書ファイルは更新せず現在のEmacs +セッションのみ有効な単語とし、@kbd{d}と答えると新たな単語を学習せずに捨て +ることになります。 もし、ローカル辞書の機能はいらず、全てユーザ辞書の更新のみでよいと言う場 合には@file{~/.emacs}などで、 @@ -934,6 +985,11 @@ @noindent として下さい。 +@cindex 変な単語[へんなたんこ] + もし、綴の間違ったものなど、変な単語が学習されてしまった場合は + + + @node Commenting out, Cursor jump, Local dictionary, Top @comment node-name, next, previous, up @chapter コメントアウト @@ -1004,6 +1060,8 @@ @cindex カーソルジャンプ[かあそるしやんふ] @cindex prefix g +@section 対応オブジェクトへのジャンプ + 文書中のいろいろな場所で @table @kbd @@ -1028,11 +1086,24 @@ ない場合はエラーになります。またこれは、領域固定のための @code{%#BEGIN} と @code{%#END} のペアに対しても同様に動作します。なお、@code{label/ref}や @code{cite/bibitem}対応するものが別ファイルにある時は、ジャンプ先となるファ -イルがオープンされていなければなりません。 -@xref{%#記法} +イルがオープンされていなければなりません。@xref{%#記法} +メインの .tex ファイルの @code{\include{chap1}} などにカーソルを合わせ、 +@kbd{[prefix] g} を押すと、@file{chap1.tex} にジャンプします。 - メインの .tex ファイルの @code{\include{chap1}} などにカーソルを合わせ、 -@kbd{[prefix] g} を押すと、@file{chap1.tex} にジャンプします。また、 +また、 + +@table @kbd +@item [prefix] 4 g + @dots{} 別ウィンドウで対応オブジェクトにジャンプ +@end table + +@noindent +を押すと、対応するオブジェクトへのジャンプを別ウィンドウで行います。ただし、 +この機能は @code{begin/end}, @code{%#BEGIN/%#END} 間のジャンプに対しては +(意味がないと思われるので)機能しないので注意してください。 + +@section メインファイルへのジャンプ + @file{chap1.tex}のようなサブファイルで、 @table @kbd @@ -1045,7 +1116,11 @@ @noindent を押すと、メインファイルの編集バッファに切替えます。もし、メインファイルを オープンしていない場合は、カレントディレクトリから探して自動的にオープンし -ます。さらに現在の環境を単位として機能するコマンドに以下のものがあります。 +ます。 + +@section 環境を単位としたジャンプ + +さらに現在の環境を単位として機能するコマンドに以下のものがあります。 @cindex 環境の先頭へ[かんきようのせんとうへ] @cindex 環境の末尾へ[かんきようのまつひへ] @@ -1067,7 +1142,7 @@ -@node Modifying/Deleting, Filling item, Cursor jump, Top +@node Modifying/Deleting, Filling, Cursor jump, Top @comment node-name, next, previous, up @chapter 変更/削除 @cindex 変更/削除[へんこう/さくしよ] @@ -1149,10 +1224,13 @@ ↑(カーソル位置) @end example -@node Filling item, Includeonly, Modifying/Deleting, Top +@node Filling, Includeonly, Modifying/Deleting, Top @comment node-name, next, previous, up -@chapter itemの桁揃え -@cindex itemの桁揃え[itemのけたそろえ] +@chapter 桁揃え +@cindex 桁揃え[けたそろえ] + +@section itemの桁揃え +@cindex itemなどの桁揃え[itemなとのけたそろえ] @cindex prefix i itemize 環境中にある@code{\item}の項目(文章)が複数行に渡る場合に、項 @@ -1184,7 +1262,40 @@ この変数の指定の仕方がよく分からない場合は、独自の項目列挙コマンドの名前を @code{@code{"\item"}で始まるものにして下さい(例えば"\itembf"})。 -@node Includeonly, What column, Filling item, Top + @kbd{[prefix] i} では@code{\item} を「ハングインデント」に整形します。も +し@code{\item}とその説明用パラグラフを切り離す時は通常の +@kbd{M-q}(他のモードではfill-paragraphが割り当てられている)を使ってくださ +い。(つまり以下のような場合:) + +@example +ハングインデント: + >\item[ほげほげ] 英語では、特に意味のない単語を `foo' であらわしま + > すが、これの日本語版ともいえる単語が「ほげほげ」 + > です。 +通常インデント: + > \item へろへろ + > + > 「ほげほげ」をでたらめが単語として使った時に、第2のでたらめな + > 単語として「へろへろ」が使われることが多いようです。 +@end example + + 上の通常インデントの場合、説明パラグラフのインデントは \item と同じ深さ +とする必要があります。ただし、@kbd{M-q}を行の最初の非空白文字の位置で押す +ことにより深さを変えることができます(後述)。 + +@section パラグラフの桁揃え +@cindex パラグラフの桁揃え[はらくらふのけたそろえ] +@cindex M-q + + パラグラフの桁揃え(fill)は、基本的に通常通り機能しますが、verbatim環境や、 +tabular環境など桁揃えをすると悲惨な状況になるような環境中では機能しません。 +また、\verb で括ってあるものは決して行分割されません(変数 +@code{YaTeX-verb-regexp} で制御) )。さらに、一時的にインデントの深さを変え +てある箇所では、そのインデントの先頭で@kbd{M-q}を押すことにより +fill-prefix をいちいち変更しなくて桁揃えができます。 + + +@node Includeonly, What column, Filling, Top @comment node-name, next, previous, up @chapter 勝手にincludeonly @cindex 勝手にincludeonly[かつてにincludeonly] @@ -1441,7 +1552,11 @@ @end defvar @defvar YaTeX-item-regexp -itemの桁揃えの時に用いる、itemの正規表現(@code{"\\\\item"}) +itemの桁揃えの時に用いる、itemの正規表現(@code{"\\\\(sub\\)*item"}) +@end defvar + +@defvar YaTeX-verb-regexp +verbコマンドの正規表現。先頭の\\\\はつけない(@code{"verb\\*?\\|path"}) @end defvar @defvar tex-command @@ -1534,7 +1649,13 @@ @end defvar @defvar YaTeX-auto-math-mode -数式モードの切り替えを自動的に行う。(@code{nil}) +数式モードの切り替えを自動的に行う。(@code{t}) +@end defvar + +@defvar YaTeX-math-key-list-private + 数式イメージ補完で用いる (プリフィクスキー . 対応補完テーブル) の + alist(@code{nil})。補完テーブルの書き方については + @file{yatexmth.el}を参照。 @end defvar @defvar YaTeX-default-pop-window-height @@ -1651,11 +1772,11 @@ 本プログラムはフリーソフトウェアです。本プログラムを使用して生じたいかな る結果に対しても作者は責任を負わないこととします。転載等に関しては制限いた しません。常識的に扱ってください。また、使用している旨をメイルでお知らせい -ただくと、作者は喜んでサポートに励むことでしょう(ほんとか)。 +ただくと、作者は喜んでサポートに励むことでしょう。 苦情、希望、バグ報告、感想等は歓迎いたします。 -連絡は pcs39334@@asciinet.or.jp または、 -yuuji@@ae.keio.ac.jpまで(1995年3月現在)。 +連絡は yuuji@@ae.keio.ac.jp または、 +pcs39334@@asciinet.or.jp まで(1995年3月現在)。 仕様は、予告なく確実に(気分次第で)変更されます:-p。 diff -r b1e036697b20 -r b0371b6ed799 help/YATEXHLP.eng --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/help/YATEXHLP.eng Tue Dec 20 21:00:21 1994 +0000 @@ -0,0 +1,1360 @@ +textfloatsep +\addtolength{\textfloatsep}{LENGTH} +Length between the text and, float of the top or bottom of page + +floatsep +\addtolength{\floatsep}{LENGTH} +Length between two floats + +oddsidemargin +\setlength{\oddsidemargin}{LENGTH} +右ページの左端から1インチ(2.54cm)の線と本文の距離 + +pagestyle +\pagestyle{スタイル} +出力ページのヘッダとフッタのスタイルを決める。スタイルには以下のものがある: +plain 標準スタイル. フッタにページ番号だけつける. +empty ヘッダにもフッタにも何も出力しない. +headings ヘッダにセクションに応じた見出しとページ番号をつけ + フッタには何も出力しない. +myheadings headingsのスタイルで、ヘッダの情報を \markbpth と + \markright で指定できる. + +thispagestyle +\thispagestyle{スタイル} +現在のページだけのスタイルを決定する。 + +pagenumbering +\pagenumbering{スタイル} +ページ番号のスタイルを決める。スタイルには以下のものがある: +arabic アラビア数字 +alph 小文字の英字 +Alph 大文字の英字 +roman 小文字のローマ数字 +Roman 大文字のローマ数字 + +shortstack +\shortstack[場所]{重ねて\\表示する\\内容} +{}内の内容を\\で区切られた単位毎に積み重ねて表示する。 +[場所]は、l(左寄せ)、c(センタリング)、r(右寄せ)のいずれか。 + +newlength +\newlength{NAME} +NAMEという長さコマンドを新たに宣言する。 + +addtolength +\addtolength{長さコマンド}{数値} +第1引数の長さを第2に引数の数値を足す。 +代表的なスタイルパラメータについては \setlength の項を参照せよ。 + +setlength +\setlength{長さコマンド}{数値} +第1引数の長さを第2に引数の数値に設定する。 +代表的なスタイルパラメータは以下の通り: +(スタイルパラメータの変更はプリアンブルで行うこと) +\evensidemargin \footheight \footskip \headheight +\headsep \marginparsep \marginparwidth \oddsidemargin +\textheight \textwidth \topmargin \topskip +\parindent \baselineskip \baselinestretch \parskip +\columnsep \columnseprule \mathindent + +settowidth{\NAME}{TEXT} +\hbox{TEXT}の出力結果と同じ幅に長さ\NAME をセットする。 + +evensidemargin +\setlength{\evensidemargin}{LENGTH} +左ページの左端から1インチ(2.54cm)の線と本文の距離 + +footheight +\setlength{\footheight}{LENGTH} +フッタの高さ + +footskip +\setlength{\footskip}{LENGTH} +本文の箱の下端とフッタの距離 + +headheight +\addtolength{\headheight}{LENGTH} +ヘッダの高さ + +headsep +\setlength{\headsep}{LENGTH} +ヘッダと本文の間隔 + +marginparsep +\addtolength{\marginparsep}{LENGTH} +傍注と本文の間隔 + +marginparwidth +\addtolength{\marginparwidth}{LENGTH} +傍注の幅 + +oddsidemargin +\addtolength{\oddsidemargin}{LENGTH} +右ページの左端から1インチ(2.54cm)の線と本文の距離 + +textheight +\addtolength{\textheight}{LENGTH} +本文の高さ + +textwidth +\addtolength{\textwidth}{LENGTH} +本文の幅 + +topmargin +\addtolength{\topmargin}{LENGTH} +ページ上端から1インチの線とヘッダの距離 + +topskip +\addtolength{\topskip}{LENGTH} +本文の箱の上端と一行目のテキストとの間隔 + +parindent +\setlength{\parindent}{LENGTH} +\parindent 段落の先頭の字下げ幅. + +linewidth +\addtolength{\linewidth}{LENGTH} +\linewidth 行の幅. + +baselineskip +\addtolength{baselineskip}{LENGTH} +\baselineskip 行のベースライン間の最低限の高さ. + +baselinestretch +\renewcommand{baselinestretch}{1.5} +\baselinestretch \baselineskip に乗ずる係数. (default=1) +(* \setlengthなどではなく、\renewcommandで再定義する。) + +parskip +\addtolength{\parskip}{LENGTH} +\parskip 段落前の垂直スペース. + +columnsep +\addtolength{\columnsep}{LENGTH} +\columnsep 2段組みの時の段間の幅. + +columnseprule +\addtolength{\columnseprule}{LENGTH} +二段組の時の段間の罫線の太さ. + +columnwidth +\addtolength{\columnwidth}{LENGTH} +二段組の時には (\textwidth - \columnsep)/2 +そうでない時は、\textwidth + + +columnseprule +\addtolength{columnseprule}{LENGTH} +\columnseprule 2段組みの時の段間の罫線の幅. (default=0pt) + +mathindent +\addtolength{mathindent}{LENGTH} +\mathindent スタイルオプションで fleqn を指定した場合の、 + 左マージンからの数式の字下げ幅. + +LaTeX +\LaTeX +\LaTeX のロゴを表示。\LaTeX の定義は以下の通り。 +\def\LaTeX{{\rm L\kern-.36em\raise.3ex\hbox{\sc a}\kern-.15em + T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}} + +fragile +** LaTeX用語 ** +引数によって展開結果が変わるようなコマンドをいう。 +その逆は robust なコマンド。 + +robust +** LaTeX用語 ** +展開結果が常に変わらないようなコマンドをいう。 +フォント/サイズ指定子、長さコマンド、数式モード中に使う多くのコマンドは +robustなコマンド。 +(maketitle型コマンドのうちオプション引数を全くとらないものと考えて良い) + +protect +\protect「fragileなコマンド」 +引数によって結果が変わるようなコマンドを「fragileなコマンド」と言う。 +一方、引数がいろいろな箇所で参照されるコマンドを「動く引数を取るコマンド +と言う。これは chapter や caption など目次などから参照される引数をとるも +のや、tabular/array 環境の @ 表現が該当する。 + +さて、これらの「動く引数を取るコマンド」の引数に「fragileなコマンド」を +与える時に(fragileなコマンドの直前に)使うのが \protect である。以下は典 +型的な利用例である。 + +\newcommand{\thissystem}[1]{YaTeX version #1} +\chapter{\protect \thissystem{1.50}について} + +newcommand +\newcommand{\コマンド名}[引数の数]{定義} +「コマンド名」を「引数の数」個の引数を取る「定義」であるマクロとして定義 +する。定義中でn番目の引数は #n として参照する。 + \newcommand{\foo}[1]{\underline{#1}} +とすると \foo{bar} は \underline{bar} と展開される。したがってフォント指 +定子を含む場合newcommandの{}につられて、 + \newcommand{\foo}[1]{\bf #1} +とすると \foo{bar} がテキスト中で \bf bar と展開されてしまうので、 + \newcommand{\foo}[1]{{\bf #1}} +としなければならない。 + + 「コマンド名」のマクロが既に定義されている場合はエラーとなる。再定義す +る場合は、\renewcommandを使う。 + +renewcommand +\renewcommand{\コマンド名}[引数の数]{定義} +既に定義されているコマンドを別の内容で再定義する。 +以下は \newcommand の説明。 + + +newenvironment +\newenvironment{環境名}[引数の数]{定義1}{定義2} +新たな環境を定義する。 +\begin{環境名}の時の展開内容を「定義1」に\end{環境名}の時の展開内容を +「定義2」に記述する。 + \newcommand{\環境名}{定義1} \def{\end環境名}{定義2} +と同値。 + +renewenvironment +\renewenvironment{環境名}[引数の数]{定義1}{定義2} +既に定義されている「環境名」を別の内容で再定義する。 +以下は、\newenvironmentの説明。 + + + +typeout +\typeout{メッセージ} +タイプセット中に「メッセージ」を端末に出力する。 + +typein +\typein{メッセージ} \typein[\マクロ]{メッセージ} +タイプセット中に「メッセージ」をプロンプトに出し、入力した結果を実行する。 +第二の書式では、「\マクロ」を入力したものに定義する。 + +par +\par +段落の区切りの役割をする。空行と同じ。 + +everypar +\everypar +RTFM + +nopagebreak +\nopagebreak[i] (i = 0,1,2,3,4) +改頁を強さiで抑制する([i]を省略すると4)。 + +pagebreak +\pagebreak[i] (i = 0,1,2,3,4) +改頁を強さiで促す([i]を省略すると4)。 + +linebreak +\linebreak[i] (i = 0,1,2,3,4) +改行を強さiで促す([i]を省略すると4)。 + +nolinebreak +\nolinebreak[i] (i = 0,1,2,3,4) +改行を強さiで抑制する([i]を省略すると4)。 + +samepage +\samepage +改頁を禁止する。 +RTFM + +obeycr +\obeycr + を \\. に定義する。→\restorecr + +restorecr +\restorecr +\obeycrで変更したの定義を元に戻す。 + +\ +\\ \\[長さ] +(任意の場所で)改行する。段落中では、\newline と同じ。 +オプション引数の[長さ]を指定すると、次の行との間隔を +\vspace{LENGTH}によって確保する。 + +addvspace +\addvspace{スキップ} +縦方向の間隔に「スキップ」の値を足す。ただし +\addvspace{S1} \addvspace{S2} と複数の値を同時に指定しても +\addvspace{S1,S2のうち大きいほう} と同値になる。 + +vspace +\vspace{間隔} \vspace*{間隔} +垂直方向に「間隔」ぶんのスペースを足す。 +\vspace* はどんな場所でもスペースを足すが、\vspace はページの先頭や +末尾でははたらかない。 + +vspace* +\vspace{間隔} \vspace*{間隔} +垂直方向に「間隔」ぶんのスペースを足す。 +\vspace* はどんな場所でもスペースを足すが、\vspace はページの先頭や +末尾でははたらかない。 + +hspace +\hspace{間隔} \hspace*{間隔} +水平方向に「間隔」ぶんのスペースを足す。 +\hspace* はどんな場所でもスペースを足すが、\hspace は行の先頭や末尾では +はたらかない。 + +hspace* +\hspace{間隔} \hspace*{間隔} +水平方向に「間隔」ぶんのスペースを足す。 +\hspace* はどんな場所でもスペースを足すが、\hspace は行の先頭や末尾では +はたらかない。 + +smallskip +\smallskip +垂直方向に小さな間隔を空ける。 +\def\smallskip{\vspace\smallskipamount} + +medskip +\medskip +垂直方向に中くらいの間隔を空ける。 +\def\medskip{\vspace\medskipamount} + +bigskip +\bigskip +垂直方向に大きな間隔を空ける。 +\def\bigskip{\vspace\bigskipamount} + +, +\, +狭いスペースを空ける。段落モード、LRモード、数式モードいずれでも利用可。 +クォートの中にクォートを書くときなどに用いる。 +例: ``\,`Foo', he said.'' +数式モードで使えるスペースには以下のものがある: + \: 少し広い + \! 負で狭い + \; 広い + +: +$\:$ +少し広いスペース。数式モードのみ。 + +! +$\!$ +狭い負のスペース。数式モードのみ。 + +; +$\;$ +広いスペース。数式モードのみ。 + +@whilenum +\@whilenum TEST \do {BODY} +この辺あとで + +nofiles +\nofiles +プリアンブルで宣言すると、.aux, .idx, .lof, .lot, .toc ファイルの作成が +抑制される。 + +includeonly +\includeonly{sub1} \includeonly{sub1,sub3} +\include{}で読み込むファイルのうち、実際に読み込み処理するものを指定する。 +(.texは省略可) +\includeonlyの引数リストにないファイルはまったく処理されない、または前回 +以前に処理されている場合そこから全く変更がないものとして扱われる。 + +include +\include{FILE} +\clearpage \input{FILE} \clearpage +と同じはたらきをする。 + +input +\input{FILE} +FILE.tex がそこにあるかのように処理を続ける。 + +setcounter +\setcounter{FOO}{VAL} +カウンタFOOの値をVALに設定する。 + +addtocounter +\addtocounter{FOO}{VAL} +カウンタFOOの値にVALを加える。 + +newcounter +\newcounter{COUNTER}[OLDCTR] +新しいカウンタCOUNTERを設定する。 +オプション引数[OLDCTR]を指定すると、既存のカウンタOLDCTRの値が +\stepcounter もしくは \addtocounter で変更されるたびにCOUNTERの値もリセッ +トされる。 + +value +\value{COUNTER} +COUNTERの値を返す。\protect を前置してはならない。 + +stepcounter +\stepcounter{FOO} +カウンタFOOの値をインクリメントする。FOOに従うカウンタがあればそれらをリ +セットする。 + +refstepcounter +\refstepcounter{FOO} +カウンタFOOの値をインクリメントする。FOOに従うカウンタがあればそれらをリ +セットする。\stepcounterとの違いは、\refstepcounter{FOO} の直後に +\label{hoge} があった場合に、\ref{hoge} の値が \value{FOO} を持つように +「\ref値」を設定することである。 + +arabic +\arabic{COUNTER} +アラビア数字でCOUNTERの値を出力。 + +roman +\roman{COUNTER} +小文字のローマ数字でCOUNTERの値を出力。 + +Roman +\Roman{COUNTER} +大文字のローマ数字でCOUNTERの値を出力。 + +alph +\alph{COUNTER} +小文字の英字でCOUNTERの値を出力。 + +Alph +\Alph{COUNTER} +大文字の英字でCOUNTERの値を出力。 + +fnsymbol +\fnsymbol{COUNTER} +脚注シンボル(1 = *, 2 = \dagger, ...) でCOUNTERの値を出力。数式モードのみ。 + +label +\label{LABEL} +ラベルLABELの値をその時の「\ref値」に設定する。 +この値は、\ref{LABEL}によって参照される。また\pageref{LABEL}により +\label{LABEL}の存在するページ番号が参照される。 +「\ref値」とは \section などのセクションコマンド、enumerate環境での +\item コマンド、theorem環境などによって設定される値である。例えば、 +enumerate環境中の \item の直後ではそのitemの番号が「\ref値」となり、 +そこにある \label{LABEL} はitemの番号をLABELにセットする。 + +ref +\ref{LABEL} +\label{LABEL}で設定したLABELの値を参照する。 +本文中で設定されたラベルにたいしてはページ番号が、 +図表中で設定されたラベルは図表番号が、 +enumerateされたitemで設定されたラベルにたいしては、item番号が返される。 + +pageref +pageref{LABEL} +\label{LABEL}の存在するページ番号を参照する。 + +( +\( 数式 \) +文中数式を組む。 +\begin{math} 数式 \end{math} +と同値。\( および \)は fragile. + +) +\( x^2 = 4 \) +文中数式を組む。 +\begin{math} 数式 \end{math} +と同値。\( および \)は fragile. + +[ +ディスプレイ数式を組む。 +\[ 数式 \] +\begin{displaymath} 数式 \end{displaymath} +と同値。\[ および \]は fragile. + +) +\[ 数式 \] +ディスプレイ数式を組む。 +\begin{displaymath} 数式 \end{displaymath} +と同値。\[ および \]は fragile. + +equation +\begin{equation} 数式 \end{equation} +番号つきの数式をdisplaymath環境で組む。 + +eqnarray +\begin{eqnarray} 方程式の並び \end{eqnarray} +方程式の並びを3つの桁に整理して出力する。3つの桁は&記号によって、 +「左辺 & 等不等号 & 右辺」のように区切られる。例えば以下のようにする。 +\begin{eqnarray} + 3x + 2y & = & 4 \\ + x - 4y & = & -5 +\end{eqnarray} +eqnarray* 環境は数式番号を出力しないほかはeqnarray環境と同じである。 + +eqnarray* +\begin{eqnarray*} 方程式の並び \end{eqnarray*} +数式番号を出力しないほかはeqnarray環境と同じである。 + +frac +\frac{分子}{分母} + 分子 +------ のような分数形式を組む。{分子 \over 分母} と同じ。 + 分母 + +sqrt +\sqrt[N]{式} +「式」のN乗根をあらわす数式。[N]を省略すると平方根。 + +lefteqn +\lefteqn{式} +ディスプレイ数式モードにおいて、「式」が幅ゼロであるとみなして、左寄せす +る。たとえばeqnarray環境において、左辺が長くなってしまう場合に、行を +折り畳むために利用する。 +\begin{eqnarray} + \lefteqn{a_1 + a_2 + \cdots + a_n =} \\ + & & a_1 + b_1 + \cdots + z_1 + \\ + & & b_2 + c+2 + \cdost + z_2 +\end{eqnarray} + +center +\begin{center} 内容 \end{center} +「内容」を中央寄せする。各行は\\によって改行位置を指定する。 +→ \centering + +flushright +\begin{flushright} 内容 \end{flushright} +「内容」を右寄せする。各行は\\によって改行位置を指定する。 +→ \raggedright + +flushleft +\begin{flushleft} 内容 \end{flushleft} +「内容」を左寄せする。各行を\\によって改行位置を指定するとその位置で改行 +するが、指定しないと適当な行長のところで改行してくれる。 +→ \raggedleft + +centering +\centering +段落をセンタリングして組版する。 +たとえば table環境、figura環境の先頭で宣言すると環境の終りまでをセンタリ +ングして組む。 + +raggedright +\raggedright +段落を右寄せして組版する。 + +raggedleft +\raggedleft +段落を左寄せして組版する。 + +raggedbottom +\raggedbottom +組版する時に各ページの高さに多少のずれがあっても許容する。 +プリアンブルで指定する。 +→\flushbottom + +flushbottom +\flushbottom +組版する時に各ページの高さを正確にそろえる。 +プリアンブルで指定する。 +→\raggedbottom + +sloppy +\sloppy +\sloppy を指定すると、各行を必ず右マージンで折り返す代わりに、 +単語間の空白を大目に見る。 +→\fussy + +fussy +\fussy +通常の組版規則に戻る。 +→\sloppy + +sloppypar +\begin{sloppypar} 段落 \end{sloppypar} +段落を \sloppy で組む。 +→\sloppy + +verbatim +\begin{verbatim} ... \end{verbatim} +The verbatim environment uses the fixed-width \tt font, turns blanks into +spaces, starts a new line for each carrige return (or sequence of +consecutive carriage returns), and interprets EVERY character literally. +I.e., all special characters \, {, $, etc. are \catcode'd to 'other'. + +verbatim* +\begin{verbatim*} ... \end{verbatim*} + + +The verbatim* environment is the same, except that spaces +print as the TeXbook's space character instead of as blank spaces. + +list +\begin{list}{デフォルトラベル}{整形パラメータ} ... \end{list} +リスト環境に入る。リスト環境では \item で指定された各項目を一定の字下げ +で列挙する。第1引数には \item のオプション引数のラベルが省略された時のデ +フォルトラベルを指定し、第2引数には各itemを置く時に処理されるパラメータ +を指定する。 +例: +\begin{list}% + {$\diamond$} + {\addtolength{\leftmargin}{4em}} + \item 第1引数には\verb|\item| にオプション引数をつけなかった時にふる、 + デフォルトのラベルを与える。 + \item 第2引数には各itemを置く時に処理されるパラメータを与える。 + \item[*] のようにオプション引数をつけるとそれがラベルとなる。 +\end{list} + + list環境の体裁を制御する変数には以下のものがある(括弧内は既定値)。 +水平方向: + + +list環境の体裁を制御する変数 +\labelwidth itemのラベルの幅 +\labelsep ラベルの右端と最初のアイテムのテキストとの間隔 +\leftmargin list環境内での左マージン +\rightmargin 同右マージン (0pt) +\itemindent itemの直前に加えられるインデント幅 (0pt) +\linewidth 一行の幅 +\listparindent 各パラグラフの先頭のインデント(ただし\itemの付いている先 + 頭のパラグラフを除く)(0pt) + +垂直方向: +\topsep list環境に入る前のパラグラフと最初のitemとの間隔 +\partopsep list環境で新しいパラグラフをはじめる時に\topsepに加えら + れる付加的な間隔 +\itemsep 連続するitemどうしの間隔 +\parsep 一つのitem内でのパラグラフどうしの間隔 + + +itemize +\begin{itemize} \item アイテム1 ... \item アイテムn \end{itemize} +項目を列挙するための環境。 +最大4つまでネストできる。 +各レベルのitemの頭につく記号は、\labelitemi, \labelitemii, +\labelitemiii, \labelitemiv で制御される。 + +itemize環境の体裁を制御する変数には以下のものがある。 + + + +enumerate +\begin{enumerate} \item アイテム1 ... \item アイテムn \end{enumerate} +項目を番号つきで列挙するための環境。 +最大4つまでネストできる。 +各レベルのitemの頭につく番号は、enumi, enumii, enumiii, enumiv +が保持していて、各itemのラベルは、\labelenumi, ..., \labelenumiv +で生成される。また、\p@enumN\theenumN は \ref値を設定する。 +(Nはレベルの深さ。\ref値については\refの説明を参照せよ) +たとえば +\def\theenumii{\alph{enumii}} +\def\p@enumii{\theenumi\theenumii} +\def\labelenumii{(\theenumii)} +とすると \ref値が 3a などのように設定される。 + +enumerate環境の体裁を制御する変数には以下のものがある。 + + +item +\item \item[LABEL] +itemize, enumerate, description 環境などで項目を開始する。 +[LABEL]を指定するとラベルとしてLABELを出力する。 + +description +\begin{description} \item[見出し単語] 説明 ... \end{description} +[見出し単語]を見出しとする + +subitem +\subitem 項目 +サブアイテムを定義。 + +subsubitem +\subsubitem 項目 +サブサブアイテムを定義。 + +makebox +\makebox[WID][POS]{オブジェクト} \makebox(X,Y)[POS]{オブジェクト} +第1の書式では、オブジェクトをWIDで指定した幅として、\hbox 内の +POSで指定した場所に配置する。POSにlを指定すると左寄せ、rを指定すると右寄せ、 +何も指定しないとセンタリングされる。 +第2の書式では、picuture環境で大きさ(X,Y)の(\unitlengthを基準とする) +\hbox にオブジェクトを配置する。配置位置POSは第1の書式と同様。 + +mbox +\mbox{オブジェクト} +\makebox{オブジェクト}と同じ。 + +newsavebox +\newsavebox{\CMD} +新規のボックス保存用コマンドを定義する。\CMDは \savebox コマンドで +ボックスを保存するために使う。\newsaveboxで宣言したコマンド名は +常にグローバルとなる。 + +savebox +\savebox{\CMD}{テキスト} +ボックスを組む内容である「テキスト」の結果を\CMDに保存する。 +「テキスト」は \makebox への引数と全く同じであるが、「テキスト」を +処理した結果はその場に表示はしない。\usebox{\CMD}により処理したボックス +が置かれる。 + +sbox +\sbox{\CMD}{テキスト} +\saveboxと同じ。sboxはrobust, saveboxはfragile + +framebox +\framebox{オブジェクト} +「オブジェクト」に枠をつけて\makeboxと同様の処理をする。 +枠の線の太さは \framerule、オブジェクトとの間隔は \framesep で決まる。た +だしpicture環境で \framebox(X,Y){オブジェクト}とした場合は、picture環境 +用の線の太さに従い、外枠とオブジェクトとの間隔は空けられない。 + +fbox +\fbox{オブジェクト} +\framebox{オブジェクト}と同じ。 +\fboxはrobust, \frameboxはfragile + +parbox +\parbox[POS]{WIDTH}{TEXT} +TEXTをWIDThの幅で組んでボックスを作成する。ボックスの位置はPOSによって +c : センタリング(デフォルト) +b : ボックスの一番下の線が現テキストのラインに合う +t : ボックスの一番上の線が現テキストのラインに合う +のように決められる。\parboxではパラメータが以下のようにリセットされる。 + +\parskip = 0pt +\linewidth = \hsize +\@totalleftmargin = 0pt +\leftskip = 0pt +\rightskip = 0pt +\@rightskip = 0pt +\parfillskip = 0pt plus 1fil +\lineskip = \normallineskip +\baselineskip = \normalbaselineskip + +minipage +\begin{minipage}[pos]{WIDTH} TEXT \end{minipage} +\parbox とほぼ同様WIDTHの幅のTEXTをボックスとして組む。ボックスの位置は +POSによって +c : センタリング(デフォルト) +b : ボックスの一番下の線が現テキストのラインに合う +t : ボックスの一番上の線が現テキストのラインに合う +のように決められる。 +parboxと違い、TEXTは通常のパラグラフとして組まれる。 + +rule +\rule[RAISED]{WIDTH}{HEIGHT} +幅 WIDTH x 高さ HEIGHT の罫線を作る。RAISEDが指定された場合、その分だけ +上に上げられる。 + +underline +\underline{TEXT} +TEXTに下線をつけて表示。 + +raisebox +\raisebox{DISTANCE}[HEIGHT][DEPTH]{BOX} +BOXをDISTANCEだけ上げて組む。 +HEIGHT, DEPTH を指定すると、TeXから見たBOXの「高さ」と「深さ」 +(註:これらの用語についてはTeXBookなどを参照のこと) +を HEIGHT, DEPTH に指定する。 + +tabbing +\begin{tabbing} \= text1.1 \= text1.2 \\ \> text2.1 \> text2.2 \end{tabbing} +桁揃えを行う環境を作る(入れ子不可)。例えば、 +\begin{tabbing} + \= 項目1 \hspace*{2em} \= 項目2 \hspace*{3em} \= 項目3 \\ + \> いろは \> にほへ \> とちり \+ \\ + \> ぬるを \> わかよ \\ + \> たれそ \- \\ + \> つねな \> らむう \> ゐのお +\end{tabbing} +上のtabbing環境は以下のように3つのタブ位置で組まれる。 + (1番目) (2番目) (3番目) + いろは にほへ とちり + ぬるを をかよ + たれそ + つねな らむう ゐのお + \2em/ \3em/ +tabbing環境におけるタブ位置操作コマンドは以下の通り(nは1から): +\= n番目のタブ位置を現在位置に設定しタブカウンタ(n)を1進める +\\ 改行してタブカウンタをリセットする(n=1) +\> 位置をn番目のタブ位置に設定し、カウンタを1進める +\+ 次の行のタブカウンタの初期値に1加える \+ \\ とすると次の行の最初 + の \> は2番目のタブ位置を示す. \+ を複数書くとその数だけタブカウ + ンタの初期値が増える +\- \+とは逆に、次の行のタブカウンタの初期値から1引く +\< 一つ前のタブカウンタに戻ってそのタブ位置をセット. 行頭のみ +\' \'以降を通常のタブ位置より \tabbingsep 分だけ右寄せして出力 +\` \`以降のテキストをすべて右寄せして出力 +\pushtabs それまで用いていたタブストップ位置を全てpush +\poptabs それまで用いていたタブストップ位置を全てpop. \pushtabs と + \poptabs は必ず対になっていなければならない. 入れ子可 +\aX Xは = か ' か ` tabbing環境でない通常のアクセントは + \a= \a' \a` で表わす +\kill 現在行のテキストは出力せずタブ設定だけ解釈する + +array +\begin{array}{PREAMBLE} C1 & C2 & .. & Cn \\ D1 ... \end{array} +Make a mathematical array. Useful to make matrix. +See the help of `tabular' for detailed description. + +tabular +\begin{tabular}[OPT]{PREAMBLE} C1 & C2 & .. & Cn \\ D1 ... \end{tabular} +Make tabular. +[[OPT]] +[t] Align the top of tabular to the line. +[b] Align the bottom of tabular to the line. +[[PREAMBLE]] + l,r,c : indicate where entry is to be placed. + | : for vertical rule + @{EXP} : inserts the text EXP in every column. \arraycolsep or \tabcolsep + spacing is suppressed. + *{N}{PRE} : equivalent to writing N copies of PRE in the preamble. PRE + may contain *{N'}{EXP'} expressions. + p{LEN} : makes entry in parbox of width LEN. + +[[Usable commands in array, tabular environment]] +\multicolumn + +\vline + +\hline + +\cline{i-j} + +\extracolsep{W} + + + +See below as sample. + +\LaTeX Expression Printed image +\begin{array}{ccr} + x+y+z & a_1 & 1 \\ x+y+z a1 1 + x+z & a_2 & 21 \\ x+z a2 21 + y & a_3 & 321 y a3 321 +\end{array} + +\[ \left( + \begin{array}{cccc} + a_{11} & a_{12} & \dots & a_{1n} \\ / a11 a12 ... a1n \ + a_{21} & a_{22} & \dots & a_{2n} \\ | a21 a22 ... a2n | + \vdots & \vdots & \ddots& \vdots \\ | : : \. : | + a_{n1} & a_{n2} & \dots & a_{nn} \ an1 an2 ..: ann / + \end{array} +\right)\] + +\right(, \left) or \right{, left} or \right[, \left] or \right|, \left| +can enclose whole of array environment by parentheses, braces, brackets, +norm respectively. The number of `\right's and `\left's should be the +same, but the type of parentheses don't have to match like +\right( \left]. `\right.' produces the invisible parenthesis. + +\[ Ans. \cdots \left\{ / + \begin{array}{ccc} | x = 5 + x & = & 5 \\ Ans. ...< + y & = & 3 | y = 3 + \end{array} \right. \] \ + +Here are the style parameters for the tabular environment. +\arraycolsep : half the width separating columns in an array environment +\tabcolsep : half the width separating columns in a tabular environment +\arrayrulewidth : width of rules +\doublerulesep : space between adjacent rules in array or tabular +\arraystretch : line spacing in array and tabular environments is done by + placing a strut in every row of height and depth + \arraystretch times the height and depth of the strut + produced by an ordinary \strut commmand. + +Tabular environment cannot spread across pages. `supertabular.sty' +allow this. + +tabular* +\begin{tabular*}{幅}{プリアンブル} ... \end{tabular*} +Make tabular environment with specifying its width. +To fill this width, use \extracolsep{} of preamble as below: +\begin{tabular*}{10em}[b]{|c@{\extracolsep{\fill}}|c|c|} + \hline + a & b & c \\ \hline + 1 & 2 & 3 +\end{tabular*} +See also tabular. + +multicolumn +\multicolumn{N}{FORMAT}{ITEM} +In tabular environment, +replaces the next N column items by +ITEM, formatted according to FORMAT. FORMAT should contain at most +one l,r or c. If it contains none, then ITEM is ignored. + +vline +\vline +In tabular environment, +draws a vertical line the height of the current row. May +appear in an array element entry. + + +hline +\hline +In tabular environment draws a horizontal line between rows. Must +appear either before the first entry (to appear above the first row) or +right after a \\ command. If followed by another \hline, then adds a +\vskip of \doublerulesep. + +cline +\cline{i-j} +In tabular environment, +draws horizontal lines between rows covering columns +i through j, inclusive. Multiple commands may follow +one another to provide lines covering several disjoint +columns + +extracolsep +\extracolsep{W} +for use inside an @ in the preamble. Causes a WIDTH +space to be added between columns for the rest of the +columns. This is in addition to the ordinary intercolumn +space. + +picture +\begin{picture}(WIDTH,HEIGHT)(X,Y) ..contents.. \end{picture} +The picture environment allows you to create just about any kind of +picture you want containing text, lines, arrows and circles. You tell +LaTeX where to put things in the picture by specifying their +coordinates. A coordinate is a number that may have a decimal point +and a minus sign - a number like 5, 2.3 or -3.1416. A coordinate +specifies a length in multiples of the unit length \unitlength, so if +\unitlength has been set to 1cm, then the coordinate 2.54 specifies a +length of 2.54 centimeters. You can change the value of \unitlength +anywhere you want, using the \setlength command, but strange things +will happen if you try changing it inside the picture environment. + +A position is a pair of coordinates, such as (2.4,-5), specifying the +point with x-coordinate 2.4 and y-coordinate -5. Coordinates are +specified in the usual way with respect to an origin, which is +normally at the lower-left corner of the picture. Note that when a +position appears as an argument, it is not enclosed in braces; the +parentheses serve to delimit the argument. + +The picture environment has one mandatory argument, which is a +position. It specifies the size of the picture. The environment +produces a rectangular box with width and height determined by this +argument's x- and y-coordinates. + +The picture environment also has an optional position argument, +following the size argument, that can change the origin. (Unlike +ordinary optional arguments, this argument is not contained in square +brackets.) The optional argument gives the coordinates of the point at +the lower-left corner of the picture (thereby determining the origin). +For example, if \unitlength has been set to 1mm, the command + +\begin{picture}(100,200)(10,20) + +produces a picture of width 100 millimeters and height 200 +millimeters, whose lower-left corner is the point (10,20) and whose +upper-right corner is therefore the point (110,220). When you first +draw a picture, you will omit the optional argument, leaving the +origin at the lower-left corner. If you then want to modify your +picture by shifting everything, you just add the appropriate optional +argument. + +The environment's mandatory argument determines the nominal size of +the picture. This need bear no relation to how large the picture +really is; LaTeX will happily allow you to put things outside the +picture, or even off the page. The picture's nominal size is used by +TeX in determining how much room to leave for it. + +Everything that appears in a picture is drawn by the \put command. The +command + +\put (11.3,-.3){...} + +puts the object specified by "..." in the picture, with its reference +point at coordinates (11.3,-.3). The reference points for various +objects will be described below. + +The \put command creates an LR box. You can put anything in the text +argument of the \put command that you'd put into the argument of an +\mbox and related commands. When you do this, the reference point +will be the lower left corner of the box. + +Picture environment is obsolete I thinks, so show only commands. + +[[COMMANDS]] +\put(X,Y){OBJECT} +\multiput(X,Y)(dX,dY){REPEAT}{OBJECT} +[[OBJECTS]] +\makebox(X,Y)[POS]{TEXT} +\framebox(X,Y)[POS]{TEXT} +\dashbox(X,Y)[POS]{TEXT} +(POS = l, r, b, t) +\line(dX,dY){HorizontalLength} +\vector(dX,dY){HorizontalLength} (arrow) +(dX,dY = +-1, +-2, ..., +-6) +\shortstack[POS]{FIRST\\SECOND\\THIRD...} +\circle{DIAMETER} +\circle*{DIAMETER} (Filled circle) +(Maximum diameters are 40pt, 15pt) +\oval(Dia-X,DiaY)[POS] (Oval POS = l, r, t, b) +\frame{OBJECT} +\thinlines, \thicklines (choose line thickness) +\linethickness{THICKNESS} + +newtheorem +\newtheorem{NAME}{TEXT}[COUNTER] \newtheorem{NAME}[OLDNAME]{TEXT} +This defines the environment NAME to be just as one would expect a +theorem environment to be, except that it prints ``TEXT'' instead of +``Theorem''. + +If OLDNAME is given, then environments NAME and OLDNAME use the same +counter, so using a NAME environment advances the number of the next +NAME environment, and vice-versa. + +If COUNTER is given, then environment NAME is numbered within COUNTER. +E.g., if COUNTER = subsection, then the first NAME in subsection 7.2 +is numbered TEXT 7.2.1. + +The way NAME environments are numbered can be changed by redefining +\theNAME. + +title +\title{TITLE} +Define the title of the document. + +author +\author{AUTHOR} +Declare the author of the document. + +date +\date{DATE} +Define the date of document which is used by \maketitle. +Omitting DATE produces current date. + +thanks +\thanks{FOOTNOTE} +Output a footnote in title page. + +maketitle +\maketitle +Output a title. Should be written in document environment. +Here are the constituents of title page. +\title{TITLE} +\author{AUTHOR} +\date{DATE} (If DATE omitted, output the date of typesetting) +\thanks{NOTE} (Output a thanks message or the post of the author) + +part +\part{TITLE} +Start a new part whose title is TITLE. + + +chapter +\chapter{TITLE} +Start a chapter whose title is TITLE. +Sectioning commands: +\part Part ? +\chapter Chapter ? (not available in `article.sty') +\section ? +\subsection ?.? +\subsubsection ?.?.? +\paragraph *** +\subparagraph === + +section +\section{TITLE} +Start a section whose title is TITLE. + + +subsection +\subsection{TITLE} +Start a subsection whose title is TITLE. + + +subsubsection +\subsubsection{TITLE} +Start a paragraph whose title is TITLE. + + +paragraph +\paragraph{TITLE} +Start a paragraph whose title is TITLE. + + +appendix +\appendix +Declare the beginning of appendix. +Change the numbering fashion to appendix oriented. + +contentsline +\contentsline{TYPE}{ENTRY}{PAGE} +\contentsline{subsection}{\makebox{30pt}[r]{1.4.3} Gnats and Gnus}{22} +Macro to produce a TYPE entry in a table of contents, etc. +It will appear in the .TOC or other file. For example, +The entry for subsection 1.4.3 in the table of contents might +be produced by: +\contentsline{subsection}{\makebox{30pt}[r]{1.4.3} Gnats and Gnus}{22} +The \protect command causes command sequences to be written +without expanding them. + +addcontentsline +\addcontentsline{TABLE}{TYPE}{ENTRY} +User command for adding his own entry to a table of contents, etc. +It adds the entry + \contentsline{TYPE}{ENTRY}{page} +to the .TABLE file. + +addtocontents +\addtocontents{TABLE}{TEXT} +Adds TEXT to the .TABLE file, with no page number. + +index +\index{INDEX} +Create an entry of index. + + +glossary +\glossary{STRING} +Create an entry of glossary. + +makeindex +\makeindex +Writes \indexentry to .idx file. +Should be in preamble. + +makeglossary +\makeglossary +Writes \glossaryentry to .glo file. +Should be in preamble. + +bibliography +\bibliography{FILE1,FILE2, ... ,FILEn} +Specifies the bibdata files. + +bibliographystyle +\bibliographystyle{STYLE} +Style of numbering of bibliographies. +plain nomal +unsrt without sortingg +alpha gives tag like "Foo94" +abbrv omit the first name of author, publishing month, book title + +thebibliography +\begin{thebibliography} \bibitem{ITEM},... \end{thebibliography} +The thebibliography environment is a list environment. To save the +use of an extra counter, it should use enumiv as the item counter. +Instead of using \item, items in the bibliography are produced by the +\bibitem command. +--- + + +bibitem +\bibitem{NAME} \bibitem[LABEL]{NAME} +Produces a numbered (as [1], [2],...) entry cited as NAME. +Second form produces an entry labeled by LABEL and cited as NAME. + +thefootnote +In usual LaTeX style, produces the footnote number. +If footnotes are to be numbered within pages, then the +document style file must include an \@addtoreset command +to cause the footnote counter to be reset when the page +counter is stepped. This is not a good idea, though, +because the counter will not always be reset in time +to ensure that the first footnote on a page is footnote +number one. + +footnote +\footnote{NOTE} or \footnote[NUM]{NOTE} +User command to insert a footnote. +In second form, insert a footnote numbered +NUM, where NUM is a number -- 1, 2, +etc. For example, if footnotes are numbered +*, **, etc. within pages, then \footnote[2]{...} +produces footnote '**'. This command does not +step the footnote counter. +(fragile) + +footnotemark +\footnotemark[NUM] +Command to produce just the footnote mark in +the text, but no footnote. With no argument, +it steps the footnote counter before generating +the mark. + +footnotetext +\footnotetext[NUM]{TEXT} +Command to produce the footnote but no mark. +\footnote is equivalent to \footnotemark \footnotetext . + +footnotesize +{\footnotesize ...} +Size-changing command for footnotes. + +footnotesep +\footnotesep +The height of a strut placed at the beginning of every footnote. + +footnoterule +\footnoterule +Macro to draw the rule separating footnotes from text. +It is executed right after a \vspace of \skip\footins. +It should take zero vertical space--i.e., it should to +a negative skip to compensate for any positive space +it occupies. (See PLAIN.TEX.) + +documentstyle +\documentstyle[OPTION1,OPTION2, ... ,OPTIONn]{STYLE} +The user starts his file with the command as above +which saves the OPTION's and \input's the file STYLE.STY. + +verb +\verb#CONTENTS# +The command \verb produces in-line verbatim text, where the argument +is delimited by any pair of characters. E.g., \verb #...# takes +'...' as its argument, and sets it verbatim in \tt font. + +The *-variants of these commands is the same, except that spaces +print as the TeXbook's space character instead of as blank spaces. + +styleparameter +まだ訳していないスタイルパラメータ。 + +topfigrule +\topfigrule +Command to place rule (or whatever) between floats +at top of page and text. Executed in inner vertical +mode right before the \textfloatsep skip separating +the floats from the text. Must occupy zero vertical +space. (See \footnoterule.) + +botfigrule +\setlength{\botfigrule}{LENGTH} +Same as \topfigrule, but put after the \textfloatsep +skip separating text from the floats at bottom of page. + +intextsep +\setlength{\intextsep}{LENGTH} +Space left on top and bottom of an in-text float. + +newpage +\newpage +Advance to a new page. +\clearpage Output the unfinished table of images, if any, + and clear page. +\cleardoublepage Same as \clearpage except that when spread style + (such as book), start a new page with odd page. +\newpage Finish current column when twocolumn. + +clearpage +\clearpage + + +cleardoublepage +\cleardoublepage + + +length + +Here are the available units of length in TeX. +cm centi meter +em width of `M' +ex height of `x' +in inch (=2.54cm) +mm mi.li meter +pc pica(=12pt) +pt point (72.27pt=1 inch) +\fill Freely extendable length whose normal length is 0 +\stretch{X} X-times as long as \fill + +stretch +\stretch{X} + + +twocolumn +\twocolumn[STRING] +Clear page and start two-column typesetting. +Optional argument [STRING] specifies the page-acrossing title. +->onecolumn + +onecolumn +\onecolumn +Clear page and start one-column typesetting. +->twocolumn + +topnewpage +\topnewpage{BOX} +Begin a new page and create the parbox-ed BOX whose width is \textwidth. +This is useful to make a page-acrossing title in a twocolumn page. + +YaTeX +(setq auto-mode-alist (cons '("\\.tex$" . yatex-mode) auto-mode-alist)) +おそらくあなたが今使っているこのモード。 +LaTeXを効率的に使うための多くの機能を盛り込んでいます。 + +【発音について】 +yatex.elなどプログラムを指す時は「やてっく」、システムを指す時は「やちょ +う」と読みます。 + +【謝辞】 +以下の方々の御協力を頂きました。ここに感謝申し上げます。 + +(順不同) +峯恒憲さん(九州大) + Bibtex起動、typeset process の kill、エラー箇所の正しい判定 + の要望その他を頂きました。 + +森中秀明さん(アンリツ) + タイプセットバッファでの実行継続、lpq, bibtex起動、領域指定タイ + プセット後のプレビュー対象ファイルのデフォルト値の変更、 + describe-mode、\verb の補完の要望、verbatim環境や\verbの中にある + \begin{}, \end{} を数えないようにする要望、などを頂きました。 + +石坂裕毅さん(富士通) + YaTeX-get-error-file のバグレポートなどを頂きました。 + +Bayardさん(asciinet) + min-outとの連係の不具合の報告を頂きました。 + +Kけんさん(asciinet) + ms-dos固有の設定に関するバグレポートを頂きました。 + +sa2cさん(asciinet) + Mule用のパッチを頂きました。 + +桂川直己さん(筑波大) + 数え切れないバグレポートと要望を頂きました。またVzへの移植版であ + る laitex(雷鳥) を作成されました。 + +三平善郎さん(慶応大) + 開き括弧の入力時の処理のモード分けのアイデアを頂きました。 + +萩庭崇さん(慶応大) + begin型補完の内側に文字があった場合それらをインデントしてほしい + という要望を頂きました。 + +田中健次郎さん(慶応大) + タイプセット時に未セーブ状態の関連ファイルをセーブして欲しいとい + う要望を頂きました。 + +bauerさん(asciinet) + アクセント補完の要望とアクセント記号の規則の情報等を頂きました。 + +佐々木たろうさん(asciinet) + 数式環境の処理に関する多様なアイデア、ウィンドウ選択処理に関する + ユーザインタフェースの繊細な改善案などを頂きました。 + +Deslarさん(asciinet) + byte-compile関係のバグ報告などを頂きました。 + +tadfさん(asciinet) + Demacsでのプロセス起動時のインタフェースの不具合の報告などを頂き + ました。 + +ほんまたけるさん(asciinet) + パラグラフ境界をLaTeX用に設定しなおす要望などを頂きました。 + +TUSKさん(asciinet) + Texinfoドキュメント(初版)を作成して頂きました。 + +横田和也さん(asciinet) + dviout起動時の工夫の案、ミニバッファで読み込むもののヒストリを分 + けるアイデアのきっかけをいただき、ヘルプファイルの項目の提供をし + て頂きました。 + +kanbai-anさん(asciinet) + 日本語入力モード判定関数のバグを直すパッチなどを頂きました。 + + +yatex + + diff -r b1e036697b20 -r b0371b6ed799 help/YATEXHLP.jp --- a/help/YATEXHLP.jp Fri Nov 25 08:26:13 1994 +0000 +++ b/help/YATEXHLP.jp Tue Dec 20 21:00:21 1994 +0000 @@ -1023,15 +1023,40 @@ index \index{INDEX} -まだ書いてない。 +索引のエントリを定義する。 + +-------------------------------------------------------------------- + glossary \glossary{STRING} -まだ書いてない。 +用語集のエントリを定義する。 makeindex \makeindex \indexentryで登録されている項目を .idx ファイルに書き込む。 +プリアンブルで指定する。 + +-------------------------------------------------------------------- + + +makeglossary +\makeglossary +\glossaryentryで登録されている項目を .glo ファイルに書き込む。 +プリアンブルで指定する。 + +索引の作り方 + +(1)\documentstyleにmakeidxオプションを与え、プリアンブルに \makeindex + を書き、索引を生成する場所に \printindex を書く。 +(2)本文に \index{索引となる単語} を埋め込む。 +(3)一度(または二度)タイプセットする。 +(4).idxファイルができるのでそのファイルを makeindex にかける。 +(5).indファイルができるのでもう一度タイプセットして出来上がり。 + +** \indexの記法 ** +日本語をそのまま \index{漢字} と入れたのではあいうえお順にソートされない。 +そこで、読みを@で区切って \index{かんじ@漢字} のように入れる。 bibliography \bibliography{FILE1,FILE2, ... ,FILEn} @@ -1106,9 +1131,14 @@ % mode right before the \textfloatsep skip separating % the floats from the text. Must occupy zero vertical % space. (See \footnoterule.) -% \botfigrule : Same as \topfigrule, but put after the \textfloatsep -% skip separating text from the floats at bottom of page. -% \intextsep : Space left on top and bottom of an in-text float. +botfigrule +\setlength{\botfigrule}{長さ} +Same as \topfigrule, but put after the \textfloatsep +skip separating text from the floats at bottom of page. + +intextsep +\setlength{\intextsep}{長さ} +文書中フロートの上下に残された空白の長さ newpage diff -r b1e036697b20 -r b0371b6ed799 yatex.el Binary file yatex.el has changed diff -r b1e036697b20 -r b0371b6ed799 yatex.new --- a/yatex.new Fri Nov 25 08:26:13 1994 +0000 +++ b/yatex.new Tue Dec 20 21:00:21 1994 +0000 @@ -1,11 +1,32 @@ What's new in YaTeX yatex.el 各バージョンの変更点について +1.55 {}の上で [prefix] k した時に直前のコマンドが maketitle 型辞書に + 属していれば {} のみ(フォント指定子があればそれも)を消すようにした。 + 新単語入力時に、N)one を選ぶと、そのEmacsでのみ有効にするように + し、補完テーブルも辞書ファイルも更新しない D)iscard を新設。 + ?プロンプトを出しているタイプセッタをkillする時は x コマンドを送っ + て終了させ .aux ファイルの破損を防ぐようにした。 + Emacs19でタイプセット時親ファイルを聞いた時にカレントバッファが + 親ファイルになってしまうのを回避した。 + 親子ファイル間ジャンプで別 frame へのジャンプをサポート(Emacs19)。 + \include{child} 上で [prefix] g して child.tex に飛び child.tex + に親ファイル指定(%#!jlatex parent)がない時はジャンプ元ファイルを + 親ファイルとみなすようにした。 + \input{} にフルパスが書いてある時も [prefix] g を可能にした。 + 同時編集するファイルの名前の重複を許した。 + [prefix] i の \item fill の修正。 + エラージャンプで dired が起動する事があるバグを修正。 + Emacs-19でもミニバッファから読み込むものの種別毎にヒストリを分け + て持つようにした(今までは Emacs18+gmhist のみ有効)。 + maketitle 型コマンド入力直後のスペースは入れないようにした。 + itemize 環境中のTABで \subitem のインデントの深さを変えた。 + 1.54 section 型コマンドの引数のデフォルトの入力には通常の文字列入力を 行うようにし、変数 user-article-table を廃止した。これにより + ~/.yatexrc に任意の elisp を入れておいても消えないようになった。 Emacs-19(Mule2) でのデフォルトのヘルプファイルの格納場所をetcディ レクトリから、site-lisp ディレクトリに変更した(注意!!)。 - ~/.yatexrc に任意の elisp を入れておいても消えないようになった。 documentstyle のアドイン関数を充実させ、スタイルオプションやスタ イルの学習を行うようにした。 ユーザ辞書も新単語の入力と同時に更新するようにし、kill-emacs を diff -r b1e036697b20 -r b0371b6ed799 yatex19.el --- a/yatex19.el Fri Nov 25 08:26:13 1994 +0000 +++ b/yatex19.el Tue Dec 20 21:00:21 1994 +0000 @@ -1,7 +1,7 @@ ;;; -*- Emacs-Lisp -*- ;;; YaTeX facilities for Emacs 19 ;;; (c )1994 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] -;;; Last modified Mon Nov 21 21:52:16 1994 on figaro +;;; Last modified Mon Dec 19 02:55:36 1994 on VFR ;;; $Id$ ;;; とりあえず hilit19 を使っている時に色が付くようにして @@ -205,7 +205,10 @@ ;; Highlightening ;; ローカルなマクロを読み込んだ後 redraw すると ;; ローカルマクロを keyword として光らせる(keywordじゃまずいかな…)。 -(defvar YaTeX-hilit-pattern-adjustment +(defvar YaTeX-hilit-patterns-alist nil + "*Hiliting pattern alist for LaTeX text. +Default value is equal to latex-mode's one.") +(defvar YaTeX-hilit-pattern-adjustment-default (list ;;\def が define なんだから new* も define でしょう。 '("\\\\\\(re\\)?new\\(environment\\|command\\){" "}" define) @@ -215,17 +218,26 @@ (concat "\\\\\\(" YaTeX-sectioning-regexp "\\){") "}" 'sectioning) ;;eqnarray などの数式環境が入ってないみたい… - '("\\\\begin{\\(eqnarray\\*?\\)\\|\\(equation\\*?\\)}" - "\\\\end{\\(eqnarray\\*?\\)\\|\\(equation\\*?\\)}" + '("\\\\begin{\\(eqnarray\\*?\\|equation\\*?\\)}" + "\\\\end{\\(eqnarray\\*?\\|equation\\*?\\)}" formula)) "Adjustment for hilit19's LaTeX hilit pattern.") +(defvar YaTeX-hilit-pattern-adjustment-private nil + "*Private variable, same purpose as YaTeX-hilit-pattern-adjustment-default.") (defvar YaTeX-hilit-sectioning-face - '(yellow/dodgerblue yellow/cornflowerblue)) + '(yellow/dodgerblue yellow/cornflowerblue) + "*Hilightening face for sectioning unit. '(FaceForLight FaceForDark)") (defvar YaTeX-hilit-singlecmd-face - '(slateblue2 aquamarine)) + '(slateblue2 aquamarine) + "*Hilightening face for maketitle type. '(FaceForLight FaceForDark)") (defun YaTeX-19-collect-macro () (cond ((and (featurep 'hilit19) (fboundp 'hilit-translate)) + (or YaTeX-hilit-patterns-alist + (let ((alist (cdr (assq 'latex-mode hilit-patterns-alist)))) + (setcar (assoc "\\\\item\\(\\[[^]]*\\]\\)?" alist) + (concat YaTeX-item-regexp "\\b\\(\\[[^]]*\\]\\)?")) + (setq YaTeX-hilit-patterns-alist alist))) (let ((get-face (function (lambda (table) @@ -242,8 +254,9 @@ (cons (cons 'yatex-mode (append - YaTeX-hilit-pattern-adjustment - (cdr (assq 'latex-mode hilit-patterns-alist)) + YaTeX-hilit-pattern-adjustment-private + YaTeX-hilit-pattern-adjustment-default + YaTeX-hilit-patterns-alist (list (list (concat "\\\\\\(" @@ -259,7 +272,7 @@ (function (lambda (s) (regexp-quote (car s)))) (append user-singlecmd-table tmp-singlecmd-table) "\\|") - "\\)") + "\\)\\b") 0 'macro)))) hilit-patterns-alist))))) (YaTeX-19-collect-macro) diff -r b1e036697b20 -r b0371b6ed799 yatexadd.el --- a/yatexadd.el Fri Nov 25 08:26:13 1994 +0000 +++ b/yatexadd.el Tue Dec 20 21:00:21 1994 +0000 @@ -1,8 +1,8 @@ ;;; -*- Emacs-Lisp -*- ;;; YaTeX add-in functions. -;;; yatexadd.el rev.9 +;;; yatexadd.el rev.11 ;;; (c )1991-1994 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] -;;; Last modified Sat Nov 12 07:03:15 1994 on VFR +;;; Last modified Mon Dec 19 03:07:01 1994 on landcruiser ;;; $Id$ ;;; @@ -176,19 +176,47 @@ (YaTeX:read-coordinates "Dimension")) ) +(defvar YaTeX-minibuffer-quick-map nil) +(if YaTeX-minibuffer-quick-map nil + (setq YaTeX-minibuffer-quick-map + (copy-keymap minibuffer-local-completion-map)) + (let ((ch (1+ ? ))) + (while (< ch 127) + (define-key YaTeX-minibuffer-quick-map (char-to-string ch) + 'YaTeX-minibuffer-quick-complete) + (setq ch (1+ ch))))) + +(defvar YaTeX:left-right-delimiters + '(("(" . ")") (")" . "(") ("[" . "]") ("]" . "[") + ("\\{" . "\\}") ("\\}" . "\\{") ("|") ("\\|") + ("\\lfloor" . "\\rfloor") ("\\lceil" . "\\rceil") + ("\\langle" . "\\rangle") ("/") (".") + ("\\rfloor" . "\\rfloor") ("\\rceil" . "\\lceil") + ("\\rangle" . "\\langle") ("\\backslash") + ("\\uparrow") ("\\downarrow") ("\\updownarrow") ("\\Updownarrow")) + "TeX math delimiter, which can be completed after \\right or \\left.") + +(defvar YaTeX:left-right-default nil "Default string of YaTeX:right.") + (defun YaTeX:left () - (let (c) - (while (not (string-match - (progn (message "Which parenthesis? One of [{(|)}]: ") - (setq c (regexp-quote (char-to-string (read-char))))) - "[{(|)}]"))) - (setq single-command "right") - (cond - ((string-match c "[(|)]") c) - (t (concat "\\" c)))) -) + (let ((minibuffer-completion-table YaTeX:left-right-delimiters) + delimiter (leftp (string= single-command "left"))) + (setq delimiter + (read-from-minibuffer + (format "Delimiter%s: " + (if YaTeX:left-right-default + (format "(default=`%s')" YaTeX:left-right-default) + "(SPC for menu)")) + nil YaTeX-minibuffer-quick-map)) + (if (string= "" delimiter) (setq delimiter YaTeX:left-right-default)) + (setq single-command (if leftp "right" "left") + YaTeX:left-right-default + (or (cdr (assoc delimiter YaTeX:left-right-delimiters)) delimiter)) + delimiter)) + (fset 'YaTeX:right 'YaTeX:left) + (defun YaTeX:read-coordinates (&optional mes varX varY) (concat "(" @@ -487,7 +515,7 @@ (if (> argc 0) (insert (format "[%d]" argc))) (if (and (stringp command) (string< "" command) - (y-or-n-p "Update user completion table?")) + (y-or-n-p "Update dictionary?")) (cond ((= argc 0) (YaTeX-update-table @@ -515,6 +543,8 @@ "Page style: " '(("plain") ("empty") ("headings") ("myheadings") ("normal") nil)) ) +(fset 'YaTeX::thispagestyle 'YaTeX::pagestyle) + ;; ; completion for the arguments of \pagenumbering ;; @@ -570,6 +600,7 @@ "*User definable alist of local style parameters.") (defvar YaTeX:length-history nil "Holds history of length.") +(put 'YaTeX:length-history 'no-default t) (defun YaTeX::setlength (&optional argp) "YaTeX add-in function for arguments of \\setlength." (cond @@ -583,8 +614,7 @@ nil nil "\\") ) ((equal 2 argp) - (let ((minibuffer-history-symbol 'YaTeX:length-history)) - (read-string "Length: ")))) + (read-string-with-history "Length: " nil 'YaTeX:length-history))) ) (fset 'YaTeX::addtolength 'YaTeX::setlength) @@ -670,7 +700,7 @@ (minibuffer-completion-table dt) (opt (read-from-minibuffer "Style options ([opt1,opt2,...]): " - nil YaTeX-minibuffer-completion-map)) + nil YaTeX-minibuffer-completion-map nil)) (substr opt) o) (if (string< "" opt) (progn @@ -689,9 +719,10 @@ ""))) (defun YaTeX::documentstyle (&optional argp) - "YaTeX add-in function for arguments of \\socumentstyle." + "YaTeX add-in function for arguments of \\documentstyle." (cond ((equal argp 1) + (setq env-name "document") (let ((sname (YaTeX-cplread-with-learning (format "Documentstyle (default %s): " diff -r b1e036697b20 -r b0371b6ed799 yatexgen.el --- a/yatexgen.el Fri Nov 25 08:26:13 1994 +0000 +++ b/yatexgen.el Tue Dec 20 21:00:21 1994 +0000 @@ -1,8 +1,8 @@ ;;; -*- Emacs-Lisp -*- ;;; YaTeX add-in function generator. -;;; yatexgen.el rev.3 +;;; yatexgen.el rev.4 ;;; (c )1991-1994 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] -;;; Last modified Thu Nov 17 03:54:56 1994 on VFR +;;; Last modified Sun Dec 11 05:38:35 1994 on VFR ;;; $Id$ (require 'yatex) @@ -469,7 +469,7 @@ (concat "(read-file-name \"" (read-string (if nth (format "Prompt for argument#%d: " nth) "Prompt: ")) - ": \" nil nil t \"\")\n") + ": \" "" nil t \"\")\n") ) (defun YaTeX-generate-create-read-oneof (&optional nth readpos) (concat diff -r b1e036697b20 -r b0371b6ed799 yatexlib.el --- a/yatexlib.el Fri Nov 25 08:26:13 1994 +0000 +++ b/yatexlib.el Tue Dec 20 21:00:21 1994 +0000 @@ -2,7 +2,7 @@ ;;; YaTeX library of general functions. ;;; yatexlib.el ;;; (c )1994 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] -;;; Last modified Thu Nov 24 02:20:45 1994 on VFR +;;; Last modified Wed Dec 21 05:58:06 1994 on landcruiser ;;; $Id$ ;;;###autoload @@ -47,15 +47,15 @@ Optional second arg SETBUF t make use set-buffer instead of switch-to-buffer." (interactive "Fswitch to file: ") (let (buf) - (if (setq buf (get-buffer (file-name-nondirectory file))) + (if (setq buf (get-file-buffer file)) (progn (funcall (if setbuf 'set-buffer 'switch-to-buffer) - (file-name-nondirectory file)) + (get-file-buffer file)) buf) (if (file-exists-p file) - (funcall - (if setbuf 'find-file-noselect 'find-file) - file) + (or ;find-file returns nil but set current-buffer... + (funcall (if setbuf 'find-file-noselect 'find-file) file) + (current-buffer)) (message "%s was not found in this directory." file) nil))) ) @@ -64,8 +64,8 @@ (defun YaTeX-switch-to-buffer-other-window (file) "Switch to buffer if buffer exists, find file if not." (interactive "Fswitch to file: ") - (if (get-buffer (file-name-nondirectory file)) - (progn (switch-to-buffer-other-window file) t) + (if (get-file-buffer file) + (progn (switch-to-buffer-other-window (get-file-buffer file)) t) (if (file-exists-p file) (progn (find-file-other-window file) t) (message "%s was not found in this directory." file) @@ -128,19 +128,7 @@ (get-buffer-window buffer)) (progn (if select - (cond - (YaTeX-emacs-19 - (let ((frame (window-frame (get-buffer-window buffer t)))) - (select-frame frame) - (focus-frame frame) - (set-mouse-position frame 0 0) - (raise-frame frame) - (select-window (get-buffer-window buffer)) - (if (and (featurep 'windows) - (win:frame-window frame)) - (win:adjust-window)))) - (t - (select-window (get-buffer-window buffer))))) + (goto-buffer-window buffer)) t)) (let ((window (selected-window)) (wlist (YaTeX-window-list)) win w (x 0)) @@ -167,18 +155,7 @@ ((and YaTeX-emacs-19 (get-buffer-window buffer t)) nil) ;if found in other frame (YaTeX-default-pop-window-height - (split-window - (selected-window) - (max - (min - (- (screen-height) - (if (numberp YaTeX-default-pop-window-height) - (+ YaTeX-default-pop-window-height 2) - (/ (* (screen-height) - (string-to-int YaTeX-default-pop-window-height)) - 100))) - (- (screen-height) window-min-height 1)) - window-min-height)) + (split-window-calculate-height YaTeX-default-pop-window-height) (pop-to-buffer buffer) (or select (select-window window))) (t nil))) @@ -186,6 +163,27 @@ ) ;;;###autoload +(defun split-window-calculate-height (height) + "Split current window wight specified HEIGHT. +If HEIGHT is number, make new window that has HEIGHT lines. +If HEIGHT is string, make new window that occupy HEIGT % of screen height. +Otherwise split window conventionally." + (if (one-window-p) + (split-window + (selected-window) + (max + (min + (- (screen-height) + (if (numberp YaTeX-default-pop-window-height) + (+ YaTeX-default-pop-window-height 2) + (/ (* (screen-height) + (string-to-int YaTeX-default-pop-window-height)) + 100))) + (- (screen-height) window-min-height 1)) + window-min-height))) +) + +;;;###autoload (defun YaTeX-window-list () (let*((curw (selected-window)) (win curw) (wlist (list curw))) (while (not (eq curw (setq win (next-window win)))) @@ -215,11 +213,20 @@ ;;;###autoload (defun YaTeX-minibuffer-complete () "Complete in minibuffer. -If the symbol 'delim is bound and is string, its value is assumed to be + If the symbol 'delim is bound and is string, its value is assumed to be the character class of delimiters. Completion will be performed on -the last field separated by those delimiters." +the last field separated by those delimiters. + If the symbol 'quick is bound and is 't, when the try-completion results +in t, exit minibuffer immediately." (interactive) - (let (beg word compl (md (match-data))) + (let ((md (match-data)) beg word compl + (quick (and (boundp 'quick) (eq quick t))) + (displist ;function to display completion-list + (function + (lambda () + (with-output-to-temp-buffer "*Completions*" + (display-completion-list + (all-completions word minibuffer-completion-table))))))) (setq beg (if (and (boundp 'delim) (stringp delim)) (save-excursion (skip-chars-backward (concat "^" delim)) @@ -229,31 +236,117 @@ compl (try-completion word minibuffer-completion-table)) (cond ((eq compl t) - (let ((p (point)) (max (point-max))) - (goto-char max) - (insert " [Sole completion]") - (goto-char p) - (sit-for 1) - (delete-region max (point-max)) - (goto-char p))) + (if quick (exit-minibuffer) + (let ((p (point)) (max (point-max))) + (unwind-protect + (progn + (goto-char max) + (insert " [Sole completion]") + (goto-char p) + (sit-for 1)) + (delete-region max (point-max)) + (goto-char p))))) ((eq compl nil) (ding) (save-excursion (let (p) - (goto-char (setq p (point-max))) - (insert " [No match]") - (goto-char p) - (sit-for 2) - (delete-region p (point-max))))) + (unwind-protect + (progn + (goto-char (setq p (point-max))) + (insert " [No match]") + (goto-char p) + (sit-for 2)) + (delete-region p (point-max)))))) ((string= compl word) - (with-output-to-temp-buffer "*Completions*" - (display-completion-list - (all-completions word minibuffer-completion-table)))) + (funcall displist)) (t (delete-region beg (point-max)) - (insert compl)) - ) + (insert compl) + (if quick + (if (eq (try-completion compl minibuffer-completion-table) t) + (exit-minibuffer) + (funcall displist))))) (store-match-data md)) ) +(defun YaTeX-minibuffer-quick-complete () + "Set 'quick to 't and call YaTeX-minibuffer-complete. +See documentation of YaTeX-minibuffer-complete." + (interactive) + (let ((quick t)) + (self-insert-command 1) + (YaTeX-minibuffer-complete))) + +(defun foreach-buffers (pattern job) + "For each buffer which matches with PATTERN, do JOB." + (let ((list (buffer-list))) + (save-excursion + (while list + (set-buffer (car list)) + (if (or (and (stringp pattern) + (buffer-file-name) + (string-match pattern (buffer-file-name))) + (and (symbolp pattern) major-mode (eq major-mode pattern))) + (eval job)) + (setq list (cdr list))))) +) + +(defun goto-buffer-window (buffer) + "Select window which is bound to BUFFER. +If no such window exist, switch to buffer BUFFER." + (if (stringp buffer) + (setq buffer (or (get-file-buffer buffer) (get-buffer buffer)))) + (if (get-buffer buffer) + (cond + ((get-buffer-window buffer) + (select-window (get-buffer-window buffer))) + ((and YaTeX-emacs-19 (get-buffer-window buffer t)) + (let*((win (get-buffer-window buffer t)) + (frame (window-frame win))) + (select-frame frame) + (raise-frame frame) + (focus-frame frame) + (select-window win) + (set-mouse-position frame 0 0) + (and (featurep 'windows) (fboundp 'win:adjust-window) + (win:adjust-window)))) + (t (switch-to-buffer buffer)))) +) + +;; Here starts the functions which support gmhist-vs-Emacs19 compatible +;; reading with history. +;;;###autoload +(defun completing-read-with-history + (prompt table &optional predicate must-match initial hsym) + "Completing read with general history: gmhist, Emacs-19." + (let ((minibuffer-history + (or (symbol-value hsym) + (and (boundp 'minibuffer-history) minibuffer-history))) + (minibuffer-history-symbol (or hsym 'minibuffer-history))) + (prog1 + (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)) + (if (and YaTeX-emacs-19 hsym) (set hsym minibuffer-history))))) + +;;;###autoload +(defun read-from-minibuffer-with-history (prompt &optional init map read hsym) + "Read from minibuffer with general history: gmhist, Emacs-19." + (cond + (YaTeX-emacs-19 + (read-from-minibuffer prompt init map read hsym)) + (t + (let ((minibuffer-history-symbol hsym)) + (read-from-minibuffer prompt init map read))))) + +;;;###autoload +(defun read-string-with-history (prompt &optional init hsym) + "Read string with history: gmhist(Emacs-18) and Emacs-19." + (cond + (YaTeX-emacs-19 + (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)))) (provide 'yatexlib) diff -r b1e036697b20 -r b0371b6ed799 yatexmth.el --- a/yatexmth.el Fri Nov 25 08:26:13 1994 +0000 +++ b/yatexmth.el Tue Dec 20 21:00:21 1994 +0000 @@ -2,7 +2,7 @@ ;;; YaTeX math-mode-specific functions. ;;; yatexmth.el rev.2 ;;; (c )1993-1994 by HIROSE Yuuji [yuuji@ae.keio.ac.jp] -;;; Last modified Tue Oct 11 22:57:43 1994 on figaro +;;; Last modified Fri Dec 2 17:03:30 1994 on VFR ;;; $Id$ ;;; [Customization guide] @@ -42,7 +42,7 @@ ;;; ("'" . Other-List-if-any))) ;;; ;;; Put these expressions into your ~/.emacs, and you can use this -;;; completion in the YaTeX-math-mode. +;;; completion in the math-mode. ;;; ;;; And you can add your favorite completion sequences to the ;;; default completion list invoked with `;', by defining those lists @@ -81,8 +81,8 @@ ;;; '(("," . YaTeX-math-funcs-list) ;;; ("'" . ほかに定義したいシリーズがあれば…))) ;;; -;;; これらを ~/.emacs に書いておけば、野鳥の math-mode で自分専用の -;;; イメージ補完が利用できます。 +;;; これらを ~/.emacs に書いておけば、math-mode で自分専用のイメージ +;;; 補完が利用できます。 (defvar YaTeX-jisold (and (boundp 'dos-machine-type) @@ -378,6 +378,10 @@ (list 'nth 1 list)) (defvar YaTeX-math-cmd-regexp (concat (regexp-quote YaTeX-ec) "[A-z]")) +(defvar YaTeX-math-verbatim-environments + '("alltt") + "*List of environments in which LaTeX math mode is disabled. +This value is appended with YaTeX-verbatim-environments.") ;;; ;;YaTeX math-mode functions @@ -438,12 +442,14 @@ "If current position is supposed to be in LaTeX-math-mode, return t." (or (YaTeX-quick-in-environment-p '("math" "eqnarray" "equation" "eqnarray*" "displaymath")) - (let ((p (point)) (nest 0) me0 + (let*((p (point)) (nest 0) me0 + (delim (concat YaTeX-sectioning-regexp + "\\|^%\\|^$\\|^\C-l")) (boundary (save-excursion - (if (looking-at YaTeX-paragraph-delimiter) + (if (looking-at delim) (goto-char (max (point-min) (1- (point))))) - (re-search-backward YaTeX-paragraph-delimiter nil 1) + (re-search-backward delim nil 1) (point)))) (save-excursion (cond @@ -455,7 +461,7 @@ "\\([()]\\|[][]\\)") boundary t)) (setq me0 (match-end 0)) (if (or (YaTeX-on-comment-p) - (YaTeX-quick-in-environment-p "verbatim")) nil + (YaTeX-literal-p)) nil (if (or (= (char-after (1- me0)) ?\)) (= (char-after (1- me0)) ?\])) (setq nest (1+ nest)) @@ -464,11 +470,18 @@ (if (< nest 0) (throw 'open t)))) t) (t (catch 'dollar - (while (search-backward "$" boundary t) + (while ;(search-backward "$" boundary t);little bit fast. + (YaTeX-re-search-active-backward ;;;;;; Too slow??? + "\\$" YaTeX-comment-prefix boundary t) (cond ((equal (char-after (1- (point))) ?$) ; $$ equation $$ (backward-char 1) (setq nest (1+ nest))) + ((let ((YaTeX-verbatim-environments + (append YaTeX-math-verbatim-environments + YaTeX-verbatim-environments))) + (YaTeX-literal-p)) + nil) ((and (equal (char-after (1- (point))) ?\\ ) (not (equal (char-after (- (point) 3)) ?\\ ))) nil) ;\$ @@ -583,8 +596,9 @@ (setq result (catch 'complete (if (and (not force) - (or (and (not YaTeX-auto-math-mode) (not YaTeX-math-mode)) - (not (YaTeX-in-math-mode-p)))) + (if YaTeX-auto-math-mode + (not (YaTeX-in-math-mode-p)) + (not YaTeX-math-mode))) (throw 'complete 'escape));this tag should be exit, but... (while t (message "Sequence(TAB for menu): %s" key) diff -r b1e036697b20 -r b0371b6ed799 yatexprc.el --- a/yatexprc.el Fri Nov 25 08:26:13 1994 +0000 +++ b/yatexprc.el Tue Dec 20 21:00:21 1994 +0000 @@ -1,709 +1,727 @@ -;;; -*- Emacs-Lisp -*- -;;; YaTeX process handler. -;;; yatexprc.el -;;; (c )1993-1994 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] -;;; Last modified Fri Nov 25 03:31:46 1994 on VFR -;;; $Id$ - -(require 'yatex) - -(defvar YaTeX-typeset-process nil - "Process identifier for jlatex" -) -(defvar YaTeX-typeset-buffer "*YaTeX-typesetting*" - "Process buffer for jlatex") - -(defvar YaTeX-typeset-buffer-syntax nil - "*Syntax table for typesetting buffer") - -(defvar YaTeX-current-TeX-buffer nil - "Keeps the buffer on which recently typeset run.") - -(defvar YaTeX-shell-command-option - (or (and (boundp 'shell-command-option) shell-command-option) - (if YaTeX-dos "/c" "-c")) - "Shell option for command execution.") - -(if YaTeX-typeset-buffer-syntax nil - (setq YaTeX-typeset-buffer-syntax - (make-syntax-table (standard-syntax-table))) - (modify-syntax-entry ?\{ "w" YaTeX-typeset-buffer-syntax) - (modify-syntax-entry ?\} "w" YaTeX-typeset-buffer-syntax) - (modify-syntax-entry ?\[ "w" YaTeX-typeset-buffer-syntax) - (modify-syntax-entry ?\] "w" YaTeX-typeset-buffer-syntax) -) - -(defun YaTeX-typeset (command buffer) - "Execute jlatex (or other) to LaTeX typeset." - (interactive) - (save-excursion - (let ((p (point)) (window (selected-window)) execdir) - (if (and YaTeX-typeset-process - (eq (process-status YaTeX-typeset-process) 'run)) - ;; if tex command is halting. - (YaTeX-kill-typeset-process YaTeX-typeset-process)) - (YaTeX-visit-main t);;execution directory - (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))))) - (set-buffer (get-buffer-create buffer)) - (setq default-directory execdir) - (cd execdir) - (erase-buffer) - (cond - (YaTeX-dos ;if MS-DOS - (YaTeX-put-nonstopmode) - (call-process - shell-file-name nil buffer nil YaTeX-shell-command-option command) - (YaTeX-remove-nonstopmode)) - (t ;if UNIX - (set-process-buffer - (setq YaTeX-typeset-process - (start-process "LaTeX" buffer shell-file-name - YaTeX-shell-command-option command)) - (get-buffer buffer)) - (set-process-sentinel YaTeX-typeset-process 'YaTeX-typeset-sentinel))) - (message (format "Calling `%s'..." command)) - (setq YaTeX-current-TeX-buffer (buffer-name)) - (use-local-map YaTeX-typesetting-mode-map) - (set-syntax-table YaTeX-typeset-buffer-syntax) - (setq mode-name "typeset") - (if YaTeX-typeset-process ; if process is running (maybe on UNIX) - (cond ((boundp 'MULE) - (set-current-process-coding-system - YaTeX-latex-message-code YaTeX-coding-system)) - ((boundp 'NEMACS) - (set-kanji-process-code YaTeX-latex-message-code)))) - (if YaTeX-dos (message "Done.") - (insert " ") - (set-marker (process-mark YaTeX-typeset-process) (1- (point)))) - (if (bolp) (forward-line -1)) ;what for? - (if YaTeX-emacs-19 - (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)) - (select-window window))) -) - -(defun YaTeX-typeset-sentinel (proc mes) - (cond ((null (buffer-name (process-buffer proc))) - ;; buffer killed - (set-process-buffer proc nil)) - ((memq (process-status proc) '(signal exit)) - (let* ((obuf (current-buffer)) (pbuf (process-buffer proc)) - (pwin (get-buffer-window pbuf)) - (owin (selected-window)) win) - ;; save-excursion isn't the right thing if - ;; process-buffer is current-buffer - (unwind-protect - (progn - ;; Write something in *typesetting* and hack its mode line - (if pwin - (select-window pwin) - (set-buffer pbuf)) - ;;(YaTeX-showup-buffer pbuf nil t) - (goto-char (point-max)) - (if pwin (recenter -3)) - (insert ?\n "latex typesetting " mes) - (forward-char -1) - (insert " at " (substring (current-time-string) 0 -5) "\n") - (forward-char 1) - (setq mode-line-process - (concat ": " - (symbol-name (process-status proc)))) - (message "latex typesetting %s." - (if (eq (process-status proc) 'exit) - "done" "ceased")) - ;; If buffer and mode line shows that the process - ;; is dead, we can delete it now. Otherwise it - ;; will stay around until M-x list-processes. - (delete-process proc) - ) - (setq YaTeX-typesetting-process nil) - ;; Force mode line redisplay soon - (set-buffer-modified-p (buffer-modified-p)) - ) - (select-window owin) - (set-buffer obuf)))) -) - -(defvar YaTeX-texput-file "texput.tex" - "*File name for temporary file of typeset-region." -) - -(defun YaTeX-typeset-region () - "Paste the region to the file `texput.tex' and execute jlatex (or other) -to LaTeX typeset. The region is specified by the rule: - (1)If keyword `%#BEGIN' is found in the upper direction from (point). - (1-1)if the keyword `%#END' is found after `%#BEGIN', - ->Assume the text between `%#BEGIN' and `%#END' as region. - (1-2)if the keyword `%#END' is not found anywhere after `%#BEGIN', - ->Assume the text after `%#BEGIN' as region. - (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." - (interactive) - (save-excursion - (let* - ((end "") typeout ;Type out message that tells the method of cutting. - (cmd (concat (YaTeX-get-latex-command nil) " " YaTeX-texput-file)) - (buffer (current-buffer)) opoint preamble (subpreamble "") main - (hilit-auto-highlight nil) ;for Emacs19 with hilit19 - reg-begin reg-end) - - (save-excursion - (if (search-backward "%#BEGIN" nil t) - (progn - (setq typeout "--- Region from BEGIN to " - end "the end of the buffer ---" - reg-begin (match-end 0)) - (if (search-forward "%#END" nil t) - (setq reg-end (match-beginning 0) - end "END ---") - (setq reg-end (point-max)))) - (setq typeout "=== Region from (point) to (mark) ===") - (setq reg-begin (point) reg-end (mark))) - (goto-char (point-min)) - (while (search-forward "%#REQUIRE" nil t) - (setq subpreamble - (concat subpreamble - (cond - ((eolp) - (buffer-substring - (match-beginning 0) - (point-beginning-of-line))) - (t (buffer-substring - (match-end 0) - (point-end-of-line)))) - "\n")) - (goto-char (match-end 0)))) - (YaTeX-visit-main t) - (setq main (current-buffer)) - (setq opoint (point)) - (goto-char (point-min)) - (setq - preamble - (if (re-search-forward "^[ ]*\\\\begin.*{document}" nil t) - (buffer-substring (point-min) (match-end 0)) - (concat "\\documentstyle{" YaTeX-default-document-style "}\n" - "\\begin{document}"))) - (goto-char opoint) - ;;(set-buffer buffer) ;for clarity - (set-buffer (find-file-noselect YaTeX-texput-file)) - ;;(find-file YaTeX-texput-file) - (erase-buffer) - (if YaTeX-need-nonstop - (insert "\\nonstopmode{}\n")) - (insert preamble "\n" subpreamble "\n") - (insert-buffer-substring buffer reg-begin reg-end) - (insert "\\typeout{" typeout end "}\n") ;Notice the selected method. - (insert "\n\\end{document}\n") - (basic-save-buffer) - (kill-buffer (current-buffer)) - (set-buffer main) ;return to parent file or itself. - (YaTeX-typeset cmd YaTeX-typeset-buffer) - (switch-to-buffer buffer) ;for Emacs-19 - (put 'dvi2-command 'region t))) -) - -(defun YaTeX-typeset-buffer () - "Typeset whole buffer. If %#! usage says other buffer is main text, -visit main buffer to confirm if its includeonly list contains current -buffer's file. And if it doesn't contain editing text, ask user which -action wants to be done, A:Add list, R:Replace list, %:comment-out list." - (interactive) - (YaTeX-save-buffers) - (let*((me (substring (buffer-name) 0 (rindex (buffer-name) ?.))) - (mydir (file-name-directory (buffer-file-name))) - (cmd (YaTeX-get-latex-command t))) - (if (YaTeX-main-file-p) nil - (save-excursion - (YaTeX-visit-main t) ;search into main buffer - (save-excursion - (push-mark (point) t) - (goto-char (point-min)) - (if (and (re-search-forward "^[ ]*\\\\begin{document}" nil t) - (re-search-backward "^[ ]*\\\\includeonly{" nil t)) - (let* - ((b (progn (skip-chars-forward "^{") (point))) - (e (progn (skip-chars-forward "^}") (1+ (point)))) - (s (buffer-substring b e)) c - (pardir (file-name-directory (buffer-file-name)))) - (if (string-match (concat "[{,/]" me "[,}]") s) - nil ; Nothing to do when it's already in includeonly. - (ding) - (switch-to-buffer (current-buffer));Display this buffer. - (setq - me ;;Rewrite my name(me) to contain sub directory name. - (concat - (if (string-match pardir mydir) ;if mydir is child of main - (substring mydir (length pardir)) ;cut absolute path - mydir) ;else concat absolute path name. - me)) - (message - "`%s' is not in \\includeonly. A)dd R)eplace %%)comment? " - me) - (setq c (read-char)) - (cond - ((= c ?a) - (goto-char (1+ b)) - (insert me (if (string= s "{}") "" ","))) - ((= c ?r) - (delete-region (1+ b) (1- e)) (insert me)) - ((= c ?%) - (beginning-of-line) (insert "%")) - (t nil)) - (basic-save-buffer)))) - (exchange-point-and-mark)) - )) - (YaTeX-typeset cmd YaTeX-typeset-buffer) - (put 'dvi2-command 'region nil)) -) - -(defvar YaTeX-call-command-history nil - "Holds history list of YaTeX-call-command-on-file.") -(put 'YaTeX-call-command-history 'no-default t) -(defun YaTeX-call-command-on-file (base-cmd buffer) - (YaTeX-save-buffers) - (YaTeX-typeset - (let ((minibufer-history-symbol 'YaTeX-call-command-history)) - (read-string "Call command: " - (concat base-cmd " " (YaTeX-get-preview-file-name)))) - buffer) -) - -(defun YaTeX-bibtex-buffer (cmd) - "Pass the bibliography data of editing file to bibtex." - (interactive) - (YaTeX-save-buffers) - (YaTeX-call-command-on-file cmd "*YaTeX-bibtex*" ) -) - -(defun YaTeX-kill-typeset-process (proc) - "Kill process PROC after sending signal to PROC. -PROC should be process identifier." - (cond - (YaTeX-dos - (error "MS-DOS can't have concurrent process.")) - ((or (null proc) (not (eq (process-status proc) 'run))) - (error "No typesetting process.")) - (t (interrupt-process proc) - (delete-process proc))) -) - -(defun YaTeX-system (command buffer) - "Execute some command on buffer. Not a official function." - (save-excursion - (YaTeX-showup-buffer - buffer (function (lambda (x) (nth 3 (window-edges x))))) - (set-buffer (get-buffer-create buffer)) - (erase-buffer) - (if YaTeX-dos - (call-process - shell-file-name nil buffer nil YaTeX-shell-command-option command) - (set-process-buffer - (start-process - "system" buffer shell-file-name YaTeX-shell-command-option command) - (get-buffer buffer)))) -) - -(defvar YaTeX-preview-command-history nil - "Holds minibuffer history of preview command.") -(put 'YaTeX-preview-command-history 'no-default t) -(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) - "Execute xdvi (or other) to tex-preview." - (interactive - (list - (let ((minibuffer-history-symbol 'YaTeX-preview-command-history)) - (read-string "Preview command: " dvi2-command)) - (let ((minibuffer-history-symbol 'YaTeX-preview-file-history)) - (read-string "Preview file[.dvi]: " - (if (get 'dvi2-command 'region) - (substring YaTeX-texput-file - 0 (rindex YaTeX-texput-file ?.)) - (YaTeX-get-preview-file-name)) - )))) - (setq dvi2-command preview-command) ;`dvi2command' is buffer local - (save-excursion - (YaTeX-visit-main t) - (let ((pbuffer "*dvi-preview*") (dir default-directory)) - (YaTeX-showup-buffer - pbuffer (function (lambda (x) (nth 3 (window-edges x))))) - (set-buffer (get-buffer-create pbuffer)) - (erase-buffer) - (setq default-directory dir) ;for 18 - (cd dir) ;for 19 - (cond - (YaTeX-dos ;if MS-DOS - (send-string-to-terminal "\e[2J\e[>5h") ;CLS & hide cursor - (call-process shell-file-name "con" "*dvi-preview*" nil - YaTeX-shell-command-option preview-command preview-file) - (send-string-to-terminal "\e[>5l") ;show cursor - (redraw-display)) - (t ;if UNIX - (set-process-buffer - (start-process "preview" "*dvi-preview*" shell-file-name - YaTeX-shell-command-option - (concat preview-command " " preview-file)) - (get-buffer pbuffer)) - (message - (concat "Starting " preview-command - " to preview " preview-file)))))) -) - -(defun YaTeX-prev-error () - "Visit previous typeset error. - To avoid making confliction of line numbers by editing, jump to -error or warning lines in reverse order." - (interactive) - (let ((cur-buf (buffer-name)) (cur-win (selected-window)) - error-line typeset-win error-buffer error-win) - (if (null (get-buffer YaTeX-typeset-buffer)) - (error "There is no typesetting buffer.")) - (YaTeX-showup-buffer YaTeX-typeset-buffer nil t) - (setq typeset-win (selected-window)) - (if (re-search-backward - (concat "\\(" latex-error-regexp "\\)\\|\\(" - latex-warning-regexp "\\)") - nil t) - nil - (select-window cur-win) - (error "No more erros on %s" cur-buf)) - (goto-char (match-beginning 0)) - (skip-chars-forward "^0-9" (match-end 0)) - (setq error-line - (string-to-int - (buffer-substring - (point) - (progn (skip-chars-forward "0-9" (match-end 0)) (point)))) - error-buffer (YaTeX-get-error-file cur-buf) - error-win (get-buffer-window error-buffer)) - (if (or (null error-line) (equal 0 error-line)) - (error "Can't detect error position.")) - (select-window cur-win) - (cond - (error-win (select-window error-win)) - ((eq (get-lru-window) typeset-win) - (YaTeX-switch-to-buffer error-buffer)) - (t (select-window (get-lru-window)) - (YaTeX-switch-to-buffer error-buffer))) - (setq error-win (selected-window)) - (goto-line error-line) - (message "LaTeX %s in `%s' on line: %d." - (if (match-beginning 1) "error" "warning") - error-buffer error-line) - (select-window typeset-win) - (skip-chars-backward "0-9") - (recenter (/ (window-height) 2)) - (sit-for 3) - (goto-char (match-beginning 0)) - (select-window error-win)) -) - -(defun YaTeX-jump-error-line () - "Jump to corresponding line on latex command's error message." - (interactive) - (let (error-line error-file error-buf) - (save-excursion - (beginning-of-line) - (setq error-line (re-search-forward "l[ ines]*\\.?\\([1-9][0-9]*\\)" - (point-end-of-line) t))) - (if (null error-line) - (if (eobp) (insert (this-command-keys)) - (error "No line number expression.")) - (goto-char (match-beginning 0)) - (setq error-line (string-to-int - (buffer-substring (match-beginning 1) (match-end 1))) - error-file (YaTeX-get-error-file YaTeX-current-TeX-buffer) - error-buf (YaTeX-switch-to-buffer error-file t)) - (if (null error-buf) - (error "`%s' is not found in this directory." error-file)) - (YaTeX-showup-buffer error-buf nil t) - (goto-line error-line))) -) - -(defun YaTeX-send-string () - "Send string to current typeset process." - (interactive) - (if (and (eq (process-status YaTeX-typeset-process) 'run) - (>= (point) (process-mark YaTeX-typeset-process))) - (let ((b (process-mark YaTeX-typeset-process)) - (e (point-end-of-line))) - (goto-char b) - (skip-chars-forward " \t" e) - (setq b (point)) - (process-send-string - YaTeX-typeset-process (concat (buffer-substring b e) "\n")) - (goto-char e) - (insert "\n") - (set-marker (process-mark YaTeX-typeset-process) (point)) - (insert " ")) - (ding)) -) - -(defun YaTeX-view-error () - (interactive) - (if (null (get-buffer YaTeX-typeset-buffer)) - (message "No typeset buffer found.") - (let ((win (selected-window))) - (YaTeX-showup-buffer YaTeX-typeset-buffer nil t) - ;; Next 3 lines are obsolete because YaTeX-typesetting-buffer is - ;; automatically scrolled up at typesetting. - ;;(goto-char (point-max)) - ;;(forward-line -1) - ;;(recenter -1) - (select-window win))) -) - -(defun YaTeX-get-error-file (default) - "Get current processing file from typesetting log." - (save-excursion - (let(s) - (condition-case () (up-list -1) - (error - (let ((list 0) found) - (while - (and (<= list 0) (not found) - (re-search-backward "\\((\\)\\|\\()\\)" nil t)) - (if (equal (match-beginning 0) (match-beginning 2)) ;close paren. - (setq list (1- list)) ;open paren - (setq list (1+ list)) - (if (= list 1) - (if (looking-at "\\([^,{}%]+\.\\)tex\\|sty") - (setq found t) - (setq list (1- list))))))))) - (setq s - (buffer-substring - (progn (forward-char 1) (point)) - (progn (skip-chars-forward "-A-Za-z0-9_/\.\\" (point-end-of-line)) - (point)))) - (if (string= "" s) default s))) -) - -(defun YaTeX-put-nonstopmode () - (if YaTeX-need-nonstop - (if (re-search-backward "\\\\nonstopmode{}" (point-min) t) - nil ;if already written in text then do nothing - (save-excursion - (YaTeX-visit-main t) - (goto-char (point-min)) - (insert "\\nonstopmode{}%_YaTeX_%\n"))) - ) -) - -(defun YaTeX-remove-nonstopmode () - (if YaTeX-need-nonstop ;for speed - (save-excursion - (YaTeX-visit-main t) - (goto-char (point-min)) - (forward-line 1) - (narrow-to-region (point-min) (point)) - (goto-char (point-min)) - (delete-matching-lines "^\\\\nonstopmode\\{\\}%_YaTeX_%$") - (widen))) -) - -(defun YaTeX-get-preview-file-name () - "Get file name to preview by inquiring YaTeX-get-latex-command" - (let* ((latex-cmd (YaTeX-get-latex-command t)) - (rin (rindex latex-cmd ? )) - (fname (if (> rin -1) (substring latex-cmd (1+ rin)) "")) - (period)) - (if (string= fname "") - (setq fname (substring (file-name-nondirectory - (buffer-file-name)) - 0 -4)) - (setq period (rindex fname ?.)) - (setq fname (substring fname 0 (if (eq -1 period) nil period))) - )) -) - -(defun YaTeX-get-latex-command (&optional switch) - "Specify the latex-command name and its argument. -If there is a line which begins with string: \"%#!\", the following -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 -will be the latex-command, -and you write \"%#!jlatex main.tex\" on some line and argument SWITCH -is non-nil, then - \"jlatex main.tex\" - -will be given to the shell." - (let (magic command target) - (setq parent - (cond - (YaTeX-parent-file YaTeX-parent-file) - (t (save-excursion - (YaTeX-visit-main t) - (file-name-nondirectory (buffer-file-name))))) - magic (YaTeX-get-builtin "!")) - (cond - (magic - (cond - (switch (if (string-match "\\s " magic) magic - (concat magic " " parent))) - (t (concat (substring magic 0 (string-match "\\s " magic)) " ")))) - (t (concat tex-command " " (if switch parent))))) -) - -(defvar YaTeX-lpr-command-history nil - "Holds command line history of YaTeX-lpr.") -(put 'YaTeX-lpr-command-history 'no-default t) -(defun YaTeX-lpr (arg) - "Print out. If prefix arg ARG is non nil, call print driver without -page range description." - (interactive "P") - (let*((cmd (or (YaTeX-get-builtin "LPR") dviprint-command-format)) - from to (lbuffer "*dvi-printing*")) - (setq - cmd - (YaTeX-replace-format - cmd "f" - (if (or arg (not (string-match "%f" cmd))) - "" - (YaTeX-replace-format - dviprint-from-format - "b" - (if (string= - (setq from (read-string "From page(default 1): ")) "") - "1" from)))) - ) - (setq - cmd - (YaTeX-replace-format - cmd "t" - (if (or arg (not (string-match "%t" cmd)) - (string= - (setq to (read-string "To page(default none): ")) "")) - "" - (YaTeX-replace-format dviprint-to-format "e" to))) - ) - (setq cmd - (let ((minibuffer-history-symbol 'YaTeX-lpr-command-history)) - (read-string "Edit command line: " - (format cmd (YaTeX-get-preview-file-name))))) - (save-excursion - (YaTeX-visit-main t) ;;change execution directory - (YaTeX-showup-buffer - lbuffer (function (lambda (x) (nth 3 (window-edges x))))) - (set-buffer (get-buffer-create lbuffer)) - (erase-buffer) - (cond - (YaTeX-dos - (call-process shell-file-name "con" "*dvi-printing*" nil - YaTeX-shell-command-option cmd)) - (t - (set-process-buffer - (start-process "print" "*dvi-printing*" shell-file-name - YaTeX-shell-command-option cmd) - (get-buffer lbuffer)) - (message "Starting printing command: %s..." cmd))) - )) -) - -(defun YaTeX-main-file-p () - "Return if current buffer is main LaTeX source." - (cond - ((YaTeX-get-builtin "!") - (string-match (YaTeX-guess-parent (YaTeX-get-builtin "!")) (buffer-name))) - (t - (save-excursion - (let ((latex-main-id (concat "^\\s *" YaTeX-ec-regexp "documentstyle"))) - (or (re-search-backward latex-main-id nil t) - (re-search-forward latex-main-id nil t)))))) -) - -(defun YaTeX-visit-main (&optional setbuf) - "Switch buffer to main LaTeX source. -Use set-buffer instead of switch-to-buffer if the optional second argument -SETBUF is t(Use it only from Emacs-Lisp program)." - (interactive) - (let (b-in main-file) - (if (setq b-in (YaTeX-get-builtin "!")) - (setq main-file (YaTeX-guess-parent b-in))) - (if YaTeX-parent-file - (setq main-file ;;(get-file-buffer YaTeX-parent-file) - YaTeX-parent-file)) - (if (YaTeX-main-file-p) - (if (interactive-p) (message "I think this is main LaTeX source.") nil) - (cond - ((and (interactive-p) main-file (get-buffer-window main-file)) - (select-window (get-buffer-window main-file))) - ((and main-file (YaTeX-switch-to-buffer main-file setbuf))) - ((and main-file - (file-exists-p (setq main-file (concat "../" main-file))) - (y-or-n-p (concat (expand-file-name main-file) - " is main file?:"))) - (YaTeX-switch-to-buffer main-file setbuf)) - (t (setq main-file (read-file-name "Enter your main text: " nil nil 1)) - (setq YaTeX-parent-file main-file) - (find-file main-file)) - ))) - nil -) - - -(defun YaTeX-guess-parent (command-line) - (setq command-line - (if (string-match ".*\\s " command-line) - (substring command-line (match-end 0)) - (file-name-nondirectory (buffer-file-name))) - command-line - (concat (if (string-match "\\(.*\\)\\." command-line) - (substring command-line (match-beginning 1) (match-end 1)) - command-line) - ".tex")) -) - -(defun YaTeX-visit-main-other-window () - "Switch to buffer main LaTeX source in other window." - (interactive) - (if (YaTeX-main-file-p) (message "I think this is main LaTeX source.") - (YaTeX-switch-to-buffer-other-window - (concat (YaTeX-get-preview-file-name) ".tex"))) -) - -(defun YaTeX-get-builtin (key) - "Read source built-in command of %# usage." - (save-excursion - (goto-char (point-min)) - (if (and (re-search-forward - (concat "^" (regexp-quote (concat "%#" key))) nil t) - (not (eolp))) - (buffer-substring - (progn (skip-chars-forward " " (point-end-of-line))(point)) - (point-end-of-line)) - nil)) -) - -(defun YaTeX-save-buffers () - "Save buffers which is in yatex-mode." - (basic-save-buffer) - (save-excursion - (mapcar '(lambda (buf) - (set-buffer buf) - (if (and (buffer-file-name buf) - (eq major-mode 'yatex-mode) - (buffer-modified-p buf) - (y-or-n-p (format "Save %s" (buffer-name buf)))) - (save-buffer buf))) - (buffer-list))) -) - -(provide 'yatexprc) +;;; -*- Emacs-Lisp -*- +;;; YaTeX process handler. +;;; yatexprc.el +;;; (c )1993-1994 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] +;;; Last modified Wed Dec 14 16:58:15 1994 on 98fa +;;; $Id$ + +(require 'yatex) + +(defvar YaTeX-typeset-process nil + "Process identifier for jlatex" +) +(defvar YaTeX-typeset-buffer "*YaTeX-typesetting*" + "Process buffer for jlatex") + +(defvar YaTeX-typeset-buffer-syntax nil + "*Syntax table for typesetting buffer") + +(defvar YaTeX-current-TeX-buffer nil + "Keeps the buffer on which recently typeset run.") + +(defvar YaTeX-shell-command-option + (or (and (boundp 'shell-command-option) shell-command-option) + (if YaTeX-dos "/c" "-c")) + "Shell option for command execution.") + +(if YaTeX-typeset-buffer-syntax nil + (setq YaTeX-typeset-buffer-syntax + (make-syntax-table (standard-syntax-table))) + (modify-syntax-entry ?\{ "w" YaTeX-typeset-buffer-syntax) + (modify-syntax-entry ?\} "w" YaTeX-typeset-buffer-syntax) + (modify-syntax-entry ?\[ "w" YaTeX-typeset-buffer-syntax) + (modify-syntax-entry ?\] "w" YaTeX-typeset-buffer-syntax) +) + +(defun YaTeX-typeset (command buffer) + "Execute jlatex (or other) to LaTeX typeset." + (interactive) + (save-excursion + (let ((p (point)) (window (selected-window)) execdir (cb (current-buffer))) + (if (and YaTeX-typeset-process + (eq (process-status YaTeX-typeset-process) 'run)) + ;; if tex command is halting. + (YaTeX-kill-typeset-process YaTeX-typeset-process)) + (YaTeX-visit-main t) ;;execution directory + (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))))) + (set-buffer (get-buffer-create buffer)) + (setq default-directory execdir) + (cd execdir) + (erase-buffer) + (cond + (YaTeX-dos ;if MS-DOS + (YaTeX-put-nonstopmode) + (call-process + shell-file-name nil buffer nil YaTeX-shell-command-option command) + (YaTeX-remove-nonstopmode)) + (t ;if UNIX + (set-process-buffer + (setq YaTeX-typeset-process + (start-process "LaTeX" buffer shell-file-name + YaTeX-shell-command-option command)) + (get-buffer buffer)) + (set-process-sentinel YaTeX-typeset-process 'YaTeX-typeset-sentinel))) + (message (format "Calling `%s'..." command)) + (setq YaTeX-current-TeX-buffer (buffer-name)) + (use-local-map YaTeX-typesetting-mode-map) + (set-syntax-table YaTeX-typeset-buffer-syntax) + (setq mode-name "typeset") + (if YaTeX-typeset-process ; if process is running (maybe on UNIX) + (cond ((boundp 'MULE) + (set-current-process-coding-system + YaTeX-latex-message-code YaTeX-coding-system)) + ((boundp 'NEMACS) + (set-kanji-process-code YaTeX-latex-message-code)))) + (if YaTeX-dos (message "Done.") + (insert " ") + (set-marker (process-mark YaTeX-typeset-process) (1- (point)))) + (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)) + (select-window window) + (switch-to-buffer cb))) +) + +(defun YaTeX-typeset-sentinel (proc mes) + (cond ((null (buffer-name (process-buffer proc))) + ;; buffer killed + (set-process-buffer proc nil)) + ((memq (process-status proc) '(signal exit)) + (let* ((obuf (current-buffer)) (pbuf (process-buffer proc)) + (pwin (get-buffer-window pbuf)) + (owin (selected-window)) win) + ;; save-excursion isn't the right thing if + ;; process-buffer is current-buffer + (unwind-protect + (progn + ;; Write something in *typesetting* and hack its mode line + (if pwin + (select-window pwin) + (set-buffer pbuf)) + ;;(YaTeX-showup-buffer pbuf nil t) + (goto-char (point-max)) + (if pwin (recenter -3)) + (insert ?\n "latex typesetting " mes) + (forward-char -1) + (insert " at " (substring (current-time-string) 0 -5) "\n") + (forward-char 1) + (setq mode-line-process + (concat ": " + (symbol-name (process-status proc)))) + (message "latex typesetting %s." + (if (eq (process-status proc) 'exit) + "done" "ceased")) + ;; If buffer and mode line shows that the process + ;; is dead, we can delete it now. Otherwise it + ;; will stay around until M-x list-processes. + (delete-process proc) + ) + (setq YaTeX-typeset-process nil) + ;; Force mode line redisplay soon + (set-buffer-modified-p (buffer-modified-p)) + ) + (select-window owin) + (set-buffer obuf)))) +) + +(defvar YaTeX-texput-file "texput.tex" + "*File name for temporary file of typeset-region." +) + +(defun YaTeX-typeset-region () + "Paste the region to the file `texput.tex' and execute jlatex (or other) +to LaTeX typeset. The region is specified by the rule: + (1)If keyword `%#BEGIN' is found in the upper direction from (point). + (1-1)if the keyword `%#END' is found after `%#BEGIN', + ->Assume the text between `%#BEGIN' and `%#END' as region. + (1-2)if the keyword `%#END' is not found anywhere after `%#BEGIN', + ->Assume the text after `%#BEGIN' as region. + (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." + (interactive) + (save-excursion + (let* + ((end "") typeout ;Type out message that tells the method of cutting. + (texput YaTeX-texput-file) + (cmd (concat (YaTeX-get-latex-command nil) " " texput)) + (buffer (current-buffer)) opoint preamble (subpreamble "") main + (hilit-auto-highlight nil) ;for Emacs19 with hilit19 + reg-begin reg-end) + + (save-excursion + (if (search-backward "%#BEGIN" nil t) + (progn + (setq typeout "--- Region from BEGIN to " + end "the end of the buffer ---" + reg-begin (match-end 0)) + (if (search-forward "%#END" nil t) + (setq reg-end (match-beginning 0) + end "END ---") + (setq reg-end (point-max)))) + (setq typeout "=== Region from (point) to (mark) ===") + (setq reg-begin (point) reg-end (mark))) + (goto-char (point-min)) + (while (search-forward "%#REQUIRE" nil t) + (setq subpreamble + (concat subpreamble + (cond + ((eolp) + (buffer-substring + (match-beginning 0) + (point-beginning-of-line))) + (t (buffer-substring + (match-end 0) + (point-end-of-line)))) + "\n")) + (goto-char (match-end 0)))) + (YaTeX-visit-main t) + (setq main (current-buffer)) + (setq opoint (point)) + (goto-char (point-min)) + (setq + preamble + (if (re-search-forward "^[ ]*\\\\begin.*{document}" nil t) + (buffer-substring (point-min) (match-end 0)) + (concat "\\documentstyle{" YaTeX-default-document-style "}\n" + "\\begin{document}"))) + (goto-char opoint) + ;;(set-buffer buffer) ;for clarity + (set-buffer (find-file-noselect texput)) + ;;(find-file YaTeX-texput-file) + (erase-buffer) + (if YaTeX-need-nonstop + (insert "\\nonstopmode{}\n")) + (insert preamble "\n" subpreamble "\n") + (insert-buffer-substring buffer reg-begin reg-end) + (insert "\\typeout{" typeout end "}\n") ;Notice the selected method. + (insert "\n\\end{document}\n") + (basic-save-buffer) + (kill-buffer (current-buffer)) + (set-buffer main) ;return to parent file or itself. + (YaTeX-typeset cmd YaTeX-typeset-buffer) + (switch-to-buffer buffer) ;for Emacs-19 + (put 'dvi2-command 'region t))) +) + +(defun YaTeX-typeset-buffer () + "Typeset whole buffer. If %#! usage says other buffer is main text, +visit main buffer to confirm if its includeonly list contains current +buffer's file. And if it doesn't contain editing text, ask user which +action wants to be done, A:Add list, R:Replace list, %:comment-out list." + (interactive) + (YaTeX-save-buffers) + (let*((me (substring (buffer-name) 0 (rindex (buffer-name) ?.))) + (mydir (file-name-directory (buffer-file-name))) + (cmd (YaTeX-get-latex-command t)) (cb (current-buffer))) + (if (YaTeX-main-file-p) nil + (save-excursion + (YaTeX-visit-main t) ;search into main buffer + (save-excursion + (push-mark (point) t) + (goto-char (point-min)) + (if (and (re-search-forward "^[ ]*\\\\begin{document}" nil t) + (re-search-backward "^[ ]*\\\\includeonly{" nil t)) + (let* + ((b (progn (skip-chars-forward "^{") (point))) + (e (progn (skip-chars-forward "^}") (1+ (point)))) + (s (buffer-substring b e)) c + (pardir (file-name-directory (buffer-file-name)))) + (if (string-match (concat "[{,/]" me "[,}]") s) + nil ; Nothing to do when it's already in includeonly. + (ding) + (switch-to-buffer (current-buffer));Display this buffer. + (setq + me ;;Rewrite my name(me) to contain sub directory name. + (concat + (if (string-match pardir mydir) ;if mydir is child of main + (substring mydir (length pardir)) ;cut absolute path + mydir) ;else concat absolute path name. + me)) + (message + "`%s' is not in \\includeonly. A)dd R)eplace %%)comment? " + me) + (setq c (read-char)) + (cond + ((= c ?a) + (goto-char (1+ b)) + (insert me (if (string= s "{}") "" ","))) + ((= c ?r) + (delete-region (1+ b) (1- e)) (insert me)) + ((= c ?%) + (beginning-of-line) (insert "%")) + (t nil)) + (basic-save-buffer)))) + (exchange-point-and-mark))) + (switch-to-buffer cb)) ;for 19 + (YaTeX-typeset cmd YaTeX-typeset-buffer) + (put 'dvi2-command 'region nil)) +) + +(defvar YaTeX-call-command-history nil + "Holds history list of YaTeX-call-command-on-file.") +(put 'YaTeX-call-command-history 'no-default t) +(defun YaTeX-call-command-on-file (base-cmd buffer) + (YaTeX-save-buffers) + (YaTeX-typeset + (read-string-with-history + "Call command: " + (concat base-cmd " " (YaTeX-get-preview-file-name)) + 'YaTeX-call-command-history) + buffer) +) + +(defun YaTeX-bibtex-buffer (cmd) + "Pass the bibliography data of editing file to bibtex." + (interactive) + (YaTeX-save-buffers) + (YaTeX-call-command-on-file cmd "*YaTeX-bibtex*" ) +) + +(defun YaTeX-kill-typeset-process (proc) + "Kill process PROC after sending signal to PROC. +PROC should be process identifier." + (cond + (YaTeX-dos + (error "MS-DOS can't have concurrent process.")) + ((or (null proc) (not (eq (process-status proc) 'run))) + (message "Typesetting process is not running.")) + (t + (save-excursion + (set-buffer (process-buffer proc)) + (save-excursion + (goto-char (point-max)) + (beginning-of-line) + (if (looking-at "\\? +$") + (let ((mp (point-max))) + (process-send-string proc "x\n") + (while (= mp (point-max)) (sit-for 1)))))) + (if (eq (process-status proc) 'run) + (progn + (interrupt-process proc) + (delete-process proc))))) +) + +(defun YaTeX-system (command buffer) + "Execute some command on buffer. Not a official function." + (save-excursion + (YaTeX-showup-buffer + buffer (function (lambda (x) (nth 3 (window-edges x))))) + (set-buffer (get-buffer-create buffer)) + (erase-buffer) + (if YaTeX-dos + (call-process + shell-file-name nil buffer nil YaTeX-shell-command-option command) + (set-process-buffer + (start-process + "system" buffer shell-file-name YaTeX-shell-command-option command) + (get-buffer buffer)))) +) + +(defvar YaTeX-preview-command-history nil + "Holds minibuffer history of preview command.") +(put 'YaTeX-preview-command-history 'no-default t) +(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) + "Execute xdvi (or other) to tex-preview." + (interactive + (list + (read-string-with-history + "Preview command: " dvi2-command 'YaTeX-preview-command-history) + (read-string-with-history + "Preview file[.dvi]: " + (if (get 'dvi2-command 'region) + (substring YaTeX-texput-file + 0 (rindex YaTeX-texput-file ?.)) + (YaTeX-get-preview-file-name)) + 'YaTeX-preview-file-history))) + (setq dvi2-command preview-command) ;`dvi2command' is buffer local + (save-excursion + (YaTeX-visit-main t) + (let ((pbuffer "*dvi-preview*") (dir default-directory)) + (YaTeX-showup-buffer + pbuffer (function (lambda (x) (nth 3 (window-edges x))))) + (set-buffer (get-buffer-create pbuffer)) + (erase-buffer) + (setq default-directory dir) ;for 18 + (cd dir) ;for 19 + (cond + (YaTeX-dos ;if MS-DOS + (send-string-to-terminal "\e[2J\e[>5h") ;CLS & hide cursor + (call-process shell-file-name "con" "*dvi-preview*" nil + YaTeX-shell-command-option preview-command preview-file) + (send-string-to-terminal "\e[>5l") ;show cursor + (redraw-display)) + (t ;if UNIX + (set-process-buffer + (start-process "preview" "*dvi-preview*" shell-file-name + YaTeX-shell-command-option + (concat preview-command " " preview-file)) + (get-buffer pbuffer)) + (message + (concat "Starting " preview-command + " to preview " preview-file)))))) +) + +(defun YaTeX-prev-error () + "Visit previous typeset error. + To avoid making confliction of line numbers by editing, jump to +error or warning lines in reverse order." + (interactive) + (let ((cur-buf (buffer-name)) (cur-win (selected-window)) + error-line typeset-win error-buffer error-win) + (if (null (get-buffer YaTeX-typeset-buffer)) + (error "There is no typesetting buffer.")) + (YaTeX-showup-buffer YaTeX-typeset-buffer nil t) + (setq typeset-win (selected-window)) + (if (re-search-backward + (concat "\\(" latex-error-regexp "\\)\\|\\(" + latex-warning-regexp "\\)") + nil t) + nil + (select-window cur-win) + (error "No more erros on %s" cur-buf)) + (goto-char (match-beginning 0)) + (skip-chars-forward "^0-9" (match-end 0)) + (setq error-line + (string-to-int + (buffer-substring + (point) + (progn (skip-chars-forward "0-9" (match-end 0)) (point)))) + error-buffer (YaTeX-get-error-file cur-buf) + error-win (get-buffer-window error-buffer)) + (if (or (null error-line) (equal 0 error-line)) + (error "Can't detect error position.")) + (select-window cur-win) + (cond + (error-win (select-window error-win)) + ((eq (get-lru-window) typeset-win) + (YaTeX-switch-to-buffer error-buffer)) + (t (select-window (get-lru-window)) + (YaTeX-switch-to-buffer error-buffer))) + (setq error-win (selected-window)) + (goto-line error-line) + (message "LaTeX %s in `%s' on line: %d." + (if (match-beginning 1) "error" "warning") + error-buffer error-line) + (select-window typeset-win) + (skip-chars-backward "0-9") + (recenter (/ (window-height) 2)) + (sit-for 3) + (goto-char (match-beginning 0)) + (select-window error-win)) +) + +(defun YaTeX-jump-error-line () + "Jump to corresponding line on latex command's error message." + (interactive) + (let (error-line error-file error-buf) + (save-excursion + (beginning-of-line) + (setq error-line (re-search-forward "l[ ines]*\\.?\\([1-9][0-9]*\\)" + (point-end-of-line) t))) + (if (null error-line) + (if (eobp) (insert (this-command-keys)) + (error "No line number expression.")) + (goto-char (match-beginning 0)) + (setq error-line (string-to-int + (buffer-substring (match-beginning 1) (match-end 1))) + error-file (YaTeX-get-error-file YaTeX-current-TeX-buffer) + error-buf (YaTeX-switch-to-buffer error-file t)) + (if (null error-buf) + (error "`%s' is not found in this directory." error-file)) + (YaTeX-showup-buffer error-buf nil t) + (goto-line error-line))) +) + +(defun YaTeX-send-string () + "Send string to current typeset process." + (interactive) + (if (and (eq (process-status YaTeX-typeset-process) 'run) + (>= (point) (process-mark YaTeX-typeset-process))) + (let ((b (process-mark YaTeX-typeset-process)) + (e (point-end-of-line))) + (goto-char b) + (skip-chars-forward " \t" e) + (setq b (point)) + (process-send-string + YaTeX-typeset-process (concat (buffer-substring b e) "\n")) + (goto-char e) + (insert "\n") + (set-marker (process-mark YaTeX-typeset-process) (point)) + (insert " ")) + (ding)) +) + +(defun YaTeX-view-error () + (interactive) + (if (null (get-buffer YaTeX-typeset-buffer)) + (message "No typeset buffer found.") + (let ((win (selected-window))) + (YaTeX-showup-buffer YaTeX-typeset-buffer nil t) + ;; Next 3 lines are obsolete because YaTeX-typesetting-buffer is + ;; automatically scrolled up at typesetting. + ;;(goto-char (point-max)) + ;;(forward-line -1) + ;;(recenter -1) + (select-window win))) +) + +(defun YaTeX-get-error-file (default) + "Get current processing file from typesetting log." + (save-excursion + (let(s) + (condition-case () (up-list -1) + (error + (let ((list 0) found) + (while + (and (<= list 0) (not found) + (re-search-backward "\\((\\)\\|\\()\\)" nil t)) + (if (equal (match-beginning 0) (match-beginning 2)) ;close paren. + (setq list (1- list)) ;open paren + (setq list (1+ list)) + (if (= list 1) + (if (looking-at "\\([^,{}%]+\.\\)tex\\|sty") + (setq found t) + (setq list (1- list))))))))) + (setq s + (buffer-substring + (progn (forward-char 1) (point)) + (progn (skip-chars-forward "^ \n" (point-end-of-line)) + (point)))) + (if (string= "" s) default s))) +) + +(defun YaTeX-put-nonstopmode () + (if YaTeX-need-nonstop + (if (re-search-backward "\\\\nonstopmode{}" (point-min) t) + nil ;if already written in text then do nothing + (save-excursion + (YaTeX-visit-main t) + (goto-char (point-min)) + (insert "\\nonstopmode{}%_YaTeX_%\n"))) + ) +) + +(defun YaTeX-remove-nonstopmode () + (if YaTeX-need-nonstop ;for speed + (save-excursion + (YaTeX-visit-main t) + (goto-char (point-min)) + (forward-line 1) + (narrow-to-region (point-min) (point)) + (goto-char (point-min)) + (delete-matching-lines "^\\\\nonstopmode\\{\\}%_YaTeX_%$") + (widen))) +) + +(defun YaTeX-get-preview-file-name () + "Get file name to preview by inquiring YaTeX-get-latex-command" + (let* ((latex-cmd (YaTeX-get-latex-command t)) + (rin (rindex latex-cmd ? )) + (fname (if (> rin -1) (substring latex-cmd (1+ rin)) "")) + (period)) + (if (string= fname "") + (setq fname (substring (file-name-nondirectory + (buffer-file-name)) + 0 -4)) + (setq period (rindex fname ?.)) + (setq fname (substring fname 0 (if (eq -1 period) nil period))) + )) +) + +(defun YaTeX-get-latex-command (&optional switch) + "Specify the latex-command name and its argument. +If there is a line which begins with string: \"%#!\", the following +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 +will be the latex-command, +and you write \"%#!jlatex main.tex\" on some line and argument SWITCH +is non-nil, then + \"jlatex main.tex\" + +will be given to the shell." + (let (magic command target) + (setq parent + (cond + (YaTeX-parent-file YaTeX-parent-file) + (t (save-excursion + (YaTeX-visit-main t) + (file-name-nondirectory (buffer-file-name))))) + magic (YaTeX-get-builtin "!")) + (cond + (magic + (cond + (switch (if (string-match "\\s " magic) magic + (concat magic " " parent))) + (t (concat (substring magic 0 (string-match "\\s " magic)) " ")))) + (t (concat tex-command " " (if switch parent))))) +) + +(defvar YaTeX-lpr-command-history nil + "Holds command line history of YaTeX-lpr.") +(put 'YaTeX-lpr-command-history 'no-default t) +(defun YaTeX-lpr (arg) + "Print out. If prefix arg ARG is non nil, call print driver without +page range description." + (interactive "P") + (let*((cmd (or (YaTeX-get-builtin "LPR") dviprint-command-format)) + from to (lbuffer "*dvi-printing*")) + (setq + cmd + (YaTeX-replace-format + cmd "f" + (if (or arg (not (string-match "%f" cmd))) + "" + (YaTeX-replace-format + dviprint-from-format + "b" + (if (string= + (setq from (read-string "From page(default 1): ")) "") + "1" from)))) + ) + (setq + cmd + (YaTeX-replace-format + cmd "t" + (if (or arg (not (string-match "%t" cmd)) + (string= + (setq to (read-string "To page(default none): ")) "")) + "" + (YaTeX-replace-format dviprint-to-format "e" to))) + ) + (setq cmd + (read-string-with-history + "Edit command line: " + (format cmd (YaTeX-get-preview-file-name)) + 'YaTeX-lpr-command-history)) + (save-excursion + (YaTeX-visit-main t) ;;change execution directory + (YaTeX-showup-buffer + lbuffer (function (lambda (x) (nth 3 (window-edges x))))) + (set-buffer (get-buffer-create lbuffer)) + (erase-buffer) + (cond + (YaTeX-dos + (call-process shell-file-name "con" "*dvi-printing*" nil + YaTeX-shell-command-option cmd)) + (t + (set-process-buffer + (start-process "print" "*dvi-printing*" shell-file-name + YaTeX-shell-command-option cmd) + (get-buffer lbuffer)) + (message "Starting printing command: %s..." cmd))) + )) +) + +(defun YaTeX-main-file-p () + "Return if current buffer is main LaTeX source." + (cond + ((YaTeX-get-builtin "!") + (string-match (YaTeX-guess-parent (YaTeX-get-builtin "!")) (buffer-name))) + (t + (save-excursion + (let ((latex-main-id (concat "^\\s *" YaTeX-ec-regexp "documentstyle"))) + (or (re-search-backward latex-main-id nil t) + (re-search-forward latex-main-id nil t)))))) +) + +(defun YaTeX-visit-main (&optional setbuf) + "Switch buffer to main LaTeX source. +Use set-buffer instead of switch-to-buffer if the optional second argument +SETBUF is t(Use it only from Emacs-Lisp program)." + (interactive "P") + (if (and (interactive-p) setbuf) (setq YaTeX-parent-file nil)) + (let (b-in main-file) + (if (setq b-in (YaTeX-get-builtin "!")) + (setq main-file (YaTeX-guess-parent b-in))) + (if YaTeX-parent-file + (setq main-file ;;(get-file-buffer YaTeX-parent-file) + YaTeX-parent-file)) + (if (YaTeX-main-file-p) + (if (interactive-p) (message "I think this is main LaTeX source.") nil) + (cond + ((and (interactive-p) main-file (get-file-buffer main-file)) + (goto-buffer-window main-file)) + ((and main-file (YaTeX-switch-to-buffer main-file setbuf))) + ((and main-file + (file-exists-p (setq main-file (concat "../" main-file))) + (y-or-n-p (concat (expand-file-name main-file) + " is main file?:"))) + (setq YaTeX-parent-file main-file) + (YaTeX-switch-to-buffer main-file setbuf)) + (t (setq main-file (read-file-name "Enter your main text: " nil nil 1)) + (setq YaTeX-parent-file main-file) + (YaTeX-switch-to-buffer main-file setbuf)) + ))) + nil +) + + +(defun YaTeX-guess-parent (command-line) + (setq command-line + (if (string-match ".*\\s " command-line) + (substring command-line (match-end 0)) + (file-name-nondirectory (buffer-file-name))) + command-line + (concat (if (string-match "\\(.*\\)\\." command-line) + (substring command-line (match-beginning 1) (match-end 1)) + command-line) + ".tex")) +) + +(defun YaTeX-visit-main-other-window () + "Switch to buffer main LaTeX source in other window." + (interactive) + (if (YaTeX-main-file-p) (message "I think this is main LaTeX source.") + (YaTeX-switch-to-buffer-other-window + (concat (YaTeX-get-preview-file-name) ".tex"))) +) + +(defun YaTeX-get-builtin (key) + "Read source built-in command of %# usage." + (save-excursion + (goto-char (point-min)) + (if (and (re-search-forward + (concat "^" (regexp-quote (concat "%#" key))) nil t) + (not (eolp))) + (buffer-substring + (progn (skip-chars-forward " " (point-end-of-line))(point)) + (point-end-of-line)) + nil)) +) + +(defun YaTeX-save-buffers () + "Save buffers which is in yatex-mode." + (basic-save-buffer) + (save-excursion + (mapcar '(lambda (buf) + (set-buffer buf) + (if (and (buffer-file-name buf) + (eq major-mode 'yatex-mode) + (buffer-modified-p buf) + (y-or-n-p (format "Save %s" (buffer-name buf)))) + (save-buffer buf))) + (buffer-list))) +) + +(provide 'yatexprc)