yatex1.81004075500037440000000000000000001341014627400114725ustar yuujiwheelyatex1.81/docs004075500037440000000000000000001341014627400124225ustar yuujiwheelyatex1.81/docs/htmlqa.eng010044400037440000000000000075241303342261200144570ustar yuujiwheel%% %% Q and A on yahtml %% %% C-u C-x $ shows only questions. C-x $ shows all. %% -- New Item *Can I use font-lock with yahtml? [Installation] ============== *Must I install YaTeX even if I don't use LaTeX? No. Get the files starting with "yahtml" from http://www.yatex.org/ and that's all you will need. [Customization] ============== *Can I use font-lock with yahtml? Yes. Native font-lock support started at yahtml-1.69. All you have to do for font-lock-ing, is to load font-lock beforehand. If you had added such workaround as (put 'yahtml-mode 'font-lock-defaults 'another-html-mode) in hooks, please remove it! *I usually use EUC, but need JIS coding on some files. Write (setq yahtml-kanji-code 3) ;3 for EUC and your default kanji code for HTML files will be EUC. Now to change codings foe selected files. If your server is Apache, then prepare a file named ".htaccess" in the directory and write AddType "text/html; charset=iso-2020-jp" .html Apache will now inform all your visitors that the html files in this directory are in iso-2022-jp, aka JIS. yahtml will also follow this and encode all files in this directory with JIS. Not using Apache? Then adding the following to the end of your html source will make this files coding system JIS. Note that Emacs-20 and XEmacs do not need the "*" in the kanji code symbol. [What about...] ============== *Indentation for a large file is slow Should be fixed. *Inserting template.html Use autoinsert.el that comes with Emacs19/Mule2. Another option is to use auto-insert-tkld. The latter can be found at ftp://ftp.ae.keio.ac.jp/pub/emacs-lisp/util/auto-inset-tkld.tar.Z Examples in Japanese are at http://namazu.org/~tsuchiya/elisp/yahtml-mode.html [ETC] ============ *How do I pronounce yahtml A real FAQ. The author doesn't know either. Any ideas? ... It hits on me! We define the official name of yahtml as; HTML-Ya "Ya" is the Japanese word whose meaning is `shop', and sometimes `enthusiast' of something. With HTML-Ya, do the publishment of your thought efficiently and beautifully! *Mailing lists? A question, so an answer. The mailing list for YaTeX (Wild Bird) and it's implementation to Vz Editor; LaiTeX (Thunder Bird, by KATSURAGAWA Naoki), implementation to Wz Editor; HackTeX (Swan, by TAKENAKA Hiroshi), implementation to Hidemaru Editor; HiTeX (Flying Bird, by YASUDA Haruyuki) is "fj Wild Bird Society". Send a mail like To: yatex@yatex.org Subject: subscribe ----- Hi! My name is yuuji. See any birds fly by? and you're in. Once you're in, you'll get a reply with lists of commands used in the mailing list. Join along and help adding new feathers to Wild Bird. BTW, if you haven't guessed it yet, yes, this mailing list is in Japanese. But give us a try anyway. You're always welcome. *How to get the up-to-date information on yahtml? If you can access WWW, try to see; http://www.yatex.org/ And if you trace the link of `yatex-current', you can get the really latest version of yahtml. Since it collects the elisps in the author's source directory, what you'll get may contain some errors. The author cannot respond to your query about yatex-current. *Help, help HELP!! Ways of getting answers in fastest order. *Look for someone near you who knows what's he/she's doing. *Post a question to the mailing list. *Send mail to yuuji@yatex.org take a pick. *Picking a question in this file with C-u C-x $ and hitting C-x $ takes me to a weird world. You too? Try marking the question before C-x $ and to C-x C-x to take you back to it. (Mule2 doesn't seem to have the same problem) Local Variables: mode: indented-text fill-column: 72 fill-prefix: " " End: yatex1.81/docs/htmlqa010064400037440000000000000147751315523115400137230ustar yuujiwheel%% %% Q and A on yahtml %% %% C-u C-x $ とすると質問項目だけ表示されます。C-x $ で元に戻ります。 %% (新項目: ・font-lockって使えますか?) ■インストール関連 ・LaTeX使わないんだけど野鳥も入れなきゃダメですか? や、別にええっす。 http://www.yatex.org/ のソースアーカイブリンク のなかに、"yahtml" で始まるファイルがあるので次からはそれを持っ て来ればよござんす。 ■カスタマイズ関連 ・font-lockって使えますか? はい。yahtml-1.69から使えます。あらかじめ font-lock をロードしてお きましょう。以前、yahtml が font-lock に対応する前に (put 'yahtml-mode 'font-lock-defaults 'another-html-mode) などを ~/.emacs に書いた人は、その設定を削除して下さい。 ・いつもは EUC にしてたまに JIS コードのファイルを作りたいんだけど。 ~/.emacs で (setq yahtml-kanji-code 3) ;3はEUC しておけば普段のhtmlコードはEUCになります。で局所的に変える方法。 サーバーはApacheですね? ならそのディレクトリに .htaccess という ファイルを用意して、 AddType "text/html; charset=iso-2020-jp" .html という行を書きましょう。するとApache君はそのディレクトリのhtmlファ イルを「iso-2022-jp(いわゆるJIS)だよー」とお客さんにあらかじめ伝 えるようになります。yahtmlもこれに従い、そのディレクトリ以下のファ イルは漢字コードをJISに設定します。 なに、apacheではないとな。なら明示的にhtmlソースのお尻に、 と書いておけばそのファイルだけJISになります。 ただし、Emacs-20 や XEmacs の場合、漢字コードのシンボルの両端の* は付きません。 ・を 認識して漢字コードを設定して欲しいなー。 HTML5 で書くのであればこの構文を使うのはやめ、文字集合はUTF-8に 絞り と記しましょう。 文書の中にファイルのエンコード法を書いてもそもそもそのMETAなんちゃ らを読めない可能性があるので charset をMETAで指定するのは本当に 期待した通りには機能しません。たとえば、多国語文書を書く必要が出 たとします。すると今のところUTF-7でエンコードするのが一番無難で しょう。NetscapeでもIEでもUTF-7はちゃんと読むことができます。と ういことで、ファイルを開いてブラウザがちゃんとUTF-7と認識するよ うに、HTML文書の先頭に次のように書きました。 このように書いたものが http://www.yatex.org/charset/hello-meta.file にあります。 NetscapeとIEならUTF-7は読めるはずなので、どちらかでアクセスして みましょう。読めますか? 読めませんね。IEの場合はUTF-7の部分を自 動判別するので、一見読めてるように見えますがtext/html とは解釈さ れておらず、結局METAが判別できなかったことが分かります。つまり、 違うエンコード法を利用する場合、 の部分さえもサーバに解 釈不能な状態になり得るので、文書の中にcharset指定を埋め込むのは 賢い方法ではありません。 かわりに、上記で説明した .htaccess を利用しましょう。*.utf7 とい う拡張子を持つファイルは、UTF-7 でエンコードしたHTML文書である、 という定義は、以下のように書けます。 AddType "text/html; charset=utf-7" .utf7 .htaccess ファイルにこのように定義しておけば、無駄ななど綴らなくてもしっかりとサーバがエンコーディングを理 解できます。このようにして書かれた UTF-7 のHTML文書が http://www.yatex.org/charset/hello.utf7 にありますので、同じくNetscapeかIEで読んでみましょう。 AddTypeは~/public_html などに置けばそれ以下の *.utf7 という拡張 子全てに適用できます。一個だけAddTypeを書くだけでいいのです。 HTML屋では、気休め程度にしかならないMETAによるcharset指定を推奨 しない事を選びました。かわりに、もっと確実で簡単な .htaccess に よるエンコーディング指定を推奨するために、そちらをサポートします。 関係ありませんが今(2000年現在)では x-sjisじゃなくて、Shift_JIS と綴ることになってます:-p ・
  • の直後に空白入るとhtmllintに怒られるから空白なしにしたいんだけど… それ、htmllintがやりすぎなんです。タグ直後の空白に対して文句いう のは http://www.cre.canon.co.uk/%7Eneilb/weblint/www5-paper.html によると、空白があることで変なレイアウトになってしまうへぼブラウ ザへの配慮によるものなのでHTML的にはまるで問題ないんです。とかく htmllintを使うとhtmllintに怒られないこと自体が目的となりがちです が、わたしはそれは本末転倒であると思います。 ・の途中で auto-fill されちゃうと悲しい 使っているのがMule2(Emacs-19)以降なら auto-fill-inhibit-regexp という変数でコントロールできます。 yahtml-mode-hook を使って以下 のように設定しましょう。 (add-hook 'yahtml-mode-hook '(lambda () (setq auto-fill-inhibit-regexp "^[ ]*\\(. *I was asked for a parent file when typesetting, and answered the wrong file. Re-read the child file with C-x C-v RET or re-type the parent file with C-u C-c ^. *The typeset buffer is not shown when I get a typeset buffer on Demacs. This happens on Demacs 1.2.0, when the child process returns an error level of 1 or more. If you are calling jlatex from a batch file, call a dummy command that always returns errorlevel 0 at the end. *How can I enter "\underline{\makebox[4em][l]{x y}{\tt z}}" more easily? Recursive completion can be used for inputting arguments in the mini-buffer of a section type completion. Following is an example showing the command in question. PROMPT KEYs ENTERED C-c s und SPC RET \underline{???}: C-c s makeb SPC RET Width: 4em RET makebox position (`lr'): - l RET \makebox{???}: x y RET \underline{???}: \makebox[4em][l]{x y} C-c l tt RET \underline{???}: \makebox[4em][l]{x y}{\tt } z RET *How can I kill \footnote{} from \footnote{HOGE} Put the point to \footnote and do C-c k. This will kill the \footnote{}. If you want to kill the whole thing including HOGE, do C-u C-c k. *I want to make HONYARA into a footnote. Mark HONYARA and do C-c S footnote RET. (S in uppercase) *I want to make the verbatim environment I have now into verbatim*. Do C-c c on the line with \begin{verbatim} or \end{verbatim}. *I want to enclose a region with \verb. \verb isn't a maketitle-type, so there aren't any quick commands. But you can use C-c $ to do the same thing. v v WHAT YOU NEED to make \verb \verbWHAT YOU NEED to make \verb (insert \verb) ^(C-@) (mark W) \verbWHAT YOU NEED to make \verb ^C-c $ (move point to end enclose with $) \verb$WHAT YOU NEED$ to make \verb (done!) *I want to have commands defined on a upper level file to be read in when doing a typeset-region on a child file. When you are editing child files broken into sections and some macros to be used are defined in upper level files, you'll need them to do typeset-region. The macros needed will be copied to the temporary file if you add %#REQUIRE to the end of the macro's definition. Say you had a grand-child file +-- main.tex --+ +---- sub.tex ----+ +-- subsub.tex --+ | : | |%#jlatex main | |%#jlatex main | |\include{sub} | |\include{macros} | |..... | | : |<-| : |<-|%#BEGIN | | : | | : | |TEXT YOU WANT | | : | +-----------------+ |TYPESET IS | +--------------+ ^ |HERE | +-- macros.tex ---+ |%#END | |\def\foo{bar} | |: | |\def\hoge{hero} | +----------------+ +-----------------+ In this case you change the \include{macros} line in sub.tex to \include{macros} %#REQUIRE and add to subsub.tex %#REQUIRE \include{macros} If %#REQUIRE is at the top of the line, the following will be copied to the temporary file. So, macros.tex will be included only once whether you are typesetting all the files, or doing a typeset-region on sub.tex or subsub.tex. *I want to reuse ARGUMENTS I used in the last \foo{ARGUMENTS} Use the gmhist package. YaTeX works fine with gmhist. When you are asked \foo{???}: in the mini-buffer, hitting M-p (ESC p) will get you a history of what you have inputted in reverse. M-n will go forward in the history. This input history can be used for begin-type completion, section-type completion, evoking the previewer, and print out commands. gmhist can be found at many Emacs-Lisp archive sights. For example, ftp.ae.keio.ac.jp:pub/emacs-lisp/util/gmhist.tar.gz Note that Emacs-19(Mule2) doesn't need gmhist for the feature of minibuffer history. *ref<->label jump doesn't work. C-c g will start a forward search of ref/label. C-u C-c g will start a backward search. If you want to continue searching for \ref, hit C-s (C-r) twice and use the repeated search feature of the incremental search. If the point to jump is in another file, that file must be already opened. YaTeX-display-hierarchy (C-c d) can be used to open all files at once. *I get a % at the end of the line when I do a fill-paragraph or auto-fill. NTT-jTeX will add an unnecessary space in the print out image if the japanese paragraph is written with an indent. To avoid this, you need to put a % at the end of the line. YaTeX will automatically put a % so you can input indented text for NTT-jTeX. But there may be a bug in the routine so please report if you find any %s otherwise than at the end of a line. *Isn't the indentation too deep in itemize environments? Think so too? An alias Mr. K thought this was better and he feels an ultimate ecstacy with hitting the TAB to indent a line. Wasn't my idea! (still have a bit of a grudge) If you also think it's too deep, hit TAB at the end of the line with \begin{itemize} within the environment. Now it's too shallow? Umm... time for me to take a break. *Is it possible to include personal template file template.tex handily? Put your template.tex into your ~/work directory where YaTeX seeks by default. If you change the location to another place, set the lisp-variable as below. (setq YaTeX-template-file "~/other/location/template.tex") *It is bothering for me to determine I should call bibtex or latex... Since version 1.76, YaTeX automatically call bibtex/latex twice if needed. In most case, you don't have to repeat to call typesetter or bibtex. If you use `latexmk' described below, YaTeX's auto rerun functionality should be disabled by setting like this: (setq YaTeX-typeset-auto-rerun nil) The `latexmk' perl script, which is a TeX specific tool to automate generation of LaTeX document. You can find `latexmk' some CTAN ftp directory. (eg. http://www.ctan.org/pkg/latexmk/) *Can I inhibit auto-filling against very long line? If you use Emacs-19 or later, Yes. The variable auto-fill-inhibit-regexp controls the filling behaviour. To set this, use yatex-mode-hook as below. (add-hook 'yahtml-mode-hook '(lambda () (setq auto-fill-inhibit-regexp "^[ ]*\\( してください。 ・タイプセットの時に親ファイルを聞かれて、その時に間違えてしまった。 C-x C-v RET でもう一度子ファイルを読み直すか、 C-u C-c ^ で親ファイルをもう一度入力してください。 ・Demacsでタイプセットエラーがでた時にtypesetバッファがうまく表示されない。 Demacs 1.2.0 で子プロセスが1以上の errorlevel を返した場合、この ような症状が起きる事があります。jlatex をバッチファイルから呼ぶ ようにし、その末尾で必ず errorlevel 0 を返すダミーのコマンドを呼 ぶようにします。 ・「\underline{\makebox[4em][l]{x y}{\tt z}}」 などを手軽に入力したい。 section型補完の引数をミニバッファで入力する時にも再帰的に種々の 補完機能が使えます。表題のコマンド列を補完入力したものが以下の例 です。 プロンプト キー入力 C-c s und SPC RET \underline{???}: C-c s makeb SPC RET Width: 4em RET makebox position (`lr'): - l RET \makebox{???}: x y RET \underline{???}: \makebox[4em][l]{x y} C-c l tt RET \underline{???}: \makebox[4em][l]{x y}{\tt } z RET ・「\footnote{ほげほげ}」と書いたけど\footnote{}を取り払いたい。 \footnote の部分にカーソルを合わせて C-c k としてください。 \footnote{} の部分だけ選んで消去します。 全部いらない場合は C-u C-c k とします。 ・「ほにゃらら」の部分を\footnoteにしたい。 「ほにゃらら」の部分をマークして C-c S footnote RET などとします。 (Sは大文字) ・いまある verbatim 環境を verbatim* 環境にしたい。 \begin{verbatim} か \end{verbatim} の行で、C-c c します。 ・指定領域を \verb で囲みたい。 残念ながら \verb は maketitle 型なので該当する機能はありません。 ただ C-c $ が領域を $ で括る事を利用して次のようにできます。 . . ここからここまでを \verb にする \verbここからここまでを \verb にする (\verbを入れる) ↑(C-@) (「こ」の位置でマーク) \verbここからここまでを \verb にする ($でくくる) ↑C-c $ \verb$ここからここまで$を \verb にする (完成) ・子ファイルを編集していて typeset-region をやる時に子ファイルの上の方で 定義してあるコマンドも読んで欲しい。 章毎に複数メンバーでファイルを編集する時に子ファイルだけで通用す るマクロを子ファイルの上の方で定義している場合には、typeset region をする時にそれらの行も必要になって来ます。こういう場合は、 子ファイルのマクロ定義の行の末尾に %#REQUIRE をつけることで臨時 タイプセットファイルの先頭にその行がコピーされます。 さらに孫ファイルがあった場合を考えてみましょう。 +-- main.tex --+ +---- sub.tex ----+ +-- subsub.tex --+ | : | |%#jlatex main | |%#jlatex main | |\include{sub} | |\include{macros} | |..... | | : |←| : |←|%#BEGIN | | : | | : | |この辺を | | : | +-----------------+ |タイプセット | +--------------+ ↑ |したい | +-- macros.tex ---+ |%#END | |\def\foo{bar} | |: | |\def\hoge{hero} | +----------------+ +-----------------+ このような場合 sub.tex の \include{macros} の行を以下のように変 えます。 \include{macros} %#REQUIRE さらに subsub.tex のどこかに以下のような行を加えます。 %#REQUIRE \include{macros} %#REQUIRE が行頭にある時はそれより後ろの部分が臨時ファイルにコピー されます。これにより、全体をタイプセットする時、または sub.tex, subsub.tex いずれかを typeset-region する時どちらにおいてもかな らず一度だけ macros.tex がインクルードされることになります。 ・直前に入れた \foo{引数だよ} の「引数だよ」をもう一回使いたい。 ミニバッファで \foo{???}: と聞かれた時に M-p (ESC p)を 押すと今まで入力した文字の履歴を逆方向にたどって表示します。M-n と押すと順方向にたどります。これらの入力履歴は begin 型補完、 section 型補完、プレヴューア起動、プリントアウトコマンド起動それ ぞれに対し独立に設定されます。 ・ref←→label間ジャンプで存在するはずのref/labelにジャンプしない。 C-c g とだけ打つと対応するref/labelの前方検索から始めます。 C-u C-c g と打つと後方検索から始めます。続けて \ref を検索するよ うな場合は C-s (C-r) を二回続けて押しインクリメンタルサーチの連 続検索機能を利用します。もしジャンプ先が別ファイルにある時は、そ のファイルをあらかじめオープンしておく必要があります。C-c d の YaTeX-display-hierarchy は全てのファイルを一気にオープンするため にも使えます。 ・fill-paragraph や auto-fill で行末に%が付いちゃう。 TeX version 2 ベースのNTT-jTeXでは日本語のパラグラフの各行頭をイ ンデントして書くとその分スペースが余計に入った印刷イメージになっ てしまいます。それを回避するために行末に % を付ける必要がありま す。野鳥ではインデントされたテキストをNTT版でも入力できるように 「行末%」の面倒をみています。でもバグってる可能性ありありなので、 行末以外に % が出るなどの現象を発見したらご連絡ください。 ・itemize環境の中のitemizeのインデントが深すぎやしませんか? でしょ? 某K君があのほうがいいって言って、TABを打っては一人酔いし れているのでので、そうしたんですが、私は気に入りません(←まだ根 に持ってる)。「深すぎる!」という方は、内側の\begin{itemize} の行 末でTABを打ってください。なぬ、今度は浅すぎる? さてトイレ行こ。 ・いつも雛型として使っている template.tex を簡単に入れたい ~/work/template.tex に置きましょう。置き場所を変えたい場合は (setq YaTeX-template-file "~/hogehoge/fugafuga.tex") のようにして変更できます。 ・bibtexとlatexとかを交互にかけるのが面倒なんですけど yatex1.76からラベルやbibtexでの文献番号不整合を自動的に検知して、 再処理が必要なときは自動的に再起動するようになりました(auto rerun)。 ほとんどの場合、野鳥の auto rerun で対処できるはずです。ただし、 以下で述べるlatexmkを利用する場合は重複処理になるため野鳥の auto rerun を無効化してください。無効化は (setq YaTeX-typeset-auto-rerun nil) します。 同じ目的のツールに latexmk というツールがあります。これは、.tex, .bib, .idx などのファイル間の依存関係を調べ、自動的に bibtex, makeindex, platex などを必要な順序で必要な回数起動してくれます。 これをインストールし、各ドキュメントの先頭に %#!latexmk などと書いてタイプセッタとして latexmk を指定することで利用でき ます。なお、latexmk は CTAN サイトにあります。 (http://www.ctan.org/pkg/latexmk/) ・タイプセットとプレヴューでキーが違うのが面倒ですね? そういうことを感じるということは、もしかして、プレヴューアを起動 して確認したのちに、いちいちプレヴューアを終了させたりしてますか? UNIXでもWindowsでもそんなことは普通しなくていいんです。一度起動 したプレヴューアは常駐させておけば、表でLaTeXソースをタイプセッ トすれば、次回プレビューアの窓を選択したときに勝手にリロードして くれます。プレビューアを毎回終了させるとフォントのロードなどオー バーヘッドが大きいので、是非常駐させましょう。意外にそのことを教 えてもらってない人がいるようなので書いてみました。 結局のところほとんど [prefix] tj のタイプセットのみで用件は終わ ります。また、もしbibtexなど、他の関連コマンドを繰り返し利用する ような場合は、前項で紹介した latexmk コマンドを利用するというの がスマートな解決策です。結局のところ、ほとんど [prefix] tj と打っ て仕事を進めることになります。 ・fillがうまく行かないなあ デフォルトのインデンテーション(TABを押すと移動するカラム)と違う パラグラフをfillしようとするとうまく行きません。auto-fill をONに して文章を入力していればこの問題は起きないはずです。もし、他のと ころからコピーした段落で、デフォルトのインデンテーションと違う段 落ができてしまった場合は、 (1)行頭で C-x . (fill-prefixをキャンセルする) (2)インデンテーションを揃えたい範囲をマークする (3)M-C-\ する。 という操作でデフォルトのインデンテーションに揃えることができます。 もし、デフォルトとは違う深さでfillしたい場合は、行の最初の非空白 文字にカーソルを合わせて M-q してください。 ・Win95/WinNTでタイプセッタなど外部プロセスが呼べない shellを変更していないならとりあえず、 (setq shell-command-option "\\/c") を .emacs に入れてみましょう。 UNIX系のshell(sh, bash, tcsh, zsh等)を使っている場合は、 (setq shell-command-option "-c") を .emacs に入れてみましょう。 ・RefTeXは使えますか? 使っている人はいるみたいですから使えるんじゃないでしょうか。でも ですね、野鳥の \ref 補完があれば、RefTeXなんぞ要らないと思います よ。これからは\label{}はいちいち自分では作らずにいきなり[prefix] s で \ref を打ち込みましょう。勝手にラベルを打てそうなところを探 して勝手にラベルを打ってその名前を\refに入れてくれます。\ref補完 は \label{} と \ref{} 両方同時に補完入力します。 でですね、\ref補完の方がしょぼいと思うなら改良しますよ。「RefTeX の方が色がついてかっちょええ」という問題以外ならすぐに頑張ります。 ・自分で定義したカウンタを\ref補完でのラベル候補対象として認識させたい おお、これは高度な質問でござるよ。ちみすごいね。え、質問の意味が 分からん? じゃLaTeXのおべんきょーから。 たとえば、プログラムリストなんかには図表と同じように番号を付けた い。そゆときあるっしょ。そういうときには定理型環境を newtheorem で定義するですよ。たとえば、セクション番号に連動してつくようなプ ログラムリスト環境を作りたいとしましょ−。そしたらこうします。 \newtheorem{Program}{リスト}[section] こうすると \begin{Program} ... \end{Program} とするとタイプセッ ト結果が リスト 2.4.1 ... なんてなるわけですな。かっちょえー。さて、このままだとこの2.4.1 という番号を\refで引っ張るためには\labelを作らないとあかんわけで すよ。でもどうせ自分で環境を定義するならlabelも自動的に定義しちゃ うようなマクロを定義しちゃった方が御便利なわけですよ。 もっとい うと独自に定義したカウンタのどの位置に \label を打たせるかを野鳥 に判断させるためのパターンを書くのはものすごくむずかしいので、ラ ベルを定義するためのマクロのパターンを教えた方がやりやすいわけで す。ということで、暗黙でラベルも打たせるような環境を定義すると、 こんな感じ。 \newenvironment{program}[1]{ \begin{table}[tbp] \begin{Program}\filename{#1}\nopagebreak[4]\label{#1}\end{Program} \nopagebreak[4] \begin{breakbox}\small }{ \end{breakbox} \end{table} } この小文字 program 環境は \begin{program}{foo.c} \begin{verbatim} #include \end{verbatim} \end{program} みたいにするとタイプセット結果が リスト 2.4.1 foo.c ┌──────────────┐ │#include │ └──────────────┘ てな具合になるわけですよ。おおかちょええ。さて、小文字program環 境のマクロ定義を良く見ると環境に渡した foo.c はそのまま自動的に \label{#1} でラベルとして打たれることになります。あ、pLaTeX のラベルは日本語もOKよ。で、その暗黙のうちに打たれたラベル名を野 鳥に教えるというのがスマートなやり方です。これを定義するのが変数 YaTeX::ref-labeling-regexp-alist-private なり。これには (正規表現 . ラベル名のグループ番号) という組(consセル)がたくさん集まったリストを定義する。たとえば、 上記のprogram環境の第1引数を拾わせるには (setq YaTeX::ref-labeling-regexp-alist-private '(("\\\\begin{program}{\\([^}]+\\)}" . 1))) とします。program環境の第一引数の部分の正規表現が {\\([^}]+\\)} の部分で、\\( \\) のグループ化された正規表現 [^}]+ つまり、閉じ 中括弧以外の文字が続くところ、がラベル名として取り出せるわけです。 ということで、上記のようなLaTeXマクロの定義と YaTeX::ref-labeling-regexp-alist-private の定義で無事、自分なり のカウンタとそのラベル名を\ref補完に取り込めるわけです。最初は面 倒臭いけど、一度定義しちゃえば一生モノでっせ! ■Mule2 関連 ・Mule2+hilit19を使っている時に数式が暗くて良く読めない。 hilit19.el のデフォルトのカラーリングが暗すぎるせいです。 以下のコードを ~/.emacs や yatexhks.el などに入れてください。 (if (and (featurep 'hilit19) (eq hilit-background-mode 'dark)) (hilit-translate string 'mediumspringgreen formula 'khaki label 'yellow-underlined)) ・font-lock はどうやって使えばいいんでしょ? 1.69以降では、XEmacs-21, Emacs-21, Emacs-20 において利用できます。 野鳥起動前に (require 'font-lock) しておいてください。 ただし、font-lock のドキュメントをみると「パターンは一行内で指定し てね」とあるので本来行とは無関係な論理的構造範囲で色付を行なうため には設計されていません。これを回避するため、野鳥では仕様外のパター ン指定を行ない論理構造範囲での色付をさせています。したがって、将来 font-lock が仕様を変えたら簡単に色付がうまく行かなくなる可能性を大 いに持っています。hilit19からの乗り換えを考えている場合は、いつで も元に戻れるようにしておいた方がよいかもしれません。 ・XEmacsでも色は着きますか? font-lock を利用して下さい。野鳥起動前にあらかじめ font-lock をロー ドしておきます。 以前、野鳥が font-lock 未対応だった時代に入れた (put 'yatex-mode 'font-lock-defaults 'tex-mode) という記述は **削除** してください。野鳥独自の色づけ規則により、ユー ザー辞書に登録してあるマクロや、section型マクロの引数を数えて光ら せるなどの特長があります。 ・Meadowでも font-lock な色は着きますか? つくことはつくんですが、2000年現在の公式版Meadow-1.10はでは 光りそうなLaTeXマクロを手で入力すると光る範囲の検出がおかしくなっ てエラーが発生することがあります。新しい Meadow では本家Emacsと 同様普通に動くであろうことを期待して、この件に関しては対処しませ ん。光らないだけで実害はないので、気にしないか、あるいは次の Meadow が登場するまで hilit19 を利用して下さい。 ・\it をイタリック表示できませんか?(Mule2) まず、普段使用しているサイズの斜体フォントを探します。 *scratch* バッファで、 (set-face-font 'italic "-*-*-medium-i-*--*-*-*-*-*-*-*-*") と打ち C-j してみる(かなり時間がかかる!!)。No matches found なら (set-face-font 'italic "-*-*-medium-o-*--*-*-*-*-*-*-*-*") を試します。 どちらでもマッチするものがなかったらあきらめましょう。(;_;)/~ 大抵何かフォント名が出て来るはずです。例えば、16dotフォントを 使っている場合であれば、 "-schumacher-clean-medium-i-normal--8-80-75-75-c-80-iso8859-1" が、14dotフォントを使っている場合なら、 "-adobe-courier-medium-i-normal--12-120-75-75-m-0-iso8859-1" などが返って来るので、これを用いて (set-face-font 'italic "-schumacher-clean-medium-i-normal--8-80-75-75-c-80-iso8859-1") あるいは (set-face-font 'italic "-adobe-courier-medium-i-normal--12-120-75-75-m-0-iso8859-1") のような記述を yatexhks.el などに入れます。 以上で \it, \em, \sl の中身が斜体表示されるはずです。ただし、16 ドットフォントの場合、pixelサイズが16のものがない可能性が高いの で、幅はあっていても周りの16ドットフォントよりずいぶん小さいもの が表示される場合がほとんどです。14ドットフォントを用いている場合 はかなりましです。 ■カスタマイズ関連 ・C-c b i とかは滅多に使わないので C-c b だけで補完入力になって欲しい。 ~/.emacs などで (setq YaTeX-no-begend-shortcut t) として下さい。 ・開き括弧を入れると勝手に閉じられちゃうのが調子悪い。 しばらく使うとこちらの方が便利だと感じると思います。もしそれでも 肌に合わない時は、C-c w m で常に修正モードをONにして使って下さい。 変数 YaTeX-close-paren-always の値を nil にセットすると起動時か ら括弧の自動クローズをOFFにします。 ・; を押すと変なのがでて来たりする。 カーソル位置が数式環境であると判定されて、数式環境用イメージ補完 が起動しています。もしTeXでエラーが出ない数式を組んでいるにもか かわらず野鳥の ; が数式環境判定を誤るようなら、作者まで御連絡下 さい。なお、誤判定が起きた場合、; 自身を入力するには ; を二回押 し、; をイメージ補完prefixとして動作させるには C-u ; と押します。 ・newenvironmentした環境のオプション引数を入力させたい。 yatexadd.doc を参照してください。それでも今一つピンと来ない時は yatexgen.doc を参照し、M-x YaTeX-generate などを利用してください。 ・\foo を最初3個の引数をとるマクロとして定義し、あとで4個に変えたのに、 section型補完は \foo の補完時に3個までしか引数を聞いてくれない。 C-u 4 C-c s と4個の引数であると言う情報を与えてください。引数の 個数情報はいつでも変更可能です。 ・アドイン関数(引数型)を作ったのに2個目以降の引数の補完関数が呼ばれない。 \foo{x}{y}{z}のような3個の引数をとるコマンドの引数型アドイン関数 を作ったとすると、一度 C-u 3 C-c s foo として \foo の引数が3個で あることを辞書に学習させる必要があります。 ・自作のアドイン関数がyatexaddに上書きされてしまう。 以前は個人のアドイン関数を個人のyatexadd.elに入れることにしてい ましたが、現在は個人のアドイン関数はyatexhks.elに入れることを前 提としています。yatexhks.elは野鳥初期化の最後に読み込まれるため、 標準のyatexadd.elの定義などを上書きすることができます。 ・newenvironmentしたmylist環境でおまかせ改行を使いたい。 infoマニュアルのおまかせ改行のところを見て下さい。基本的には YaTeX-intelligent-newline-mylist という名前の関数を定義すればOK です。ただ例えば、\item だけを挿入したい、つまりitemize環境のお まかせ改行と全く同じで良いというのなら、 (fset 'YaTeX-intelligent-newline-mylist 'YaTeX-intelligent-newline-itemize) と書くと効率的です。 ・数式モードでskkを自動offにするには? canna や wnn では、$や数式環境を補完入力した時に日本語入力モード がoffになります。skkでも同様の機能を生かしたい時には、 (setq skk-mode-hook '(lambda () (if (eq major-mode 'yatex-mode) (define-key skk-map "$" 'YaTeX-insert-dollar) (define-key skk-map "$" 'skk-self-insert)) (define-key skk-map "\C-x$" 'skk-display-code-for-char-at-point))) を .emacs などに入れておいて下さい。 ・{\it }内部では斜体に {\bf }では太字になるという噂を聞いたんですが… GNU Emacs20 (on X)では簡単に設定できます。 (おそらくXEmacsでも有効) Xのデフォルトだと16ドットを使っている人が多いのですが、何故か英 字フォントは16ドットが充実していず、ちゃんとした斜体字フォントが ありません。ということでそのままでは快適なフォント生活が送れませ ん。幸い Mule の総本山である電総研でこれらのフォントを用意してく れているので、これを利用しましょう。一番楽なのは16ドットの外国語 フォントをインストールする手でしょうから、これについて説明します。 まず、ftp.etl.go.jp の /pub/mule 以下にある intlfonts- というファイルを探します。これが各国語のフォントです。 intlfonts-split/ というディレクトリがあり、ここにはフォ ントサイズによってファイルをまとめたアーカイブが置いてあるので、 例えば 16dots.tar.gz をGETします。そして以下のようにインストール します。 % tar zxpf 16dots.tar.gz % cd intlfonts- % ./configure --prefix=/usr/local/emacs \ --enable-compress=gzip --with-bdf=no # make install % xset fp+ /usr/local/emacs/share/emacs/fonts configureに渡すインストールPATHのprefixなどのオプションは環境に 合わせ適宜変更して下さい。続いて、Xのリソース定義ファイル (.Xdefautsまたは.Xresources)に、 Emacs.Fontset-0: -*-fixed-medium-r-normal--16-*-*-*-*-*-fontset-normal Emacs.Fontset-1: -*-fixed-bold-r-normal--16-*-*-*-*-*-fontset-normal Emacs.Fontset-2: -*-fixed-medium-i-normal--16-*-*-*-*-*-fontset-normal Emacs.Fontset-3: -*-fixed-bold-i-normal--16-*-*-*-*-*-fontset-normal Emacs.Font: fontset-normal と書きましょう。これで、Emacs20で斜体、太字が使えるようになりま す。もし、これらのフォントが利用できるようなら野鳥はこれを自動検 出し \it, \bf の内部のフォントとします。ただし、これは英字のみで す。 ・では{\it }とか{\bf }で漢字の見栄えを変えるのは無理なんですか? 可能です(Emacs20 & Emacs21 on X)。 日本語の場合は intlfonts だけでなく、X-TTなどのTrueTypeフォント ドライバが必要になります。XFree86 4.0 以降の場合はおそらくそのま ま利用できていることでしょう。XF86 3 の場合は http://X-TT.dsl.gr.jp/index-ja.html などを参照して X-TT をインス トールしましょう。フリーの日本語フォント、渡辺フォント(明朝)、和 田研フォント(ゴシック)をTrueType形式に変換したものがあるので、こ れらもインストールします。リコーやDynaLabなどの商用フォントを購 入しても利用できます。ここではその手順は省略し、既にX上で TrueType フォントが利用できる環境が整っていると仮定します。Xのリ ソース定義ファイルを以下のように修正します。 Emacs.Fontset-0: -*-fixed-medium-r-normal--16-*-*-*-*-*-fontset-tt,\ japanese-jisx0208:-*-fixed-medium-r-normal-*-16-*-jisx0208* Emacs.Fontset-1: -*-fixed-bold-r-normal--16-*-*-*-*-*-fontset-tt,\ japanese-jisx0208:-wadalab-*-bold-r-normal-*-0-*-jisx0208* Emacs.Fontset-2: -*-fixed-medium-i-normal--16-*-*-*-*-*-fontset-tt,\ japanese-jisx0208:-watanabe-*-medium-o-normal-*-0-*-jisx0208* Emacs.Fontset-3: -*-fixed-bold-i-normal--16-*-*-*-*-*-fontset-tt,\ japanese-jisx0208:-wadalab-*-bold-i-normal-*-0-*-jisx0208* Emacs.Font: fontset-tt これにより、やはり野鳥が自動的に和文 italic, bold フォントを検索 し、画面表示上の見映えを変えるようにしてくれます。 Windowsではもっとフォント環境が充実しているのでより簡単に設定で きるのではないかと思いますが、私はそのやり方を知りません。ご存知 の方がいらしたら教えて頂ければ幸いです。 ■その他 ・AUCほげほげを使ってる友達を改宗させたいのですが…。 まあええやん、ちょっとぐらい不便でも人間なんとか我慢できます。 なにそれでも改宗させたいとな。嬉しいことをおっしゃる。 じゃあ、次のようなデモを見せましょう。 (あらかじめ ~/.emacs で (setq YaTeX-create-file-prefix-g t) しておいて下さい) * \begin{itemize} \item ほげほげ \end{itemize} という環境を作っておいて、 「う〜ん、やっぱenumerateがいいな、うりゃ」といって カーソルを\beginか\endに合わせて [prefix] c で enumerate に変 更します。続いて、 「やっぱりここはセンタリングでしょ、おりゃ」といって 環境全体をマーク(ESC C-@)して [prefix] B(大文字) してcenter環 境に括り入れます。 「じゃあpreviewしてみよっか、でもこの部分だけでいいやね」と いってもっぺんcenter環境全体をマーク(ESC C-@)して [prefix] % B してcenter環境を %#BEGIN〜%#ENDで括ってから 領域タイプセットします。[prefix] t r。 「さてpreviewじゃ」 といいつつ [prefix] t p します。 「ほほう、よし、表を書こう」と言って、 enumerate環境の後ろにtabular環境を作ります。 「まあ3列くらいかな」といいつつデフォルトの質問には全てリター ンだけで答えます。すると & & \\ が勝手に挿入されるので適当に埋 めます。 「はい、次の行」 と言いながら ESC RET します。また適当に埋めて 今度は [prefix] t e で隣のバッファに on-the-fly preview を出し、 表の中味を書き換えては自動的に隣のpreview画像が書き変わる様を 眺めます。 続いて、center環境の外に『この表は重要ネ〜』と書きます。 「うむ、『重要』にはアンダーラインを引こう」 といって『重要』をリジョン指定して [prefix] S(大文字) で underline を補完入力し、悩んだふりをして 「やっぱアンダーラインはやめ」と言いながら \underline または { か } にカーソルを合わせて [prefix] k して \underline{} を消します。さらに悩むふりをして 「やっぱセンタリングは要らんかもしれんなあ…」と言いつつ \end{center} にカーソルを合わせて [prefix] . を押します。 すると \begin{center}, \end{center} に % がつきます。 「うむ、やっぱりセンタリングはぽいっ」と言って \end{center}の行で [prefix] k をおして begin/end 対を消します。 「さて、ファイルがでかくなって来たので分割するか」と言って \include{foo} などを [prefix] s で補完入力します。 「じゃあ foo.tex を作らなきゃ…」と言って [prefix] g します。 foo.tex が勝手に作られるので適当にごちゃごちゃ書いて [prefix] t j でタイプセットします。 「ほ〜ら、foo.tex の親ファイルがさっきのファイルだって分かって るでしょ?」と説明します。[prefix] ^ で親ファイルに戻ります。 「あ〜れ、おれこのソースをいくつに分割してたんだっけ?」 とすっとぼけながら [prefix] d でincludeツリーを表示させて n や p でごちゃごちゃやります。 こんな感じですかね。 あとは、イメージ補完、数式モード自動判定、先回りusepackageなんて のもアドバンテージでしょう。 ・なんで構成ファイルがいまさらSJISなの? だっせー。 このファイルがSJISで書かれているということが分かるあなたは、野鳥 の構成ファイルがJISだろうがEUCだろうが対処できるはずです。しかし SJISで生活している人には分かりません。Meadowや Mule for win32 な らEUCでも読めるんじゃないの? と感じるかもしれませんが、Meadow な どを使いはじめた人の中からは、「pLaTeX+野鳥が便利そうだ」という ことがきっかけになっているという嬉しい報告も聞きます。そういう人 にとってEUCやJISは得体の知れない手間のかかる面倒なファイルでしか ありません。彼らがTeXやEmacsなどの素晴らしい世界に触れる目前で遠 慮してしまう可能性を考えると、やはり野鳥はSJISであり続けるべきだ と思います。 そういうわけで、野鳥ではダサくても嫌いでも、SJISを使います。 ・メイリングリストはないんですか? っていう質問項目があるくらいだからあります。「野鳥」およびそのVz への移植版「雷鳥」(by KATSURAGAWA, Naoki)、Wzへの移植版「白鳥」 (by TAKENAKA, Hiroshi)、Hidemaruへの移植板「飛鳥」(by YASUDA Haruyuki)、xyzzyへの移植版「花鳥」(by MAEDA Manabu) に関する情報 交換のためのメイリングリスト「fj野鳥の会」がそれです。 To: yatex@yatex.org Subject: subscribe ----- たぐでーし。 明けましておめでとうございまーす。 のようにメイルを送れば加入できます。手続きは全て自動で行われ、登 録が完了すると確認とともに、参加/休止/脱会等の制御コマンドの利用 方法が返送されます。是非参加して一緒に野鳥/雷鳥/白鳥/飛鳥/花鳥を 育ててください。なお、自己紹介の文が無い場合一見加入したように見 えますが、自動的に登録解除しますので御注意下さい。 ・野鳥の最新情報は? もしあなたが、WWWにアクセスできるなら、 http://www.yatex.org/ を覗いてみて下さい。このなかの、「yatex-current」というリンクを たどると最新版の野鳥を入手することができます。ただし、正式リリー ス版ではなく、作者がデバッグ中だったりして正常に動作しない可能性 があるので、current版の利用はとくに「デバッグに協力する」という 心構えでの利用をお願いします。 yatex-currentは全ファイルを毎回取得する必要があるので非効率です。 YaTeXのソースコードのMercurialリポジトリを利用し、効率的かつ安全 に更新を行なって下さい。Mercurialをインストール後、以下のように して開発版に追随します。 hg clone https://www.yatex.org:/hgrepos/yatex で、リポジトリ全体を取得します。開発ブランチは dev なので cd yatex hg up -C dev して切り替えます(リリース用ブランチは default)。以後は、同ディレ クトリで定期的に hg pull -uv すれば更新のみを取得します。このディレクトリをEmacsの load-path に加えてしまってもよいでしょう。 ・とにかくわかりませーん! まず質問の前に yatex-current(上述) を試してみて下さい。既に直面 した問題が解決されているかもしれません。それでもだめなら質問しま しょう。 回答を得るまでの早い順に ・近くにいる詳しい人に聞く ・メイリングリストに質問を出す でしょうか。お好きな方法でどうぞ。 ・このファイルを C-u C-x $ してQを眺めて項目選んで C-x $ しても変な所にいく。 ↑なっちゃいますよね? とりあえずQuestionのところで mark しておい て C-x $ したあと C-x C-x してますが(mule2だとこんな苦労しなくて 済むようです)。 Local Variables: mode: indented-text fill-column: 72 fill-prefix: " " End: yatex1.81/docs/yahtmle.tex010044400037440000000000000402421303342261200146550ustar yuujiwheel\def\lang{eng} % -*- texinfo -*- for Texinfo V.3.1 \input texinfo @setfilename yahtmle @settitle Yet Another html-mode for Emacs @direntry * yahtml-e: (yahtmle). Yet Another html-mode for Emacs (English). @end direntry @iftex @c @syncodeindex fn cp @c Last modified Fri May 11 15:42:22 2012 on firestorm @syncodeindex vr cp @end iftex @titlepage @sp 10 @center @subtitle Yet Another html-mode for emacs @title // yahtml // %@subtitle // yahtml // @author @copyright{} 1994-2012 by HIROSE, Yuuji [yuuji@@yatex.org] @end titlepage @node Top, Intro, (dir), (dir) @comment node-name, next, previous, up @menu * Intro:: Introduction * Installation:: Installing yahtml * Command Invocation:: Using External Commands * Completion:: Input with Completion * Jump:: Moving the Cursor * Changing and Deleting:: Changing and Deleting * CSS Support:: Style Sheet Support * Customizations:: List of Customize Variables * Copying:: Copyright * Concept Index:: Index @end menu @node Intro, Installation, Top, Top @comment node-name, next, previous, up @chapter Introduction @cindex Demacs @cindex Mule @cindex LaTeX @cindex yahtml yahtml is a package to support creating HTML documents on Emacsens. Easy input of elements (tags) by completion, syntax checking with programs like weblint, and invoking the appropriate browser or image viewer depending on the cursor position is its main features. (This Info is still incomplete) @node Installation, Command Invocation, Intro, Top @comment node-name, next, previous, up @chapter Installing yahtml @menu * Setting up yahtml:: * Setting environments for weblint browsers and image viewers:: * Setting environment variables for WWW pages:: @end menu @node Setting up yahtml, Setting environments for weblint browsers and image viewers, Installation, Installation @comment node-name, next, previous, up @section Setting up yahtml Add the following to @file{~/.emacs} @lisp (setq auto-mode-alist (cons (cons "\\.html$" 'yahtml-mode) auto-mode-alist)) (autoload 'yahtml-mode "yahtml" "Yet Another HTML mode" t) @end lisp Next, add to load-path the directory with the yahtml files (@file{yahtml.el}, @file{yatexlib.el}, @file{yatexprc.el}). For example, if you put them in @file{~/src/emacs/yahtml}, @lisp (setq load-path (cons (expand-file-name "~/src/emacs/yahtml") load-path)) @end lisp @noindent is what you add. By this, yahtml will be automatically loaded when editing files with .html extensions. "yahtml" will be displayed on the mode line if no errors occurred. @node Setting environments for weblint browsers and image viewers, Setting environment variables for WWW pages, Setting up yahtml, Installation @comment node-name, next, previous, up @section Setting environments for weblint, browsers, and image viewers Check the variables for invoking external commands and modify as needed. Defaults are in parenthesis. @table @code @item yahtml-www-browser @dots{} browser command name (netscape) @item yahtml-image-viewer @dots{} image viewer command name (xv) @item yahtml-lint-program @dots{} syntax check programs command name (jweblint) @item yahtml-kanji-code @dots{} kanji code for HTML files @end table @node Setting environment variables for WWW pages, , Setting environments for weblint browsers and image viewers, Installation @comment node-name, next, previous, up @section Setting environment variables for WWW pages Variables regarding path names for files that will be your home page. @table @code @item yahtml-path-url-alist @dots{} list of matching path name on file system and URLs @item yahtml-directory-index @dots{} index file displayed when none is given in URL. Usually @file{index.html} on NCSA type httpd and @file{Welcome.html} on CERN types. @end table Examples for @code{yahtml-path-url-alist}. If @file{/home/yuuji/http/} is @code{http://localhost/~yuuji} at home and @file{/usr/home/yuuji/www/} is @code{http://www.keio.ac.jp/~yuuji/} at work, then @lisp (setq yahtml-path-url-alist '(("/home/yuuji/http" . "http://localhost/~yuuji") ("/usr/home/yuuji/www" . "http://www.keio.ac.jp/~yuuji"))) @end lisp Any number of additions can be made to this list. @node Command Invocation, Completion, Installation, Top @comment node-name, next, previous, up @chapter Invoking external commands For easy use of commands that are handy when editing HTML files. @table @kbd @item [prefix] t j @dots{} Invoke HTML syntax checker (jweblint) @item [prefix] t p @dots{} Display current page in browser @item [prefix] t r @dots{} Reload current page if browser is already running @end table @node Completion, Jump, Command Invocation, Top @comment node-name, next, previous, up @chapter Completion Input Completion input of HTML elements is done through the same key strokes as YaTeX's begin-type completion, section-type completion, large-type completion, maketitle-type completion, and accent completion. Corresponding elements in this order is; elements that span multiple lines, empty elements such as img, tags that start and end in a single line, elements with no attributes or contents, and special or symbol entities. @table @kbd @item [prefix] b (YaTeX begin-type completion) @dots{} @example
    @end example @noindent Completion for elements that the start tag and the end tag span multiple lines. Mostly block-level elements. @item [prefix] s (YateX section-type completion) @dots{} @example photo @end example @noindent Completion for elements that do not have end tags and require only attributes. Possible completions are, , . @item [prefix] l (YaTeX large-type completion) @dots{} @example $B!A(B @end example @noindent Similar to begin-type completion but used for elements that start and end on a single line. @item [prefix] m (YaTeX maketitle-type completion) @dots{} Completion for elements without attributes or contents. Possible completion is
    @item [prefix] a (YaTeX accent completion) @dots{} Used to enter special or symbol entities. By default completion for < (<), > (>), & (&), " ("), ' ('), blank ( ) is possible. @end table @node Jump, Changing and Deleting, Completion, Top @comment node-name, next, previous, up @chapter Cursor Movement By using @table @kbd @item [prefix] g @dots{} move to corresponding object @end table @noindent the cursor will go to the corresponding object according to the context. Recognized contexts are @itemize @bullet @item @code{} <--> @code{} @item @code{} -> invoke viewer @item @code{
    } -> move cursor to linked target @item @code{} -> open Java source @c @item @code{\include(\input)} $B"*(B $BBP1~$9$k%U%!%$%k(B @end itemize @node Changing and Deleting, CSS Support, Jump, Top @comment node-name, next, previous, up @chapter Changing and Deleting @menu * Changing tags in pairs:: * Changing entities:: * URLencoding of strings within region:: * td-enclosure/tr-enclosure:: @end menu @node Changing tags in pairs, Changing entities, Changing and Deleting, Changing and Deleting @comment node-name, next, previous, up @section Changing tags in pairs By using @table @kbd @item [prefix] c @dots{} change tags in matching pairs @end table @noindent the content can be changed according to the context of the HTML document where the cursor is located. @itemize @bullet @item @code{}$B!A(B@code{} @dots{} change @code{TAG} element name @item attributes such as @code{photo} @dots{} change attributes @end itemize @node Changing entities, URLencoding of strings within region, Changing tags in pairs, Changing and Deleting @comment node-name, next, previous, up @section Changing entities Special characters such as < or > must be written as < and >. Easy conversion of these characters can be done when importing text from non HTML files. @table @kbd @item [prefix] ; @dots{} convert char to special entity in marked region @item [prefix] : @dots{} convert special entity to original char in marked region (reverse of [prefix] ;) @end table @node URLencoding of strings within region, td-enclosure/tr-enclosure, Changing entities, Changing and Deleting @comment node-name, next, previous, up @section URLencoding of strings within region @table @kbd @item [prefix] # @dots{} encode chars that needs to be URLencoded within region @end table @node td-enclosure/tr-enclosure, , URLencoding of strings within region, Changing and Deleting @comment node-name, next, previous, up @section td-enclosure/tr-enclosure If you wan to convert series of field into ... repetitions for table element, td-enclosure or tr-enclosure is convenient. @table @kbd @item [prefix] @} @dots{} Enclose each field in a region into ...'s. @item [prefix] ] @dots{} Enclose each line in a region into ...'s, with every line converted to ... repetition. @end table They presume white space as field separator by default. To change this, enter other delimiting character for a query. You can convert CSV, for example, into table by specifying comma(,) as a delimiter. If you want to enclose fields with th, call with universal-argument (@kbd{C-u}). Enter `th' to enclose fields with .... The special answer `thd' means that enclose the only first column with th, and the rest with td. @node CSS Support, Customizations, Changing and Deleting, Top @comment node-name, next, previous, up @chapter CSS(Style Sheets) Support @menu * CSS-class completion:: * Reread CSS definition:: @end menu @node CSS-class completion, Reread CSS definition, CSS Support, CSS Support @comment node-name, next, previous, up @section CSS class-name completion You can input a class name in your CSS definition with completion. If you have CSS defined as below; @display h1.foo, h2.foo @{ background-color: 0xffffff; @} h1.bar, h2.bar @{ font-size: 120%; @} @end display when you input h1(or h2) tag with completing-read by [prefix] b or [prefix] l, yahtml prompts you to input class name with completion from the words which are effective to h1 or h2. And if you defined global class like this; @display .caution @{ font-size: 120%; background-color: 0xc00000;@} @end display when you input any tags via completing-read, yahtml prompts you to input class name. If this is bothering, typing @kbd{C-j} instead of @kbd{RET} (or @kbd{C-m}) cancels the next prompt to class name completion. @node Reread CSS definition, , CSS-class completion, CSS Support @comment node-name, next, previous, up @section Re-reading CSS definition If you add some class to your CSS file and you want yahtml to load new definitions, type @kbd{M-x yahtml-mode RET} to make yahtml do. @node Customizations, Copying, CSS Support, Top @comment node-name, next, previous, up @chapter Customizations @cindex Customize @cindex Key Assign Variables that modify yahtml's behavior. @menu * All customizable variables:: List of customizable variables * Hook variables:: hook variables @end menu @node All customizable variables, Hook variables, Customizations, Customizations @comment node-name, next, previous, up @section List of customizable variables. Defaults in parenthesis @defvar yahtml-prefix Prefix key for yahtml-mode. (@kbd{\C-c}) @end defvar @defvar yahtml-image-viewer Command to view image files refered by img. (xv) @end defvar @defvar yahtml-www-browser Browser to view external pages with @kbd{[prefix]g}. (netscape) @end defvar @defvar yahtml-kanji-code Default kanji code. 1=sjis, 2=jis, 3=euc, 4=utf-8 (2) If @quotation AddType "text/html; charset=xxx" .html @end quotation is written in .htaccess, this will override yahtml-kanji-code. @end defvar @defvar yahtml-fill-column Columns to auto-fill (72) @end defvar @defvar yahtml-fill-prefix fill-prefix specific to yahtml-mode. (@code{nil}) @end defvar @defvar yahtml-path-url-alist Matching list of URL and full path name on OS's file system. @end defvar @defvar yahtml-directory-index Default index filed opened when accessing a server without a filename, usually index.html. (@code{"index.html"}) @end defvar @defvar yahtml-lint-program HTML syntax check program. (@code{"jweblint"}) @end defvar @defvar yahtml-hate-too-deep-indentation setq to t when indentations for nested enumerate elements are too deep. (@code{nil}) @end defvar @defvar yahtml-always-/p setq to t if you always want @code{

    } after @code{

    }. @code{nil} @end defvar @defvar yahtml-p-prefered-env-regexp Elements that @code{

    } will be automatically inserted. (@code{"^\\(body\\|dl\\|blockquote\\)"}) @end defvar @defvar yahtml-template-file File to automatically insert when editing a new HTML file. @file{"~/http/template.html"} @end defvar @defvar yahtml-prefer-upcases Use uppercase for tags. @code{nil} @end defvar @defvar yahtml-prefer-upcase-attributes Use uppercase for attributes. @code{nil} @end defvar @defvar yahtml-server-type setq to 'apache if using a Apache server, and will refer ./.htaccess. @code{'apache} @end defvar @defvar yahtml-apache-access-file When @code{yahtml-server-type} is @code{'apache}, define name of access restriction file. @file{".htaccess"} @end defvar @defvar yahtml-shell-command-option Options needed to invoke shell commands. @end defvar @defvar yahtml-translate-hyphens-when-comment-region Whether to change hyphens to @code{-} when commenting out region. (@code{t}) @end defvar @defvar yahtml-entity-reference-chars-alist alist of characters that needs to be written by Entity Reference. Enter as @code{'(?char . "EntityReference")}. By default, @code{<}, @code{>}, @code{&}, @code{'}, is set. Add as needed. Do not include @code{&} at beginning and @code{;} at end of cdr portion of @code{"EntityReference"}. @end defvar @defvar yahtml-faithful-to-htmllint When using htmllint to check syntax, it will complain about excess spaces. setq to @code{t} to avoid this. @end defvar @defvar yahtml-use-css Use style-sheet support or not (@code{t}) @end defvar @defvar yahtml-image-inspection-bytes Number of bytes to inspect the image for geometry information (@code{10000}) @end defvar @defvar yahtml:img-default-alt-format format of img entity's ALT attributes. %x: width, %y: height, %s: size in bytes, %c: first comment string, %f: filename (@code{"%xx%y(%sbytes)"}) @end defvar @defvar yahtml-escape-chars When, completing href-s, Escape reserved characters to URL-encoding or not. Nil for never, t for everytime, and 'ask for inquiring at each reserved chars. (@code{'ask}) @end defvar @defvar yahtml-use-font-lock Use font-lock to fontify buffer or not (@code{(featurep 'font-lock)}) @end defvar @defvar yahtml-use-hilit19 Use hilit19 to highlight buffer or not (@code{(featurep 'hilit19)}) @end defvar @defvar yahtml-indentation-boundary Boundary regexp for indentation calculation. (@code{"^\\s *"}) @end defvar @node Hook variables, , All customizable variables, Customizations @comment node-name, next, previous, up @section hook variables @node Copying, Concept Index, Customizations, Top @comment node-name, next, previous, up @chapter Copying This program is distributed as freesoftware. The author will take no responsibility to any damages due to the usage of this software whatsoever. There are no restrictions to its redistribution, just use common sense. Mail me your thoughts on this program and I will be more than willing to help. Complaints, requests, bug reports and comments are welcome. Make contacts to yuuji@@yatex.org$B!!(B(as of December 2000) If you like this program and use it on a regular basis, please join the mailing list "fj Wild Bird Society". Procedures can be found in the "etc" section of @file{docs/htmlqa.eng} in this package. @flushright HIROSE, Yuuji @end flushright @node Concept Index, , Copying, Top @comment node-name, next, previous, up @unnumbered Index @printindex cp @contents @bye @c Local Variables: @c fill-column: 74 @c fill-prefix: nil @c End:  Tag table:  End tag table yatex1.81/docs/yahtmle010064400037440000000000000412701303343064500140670ustar yuujiwheelInfo file: yahtmle, -*-Text-*- produced by `texinfo-format-buffer' from file `yahtmle.tex' using `texinfmt.el' version 2.42 of 7 Jul 2006. START-INFO-DIR-ENTRY * yahtml-e: (yahtmle). Yet Another html-mode for Emacs (English). END-INFO-DIR-ENTRY  File: yahtmle, Node: Top, Next: Intro, Prev: (dir), Up: (dir) * Menu: * Intro:: Introduction * Installation:: Installing yahtml * Command Invocation:: Using External Commands * Completion:: Input with Completion * Jump:: Moving the Cursor * Changing and Deleting:: Changing and Deleting * CSS Support:: Style Sheet Support * Customizations:: List of Customize Variables * Copying:: Copyright * Concept Index:: Index  File: yahtmle, Node: Intro, Next: Installation, Prev: Top, Up: Top Introduction ************ yahtml is a package to support creating HTML documents on Emacsens. Easy input of elements (tags) by completion, syntax checking with programs like weblint, and invoking the appropriate browser or image viewer depending on the cursor position is its main features. (This Info is still incomplete)  File: yahtmle, Node: Installation, Next: Command Invocation, Prev: Intro, Up: Top Installing yahtml ***************** * Menu: * Setting up yahtml:: * Setting environments for weblint browsers and image viewers:: * Setting environment variables for WWW pages::  File: yahtmle, Node: Setting up yahtml, Next: Setting environments for weblint browsers and image viewers, Prev: Installation, Up: Installation Setting up yahtml ================= Add the following to `~/.emacs' (setq auto-mode-alist (cons (cons "\\.html$" 'yahtml-mode) auto-mode-alist)) (autoload 'yahtml-mode "yahtml" "Yet Another HTML mode" t) Next, add to load-path the directory with the yahtml files (`yahtml.el', `yatexlib.el', `yatexprc.el'). For example, if you put them in `~/src/emacs/yahtml', (setq load-path (cons (expand-file-name "~/src/emacs/yahtml") load-path)) is what you add. By this, yahtml will be automatically loaded when editing files with .html extensions. "yahtml" will be displayed on the mode line if no errors occurred.  File: yahtmle, Node: Setting environments for weblint browsers and image viewers, Next: Setting environment variables for WWW pages, Prev: Setting up yahtml, Up: Installation Setting environments for weblint, browsers, and image viewers ============================================================= Check the variables for invoking external commands and modify as needed. Defaults are in parenthesis. `yahtml-www-browser' ... browser command name (netscape) `yahtml-image-viewer' ... image viewer command name (xv) `yahtml-lint-program' ... syntax check programs command name (jweblint) `yahtml-kanji-code' ... kanji code for HTML files  File: yahtmle, Node: Setting environment variables for WWW pages, Prev: Setting environments for weblint browsers and image viewers, Up: Installation Setting environment variables for WWW pages =========================================== Variables regarding path names for files that will be your home page. `yahtml-path-url-alist' ... list of matching path name on file system and URLs `yahtml-directory-index' ... index file displayed when none is given in URL. Usually `index.html' on NCSA type httpd and `Welcome.html' on CERN types. Examples for `yahtml-path-url-alist'. If `/home/yuuji/http/' is `http://localhost/~yuuji' at home and `/usr/home/yuuji/www/' is `http://www.keio.ac.jp/~yuuji/' at work, then (setq yahtml-path-url-alist '(("/home/yuuji/http" . "http://localhost/~yuuji") ("/usr/home/yuuji/www" . "http://www.keio.ac.jp/~yuuji"))) Any number of additions can be made to this list.  File: yahtmle, Node: Command Invocation, Next: Completion, Prev: Installation, Up: Top Invoking external commands ************************** For easy use of commands that are handy when editing HTML files. `[prefix] t j' ... Invoke HTML syntax checker (jweblint) `[prefix] t p' ... Display current page in browser `[prefix] t r' ... Reload current page if browser is already running  File: yahtmle, Node: Completion, Next: Jump, Prev: Command Invocation, Up: Top Completion Input **************** Completion input of HTML elements is done through the same key strokes as YaTeX's begin-type completion, section-type completion, large-type completion, maketitle-type completion, and accent completion. Corresponding elements in this order is; elements that span multiple lines, empty elements such as img, tags that start and end in a single line, elements with no attributes or contents, and special or symbol entities. `[prefix] b (YaTeX begin-type completion)' ...

    Completion for elements that the start tag and the end tag span multiple lines. Mostly block-level elements. `[prefix] s (YateX section-type completion)' ... photo Completion for elements that do not have end tags and require only attributes. Possible completions are, , . `[prefix] l (YaTeX large-type completion)' ... Similar to begin-type completion but used for elements that start and end on a single line. `[prefix] m (YaTeX maketitle-type completion)' ... Completion for elements without attributes or contents. Possible completion is
    `[prefix] a (YaTeX accent completion)' ... Used to enter special or symbol entities. By default completion for < (<), > (>), & (&), " ("), ' ('), blank ( ) is possible.  File: yahtmle, Node: Jump, Next: Changing and Deleting, Prev: Completion, Up: Top Cursor Movement *************** By using `[prefix] g' ... move to corresponding object the cursor will go to the corresponding object according to the context. Recognized contexts are * `' <--> `' * `' -> invoke viewer * `' -> move cursor to linked target * `' -> open Java source  File: yahtmle, Node: Changing and Deleting, Next: CSS Support, Prev: Jump, Up: Top Changing and Deleting ********************* * Menu: * Changing tags in pairs:: * Changing entities:: * URLencoding of strings within region:: * td-enclosure/tr-enclosure::  File: yahtmle, Node: Changing tags in pairs, Next: Changing entities, Prev: Changing and Deleting, Up: Changing and Deleting Changing tags in pairs ====================== By using `[prefix] c' ... change tags in matching pairs the content can be changed according to the context of the HTML document where the cursor is located. * `'〜`' ... change `TAG' element name * attributes such as `photo' ... change attributes  File: yahtmle, Node: Changing entities, Next: URLencoding of strings within region, Prev: Changing tags in pairs, Up: Changing and Deleting Changing entities ================= Special characters such as < or > must be written as < and >. Easy conversion of these characters can be done when importing text from non HTML files. `[prefix] ;' ... convert char to special entity in marked region `[prefix] :' ... convert special entity to original char in marked region (reverse of [prefix] ;)  File: yahtmle, Node: URLencoding of strings within region, Next: td-enclosure/tr-enclosure, Prev: Changing entities, Up: Changing and Deleting URLencoding of strings within region ==================================== `[prefix] #' ... encode chars that needs to be URLencoded within region  File: yahtmle, Node: td-enclosure/tr-enclosure, Prev: URLencoding of strings within region, Up: Changing and Deleting td-enclosure/tr-enclosure ========================= If you wan to convert series of field into ... repetitions for table element, td-enclosure or tr-enclosure is convenient. `[prefix] }' ... Enclose each field in a region into ...'s. `[prefix] ]' ... Enclose each line in a region into ...'s, with every line converted to ... repetition. They presume white space as field separator by default. To change this, enter other delimiting character for a query. You can convert CSV, for example, into table by specifying comma(,) as a delimiter. If you want to enclose fields with th, call with universal-argument (`C-u'). Enter `th' to enclose fields with .... The special answer `thd' means that enclose the only first column with th, and the rest with td.  File: yahtmle, Node: CSS Support, Next: Customizations, Prev: Changing and Deleting, Up: Top CSS(Style Sheets) Support ************************* * Menu: * CSS-class completion:: * Reread CSS definition::  File: yahtmle, Node: CSS-class completion, Next: Reread CSS definition, Prev: CSS Support, Up: CSS Support CSS class-name completion ========================= You can input a class name in your CSS definition with completion. If you have CSS defined as below; h1.foo, h2.foo { background-color: 0xffffff; } h1.bar, h2.bar { font-size: 120%; } when you input h1(or h2) tag with completing-read by [prefix] b or [prefix] l, yahtml prompts you to input class name with completion from the words which are effective to h1 or h2. And if you defined global class like this; .caution { font-size: 120%; background-color: 0xc00000;} when you input any tags via completing-read, yahtml prompts you to input class name. If this is bothering, typing `C-j' instead of `RET' (or `C-m') cancels the next prompt to class name completion.  File: yahtmle, Node: Reread CSS definition, Prev: CSS-class completion, Up: CSS Support Re-reading CSS definition ========================= If you add some class to your CSS file and you want yahtml to load new definitions, type `M-x yahtml-mode RET' to make yahtml do.  File: yahtmle, Node: Customizations, Next: Copying, Prev: CSS Support, Up: Top Customizations ************** Variables that modify yahtml's behavior. * Menu: * All customizable variables:: List of customizable variables * Hook variables:: hook variables  File: yahtmle, Node: All customizable variables, Next: Hook variables, Prev: Customizations, Up: Customizations List of customizable variables. Defaults in parenthesis ======================================================== -- Variable: yahtml-prefix Prefix key for yahtml-mode. (`\C-c') -- Variable: yahtml-image-viewer Command to view image files refered by img. (xv) -- Variable: yahtml-www-browser Browser to view external pages with `[prefix]g'. (netscape) -- Variable: yahtml-kanji-code Default kanji code. 1=sjis, 2=jis, 3=euc, 4=utf-8 (2) If AddType "text/html; charset=xxx" .html is written in .htaccess, this will override yahtml-kanji-code. -- Variable: yahtml-fill-column Columns to auto-fill (72) -- Variable: yahtml-fill-prefix fill-prefix specific to yahtml-mode. (`nil') -- Variable: yahtml-path-url-alist Matching list of URL and full path name on OS's file system. -- Variable: yahtml-directory-index Default index filed opened when accessing a server without a filename, usually index.html. (`"index.html"') -- Variable: yahtml-lint-program HTML syntax check program. (`"jweblint"') -- Variable: yahtml-hate-too-deep-indentation setq to t when indentations for nested enumerate elements are too deep. (`nil') -- Variable: yahtml-always-/p setq to t if you always want `

    ' after `

    '. `nil' -- Variable: yahtml-p-prefered-env-regexp Elements that `

    ' will be automatically inserted. (`"^\\(body\\|dl\\|blockquote\\)"') -- Variable: yahtml-template-file File to automatically insert when editing a new HTML file. `"~/http/template.html"' -- Variable: yahtml-prefer-upcases Use uppercase for tags. `nil' -- Variable: yahtml-prefer-upcase-attributes Use uppercase for attributes. `nil' -- Variable: yahtml-server-type setq to 'apache if using a Apache server, and will refer ./.htaccess. `'apache' -- Variable: yahtml-apache-access-file When `yahtml-server-type' is `'apache', define name of access restriction file. `".htaccess"' -- Variable: yahtml-shell-command-option Options needed to invoke shell commands. -- Variable: yahtml-translate-hyphens-when-comment-region Whether to change hyphens to `-' when commenting out region. (`t') -- Variable: yahtml-entity-reference-chars-alist alist of characters that needs to be written by Entity Reference. Enter as `'(?char . "EntityReference")'. By default, `<', `>', `&', `'', is set. Add as needed. Do not include `&' at beginning and `;' at end of cdr portion of `"EntityReference"'. -- Variable: yahtml-faithful-to-htmllint When using htmllint to check syntax, it will complain about excess spaces. setq to `t' to avoid this. -- Variable: yahtml-use-css Use style-sheet support or not (`t') -- Variable: yahtml-image-inspection-bytes Number of bytes to inspect the image for geometry information (`10000') -- Variable: yahtml:img-default-alt-format format of img entity's ALT attributes. %x: width, %y: height, %s: size in bytes, %c: first comment string, %f: filename (`"%xx%y(%sbytes)"') -- Variable: yahtml-escape-chars When, completing href-s, Escape reserved characters to URL-encoding or not. Nil for never, t for everytime, and 'ask for inquiring at each reserved chars. (`'ask') -- Variable: yahtml-use-font-lock Use font-lock to fontify buffer or not (`(featurep 'font-lock)') -- Variable: yahtml-use-hilit19 Use hilit19 to highlight buffer or not (`(featurep 'hilit19)') -- Variable: yahtml-indentation-boundary Boundary regexp for indentation calculation. (`"^\\s *"')  File: yahtmle, Node: Hook variables, Prev: All customizable variables, Up: Customizations hook variables ==============  File: yahtmle, Node: Copying, Next: Concept Index, Prev: Customizations, Up: Top Copying ******* This program is distributed as freesoftware. The author will take no responsibility to any damages due to the usage of this software whatsoever. There are no restrictions to its redistribution, just use common sense. Mail me your thoughts on this program and I will be more than willing to help. Complaints, requests, bug reports and comments are welcome. Make contacts to yuuji@yatex.org (as of December 2000) If you like this program and use it on a regular basis, please join the mailing list "fj Wild Bird Society". Procedures can be found in the "etc" section of `docs/htmlqa.eng' in this package. HIROSE, Yuuji  File: yahtmle, Node: Concept Index, Prev: Copying, Up: Top Index ***** * Menu: * Customize: Customizations. (line 5) * Demacs: Intro. (line 5) * Key Assign: Customizations. (line 5) * LaTeX: Intro. (line 5) * Mule: Intro. (line 5) * yahtml: Intro. (line 5)  Tag table: Node: Top259 Node: Intro836 Node: Installation1234 Node: Setting up yahtml1500 Node: Setting environments for weblint browsers and image viewers2291 Node: Setting environment variables for WWW pages2987 Node: Command Invocation3979 Node: Completion4407 Node: Jump5923 Node: Changing and Deleting6403 Node: Changing tags in pairs6665 Node: Changing entities7160 Node: URLencoding of strings within region7704 Node: td-enclosure/tr-enclosure8007 Node: CSS Support9032 Node: CSS-class completion9243 Node: Reread CSS definition10096 Node: Customizations10371 Node: All customizable variables10647 Node: Hook variables14427 Node: Copying14553 Node: Concept Index15344  End tag table yatex1.81/docs/yahtmlj.tex010044400037440000000000000407671303342261200146760ustar yuujiwheel\def\lang{jp} % -*- texinfo -*- for Texinfo V.3.1 \input texinfo @setfilename yahtmlj @settitle Yet Another html-mode for Emacs @direntry * yahtml: (yahtmlj). Yet Another html-mode for Emacs (Japanese). @end direntry @iftex @c @syncodeindex fn cp @c Last modified Fri May 11 15:42:05 2012 on firestorm @syncodeindex vr cp @end iftex @titlepage @sp 10 @center @subtitle Yet Another html-mode for emacs @title 『HTML屋』 @subtitle // yahtml // @author @copyright{} 1994-2012 by HIROSE, Yuuji [yuuji@@yatex.org] @end titlepage @node Top, Intro, (dir), (dir) @comment node-name, next, previous, up @menu * Intro:: はじめに * Installation:: インストール * Command Invocation:: 外部コマンド起動 * Completion:: 補完入力 * Jump:: カーソルジャンプ * Changing and Deleting:: 変更と削除 * CSS Support:: スタイルシート補完 * Customizations:: カスタマイズ変数一覧 * Copying:: とりあつかい * Concept Index:: 索引 @end menu @node Intro, Installation, Top, Top @comment node-name, next, previous, up @chapter はじめに @cindex Demacs @cindex Mule @cindex LaTeX @cindex HTML屋[HTMLや] yahtmlは GNU Emacs 上で HTML文書を作成する時に、繁雑なHTMLタグの入力を補 完機能によってスムーズに行えるようにするだけでなく、weblintなどの構文チェッ クプログラム、カーソル位置のURLやファイル名に依存したブラウザ/イメージヴュー アの起動などを Emacs 編集画面中から 行えるようにするパッケージです。 (このInfoは未完成です(__)…) @node Installation, Command Invocation, Intro, Top @comment node-name, next, previous, up @chapter インストール @menu * yahtml起動のための設定:: * lintプログラム/ブラウザ/イメージヴューア環境等の設定:: * WWWページ環境用変数の設定:: @end menu @node yahtml起動のための設定, lintプログラム/ブラウザ/イメージヴューア環境等の設定, Installation, Installation @section yahtml起動のための設定 @file{~/.emacs}に下の2項目を加えます。 @lisp (setq auto-mode-alist (cons (cons "\\.html$" 'yahtml-mode) auto-mode-alist)) (autoload 'yahtml-mode "yahtml" "Yet Another HTML mode" t) @end lisp 次にyahtmlに必要なファイル(@file{yahtml.el}, @file{yatexlib.el}, @file{yatexprc.el}) を置くディレクトリを load-path に加えます。たとえば、 @file{~/src/emacs/yahtml}に置くのであれば、 @lisp (setq load-path (cons (expand-file-name "~/src/emacs/yahtml") load-path)) @end lisp @noindent などとします。 以上の設定により、拡張子が .html であるファイルを編集すると自動的に yahtml がロードされます。yahtmlが正常に起動できたときはモードラインの表示が 「yahtml」に変わります。 @node lintプログラム/ブラウザ/イメージヴューア環境等の設定, WWWページ環境用変数の設定, yahtml起動のための設定, Installation @section lintプログラム/ブラウザ/イメージヴューア環境等の設定 利用する外部プログラムなどに関する以下の変数を確認し、必要なら正しい値に変 更します(括弧内はデフォルト値)。 @table @code @item yahtml-www-browser @dots{} 起動するブラウザのコマンド名(netscape) @item yahtml-image-viewer @dots{} 起動する画像ビューアのコマンド名(xv) @item yahtml-lint-program @dots{} 構文チェックプログラムのコマンド名(jweblint) @item yahtml-kanji-code @dots{} htmlファイルの漢字コード @end table @node WWWページ環境用変数の設定, , lintプログラム/ブラウザ/イメージヴューア環境等の設定, Installation @section WWWページ環境用変数の設定 ホームページとなるファイルが存在するPATH名に関する変数を設定します。 @table @code @item yahtml-path-url-alist @dots{} ファイルシステム上のPATH名と、URLの対応表 @item yahtml-directory-index @dots{} URL指定でファイル名を省略したときに表示されるインデックス ファイル名(NCSA系httpdなら @file{index.html}, CERN系なら @file{Welcome.html}が一般的) @end table 変数 @code{yahtml-path-url-alist} の設定例を示します。例えば、自宅では、 @file{/home/yuuji/http/} が @code{http://localhost/~yuuji} で参照でき、職 場では @file{/usr/home/yuuji/www/} が@code{http://www.keio.ac.jp/~yuuji/} で参照できるようになっている場合は以下のように設定します。 @lisp (setq yahtml-path-url-alist '(("/home/yuuj/http" . "http://localhost/~yuuji") ("/usr/home/yuuj/www" . "http://www.keio.ac.jp/~yuuji"))) @end lisp この対応組はいくらでも設定することができます。 @node Command Invocation, Completion, Installation, Top @comment node-name, next, previous, up @chapter 外部コマンド起動 HTMLファイル編集にかかわるいくつかのコマンドを即座に呼ぶことができます。 @table @kbd @item [prefix] t j @dots{} HTML構文チェッカ(jweblint)起動 @item [prefix] t p @dots{} 現在のページを対象としたブラウザ起動 @item [prefix] t r @dots{} 現在のページがブラウザに表示されているときのreload指定 @end table @node Completion, Jump, Command Invocation, Top @comment node-name, next, previous, up @chapter 補完入力 「野鳥」で利用できる、「begin型補完」、「section型補完」、 「large型補完」、「maketitle型補完」、「アクセント補完」 と全く同じキー操作で対応する HTMLタグの補完入力ができます。それぞれの型の補完は順に、 「複数行に渡るタグ入力」、「空要素タグ(imgなど)の補完」、 「一行内での開始/終了タグの入力」、「空要素空属性タグの入力」、 「文字参照入力」 に 対応しています。具体的には @table @kbd @item [prefix] b (野鳥のbegin補完に対応) @dots{} @example

    @end example @noindent のように開始タグと終了タグを二行に渡って書きたい場合の補完を指します。 おもにブロック型タグが補完候補に含まれます。 @item [prefix] s (野鳥のsection型補完に対応) @dots{} @example photo @end example @noindent のように終了タグを持たず、かつ属性値のみで機能を指定するタグを補完します。 補完候補としては、img, input が存在します。 @item [prefix] l (野鳥のlarge型補完に対応) @dots{} begin型補完とほぼ同じですが、 @example @end example @noindent のように一行内に開始/終了タグを入れたいときに利用します。 @item [prefix] m (野鳥のmaketitle型補完に対応) @dots{} 要素も属性値も持たないタグを補完入力します。
    などが補完候補に相当します。 @item [prefix] a (野鳥のアクセント補完に対応) @dots{} エンティティ参照による文字表記を入力するときに用います。 デフォルトでは < (<), > (>), & (&), " ("), ' ('), ブランク ( ) の補完入力が行えます。 @end table @node Jump, Changing and Deleting, Completion, Top @comment node-name, next, previous, up @chapter カーソルジャンプ 文書中のいろいろな場所で @table @kbd @item [prefix] g @dots{} 対応するオブジェクトにジャンプ @end table @noindent を押すことにより、カーソル位置のHTML構文に対応する場所にジャンプ します。対応関係が存在すると解釈されるコマンドには以下のものがあります。 @itemize @bullet @item @code{} ←→ @code{} @item @code{} → 対応するviewer起動 @item @code{} → リンク先へのポイント移動 @item @code{} → Javaソースプログラムへの移動 @c @item @code{\include(\input)} → 対応するファイル @end itemize @node Changing and Deleting, CSS Support, Jump, Top @comment node-name, next, previous, up @chapter 変更/削除 @menu * 対タグの変更:: * 文字参照への変更:: * リジョン内文字のURLencode:: * td括り/tr括り:: @end menu @node 対タグの変更, 文字参照への変更, Changing and Deleting, Changing and Deleting @comment node-name, next, previous, up @section 対タグの変更 文書中のいろいろな場所で @table @kbd @item [prefix] c @dots{} 対応するタグ等を変更 @end table @noindent を押すことにより、カーソル位置のHTML構文に応じた 記述内容の変更を行います。カーソル位置と変更する内容の 対応は以下の通りです。 @itemize @bullet @item @code{}〜@code{} @dots{} @code{TAG} の変更 @item @code{photo} などの属性値 @dots{} 属性値の変更 @end itemize @node 文字参照への変更, リジョン内文字のURLencode, 対タグの変更, Changing and Deleting @comment node-name, next, previous, up @section 文字参照への変更 文字としての < や > を表現するときは、文字参照を用いて < や > と表記する必要がありますが、 HTML以外のファイルからこれらの文字を含むテキストを張り込んだ場合 などに、これらの文字を一括して文字参照形式に変換できます。 @table @kbd @item [prefix] ; @dots{} 指定した領域の文字参照に置き換えるべき文字の置換 @item [prefix] : @dots{} 指定した領域の文字参照を参照文字そのものに置換 ([prefix] ; の逆変換) @end table @node リジョン内文字のURLencode, td括り/tr括り, 文字参照への変更, Changing and Deleting @comment node-name, next, previous, up @section リジョン内文字のURLencode @table @kbd @item [prefix] # @dots{} 指定した領域内に URLencode すべき文字があればそれらを エンコード表記に置換。 @end table @node td括り/tr括り, , リジョン内文字のURLencode, Changing and Deleting @comment node-name, next, previous, up @section td括り/tr括り 空白区切りで書いた表形式の行レコードを 括りの並び, あるいはそれらをさらに で括った行並びに変換できます。 @table @kbd @item [prefix] @} @dots{} 現在のリジョンにあるデータを空白区切りごとに ... で括る @item [prefix] ] @dots{} 現在のリジョンにある行を 上記td括りをほどこしてからさらに行ごとに ... で括る @end table デフォルトでは空白区切りですが,これを変えるときは Delimiter: の問い合わせに区切り文字を指定します。たとえばカンマ(,) を指定するとCSVから表を作ることができます。 td以外の要素,具体的には th で括りたい場合は universal-argument (@kbd{C-u}) をつけて上記2つのコマンドを呼びます。どの要素で括るかの 質問が増えるのでそれに th と入れれば,各フィールドを ... で括ります。もし,第1フィールドのみ th で,残りを全部 td 括りにしたいとき は thd と入力して下さい。 @node CSS Support, Customizations, Changing and Deleting, Top @comment node-name, next, previous, up @chapter CSS(スタイルシート)サポート @menu * CSS-class completion:: * Reread CSS file:: @end menu @node CSS-class completion, Reread CSS file, CSS Support, CSS Support @comment node-name, next, previous, up @section CSSクラス名補完 HTML屋はCSS(Cascading Style Sheets)のクラス名を補完入力することができます。 スタイル定義として @display h1.foo, h2.foo @{ background-color: 0xffffff; @} h1.bar, h2.bar @{ font-size: 120%; @} @end display のようなものがあった場合に、h1またはh2タグを [prefix] b や [prefix] l で補 完入力した場合に、それらに有効な class 名である foo, bar を候補として補完 入力することが可能です。また @display .caution @{ font-size: 120%; background-color: 0xc00000;@} @end display のような全てのエレメントに働くclassが定義されていた場合は、全てのタグの補 完入力時にclass参照入力を求められます。これが煩わしい場合はエレメント名入 力確定のときにリターンキー(またはC-m)ではなく、C-jを押せばclass補完入力を キャンセルできます。たとえば @display @kbd{[prefix] l} 行内タグ補完を起動 (または@kbd{[prefix] l SPC}) tt をいれたいのでttと入力 @kbd{C-m} @end display とした場合は続いて class= と補完プロンプトが出ますが、 @display @kbd{[prefix] l} 行内タグ補完を起動 (または@kbd{[prefix] l SPC}) tt をいれたいのでttと入力 @kbd{C-j} @end display と最後を @kbd{C-j} で入力した場合は class 補完プロンプトは出ません。 @node Reread CSS file, , CSS-class completion, CSS Support @comment node-name, next, previous, up @section CSS定義ファイルの読み直し htmlファイルを編集中にCSS定義ファイルを修正し、追加した classを補完候補として直ちに読み込ませたい場合は、 @kbd{M-x yahtml-mode} として再起動を行ってください。 @node Customizations, Copying, CSS Support, Top @comment node-name, next, previous, up @chapter カスタマイズ @cindex カスタマイズ[かすたまいす] @cindex キーアサイン[きいあさいん] yahtmlの動作を制御する変数について説明します。 @menu * All customizable variables:: カスタマイズ変数一覧 * Hook variables:: hook変数 @end menu @node All customizable variables, Hook variables, Customizations, Customizations @comment node-name, next, previous, up @section カスタマイズ変数一覧 @defvar yahtml-prefix yahtml-mode 中のプリフィクスキー (@kbd{\C-c}) @end defvar @defvar yahtml-image-viewer imgで参照している画像ファイルを表示するときに起動するコマンド (xv) @end defvar @defvar yahtml-www-browser @kbd{[prefix]g} で外部ページを表示するときに起動するブラウザ (netscape) @end defvar @defvar yahtml-kanji-code デフォルトの漢字コード。1=sjis, 2=jis, 3=euc, 4=utf-8 (2) .htaccess ファイルに @quotation AddType "text/html; charset=xxx" .html @end quotation の記述があった場合はそれに従う @end defvar @defvar yahtml-fill-column auto-fillするときのカラム数 (72) @end defvar @defvar yahtml-fill-prefix yahtml-mode 固有のfill-prefix (@code{nil}) @end defvar @defvar yahtml-path-url-alist OSのファイルシステム上でのフルパス名と、その外部公開時のURLの対応表。 @end defvar @defvar yahtml-directory-index サーバアクセス時ファイル名を省略したときにデフォルトで開かれる インデックスファイルの名前。多くの場合 index.html。(@code{"index.html"}) @end defvar @defvar yahtml-lint-program HTML構文チェックプログラム。(@code{"jweblint"}) @end defvar @defvar yahtml-hate-too-deep-indentation ネストした列挙系環境でのインデントが深すぎるときにtにする。(@code{nil}) @end defvar @defvar yahtml-always-/p @code{

    } をいれたら必ず @code{

    } したい人向け。@code{nil} @end defvar @defvar yahtml-p-prefered-env-regexp 自動的に @code{

    } を入れて欲しい環境。 (@code{"^\\(body\\|dl\\|blockquote\\)"}) @end defvar @defvar yahtml-template-file 新規HTMLファイル作成時に自動的に挿入して欲しいファイル名。 @file{"~/http/template.html"} @end defvar @defvar yahtml-prefer-upcases タグに大文字を使いたい。@code{nil} @end defvar @defvar yahtml-prefer-upcase-attributes 属性指定子に大文字を使いたい。@code{nil} @end defvar @defvar yahtml-server-type Apache系のサーバを利用している場合は 'apache をセットする。 ./.htaccess を参照するかどうかを決定する。@code{'apache} @end defvar @defvar yahtml-apache-access-file @code{yahtml-server-type} が @code{'apache} のときに アクセス制限ファイル名を指定。@file{".htaccess"} @end defvar @defvar yahtml-shell-command-option シェルで別コマンドを起動するときのオプション。 @end defvar @defvar yahtml-translate-hyphens-when-comment-region 領域コメントアウトをするときに既に存在するハイフンを @code{-} に 変更するかどうか。(@code{t}) @end defvar @defvar yahtml-entity-reference-chars-alist エンティティ参照(Entity Reference)で記述すべき文字群を @code{'(?文字 . "エンティティ表記")} という形式を列挙した alistで並べる。デフォルトで @code{<}, @code{>}, @code{&}, @code{'}, @code{"} に対するalistが設定されているので、追加したい分だけを記述すれば良 い。cdr部 @code{"エンティティ表記"} は、先頭の @code{&} と 末尾の@code{;} は含めずに書く。 @end defvar @defvar yahtml-faithful-to-htmllint 構文チェッカとして htmllint を利用する場合ちょっとした余計な空白などに 対しても警告を示すので、これを回避するときにはこの変数を@code{t}に する。 @end defvar @defvar yahtml-use-css CSSの補完機能を使うかどうか (@code{t}) @end defvar @defvar yahtml-image-inspection-bytes 画像ファイルのサイズを調べるときに読み込むバイト数 (@code{10000}) @end defvar @defvar yahtml:img-default-alt-format のALT属性のデフォルト文字列の書式。%xは画像の幅、 %yは画像の高さ、%sはファイルサイズに置換される (@code{"%xx%y(%sbytes)"}) @end defvar @defvar yahtml-escape-chars href補完などのときに予約文字をURLエンコードするか; 'askのときは確認してから置換する (@code{'ask}) @end defvar @defvar yahtml-use-font-lock ソースの色づけパッケージとして font-lock を利用するか (@code{(featurep 'font-lock)}) @end defvar @defvar yahtml-use-hilit19 ソースの色づけパッケージとして hilit19 を利用するか (@code{(featurep 'hilit19)}) @end defvar @defvar yahtml-indentation-boundary インデント計算を打ち切ってよい境界となる正規表現 (@code{"^\\s *"}) @end defvar @node Hook variables, , All customizable variables, Customizations @comment node-name, next, previous, up @section hook変数 @node Copying, Concept Index, Customizations, Top @comment node-name, next, previous, up @chapter 取り扱い 本プログラムはフリーソフトウェアです。本プログラムを使用して生じたいかな る結果に対しても作者は責任を負わないこととします。転載等に関しては制限いた しません。常識的に扱ってください。また、使用している旨をメイルでお知らせい ただくと、作者は喜んでサポートに励むことでしょう。 苦情、希望、バグ報告、感想等は歓迎いたします。 連絡は yuuji@@yatex.org まで(2000年12月現在)。 継続的に使用してくださる方はメイリングリスト「fj野鳥の会」に 是非加入してください。加入方法については本パッケージの @file{docs/htmlqa} ファイルの「その他」の章を御覧ください。 仕様は、予告なく確実に(気分次第で)変更されます:-p。 @flushright 広瀬雄二 @end flushright @node Concept Index, , Copying, Top @comment node-name, next, previous, up @unnumbered 索引 @printindex cp @contents @bye @c Local Variables: @c fill-column: 74 @c fill-prefix: nil @c buffer-file-coding-system: sjis @c End:  Tag table:  End tag table yatex1.81/docs/yahtmlj010064400037440000000000000416651303343064500141040ustar yuujiwheelInfo file: yahtmlj, -*-Text-*- produced by `texinfo-format-buffer' from file `yahtmlj.tex' using `texinfmt.el' version 2.42 of 7 Jul 2006. START-INFO-DIR-ENTRY * yahtml: (yahtmlj). Yet Another html-mode for Emacs (Japanese). END-INFO-DIR-ENTRY  File: yahtmlj, Node: Top, Next: Intro, Prev: (dir), Up: (dir) * Menu: * Intro:: はじめに * Installation:: インストール * Command Invocation:: 外部コマンド起動 * Completion:: 補完入力 * Jump:: カーソルジャンプ * Changing and Deleting:: 変更と削除 * CSS Support:: スタイルシート補完 * Customizations:: カスタマイズ変数一覧 * Copying:: とりあつかい * Concept Index:: 索引  File: yahtmlj, Node: Intro, Next: Installation, Prev: Top, Up: Top はじめに ******** yahtmlは GNU Emacs 上で HTML文書を作成する時に、繁雑なHTMLタグの入力を 補完機能によってスムーズに行えるようにするだけでなく、weblintなどの構 文チェックプログラム、カーソル位置のURLやファイル名に依存したブラウザ/ イメージヴューアの起動などを Emacs 編集画面中から行えるようにするパッ ケージです。 (このInfoは未完成です(__)…)  File: yahtmlj, Node: Installation, Next: Command Invocation, Prev: Intro, Up: Top インストール ************ * Menu: * yahtml起動のための設定:: * lintプログラム/ブラウザ/イメージヴューア環境等の設定:: * WWWページ環境用変数の設定::  File: yahtmlj, Node: yahtml起動のための設定, Next: lintプログラム/ブラウザ/イメージヴューア環境等の設定, Prev: Installation, Up: Installation yahtml起動のための設定 ====================== `~/.emacs'に下の2項目を加えます。 (setq auto-mode-alist (cons (cons "\\.html$" 'yahtml-mode) auto-mode-alist)) (autoload 'yahtml-mode "yahtml" "Yet Another HTML mode" t) 次にyahtmlに必要なファイル(`yahtml.el', `yatexlib.el', `yatexprc.el') を置くディレクトリを load-path に加えます。たとえば、 `~/src/emacs/yahtml'に置くのであれば、 (setq load-path (cons (expand-file-name "~/src/emacs/yahtml") load-path)) などとします。 以上の設定により、拡張子が .html であるファイルを編集すると自動的に yahtml がロードされます。yahtmlが正常に起動できたときはモードラインの 表示が「yahtml」に変わります。  File: yahtmlj, Node: lintプログラム/ブラウザ/イメージヴューア環境等の設定, Next: WWWページ環境用変数の設定, Prev: yahtml起動のための設定, Up: Installation lintプログラム/ブラウザ/イメージヴューア環境等の設定 ==================================================== 利用する外部プログラムなどに関する以下の変数を確認し、必要なら正しい値 に変更します(括弧内はデフォルト値)。 `yahtml-www-browser' ... 起動するブラウザのコマンド名(netscape) `yahtml-image-viewer' ... 起動する画像ビューアのコマンド名(xv) `yahtml-lint-program' ... 構文チェックプログラムのコマンド名(jweblint) `yahtml-kanji-code' ... htmlファイルの漢字コード  File: yahtmlj, Node: WWWページ環境用変数の設定, Prev: lintプログラム/ブラウザ/イメージヴューア環境等の設定, Up: Installation WWWページ環境用変数の設定 ========================= ホームページとなるファイルが存在するPATH名に関する変数を設定します。 `yahtml-path-url-alist' ... ファイルシステム上のPATH名と、URLの対応表 `yahtml-directory-index' ... URL指定でファイル名を省略したときに表示されるインデックス ファイル名(NCSA系httpdなら `index.html', CERN系なら `Welcome.html'が一般的) 変数 `yahtml-path-url-alist' の設定例を示します。例えば、自宅では、 `/home/yuuji/http/' が `http://localhost/~yuuji' で参照でき、職場では `/usr/home/yuuji/www/' が`http://www.keio.ac.jp/~yuuji/' で参照できる ようになっている場合は以下のように設定します。 (setq yahtml-path-url-alist '(("/home/yuuj/http" . "http://localhost/~yuuji") ("/usr/home/yuuj/www" . "http://www.keio.ac.jp/~yuuji"))) この対応組はいくらでも設定することができます。  File: yahtmlj, Node: Command Invocation, Next: Completion, Prev: Installation, Up: Top 外部コマンド起動 **************** HTMLファイル編集にかかわるいくつかのコマンドを即座に呼ぶことができます。 `[prefix] t j' ... HTML構文チェッカ(jweblint)起動 `[prefix] t p' ... 現在のページを対象としたブラウザ起動 `[prefix] t r' ... 現在のページがブラウザに表示されているときのreload指定  File: yahtmlj, Node: Completion, Next: Jump, Prev: Command Invocation, Up: Top 補完入力 ******** 「野鳥」で利用できる、「begin型補完」、「section型補完」、「large型補 完」、「maketitle型補完」、「アクセント補完」と全く同じキー操作で対応 するHTMLタグの補完入力ができます。それぞれの型の補完は順に、「複数行に 渡るタグ入力」、「空要素タグ(imgなど)の補完」、「一行内での開始/終了タ グの入力」、「空要素空属性タグの入力」、「文字参照入力」に対応していま す。具体的には `[prefix] b (野鳥のbegin補完に対応)' ...

    のように開始タグと終了タグを二行に渡って書きたい場合の補完を指し ます。おもにブロック型タグが補完候補に含まれます。 `[prefix] s (野鳥のsection型補完に対応)' ... photo のように終了タグを持たず、かつ属性値のみで機能を指定するタグを補 完します。補完候補としては、img, input が存在します。 `[prefix] l (野鳥のlarge型補完に対応)' ... begin型補完とほぼ同じですが、 のように一行内に開始/終了タグを入れたいときに利用します。 `[prefix] m (野鳥のmaketitle型補完に対応)' ... 要素も属性値も持たないタグを補完入力します。
    などが補完候補に相当します。 `[prefix] a (野鳥のアクセント補完に対応)' ... エンティティ参照による文字表記を入力するときに用います。 デフォルトでは < (<), > (>), & (&), " ("), ' ('),ブランク ( ) の補完入力が行えます。  File: yahtmlj, Node: Jump, Next: Changing and Deleting, Prev: Completion, Up: Top カーソルジャンプ **************** 文書中のいろいろな場所で `[prefix] g' ... 対応するオブジェクトにジャンプ を押すことにより、カーソル位置のHTML構文に対応する場所にジャンプします。 対応関係が存在すると解釈されるコマンドには以下のものがあります。 * `' ←→ `' * `' → 対応するviewer起動 * `' → リンク先へのポイント移動 * `' → Javaソースプログラムへの移動  File: yahtmlj, Node: Changing and Deleting, Next: CSS Support, Prev: Jump, Up: Top 変更/削除 ********* * Menu: * 対タグの変更:: * 文字参照への変更:: * リジョン内文字のURLencode:: * td括り/tr括り::  File: yahtmlj, Node: 対タグの変更, Next: 文字参照への変更, Prev: Changing and Deleting, Up: Changing and Deleting 対タグの変更 ============ 文書中のいろいろな場所で `[prefix] c' ... 対応するタグ等を変更 を押すことにより、カーソル位置のHTML構文に応じた記述内容の変更を行いま す。カーソル位置と変更する内容の対応は以下の通りです。 * `'〜`' ... `TAG' の変更 * `photo' などの属性値 ... 属性値の変更  File: yahtmlj, Node: 文字参照への変更, Next: リジョン内文字のURLencode, Prev: 対タグの変更, Up: Changing and Deleting 文字参照への変更 ================ 文字としての < や > を表現するときは、文字参照を用いて< や > と 表記する必要がありますが、HTML以外のファイルからこれらの文字を含むテキ ストを張り込んだ場合などに、これらの文字を一括して文字参照形式に変換で きます。 `[prefix] ;' ... 指定した領域の文字参照に置き換えるべき文字の置換 `[prefix] :' ... 指定した領域の文字参照を参照文字そのものに置換 ([prefix] ; の逆変換)  File: yahtmlj, Node: リジョン内文字のURLencode, Next: td括り/tr括り, Prev: 文字参照への変更, Up: Changing and Deleting リジョン内文字のURLencode ========================= `[prefix] #' ... 指定した領域内に URLencode すべき文字があればそれらを エンコード表記に置換。  File: yahtmlj, Node: td括り/tr括り, Prev: リジョン内文字のURLencode, Up: Changing and Deleting td括り/tr括り ============= 空白区切りで書いた表形式の行レコードを 括りの並び,あるいはそれら をさらに で括った行並びに変換できます。 `[prefix] }' ... 現在のリジョンにあるデータを空白区切りごとに ... で括る `[prefix] ]' ... 現在のリジョンにある行を上記td括りをほどこしてからさらに行 ごとに ... で括るデフォルトでは空白区切りですが, これを変えるときはDelimiter: の問い合わせに区切り文字を指 定します。たとえばカンマ(,)を指定するとCSVから表を作るこ とができます。 td以外の要素,具体的には th で括りたい場合は universal-argument (`C-u') をつけて上記2つのコマンドを呼びます。どの要素で括るかの質問が 増えるのでそれに th と入れれば,各フィールドを ...で括ります。 もし,第1フィールドのみ th で,残りを全部 td 括りにしたいときは thd と 入力して下さい。  File: yahtmlj, Node: CSS Support, Next: Customizations, Prev: Changing and Deleting, Up: Top CSS(スタイルシート)サポート *************************** * Menu: * CSS-class completion:: * Reread CSS file::  File: yahtmlj, Node: CSS-class completion, Next: Reread CSS file, Prev: CSS Support, Up: CSS Support CSSクラス名補完 =============== HTML屋はCSS(Cascading Style Sheets)のクラス名を補完入力することができ ます。スタイル定義として h1.foo, h2.foo { background-color: 0xffffff; } h1.bar, h2.bar { font-size: 120%; } のようなものがあった場合に、h1またはh2タグを [prefix] b や [prefix] l で補完入力した場合に、それらに有効な class 名である foo, bar を候補と して補完入力することが可能です。また .caution { font-size: 120%; background-color: 0xc00000;} のような全てのエレメントに働くclassが定義されていた場合は、全てのタグ の補完入力時にclass参照入力を求められます。これが煩わしい場合はエレメ ント名入力確定のときにリターンキー(またはC-m)ではなく、C-jを押せば class補完入力をキャンセルできます。たとえば [prefix] l 行内タグ補完を起動 (または[prefix] l SPC) tt をいれたいのでttと入力 C-m とした場合は続いて class= と補完プロンプトが出ますが、 [prefix] l 行内タグ補完を起動 (または[prefix] l SPC) tt をいれたいのでttと入力 C-j と最後を `C-j' で入力した場合は class 補完プロンプトは出ません。  File: yahtmlj, Node: Reread CSS file, Prev: CSS-class completion, Up: CSS Support CSS定義ファイルの読み直し ========================= htmlファイルを編集中にCSS定義ファイルを修正し、追加した classを補完候補として直ちに読み込ませたい場合は、 `M-x yahtml-mode' として再起動を行ってください。  File: yahtmlj, Node: Customizations, Next: Copying, Prev: CSS Support, Up: Top カスタマイズ ************ yahtmlの動作を制御する変数について説明します。 * Menu: * All customizable variables:: カスタマイズ変数一覧 * Hook variables:: hook変数  File: yahtmlj, Node: All customizable variables, Next: Hook variables, Prev: Customizations, Up: Customizations カスタマイズ変数一覧 ==================== -- Variable: yahtml-prefix yahtml-mode 中のプリフィクスキー (`\C-c') -- Variable: yahtml-image-viewer imgで参照している画像ファイルを表示するときに起動するコマンド (xv) -- Variable: yahtml-www-browser `[prefix]g' で外部ページを表示するときに起動するブラウザ (netscape) -- Variable: yahtml-kanji-code デフォルトの漢字コード。1=sjis, 2=jis, 3=euc, 4=utf-8 (2) .htaccess ファイルに AddType "text/html; charset=xxx" .htmlの記述があった場合は それに従う -- Variable: yahtml-fill-column auto-fillするときのカラム数 (72) -- Variable: yahtml-fill-prefix yahtml-mode 固有のfill-prefix (`nil') -- Variable: yahtml-path-url-alist OSのファイルシステム上でのフルパス名と、その外部公開時のURLの対応 表。 -- Variable: yahtml-directory-index サーバアクセス時ファイル名を省略したときにデフォルトで開かれるイ ンデックスファイルの名前。多くの場合 index.html。(`"index.html"') -- Variable: yahtml-lint-program HTML構文チェックプログラム。(`"jweblint"') -- Variable: yahtml-hate-too-deep-indentation ネストした列挙系環境でのインデントが深すぎるときにtにする。 (`nil') -- Variable: yahtml-always-/p `

    ' をいれたら必ず `

    ' したい人向け。`nil' -- Variable: yahtml-p-prefered-env-regexp 自動的に `

    ' を入れて欲しい環境。 (`"^\\(body\\|dl\\|blockquote\\)"') -- Variable: yahtml-template-file 新規HTMLファイル作成時に自動的に挿入して欲しいファイル名。 `"~/http/template.html"' -- Variable: yahtml-prefer-upcases タグに大文字を使いたい。`nil' -- Variable: yahtml-prefer-upcase-attributes 属性指定子に大文字を使いたい。`nil' -- Variable: yahtml-server-type Apache系のサーバを利用している場合は 'apache をセットする。 ./.htaccess を参照するかどうかを決定する。`'apache' -- Variable: yahtml-apache-access-file `yahtml-server-type' が `'apache' のときにアクセス制限ファイル名 を指定。`".htaccess"' -- Variable: yahtml-shell-command-option シェルで別コマンドを起動するときのオプション。 -- Variable: yahtml-translate-hyphens-when-comment-region 領域コメントアウトをするときに既に存在するハイフンを `-' に変 更するかどうか。(`t') -- Variable: yahtml-entity-reference-chars-alist エンティティ参照(Entity Reference)で記述すべき文字群を`'(?文 字 . "エンティティ表記")' という形式を列挙したalistで並べる。デ フォルトで `<', `>', `&', `'', `"' に対するalistが設定されている ので、追加したい分だけを記述すれば良い。cdr部 `"エンティティ表記 "' は、先頭の `&' と 末尾の`;'は含めずに書く。 -- Variable: yahtml-faithful-to-htmllint 構文チェッカとして htmllint を利用する場合ちょっとした余計な空白 などに対しても警告を示すので、これを回避するときにはこの変数を`t' にする。 -- Variable: yahtml-use-css CSSの補完機能を使うかどうか (`t') -- Variable: yahtml-image-inspection-bytes 画像ファイルのサイズを調べるときに読み込むバイト数 (`10000') -- Variable: yahtml:img-default-alt-format のALT属性のデフォルト文字列の書式。%xは画像の幅、%yは 画像の高さ、%sはファイルサイズに置換される (`"%xx%y(%sbytes)"') -- Variable: yahtml-escape-chars href補完などのときに予約文字をURLエンコードするか; 'askのときは確 認してから置換する (`'ask') -- Variable: yahtml-use-font-lock ソースの色づけパッケージとして font-lock を利用するか(`(featurep 'font-lock)') -- Variable: yahtml-use-hilit19 ソースの色づけパッケージとして hilit19 を利用するか(`(featurep 'hilit19)') -- Variable: yahtml-indentation-boundary インデント計算を打ち切ってよい境界となる正規表現(`"^\\s *"')  File: yahtmlj, Node: Hook variables, Prev: All customizable variables, Up: Customizations hook変数 ========  File: yahtmlj, Node: Copying, Next: Concept Index, Prev: Customizations, Up: Top 取り扱い ******** 本プログラムはフリーソフトウェアです。本プログラムを使用して生じたい かなる結果に対しても作者は責任を負わないこととします。転載等に関しては 制限いたしません。常識的に扱ってください。また、使用している旨をメイル でお知らせいただくと、作者は喜んでサポートに励むことでしょう。 苦情、希望、バグ報告、感想等は歓迎いたします。連絡は yuuji@yatex.org まで(2000年12月現在)。継続的に使用してくださる方はメイリングリスト「fj 野鳥の会」に是非加入してください。加入方法については本パッケージの `docs/htmlqa'ファイルの「その他」の章を御覧ください。 仕様は、予告なく確実に(気分次第で)変更されます:-p。 広瀬雄二  File: yahtmlj, Node: Concept Index, Prev: Copying, Up: Top 索引 **** * Menu: * キーアサイン[きいあさいん]: Customizations. (line 5) * カスタマイズ[かすたまいす]: Customizations. (line 5) * Demacs: Intro. (line 5) * HTML屋[HTMLや]: Intro. (line 5) * LaTeX: Intro. (line 5) * Mule: Intro. (line 5)  Tag table: Node: Top260 Node: Intro729 Node: Installation1009 Node: yahtml起動のための設定1197 Node: lintプログラム/ブラウザ/イメージヴューア環境等の設定1849 Node: WWWページ環境用変数の設定2349 Node: Command Invocation3151 Node: Completion3478 Node: Jump4460 Node: Changing and Deleting4859 Node: 対タグの変更5033 Node: 文字参照への変更5383 Node: リジョン内文字のURLencode5775 Node: td括り/tr括り6014 Node: CSS Support6688 Node: CSS-class completion6886 Node: Reread CSS file7869 Node: Customizations8091 Node: All customizable variables8315 Node: Hook variables11343 Node: Copying11455 Node: Concept Index11951  End tag table yatex1.81/docs/yatex.ref010044400037440000000000000120561303342261200143220ustar yuujiwheel---------------------------------------------------------------------------- 『野鳥』 クイックリファレンス ---------------------------------------------------------------------------- 【注意】 野鳥では、prefix キーをカスタマイズできるため(標準ではC-c)これを [prefix] と表記します。C-c のまま変更していない場合、[prefix] a は C-c a を表わします。 begin型コマンドとは \begin〜\endの形式のコマンド、section型コ マンドとは \section{題}のように引数を取るコマンド、large型コマン ドとは {\tt } のような中括弧で囲まれたフォント/サイズ指定子、 maketitle型コマンドとは \maketitle のように引数を伴わないコマン ドを指します。 【補完】 ◆アクセント補完 [prefix] a ◆begin型補完 [prefix] b SPC ◆begin型補完(領域指定) [prefix] B SPC ◆begin型補完(即時) [prefix] b 環境の頭文字 ◆begin型補完(〃領域指定) [prefix] B 環境の頭文字 ◆end補完 [prefix] e ◆large型補完 [prefix] l ◆large型補完(領域指定) [prefix] L ◆maketitle型補完 [prefix] m ◆section型補完 [prefix] s ◆section型補完(領域指定) [prefix] S ◆随時補完 [prefix] SPC 即時begin型補完の、環境名の頭文字の対応については、Info マニュ アルをご覧ください。領域指定モードでは、マークした位置とポイント の間を\begin{center}…\end{center} や {\large } などで括ります。 ◆数式記号イメージ補完 ; ◆ギリシャ文字イメージ補完 : 上の2つはTeXの数式環境の中で押した場合のみ有効です。強制的に補 完機能を使う場合は、C-u を押してから ; や : を押します。 【プロセス起動】 ◆latex起動 [prefix] tj ◆latex+dvipdfmx起動 [prefix] td ◆環境の即時プレビュー [prefix] te ◆latex起動(領域指定) [prefix] tr ◆jbibtex起動 [prefix] tb ◆makeindex起動 [prefix] ti ◆latexプロセスのkill [prefix] tk ※ ◆プリントアウト [prefix] tl ◆プリントアウト(全ページ) C-u [prefix] tl ◆プレビューア起動 [prefix] tp ◆xdvi上で文字列サーチ [prefix] ts ※※ ◆lpq起動 [prefix] tq [prefix] t を押せばメニューが出るので、[prefix] t の次に押すキー は覚えなくて構いません。 ※は、MS-DOS では無効です。 ※※は、-remote 機能付きの xdvi でのみ有効です。 [prefix] tr の領域指定は、文書中の、 %#BEGIN と書いてある行か ら、%#END と書いてある行までです。%#END を省略すると、%#BEGINか ら文書末まで、両方省略するとマークした位置から、ポイントまでが指 定領域となります。 【カーソルジャンプ】 ◆タイプセットエラー箇所へ [prefix] ' タイプセットエラー発生箇所へ(末尾から)遡って順次ジャンプします。 タイプセット時にエラーが生じた場合のみ有効です。 ◆対応するオブジェクトジャンプ [prefix] g ◆別ウィンドウで 〃 [prefix] 4g カーソルジャンプは、[prefix] g を押す時のカーソルの位置により、 ジャンプすべき場所を判断します。 ・\begin{}, \end{}の上 対応する \end{},\begin{} へ ・%#BEGIN, %#END の上 対応する %#BEGIN, %#END へ ・\include(only), \input の上 対応するファイルへ ・\ref, \label の上 対応する \label, \ref へ ・\cite, \bibitem の上 対応する \bibitem, \cite へ ・その他 対応するプレヴューア位置へ ◆メインファイルへジャンプ [prefix] ^ ◆別ウィンドウで 〃 [prefix] 4^ メインファイルを野鳥に知らせるために、作成ファイルの任意の位置に、 %#!jlatex メインファイル名 のような行を書いておいて下さい。 ◆環境の先頭へ ESC C-a ◆環境の末尾へ ESC C-e ◆環境全体をマーク ESC C-h 【%によるコメントアウト】 ◆領域/環境のコメントアウト [prefix] > ◆領域/環境のコメント除去 [prefix] < カーソルが、\begin{} または \end{} の行にある時は、その環境に含 まれる文章全てをコメントアウト/除去し、それ以外の時は、マークとポ イント間の文章をコメントアウト/除去します。 ◆段落/環境宣言コメントアウト [prefix] . ◆段落/環境宣言コメント除去 [prefix] , カーソルが、\begin{} または \end{} の行にある時は、それら二つの 行をコメントアウト/除去し、それ以外の時は、カーソルの属する段落を コメントアウト/除去します。 【その他】 ◆itemの桁揃え [prefix] i \item を使う環境中のみ有効です。\item の項目全体をハングインデ ントします。 ◆LaTeXコマンド変更 [prefix] c \begin{}, \end{} の行で起動すると環境名を同時に変更します。 section型コマンドの上で起動するとコマンドを変更し、コマンドの引 数の位置で起動すると引数を変更します。large型コマンドの上で起動 するとフォント/サイズ指定子を変更します。イメージ補完で入力した 数式モードコマンドの上で起動すると確定直前のイメージ補完操作に戻 ります。 ◆コマンド削除 [prefix] k \begin{}, \end{} のペア、%#BEGIN, %#END のペア、括弧のペア、ま たはsection型コマンド、フォント/文字サイズ指定子とそれを括る括弧 を一挙に削除します。 ◆領域を()で括る [prefix] ) ◆領域を{}で括る [prefix] } ◆領域を[]で括る [prefix] ] ◆領域を$$で括る [prefix] $ ◆モード切り替え [prefix] w 新規作成/修正モード、数式モードの切り替えメニューが出ます。 ◆%# 記法の編集 [prefix] % ◆tabular/array桁位置表示 [prefix] & ◆オンラインヘルプ [prefix] ? ◆オンラインapropos [prefix] / ◆おまかせ改行 ESC RET 「おまかせ改行」は tabular, array, itemize, enumerate, list, description 環境で有効です。 ◆インクルード構造ブラウズ [prefix] d ◆font-lockし直しメニュー [prefix] u 広瀬雄二 yuuji@yatex.org Local variables: mode: text fill-prefix: " " End: yatex1.81/docs/yatexadd.doc010044400037440000000000000170421303342261200147640ustar yuujiwheel------------------------------------------------------------------------ 野鳥用付加関数の作成方法 ------------------------------------------------------------------------ 【付加関数とは】 begin 型補完で、「tabular 環境を入力している時に、わたしの好み のスタイルが入らないなあ」などと思うことはありませんか。tabular 環境に限らず、LaTeX の環境の引数には、各人お決まりのフォーマット があるものです。たとえば凝った表を書く時の tabular環境の引数は、 かなり複雑なので、デフォルトの自動入力関数よりも、 "{@{\vrule width 1pt\ }|||@{\ \vrule width 1pt}}" を挿入するだけの単純な関数のほうが、嬉しい人もいるでしょう。あるい は、「そんなの要らない。他の tabular をコピーして来たほうが早い。」 と思う人もいるでしょう。 YaTeX の付加関数は、あらかじめ○○環境用のお仕着せの特別関数を用 意しておくのではなく、○○環境用の特別関数が欲しくなったら独自の関 数を定義する、というコンセプトに基づくもので、付加関数の登録のため の手続きをすることなく、関数を定義したその瞬間から使えるようになり ます。「必要なのは、defun だけ」です。 【準備】 さすがに、関数を書くだけでは使えません:-)。yatex-mode 起動時には、 その関数を定義したファイルがロードされていなくてはなりません。関数 を定義するファイル名を yatexhks.el(またはバイトコンパイルした形式 の yatexhks.elc)にし、そのファイルを load-path 中に置いておけば、 野鳥が自動的にロードします。それ以外のファイル名にする場合は、 yatex-mode-load-hook に付加関数を定義する Emacs-Lisp ファイルをロー ドするような仕掛けを書いておくのがよいでしょう。 【関数定義】 付加関数には、各LaTeXコマンドのオプション引数を返す形式のもの、 section型補完の引数を返すもの、リジョン括りsection型補完の引数該当 部を処理するためのもの、三種類があります。ここでは便宜上その三つを、 a. 追加型付加関数 b. 引数型付加関数 c. 括り補完時付加関数 と呼ぶことにします。 a は、以下の例のように、begin型補完では\begin{環境名}の直後に付 加する文字列、section型補完では LaTeX コマンド名と第一引数の間に位 置する文字列、maketitle型補完では LaTeX コマンド名の直後に位置する 文字列を返すような関数です。 (例) \begin{table}[ht] (付加関数名 YaTeX:table) ~~~~ \put(100,200){} (付加関数名 YaTeX:put) ~~~~~~~~~ \sum_{i=0}^{n} (付加関数名 YaTeX:sum) ~~~~~~~~~~ 追加型付加関数は『LaTeXコマンド名の前に YaTeX: をつけた名前』で定 義します。 b は、以下のようにsection型コマンドの引数となる文字列を返す関数 です。 (例) \newcommand{\foo}{bar} (付加関数名 YaTeX::newcommand) ~~~~ ~~~ 引数型付加関数は『LaTeXコマンド名の前に YaTeX:: をつけた名前』で定 義します。また引数型付加関数が呼ばれる時にはsection型コマンドの何 番目の引数を入力しているのかが関数への引数として渡されます。したがっ て、引数型付加関数は整数の引数を一つ取るものとして定義し、その引数 の値により処理を決定することになります。 (yatex.1.72の新機能) c は、既存テキストの一部をsection型コマンドの引数として括るとき に、指定したりジョンの先頭と末尾の各ポイントを引数として呼ばれます。 たとえば、 5/3 というテキストをリジョン指定して [prefix] S でセクション型コマンド で括りたいときに、括られるテキストに対してなんらかの処理をほどこし たいときに呼ばれます。 (例) 5/3 ←5/3をリジョン指定し \frac で括る \frac{5/3} ←5/3のポイント位置を引数に呼ばれる ~~~ (付加関数 YaTeX::frac-region) 【定義例】 例えば、tabular環境のフォーマットとして、いつでも {|c|c|c|} を入 れるだけで良いのなら、 (defun YaTeX:tabular () "{|c|c|c|}") とだけ書けばよく、前述の、複雑な定型 tabular フォーマットを挿入す るための関数を定義する場合は次のようにします。 (defun YaTeX:tabular () "{@{\\vrule width 1pt\\ }|||@{\\ \\vrule width 1pt}}") この時、Emacs-Lisp 中の文字列では、\ 自身は \\ と表記することなど に注意して下さい。 また、{} の中を、補完時に直接キーボードから読み込ませたい時は、 (defun YaTeX:tabular () (concat "{" (read-string "Rule: ") "}")) などとすれば良いでしょう。 次に、引数型付加関数として \newcommand の引数を読み込む関数を定 義する場合を例示します。\newcommand の第一引数は新たに定義するコマ ンド名なので、必ず先頭に \ が来ます。第二引数はたいていの場合ミニ バッファでは編集しづらいような複雑な定義を書くので、何も補完しない 方が良いでしょう。これを考慮して付加関数を定義すると以下のようなも のになるでしょう。 (defun YaTeX::newcommand (n) ;nは引数の位置 (cond ((= n 1) ;第一引数ならコマンド名 (read-string "Command: " "\\")) ;\を初期入力とする ((= n 2) "") ;第二引数なら何もしない (t nil))) なお、引数型付加関数が nil を返した場合は、通常の引数入力関数が呼 ばれます。 最後に括り補完時付加関数の例として、既存テキストを \frac で括 る場合の例を示します。\frac は2つの引数を取り、\frac{a}{b} のよ うにして、分数を表すときに利用するコマンドです。数学的には a a/b ⇔ ---- b と置き換え可能な記法です。LaTeXソースにa/bと書いたものを野鳥の括 り補完で\fracに括ると、以下のようになります。 \frac{a/b} /の部分を }{ に置き換えれば正しい書き換えになります。このような ことを対話的に半自動で行なうアドイン関数は以下のようにします。 (defun YaTeX::frac-region (beg end) ;リジョンの先頭と末尾 (catch 'done (while (search-forward "/" end t) ;/がある間繰り返す (goto-char (match-beginning 0)) ;/の位置に移動 (if (y-or-n-p "Replace this slash(/) to `}{'") (throw 'done (replace-match "}{"))) ;置き換えて終了 (goto-char (match-end 0))))) 【呼ばれ方】 野鳥本体は、begin型補完とsection型補完、およびmaketitle型補完の 入力時に付加関数の存在を調べてから呼び出します。begin型補完の場合 \begin{環境名} が自動入力された直後に呼び出されます。section型補完 では第一引数の補完の直前、maketitle型補完の場合は、コマンド名の直 後(一つのスペースを挿入する直前)に呼び出されます。引数型付加関数は、 section型コマンドの引数の入力時にその都度呼ばれます。括り補完時付 加関数は、LaTeXコマンドと{}がテキストに挿入された直後に呼ばれます。 【参考】 付加関数の定義の例を yatexadd.el に用意しました。実際に独自の付 加関数を定義する時の参考として下さい。 有用と思われる関数について、簡単に説明します。 ・関数 YaTeX:read-position 引数 [] の中に入れてもよい文字を羅列した文字列。 説明 [htb] などのような location 指定を作成します。何も入力せず リターンを押すと、[]自体も省略されます。[]の中に来るべき文 字が htbp に限られているなら、(YaTeX:read-position "htbp") と呼び出します。 ・関数 YaTeX-cplread-with-learning 引数 プロンプト デフォルト補完テーブル変数シンボル ユーザ補完テーブル変数シンボル ローカル補完テーブル変数シンボル 説明 「プロンプト」というプロンプトを出し、補完入力を行います。 三つの変数のテーブルの値を結合したものが補完候補として用 いられ、新しい単語を入力すると自動的に学習されます。学習 結果は ~/.yatexrc か ./.yatexrc に保存されます。使用例と して YaTeX::documentstyle 関数の定義をごらんください。 ・関数 YaTeX:read-coordinates 引数 基本プロンプト、X座標プロンプト、Y座標プロンプト(全て省略可) 説明 「基本プロンプト X座標プロンプト:」というプロンプトを出し て、X座標を読み込み、「基本プロンプト Y座標プロンプト:」を 出して、Y座標を読み込み、(X座標,Y座標) の様な形式を作成します。 何も入力せずリターンを押しても、(,)が返されます。 各プロンプトのデフォルトはそれぞれ、Dimension, X, Y です。 ・関数 YaTeX:check-comletion-type 引数 'begin または、'section または、'maketitle 説明 付加関数が呼ばれる時に、行われている補完の形式が、引数で与 えたものであるかどうか調べ、そうでない場合にエラー終了する。 なお、変数 YaTeX-current-completion-type に現在の補完の型 を表わすシンボル(この関数の引数と同様)が格納されています。 【最後に】 快適な関数を定義したなら、そしてそれを公開してもよいと思われたな ら、筆者までお送り下さい。次の yatexadd.el に取り込んで行きたいと 思います。 広瀬雄二 yuuji@yatex.org yatex1.81/docs/yatexe010064400037440000000000002431531332771661300137370ustar yuujiwheelInfo file: yatexe, -*-Text-*- produced by `texinfo-format-buffer' from file `yatexe.tex' using `texinfmt.el' version 2.42 of 7 Jul 2006. START-INFO-DIR-ENTRY * YaTeX-e: (yatexe). Yet Another tex-mode for Emacs (English). END-INFO-DIR-ENTRY  File: yatexe, Node: Top, Next: What is YaTeX?, Prev: (dir), Up: (dir) * Menu: * What is YaTeX?:: * Main features:: What YaTeX can do * Installation:: Guide to install * Typesetting:: Call typesetting processes * %#notation:: Meta-keyword `%#' * 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 includeonly:: Free from maintaining includeonly * What column:: Check what table-column the cursor belong * Intelligent newline:: Guess requisites of new line * Usepackage checker:: Selecting correct \usepackage is YaTeX's job * Online help:: On-line documentation of LaTeX * Browsing file hierarchy:: Walking through file hierarchy * Cooperation with other packages:: Work well with gmhist, min-out * Customizations:: How to breed `Wild Bird' * Etcetera:: YaTeX is acquisitive. * Copying:: Redistribution  File: yatexe, Node: What is YaTeX?, Next: Main features, Prev: Top, Up: Top What is YaTeX? ************** YaTeX automates typesetting and previewing of LaTeX and enables completing input of LaTeX mark-up command such as `\begin{}'..`\end{}'. YaTeX also supports Demacs which runs on MS-DOS(386), Mule (Multi Language Enhancement to GNU Emacs), and latex on DOS.  File: yatexe, Node: Main features, Next: Installation, Prev: What is YaTeX?, Up: Top Main features ************* * Invocation of typesetter, previewer and related programs(`C-c t') * Typesetting on static region which is independent from point * Semiautomatic replacing of `\includeonly' * Jumping to error line(`C-c '') * Completing-read of LaTeX commands such as `\begin{}', `\section' etc. (`C-c b', `C-c s', `C-c l', `C-c m') * Enclosing text into LaTeX environments or commands (ABOVEKEYSTROKES after region setting) * Displaying the structure of text at entering sectioning commands * Lump shifting of sectioning commands (*Note view-sectioning::) * Learning unknown/new LaTeX commands for the next completion * Argument reading with a guide for complicated LaTeX commands * Generating argument-readers for new/unsupported commands(`yatexgen') * Quick changing or deleting of LaTeX commands(`C-c c', `C-c k') * Jumping from and to inter-file, begin<->end, ref<->label(`C-c g') * Blanket commenting out or uncommenting (`C-c >', `C-c <', `C-c ,', `C-c .') * Easy input of accent mark, math-mode's commands and Greek letters (`C-c a', `;', `:') * Online help for the popular LaTeX commands (`C-c ?', `C-c /') * Document files hierarchy browser (`C-c d') * Adding automatically \usepackage corresponding to inputting LaTeX macro with completion * Allow you to forget creating \label{}s, \ref{} or \cite{} completion automatically generate labels. * \includegraphics by Drag&Drop of image file  File: yatexe, Node: Installation, Next: Typesetting, Prev: Main features, Up: Top Installation ************ Put next two expressions into your `~/.emacs'. (setq auto-mode-alist (cons (cons "\\.tex$" 'yatex-mode) auto-mode-alist)) (autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t) Next, add certain path name where you put files of YaTeX to your load-path. If you want to put them in `~/src/emacs', write (setq load-path (cons (expand-file-name "~/src/emacs") load-path)) in your `~/.emacs' Then, yatex-mode will be automatically loaded when you visit a file which has extension `.tex'. If yatex-mode is successfully loaded, mode string on mode line will be turned to "YaTeX".  File: yatexe, Node: Typesetting, Next: %#notation, Prev: Installation, Up: Top Typesetting *********** The prefix key stroke of yatex-mode is `C-c' (Press 'C' with Control key) by default. If you don't intend to change the prefix key stroke, assume all `[prefix]' as `C-c' in this document. These key strokes execute typeset or preview command. `[prefix] t j' ... invoke typesetter `[prefix] t r' ... invoke typesetter on region `[prefix] t e' ... `on-the-fly preview' on current environment or whole portion of current formulas in math-mode `[prefix] t d' ... invoke dvipdfmx after successful typesetting `[prefix] t k' ... kill current typesetting process `[prefix] t b' ... invoke bibtex `[prefix] t i' ... invoke makeindex `[prefix] t d' ... invoke latex && dvipdfmx `[prefix] t p' ... preview `[prefix] t l' ... lpr dvi-file `[prefix] t s' ... search current string on xdvi-remote * Menu: * Calling typesetter:: * Calling previewer:: * Printing out::  File: yatexe, Node: Calling typesetter, Next: Calling previewer, Prev: Typesetting, Up: Typesetting Calling typesetter ================== Typing `[prefix] t j', the current editing window will be divided horizontally when you invoke latex command, and log message of LaTeX typesetting will be displayed in the other window; called typesetting buffer. The typesetting buffer automatically scrolls up and traces LaTeX warnings and error messages. If you see latex stopping by an error, you can send string to latex in the typesetting buffer. If an error stops the LaTeX typesetting, this key stroke will move the cursor to the line where LaTeX error is detected. `[prefix] '' `([prefix]+single quotation)' ... jump to the previous error or warning If you find a noticeable error, move to the typesetting buffer and move the cursor on the line of error message and type `SPACE' key. This makes the cursor move to corresponding source line. YaTeX-typeset-region invoked by `[prefix] tr' call typesetter for region. The region is specified by standard point and mark, or by `%#BEGIN' and `%#END' marks. Selected region will be copied to the temporary file `texput.tex' with the same preamble as the main file of current editing sources. Be sure to put all local macro settings in preamble, not after `\begin{document}'. The method of specification of the region is shown in the section *Note %#notation::. The documentclass for typeset-region is the same as that of editing file if you edit one file, and is the same as main file's if you edit splitting files. The `[prefix] te' key automatically marks current inner environment or inner math mode or paragraph, and then call typeset-region with marked region. This is convenient to quick view of current tabular environment or current editing formulas. If running Emacs has the ability of displaying images, typeset image will be shown in the next window. Further more, if you modify the content within that environment, YaTeX performs `on-the-fly' preview that automatically update preview image as you typed. If your Emacs does not supply on-the-fly preview, keeping previewer window for `texput.dvi' is handy for debugging. Since `[prefix] te' selects the inner-most environment as region, it is not suitable for partial typesetting of doubly or more composed environment. If you want to do partial typesetting for a nested environment, use `[prefix] tr' for static-region, which is described in the section *Note %#notation::.  File: yatexe, Node: Calling previewer, Next: Printing out, Prev: Calling typesetter, Up: Typesetting Calling previewer ================= `[prefix] t p' invokes the TeX previewer. And if you are using xdvi-remote, which can be controled from other terminals, `[prefix] t s' enables you to search current string at the cursor on the running xdvi window.  File: yatexe, Node: Printing out, Prev: Calling previewer, Up: Typesetting Printing out ============ When you type `[preifx] t l', YaTeX asks you the range of dvi-printing by default. You can skip this by invoking it with universal-argument as follows: C-u [prefix] tl  File: yatexe, Node: %#notation, Next: Completion, Prev: Typesetting, Up: Top %# notation *********** You can control the typesetting process by describing `%#' notations in the source text. * Menu: * Changing typesetter:: * Splitting input files:: * Static region for typesetting:: * Special Filtering Region:: * Lpr format:: * Controlling which command to invoke:: * Editing %# notation::  File: yatexe, Node: Changing typesetter, Next: Splitting input files, Prev: %#notation, Up: %#notation To change the `latex' command or to split a source text. ======================================================== To change the typesetting command, write %#!latex-big anywhere in the source text. This is useful for changing typesetter.  File: yatexe, Node: Splitting input files, Next: Static region for typesetting, Prev: Changing typesetter, Up: %#notation Splitting input files ===================== And if you split the source text and edit subfile that should be included from main text. %#!latex main.tex will be helpful to execute latex on main file from sub text buffer. Since this command line after `%#!' will be sent to shell literally, next description makes it convenient to use ghostview as dvi-previewer. %#!latex main && dvi2ps main.dvi > main Note that YaTeX assumes the component before the last period of the last word in this line as base name of the main LaTeX source. The `%f' notation in this line is replaced by main file name, and `%r' replaced by root name of main file name. If you specify `%f' or `%r', YaTeX always ask you the name of main file at the first typesetting. To make best use of the feature of inter-file jumping by `[prefix] g' (see *Note Cursor jump::), take described below into consideration. * You can put split texts in sub directory, but not in sub directory of sub directory. * 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. * In a sub-text, write `%#!latex main.tex' even if `main.tex' is in the parent directory(not %#!latex ../main.tex).  File: yatexe, Node: Static region for typesetting, Next: Lpr format, Prev: Splitting input files, Up: %#notation Static region ============= Typeset-region by `[prefix] tr' passes the region between point and mark to typesetting command by default. But when you want to typeset static region, enclose the region by `%#BEGIN' and `%#END' as follows. %#BEGIN TheRegionYouWantToTypesetManyTimes %#END This is the rule of deciding the region. 1. If there exists %#BEGIN before point, 1. If there exists %#END after %#BEGIN, * From %#BEGIN to %#END. 2. If %#END does not exist after %#BEGIN, * From %#BEGIN to the end of buffer. 2. If there does not exist %#BEGIN before point, * Between point and mark(standard method of Emacs). It is useful to write `%#BEGIN' in the previous line of \begin and `%#END' in the next line of \`end' when you try complex environment such as `tabular' many times. It is also useful to put only `%#BEGIN' alone at the middle of very long text. Do not forget to erase `%#BEGIN' `%#END' pair.  File: yatexe, Node: Special Filtering Region, Next: Lpr format, Prev: Static region for typesetting, Up: %#notation Special Filtering Region ======================== A region like below will be passed to external filter command. %#BEGIN FILTER{foo.pdf}{dot -T %t -o %o} \if0 ....blah blah blah... ....blah blah blah... ....blah blah blah... \fi %#END In this case, typing `[prefix] t e' send three `blah' lines to "dot -T pdf -o foo.pdf" as standard-input. It is useful to have source of text-origin graphic generated by such tools as graphviz or blockdiag, in LaTeX source. This special form of region can be inserted via feeding `.dot' into environment completion by `[prefix] t b'.  File: yatexe, Node: Lpr format, Next: Controlling which command to invoke, Prev: Static region for typesetting, Up: %#notation Lpr format ========== Lpr format is specified by three Lisp variables. Here are the default values of them. `(1)dviprint-command-format' `"dvi2ps %f %t %s | lpr"' `(2)dviprint-from-format' `"-f %b"' `(3)dviprint-to-format' `"-t %e"' On YaTeX-lpr, `%s' in (1) is replaced by the file name of main text, `%f' by contents of (2), %t by contents of (3). At these replacements, `%b' in (2) is also replaced by the number of beginning page, `%e' in (3) is replaced by the number of ending page. But `%f' and `%t' are ignored when you omit the range of print-out by `C-u [prefix] tl'. If you want to change this lpr format temporarily, put a command such as follows somewhere in the text: %#LPR dvi2ps %f %t %s | 4up -page 4 | texfix | lpr -Plp2 And if you want YaTeX not to ask you the range of printing out, the next example may be helpful. %#LPR dvi2ps %s | lpr  File: yatexe, Node: Controlling which command to invoke, Next: Editing %# notation, Prev: Lpr format, Up: %#notation Controlling which command to invoke =================================== These %# notation below can control which command to invoke for LaTeX related process. `%#PREVIEW' ... Command line for DVI viewing ([prefix] t p) `%#MAKEINDEX' ... Command line for makeindex ([prefix] t i) `%#BIBTEX' ... Command line for bibtex ([prefix] t b) `%#DVIPDF' ... Command line for dvipdf(mx) ([prefix] t b) `%#LPR' ... Command line for printing out([prefix] t l) `%#PDFVIEW' ... Command line for PDF viewing `%#IMAGEDPI' ... DPI value for converting to on-the-fly prewview image If you want to invoke "makeidx hogehoge" to update index, put the next line some upper place in the source, for example. %#MAKEINDEX makeidx hogehoge  File: yatexe, Node: Editing %# notation, Prev: Controlling which command to invoke, Up: %#notation Editing %# notation =================== To edit `%#' notation described above, type `[prefix] %' ... editing %# notation menu and select one of the entry of the menu as follows. !)Edit-%#! B)EGIN-END-region L)Edit-%#LPR Type `!' to edit `%#!' entry, `b' to enclose the region with `%#BEGIN' and `%#END', and `l' to edit `%#LPR' entry. When you type `b', all `%#BEGIN' and `%#END' are automatically erased.  File: yatexe, Node: Completion, Next: Local dictionaries, Prev: %#notation, Up: Top Completion ********** YaTeX makes it easy to input the LaTeX commands. There are several kinds of completion type, begin-type, section-type, large-type, etc... * Menu: * Begin-type completion:: * Section-type completion:: * Label Generation:: * Large-type completion:: * Maketitle-type completion:: * Arbitrary completion:: * End completion:: * Accent completion:: * Image completion:: * Greek letters completion:: * Inserting parentheses::  File: yatexe, Node: Begin-type completion, Next: Section-type completion, Prev: Completion, Up: Completion Begin-type completion ===================== "Begin-type completion" completes commands of `\begin{env}' ... `\end{env}'. All of the begin-type completions begin with this key sequence. `[prefix] b' ... start begin-type completion An additional key stroke immediately completes a frequently used LaTeX `\begin{}'...`\`end'{}' environment. `[prefix] b c' ... `\begin{center}...\end{center}' `[prefix] b d' ... `\begin{document}...\end{document}' `[prefix] b D' ... `\begin{description}...\end{description}' `[prefix] b e' ... `\begin{enumerate}...\end{enumerate}' `[prefix] b E' ... `\begin{equation}...\end{equation}' `[prefix] b i' ... `\begin{itemize}...\end{itemize}' `[prefix] b l' ... `\begin{flushleft}...\end{flushleft}' `[prefix] b m' ... `\begin{minipage}...\end{minipage}' `[prefix] b t' ... `\begin{tabbing}...\end{tabbing}' `[prefix] b T' ... `\begin{tabular}...\end{tabular}' `[prefix] b^T' ... `\begin{table}...\end{table}' `[prefix] b p' ... `\begin{picture}...\end{picture}' `[prefix] b q' ... `\begin{quote}...\end{quote}' `[prefix] b Q' ... `\begin{quotation}...\end{quotation}' `[prefix] b r' ... `\begin{flushright}...\end{flushright}' `[prefix] b v' ... `\begin{verbatim}...\end{verbatim}' `[prefix] b V' ... `\begin{verse}...\end{verse}' Any other LaTeX environments are made by completing-read of the Emacs function. `[prefix] b SPACE' ... begin-type completion The next message will show up in the minibuffer Begin environment(default document): by typing `[prefix] b'. Put the wishing environment with completion in the minibuffer, and `\begin{env}'...\`\end{env}' will be inserted in the LaTeX source text. If the environment you want to put does not exist in the YaTeX completion table, it will be registered in the user completion table. YaTeX automatically saves the user completion table in the user dictionary file at exiting of emacs. At the completion of certain environments, the expected initial entry will automatically inserted such as `\item' for `itemize' environment. If you don't want the entry, it can be removed by undoing. If you want to enclose some paragraphs which have already been written into environment, invoke the begin-type completion right after region marking. If you set `transient-mark-mode' to `nil' in your `~/.emacs', typing `C-space' (`set-mark-command') twice turns `transient-mark-mode' on temporarily. Then, type call begin-type completion to enclose text into a environment.  File: yatexe, Node: Section-type completion, Next: Label Generation, Prev: Begin-type completion, Up: Completion Section-type completion ======================= "Section-type completion" completes section-type commands which take an argument or more such as `\section{foo}'. To invoke section-type completion, type `[prefix] s' ... section-type completion then the prompt (C-v for view) \???{} (default documentclass): will show up in the minibuffer. Section-type LaTeX commands are completed by space key, and the default value is selected when you type nothing in the minibuffer. Next, \section{???}: prompts you the argument of section-type LaTeX command. For example, the following inputs \???{} (default documentclass): section \section{???}: Hello world. will insert the string \section{Hello world.} in your LaTeX source. When you neglect argument such as (C-v for view) \???{} (default section): vspace* \vspace*{???}: YaTeX puts \vspace*{} and move the cursor in the braces. In LaTeX command, there are commands which take more than one arguments such as `\addtolength{\topmargin}{8mm}'. To complete these commands, invoke section-type completion with universal argument as, C-u 2 [prefix] s (or ESC 2 [prefix] s) and make answers in minibuffer like this. (C-v for view) \???{} (default vspace*): addtolength \addtolength{???}: \topmargin Argument 2: 8mm `\addtolength' and the first argument `\topmargin' can be typed easily by completing read. Since YaTeX also learns the number of arguments of section-type command and will ask that many arguments in future completion, you had better tell the number of arguments to YaTeX at the first completion of the new word. But you can change the number of arguments by calling the completion with different universal argument again. Invoking section-type completion with `[Prefix] S' (Capital `S') includes the region as the first argument of section-type command. The section/large/maketitle type completion can work at the prompt for the argument of other section-type completion. Nested LaTeX commands are efficiently read with the recursive completion by typing YaTeX's completion key sequence in the minibuffer. * Menu: * view-sectioning::  File: yatexe, Node: view-sectioning, Prev: Section-type completion, Up: Section-type completion view-sectioning --------------- In the minibuffer at the prompt of section-type command completion, typing `C-v' shows a list of sectioning commands in source text(The line with `<<--' mark is the nearest sectioning command). Then, default sectioning command appears in the minibuffer. You can go up/down sectioning command by typing `C-p'/`C-n', can scrolls up/down the listing buffer by `C-v'/`M-v', and can hide sectioning commands under certain level by 0 through 6. Type `?' in the minibuffer of sectioning prompt for more information. You can generate this listing buffer (`*Sectioning Lines*' buffer) by typing `M-x YaTeX-section-overview' ... Generate *Sectioning Lines* buffer from the LaTeX source buffer. In this listing buffer, typing `u' on the sectioning command shifts up the corresponding sectioning command in source text and `d' shifts down. After marking lines in the listing buffer, typing `U' shifts up all sectioning commands in the region, and `U' shifts down. Here are all the key bindings of `*Sectioning Lines*' buffer. `SPC' ... Jump to corresponding source line `.' ... Display corresponding source line `u' ... Shift up a sectioning line `d' ... Shift down a sectioning line `U' ... Shift up sectioning lines in region `D' ... Shift down sectioning lines in region `0...6' ... Hide sectioning commands whose level is lower than n  File: yatexe, Node: Label Generation, Next: Large-type completion, Prev: Section-type completion, Up: Completion Label Generation ================ When you want to type-in references of `\ref' or `\cite', all you have to do is type `[prefix] s ref' without adding labels beforehand. You will see possible LaTeX-counters in the next window even if some counter does not have `\label'. Selecting the counter will automatically set the label to that counter. All possible counter list in the buffer tends to be large. You can reduce the number of list by filtering type of counters by key-commands as follows. `M-a' ... Show all(disable filtering) `M-c' ... Captions only `M-e' ... equations (with counters) only `M-i' ... numbers items only `M-s' ... sections only `M-m' ... other counters only  File: yatexe, Node: Large-type completion, Next: Maketitle-type completion, Prev: Label Generation, Up: Completion Large-type completion ===================== "Large-type completion" inputs the font or size changing descriptions such as `{\large }'. When you type `[prefix] l' ... large-type completion the message in the minibuffer {\??? } (default large): prompts prompts you large-type command with completing-read. There are TeX commands to change fonts or sizes, `it', `huge' and so on, in the completion table. Region-based completion is also invoked by calling completion after region activated.  File: yatexe, Node: Maketitle-type completion, Next: Arbitrary completion, Prev: Large-type completion, Up: Completion Maketitle-type completion ========================= We call it "maketitle-type completion" which completes commands such as `\maketitle'. Take notice that maketitle-type commands take no arguments. Then, typing `[prefix] m' ... maketitle-type completion begins maketitle-completion. Above mentioned method is true for maketitle-completion, and there are LaTeX commands with no arguments in completion table.  File: yatexe, Node: Arbitrary completion, Next: End completion, Prev: Maketitle-type completion, Up: Completion Arbitrary completion ==================== You can complete certain LaTeX command anywhere without typical completing method as described, by typing `[prefix] SPC' ... arbitrary completion after the initial string of LaTeX command that is preceded by `\'.  File: yatexe, Node: End completion, Next: Accent completion, Prev: Arbitrary completion, Up: Completion End completion ============== YaTeX automatically detects the opened environment and close it with \`\end{environment}'. Though proficient YaTeX users never fail to make environment with begin-type completion, some may begin an environment manually. In that case, type `[prefix] e' ... `end' completion at the end of the opened environment.  File: yatexe, Node: Accent completion, Next: Image completion, Prev: End completion, Up: Completion Accent completion ================= When you want to write the European accent marks(like `\`{o}'), `[prefix] a' ... accent completion shows the menu 1:` 2:' 3:^ 4:" 5:~ 6:= 7:. u v H t c d b in the minibuffer. Chose one character or corresponding numeric, and you will see \`{} in the editing buffer with the cursor positioned in braces. Type one more character `o' for example, then \`{o} will be completed, and the cursor gets out from braces.  File: yatexe, Node: Image completion, Next: Greek letters completion, Prev: Accent completion, Up: Completion Image completion of mathematical sign ===================================== Arrow marks, sigma mark and those signs mainly used in the TeX's math environment are completed by key sequences which imitate the corresponding symbols graphically. This completion only works in the math environment. YaTeX automatically detects whether the cursor located in math environment or not, and change the behavior of key strokes `;' and `:'. By the way, we often express the leftarrow mark by `<-' for example. Considering such image, you can write `\leftarrow' by typing `<-' after `;' (semicolon) as a prefix. In the same way, `\longleftarrow' (`<--') is completed by typing `;<--', infinity mark which is imitated by `oo' is completed by typing `;oo'. Here are the sample operations in YaTeX math-mode. INPUT Completed LaTeX commands ; < - `\leftarrow' ; < - - `\longleftarrow' ; < - - > `\longleftrightarrow' ; o `\circ' ; o o `\infty' In any case, you can quit from image completion and can move to the next editing operation if the LaTeX command you want is shown in the buffer. `;' itself in math-environment is inserted by `;;'. Typing `TAB' in the midst of image completion shows all of the LaTeX commands that start with the same name as string you previously typed in. In this menu buffer, press `RET' after moving the cursor (by `n', `p', `b', `f') to insert the LaTeX command. To know all of the completion table, type `TAB' just after `;'. And here is the sample menu by `TAB' after `;<'. KEY LaTeX sequence sign < \leq < ~ << \ll << <- \leftarrow <- <= \Leftarrow <= You can define your favorite key-vs-sequence completion table in the Emacs-Lisp variable `YaTeX-math-sign-alist-private'. See also `yatexmth.el' for the information of the structure of this variable.  File: yatexe, Node: Greek letters completion, Next: Inserting parentheses, Prev: Image completion, Up: Completion Greek letters completion ======================== Math-mode of YaTeX provides another image completion, Greek letters completion in the same method. After prefix `:', typing `a' makes `\alpha', `b' makes `\beta' and `g' makes `\gamma' and so on. First, type `:TAB' to know all the correspondence of alphabets vs. Greek letters. If you will find `;' or `:' doesn't work in correct position of math environment, it may be a bug of YaTeX. Please send me a bug report with the configuration of your text, and avoid it temporarily by typing `;' or `:' after universal-argument(`C-u') which forces `;' and `:' to work as math-prefix.  File: yatexe, Node: Inserting parentheses, Prev: Greek letters completion, Up: Completion Inserting parentheses ===================== Typing opening parenthesis, one of `(', `{ and `['', automatically inserts the closing one. If a opening bracket is typed after `\', `\]' is automatically inserted with computed indentation. If you stop automatic insertion, type `C-q' before opening parenthesis.  File: yatexe, Node: Local dictionaries, Next: Commenting out, Prev: Completion, Up: Top Local dictionaries ****************** Tables for completion consist of three dictionaries; `standard dictionary' built in `yatex.el', `user dictionary' for your common private commands, and `local dictionary' that is effective in a certain directory. When you input the command unknown to YaTeX at a completion in the minibuffer, YaTeX asks you with the following prompt; `foo' is not in table. Register into: U)serDic L)ocalDic N)one D)iscard In this menu, typing `u' updates your `user dictionary', `l' updates your local dictionary, `n' updates only on-memory dictionary which go through only current Emacs session, and `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 `~/.emacs' (setq YaTeX-nervous nil)  File: yatexe, Node: Commenting out, Next: Cursor jump, Prev: Local dictionaries, Up: Top Commenting out ************** You may want to comment out some region. `[prefix] >' ... comment out region by % `[prefix] <' ... uncomment region cause an operation to the region between point and mark. `[prefix] .' ... comment out current paragraph `[prefix] ,' ... uncomment current paragraph comments or uncomments the paragraph where the cursor belongs. This `paragraph' means the region marked by the function mark-paragraph, bound to `ESC h' by default. It is NOT predictable what will happen when you continuously comment out some paragraph many times. You can also comment out an environment between `\begin' and `\end', or a `\begin'-\`\end' pair themselves, by making the following key strokes on the line where `\begin{}' or `\end{}' exists. `[prefix] >' ... comment out from \begin to \`end' `[prefix] <' ... uncomment from \begin to \`end' comment whole the contents of environment. Moreover, `[prefix] .' ... comment out \begin and \`end' `[prefix] ,' ... uncomment \begin and \`end' (un)comments out only environment declaration: `\begin{}' and `\end{}'. NOTE that even if you intend to comment out some region, invoking `[prefix] >' on the `\begin',`\end' line decides to work in `commenting out from `\begin' to `\end'' mode.  File: yatexe, Node: Cursor jump, Next: Changing and Deleting, Prev: Commenting out, Up: Top Cursor jump *********** * Menu: * Jump to corresponding object:: * Invoking image processor:: * Jump to main file:: * Jumping around the environment:: * Jumping to last completion position::  File: yatexe, Node: Jump to corresponding object, Next: Invoking image processor, Prev: Cursor jump, Up: Cursor jump Jump to corresponding object ============================ Typing `[prefix] g' ... go to corresponding object in a certain place move the cursor to the place corresponding to the LaTeX command of last place. YaTeX recognize the followings as pairs that have relation each other. * `\begin{}' <-> `\end{}' * `%#BEGIN' <-> `%#END' * On the image-including line -> corresponding viewer or drawing tool * `\label{}' <-> `\ref{}' * `\include(\input)' -> included file * `\bibitem{}' <-> `\cite{}' On a `\begin',`\end' line, typing `[prefix] g' moves the cursor to the corresponding `\end',`\begin' line, if its partner really exists. The behavior on the line `%#BEGIN' and `%#END' are the same. Note that if the correspondent of `label/ref' or `cite/bibitem' exists in another file, that file have to be opened to make a round trip between references by `[prefix] g'. If you type `[prefix] g' on the line of `\include{chap1}', typically in the main text, YaTeX switches buffer to `chap1.tex'. `[prefix] 4 g' ... go to corresponding object in other window do the same job as `[prefix] g' except it's done in other window. Note that this function doesn't work on `begin/end', `%#BEGIN/%#END' pairs because it is meaningless.  File: yatexe, Node: Invoking image processor, Next: Jump to main file, Prev: Jump to corresponding object, Up: Cursor jump Invoking image processor ======================== `image-including line' described above means such lines as `\epsfile{file=foo.ps}'. If you type `[prefix] g' on that line, YaTeX automatically searches source of `foo.ps' and invokes image viewer or drawing tool correspoinding to it. For example; if you draw an image foo.obj with Tgif and enclose its product named foo.eps by `\epsfile' command. Typing `[prefix] g' on `\epsfile' line make YaTeX invoke `tgif foo.obj'. How a processor is choosen is as follows. 1. If there is an expression matching with one of the pattern defined in `YaTeX-processed-file-regexp-alist', extract file name from regexp group surrounded by \\(\\). (Which group corresponds is written in the cdr part of each list.) If no matches were found, do nothing. 2. If there is a pattern as `%PROCESSOR' which is defined in the variable `YaTeX-file-processor-alist', call that processor giving the file name with corresponding extension. 3. If not, check the existence of each file which is supplied the extension in the cdr part of each list of `YaTeX-file-processor-alist'. If any, call the corresponding image viewer or drawing tool.  File: yatexe, Node: Jump to main file, Next: Jumping around the environment, Prev: Invoking image processor, Up: Cursor jump Jump to main file ================= Typing `[prefix] ^' ... visit main file `[prefix] 4^' ... visit main file in other buffer in a sub text switch the buffer to the main text specified by `%#!' notation.  File: yatexe, Node: Jumping around the environment, Next: Jumping to last completion position, Prev: Jump to main file, Up: Cursor jump Jumping around the environment ============================== And these are the functions which work on the current LaTeX environment: `M-C-a' ... beginning of environment `M-C-e' ... `end' of environment `M-C-@' ... mark environment  File: yatexe, Node: Jumping to last completion position, Prev: Jumping around the environment, Up: Cursor jump Jumping to last completion position =================================== YaTeX always memorize the position of completion into register `3'. So every time you make a trip to any other part of text other than you are writing, you can return to the editing paragraph by calling register-to-point with argument YaTeX-current-position-register, which is achieved by typing `C-x j 3'(by default).  File: yatexe, Node: Changing and Deleting, Next: Filling, Prev: Cursor jump, Up: Top Changing and Deleting ********************* These functions are for change or deletion of LaTeX commands already entered. `[prefix] c' ... change LaTeX command `[prefix] k' ... kill LaTeX command * Menu: * Changing LaTeX commands:: * Killing LaTeX commands::  File: yatexe, Node: Changing LaTeX commands, Next: Killing LaTeX commands, Prev: Changing and Deleting, Up: Changing and Deleting Changing LaTeX commands ======================= `[prefix] c' can change the various (La)TeX commands. This can change the followings. * Environment names * Section-type commands * Argument of section-type commands * Optional parameters (enclosed by []) of section-type commands * Font/size designators * Math-mode's maketitle-type commands that can be inputted with image completion Typing `[prefix] c' on one of above objects you want to change brings a suitable reading function sometimes with completion. Note: If you want to change the argument of section-type command that contains other LaTeX commands, type `[prefix] c' either of surrounding braces of the argument in order to make YaTeX ignore the internal LaTeX sequences as an object of changing. Anyway, it is very difficult to know which argument position the cursor belongs because the LaTeX commands can be nested and braces can freely emerge. So keep it mind to put the cursor on a brace when you are thinking of changing a complicated argument.  File: yatexe, Node: Killing LaTeX commands, Prev: Changing LaTeX commands, Up: Changing and Deleting Killing LaTeX commands ====================== `[prefix] k' kills the LaTeX commands sometimes with their arguments. Following table illustrates the correspondence of the invoking position and what is killed. [Invoking position] [action] \begin, \end line kill \begin,\end pairs %#BEGIN, %#END line kill %#BEGIN,%#END pairs on a Section-type command kill section-type command on a parenthesis kill parentheses Note that when killing `\begin, \end' or `%#BEGIN, %#END' pair, the lines `\begin, \end' or `%#BEGIN, %#END' exist will be killed entirely. So take care not to create any line that contains more than one `\begin' or so. While all operations above are to kill `containers' which surround some text, universal argument (`C-u') for these commands kills not only `containers' but also `contents' of them. See below as a sample. Original text: [prefix] k C-u [prefix] k Main \footnote{note} here. Main note here. Main here. ~(cursor)  File: yatexe, Node: Filling, Next: Updation of includeonly, Prev: Changing and Deleting, Up: Top Filling ******* Filling an item =============== To fill a term (descriptive sentences) of `\item', type `M-q' ... fill item on that item. YaTeX uses the value of the variable `YaTeX-item-regexp' as the regular expression to search item header in itemize environment. If you make a newcommand to itemize terms(e.g. `\underlineitem'), put (setq YaTeX-item-regexp "\\(\\\\\\(sub\\)*item\\)\\|\\(\\\\underlineitem\\)") in your `~/.emacs'. If you are not familiar with regular expression for Emacs-Lisp, name a newcommand for `itemize' beginning with `\item' such as `\itembf', not `\bfitem'. This function reformats the `\item' into `hang-indented' style. For example: itemize, enumerate environment: > >\item[foo] `foo' is the typical word for describing an > arbitrarily written.... description environment: > \item[bar] When the word `for' is used as an arbitrarily > word, `bar' is bound to follow it. Note that the indent depth of an `\item' word 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). Filling paragraph ================= Fill-paragraph is little bit adapted for LaTeX sources. It retains from filling in certain environments where formatting leads to a disaster such as verbatim, tabular, or so. And it protects `\verb' expressions from being folded (The variable `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.  File: yatexe, Node: Updation of includeonly, Next: What column, Prev: Filling, Up: Top Updation of `\includeonly' ************************** When you edit splitting source texts, the notation \includeonly{CurrentEditingFileName} in the main file reduces the time of typesetting. If you want to hack other file a little however, you have to rewrite it to \includeonly{OtherFileNameYouWantToFix} in the main file. YaTeX automatically detects that the current edited text is not in includeonly list and prompts you A)dd R)eplace %)comment? in the minibuffer. Type `a' if you want to add the current file name to `\includeonly' list, `r' to replace \`includeonly' list with the current file, and type `%' to comment out the `\includeonly' line.  File: yatexe, Node: What column, Next: Intelligent newline, Prev: Updation of includeonly, Up: Top What column? ************ We are often get tired of finding the corresponding column in large tabulars. For example, \begin{tabular}{|c|c|c|c|c|c|c|c|}\hline Name&Position&Post No.&Addr.&Phone No.&FAX No.& Home Addr.&Home Phone\\ \hline Thunder Bird & 6 & 223 & LA & xxx-yyy & zzz-www & Japan & 9876-54321 \\ & 2 & \multicolumn{2}{c|}{Unknown} &&&(???) \\ \hline \end{tabular} Suppose you have the cursor located at `(???)' mark, can you tell which column it is belonging at once? Maybe no. In such case, type `[prefix] &' ... What column in that position. YaTeX tells you the column header of the current field. Since YaTeX assumes the first line of tabular environment as a row of column headers, you can create a row of virtual column headers by putting them in the first line and commenting that line with `%'.  File: yatexe, Node: Intelligent newline, Next: Usepackage checker, Prev: What column, Up: Top Intelligent newline ******************* At the end of begin-type completion of tabular[*], array, itemize, enumerate or tabbing environment, or typing `ESC RET' ... Intelligent newline in these environments inserts the contents corresponding to the current environment in the next line. (At the begin-type completion, this contents can be removed by `undo'.) In `tabular' environment, for example, `ESC RET' inserts the certain number of `&' and trailing `\\', and `\hline' if other `\hline' is found in backward. Here are the list of contents vs. environments. * `tabular', `tabular*', `array' Corresponding number of `&' and `\\'. And `\hline' if needed. * `tabbing' The same number of `\>' as `\=' in the first line. * `itemize', `enumerate', `description', `list' `\item' or `item[]'. Note that since this function works seeing the contents of the first line, please call this after the second line if possible. If you want to apply these trick to other environments, `foo' environment for example, define the function named `YaTeX-intelligent-newline-foo' to insert corresponding contents. That function will be called at the beginning of the next line after the newline is inserted to the current line. Since the function `YaTeX-indent-line' is designed to indent the current line properly, calling this function before your code to insert certain contents must be useful. See the definition of the function `YaTeX-intelligent-newline-itemize' as an example.  File: yatexe, Node: Usepackage checker, Next: Online help, Prev: Intelligent newline, Up: Top Usepackage checker ****************** When you input begint-type, section-type, maketitle-type macros with completion, and it requires some LaTeX2e package, YaTeX examines the existence of correct `\usepackage'. If not, YaTeX inserts the `\usepackage{}' declaration corresponding to input macro. To activate the package completion for your favarite package, set the variable `YaTeX-package-alist-private' correctly. Please refere the value of `YaTeX-package-alist-default' as an example.  File: yatexe, Node: Online help, Next: Browsing file hierarchy, Prev: Usepackage checker, Up: Top Online help *********** YaTeX provides you the online help with popular LaTeX commands. Here are the key strokes for the online help. `[prefix] ?' ... Online help `[prefix] /' ... Online apropos Online help =========== `Online help' shows the documentation for the popular LaTeX commands(defaults to the commands on the cursor) in the next buffer. There are two help file, `global help' and `private help'. The former file contains the descriptions on the standard LaTeX command and is specified its name by variable `YaTeX-help-file'. Usually, the global help file should be located in public space (`$EMACSEXECPATH' by default) and should be world writable so that anyone can update it to enrich its contents. The latter file contains descriptions on non-standard or personal command definitions and is specified by `YaTeX-help-file-private'. This file should be put into private directory. Online apropos ============== `Online apropos' is an equivalent of GNU Emacs's apropos. It shows all the documentations that contains the keyword entered by the user. When no descriptions are found... ================================= If there is no description on a command in help files, YaTeX requires you to write a description on that command. If you are willing to do, determine which help file to add and write the description on it referring your manual of (La)TeX. Please send me your additional descriptions if you describe the help on some standard commands. I might want to include it in the next distribution.  File: yatexe, Node: Browsing file hierarchy, Next: Cooperation with other packages, Prev: Online help, Up: Top Browsing file hierarchy *********************** When you are editing multi-file source, typing `[prefix] d' ... browse file hierarchy asks you the parent-most file (which may be defaulted) and displays the documentation hierarchy in the next window. In this buffer, the following commands are available. `n' ... move to the next line and show its contents `p' ... move to the previous line and show its contents `N' ... move to the next file in the same inclusion level `P' ... move to the previous file in the same inclusion level `j' ... move to the next line `k' ... move to the previous line `u' ... move to the parent file `.' ... show the current files contents in the next window `SPC' ... scroll up the current file window `DEL, b' ... scroll down the current file window `<' ... show the beginning of the current file `>' ... show the end of the current file `>' ... return to the previous postion after `<' or `>' `RET, g' ... open the current file in the next window `mouse-2' ... same as RET(available only with window system) `o' ... other window `1' ... delete other windows `-' ... shrink hierarchy buffer window `+' ... enlarge hierarchy buffer window `?' ... describe mode `q' ... quit Note that operations on the file contents in the next window do not work correctly when you close the corresponding file.  File: yatexe, Node: Cooperation with other packages, Next: Customizations, Prev: Browsing file hierarchy, Up: Top Cooperation with other packages ******************************* YaTeX works better with other brilliant packages. gmhist ====== When you are loading `gmhist.el' and `gmhist-mh.el', you can use independent command history list at the prompt of preview command (`[prefix] tp') and print command (`[prefix] tl'). On each prompt, you can enter the previous command line string repeatedly by typing `M-p'. min-out ======= `min-out', the outline minor mode, can be used in yatex-mode buffers. If you want to use it with YaTeX, please refer the file `yatexm-o.el' as an example.  File: yatexe, Node: Customizations, Next: Etcetera, Prev: Cooperation with other packages, Up: Top Customizations ************** You can customize YaTeX by setting Emacs-Lisp variables and by making add-in functions. * Menu: * Lisp variables:: * Add-in functions:: * Add-in generator::  File: yatexe, Node: Lisp variables, Next: Add-in functions, Prev: Customizations, Up: Customizations Lisp variables ============== You can change the key assignments or make completion more comfortable by setting the values of various variables which control the movement of yatex-mode. For example, if you want to change the prefix key stroke from `C-c' to any other sequence, set YaTeX-prefix to whatever you want to use. If you don't want to use the key sequence `C-c letter' which is assumed to be the user reserved sequence in Emacs world, set `YaTeX-inhibit-prefix-letter' to `t', and all of the default key bind of `C-c letter' will turn to the corresponding `C-c C-letter' (but the region based completions that is invoked with `C-c Capital-letter' remain valid, if you want to disable those bindings, set that variable to 1 instead of `t'). * Menu: * All customizable variables:: * Sample definitions:: * Hook variables:: * Hook file::  File: yatexe, Node: All customizable variables, Next: Sample definitions, Prev: Lisp variables, Up: Lisp variables All customizable variables -------------------------- Here are the customizable variables of yatex-mode. Each value setq-ed in `~/.emacs' is preferred and that of defined in `yatex.el' is neglected. Parenthesized contents stands for the default value. When you are to change some of these variables, see more detailed documentation of the variable by `M-x describe-variable'. -- Variable: YaTeX-japan Set this nil to produce all messages in English (`Depends on Japanese feature of Emacs') -- Variable: YaTeX-kanji-code Default buffer-file-coding-system for YaTeX modes' buffer. Set this 0 to no language conversion. Nil to preserve original coding-system. 1=Shift JIS, 2=JIS, 3=EUC, 4=UTF-8 (`1 or 2') -- Variable: YaTeX-prefix Prefix key stroke (`C-c') -- Variable: YaTeX-inhibit-prefix-letter Change key stroke from `C-c letter' to `C-c C-letter' (`nil') -- Variable: YaTeX-fill-prefix Fill-prefix used in yatex-mode (`nil') -- Variable: YaTeX-user-completion-table Name of user dictionary where learned completion table will be stored. (`"~/.yatexrc"') -- Variable: tex-command LaTeX typesetter command (`"latex"') -- Variable: dvi2-command Preview command (`"xdvi -geo +0+0 -s 4"') -- Variable: dviprint-command-format Command format to print dvi file (`"dvi2ps %f %t %s | lpr"') -- Variable: dviprint-from-format Start page format of above %f. %b will turn to start page (`"-f %b"') -- Variable: dviprint-to-format End page format of above %t. %e will turn to `end' page (`"-t %e"') -- Variable: makeindex-command Default makeindex command (`"makeindex"' (`"makeind"' on MS-DOS)) -- Variable: YaTeX-dvipdf-command Default command name to convert .dvi to PDF (`"dvipdfmx"') -- Variable: YaTeX-on-the-fly-preview-interval Interval time in seconds of idle to trigger on-the-fly preview of environment by `[prefix] t e'(0.9). `Nil' disables on-the-fly preview. -- Variable: YaTeX-on-the-fly-math-preview-engine Function symbol to use on-the-fly preview of MATH environment started by `[prefix] t e' (`'YaTeX-typeset-environment-by-lmp' which calls latex-math-preview-expression function if latex-math-preview is available, otherwise `'YaTeX-typeset-environment-by-builtin' which alls built-in function). `Nil' disables on-the-fly preview. -- Variable: YaTeX-cmd-gimp Command name of GIMP (code{"gimp"}) -- Variable: YaTeX-cmd-tgif Command name of tgif (code{"tgif"}) -- Variable: YaTeX-cmd-inkscape Command name of Inkscape (code{"inkscape"}) -- Variable: YaTeX-cmd-dia Command name of Dia (code{"dia"}) -- Variable: YaTeX-cmd-ooo Command name of OpenOffice.org/LibreOffice (code{"soffice"}) -- Variable: YaTeX-cmd-gs Command name of Ghostscript (code{"gs"}) -- Variable: YaTeX-cmd-dvips Command name of dvips (code{"dvips"}) -- Variable: YaTeX-cmd-displayline Command name of displayline (code{"/Applications/Skim.app/Contents/SharedSupport/displayline"}) -- Variable: YaTeX-cmd-edit-ps Command name for editing PostScript files(Value of code{"YaTeX-cmd-gimp"}) -- Variable: YaTeX-cmd-edit-pdf Command name for editing PDF files(Value of code{"YaTeX-cmd-ooo"}) -- Variable: YaTeX-cmd-edit-ai Command name for editing `.ai' files(Value of code{"YaTeX-cmd-inkscape"}) -- Variable: YaTeX-cmd-edit-svg Command name for editing SVG files(Value of code{"YaTeX-cmd-inkscape"}) -- Variable: YaTeX-cmd-edit-images Command name for editing image files(Value of code{"YaTeX-cmd-gimp"}) -- Variable: YaTeX-need-nonstop Put `\nonstopmode{}' or not (`nil') -- Variable: latex-warning-regexp Regular expression of warning message latex command puts out (`"line.* [0-9]*"') -- Variable: latex-error-regexp Regular expression of error message (`"l\\.[1-9][0-9]*"') -- Variable: latex-dos-emergency-message Message latex command running on DOS puts at abort (`"Emergency stop"') -- Variable: YaTeX-item-regexp Regular expression of item command (`"\\\\item"') -- Variable: YaTeX-verb-regexp Regexp of verb family. Omit \\\\. (`"verb\\*?\\|path"') -- Variable: YaTeX-nervous T for using local dictionary (`t') -- Variable: YaTeX-sectioning-regexp Regexp of LaTeX sectioning command (`"\\(part\\|chapter\\*?\\|\\(sub\\)*\\(section\\|paragraph\\)\\*?\\)\\b"') -- Variable: YaTeX-fill-inhibit-environments Inhibit fill in these environments (`'("tabular" "tabular*" "array" "picture" "eqnarray" "eqnarray*" "equation" "math" "displaymath" "verbatim" "verbatim*")') -- Variable: YaTeX-uncomment-once T for deleting all preceding `%' (`nil') -- Variable: YaTeX-close-paren-always T for always close all parenthesis automatically, `nil' for only eol (`t') -- Variable: YaTeX-auto-math-mode Switch math-mode automatically (`t') -- Variable: YaTeX-math-key-list-private User defined alist, math-mode-prefix vs completion alist used in image completion (`nil'). See `yatexmth.el' for the information about how to define a completion alist. -- Variable: YaTeX-default-pop-window-height Initial height of typesetting buffer when one-window. Number for the lines of the buffer, numerical string for the percentage of the screen-height. `nil' for half height (10) -- Variable: YaTeX-help-file Global online help file name (`$doc-directory/../../site-lisp/YATEXHLP.eng') -- Variable: YaTeX-help-file-private Private online help file name (`"~/YATEXHLP.eng"') -- Variable: YaTeX-no-begend-shortcut Disable [prefix] b ?? shortcut (`nil)' -- Variable: YaTeX-hilit-pattern-adjustment-private List of the list that contain the regular expression and the symbol of logical meaning of the string that matches the pattern. See also the value from `(assq 'yatex-mode hilit-patterns-alist)' and the value of `YaTeX-hilit-pattern-adjustment-default' (and even the document of hilit19.el). -- Variable: YaTeX-sectioning-level Alist of LaTeX's sectioning command vs its height. -- Variable: YaTeX-hierarchy-ignore-heading-regexp `YaTeX-display-hierarchy' searches for sectioning command first, and comment line secondary as a file headings. In latter case, ignore lines that match with regular expression of this variable. Default value of this variable is RCS header expressions and mode specifying line `-*- xxxx -*'. -- Variable: YaTeX-skip-default-reader Non-nil for this variable skips the default argument reader of section-type command when add-in function for it is not defined (`nil') -- Variable: YaTeX-create-file-prefix-g When typing `prefix g' on the `\include' line, open the target file even if the file doesn't exist (`nil') -- Variable: YaTeX-simple-messages Simplyfy messages of various completions (`nil') -- Variable: YaTeX-hilit-sectioning-face When hilit19 and yatex19 is active, YaTeX colors the sectioning commands. This variable specifies the foreground and background color of `\part' macro. The default value is `'(yellow/dodgerblue yellow/slateblue)'. The first element of this list is for the screen when `hilit-background-mode' is `'light', and the second element is for `'dark'. You should specify both color as `forecolor/backcolor'. -- Variable: YaTeX-hilit-sectioning-attenuation-rate When color mode, this variable specifies how much attenuate the color density of `\subparagraph' compared with that of `\chapter' (`'(15 40)') See also `YaTeX-hilit-sectioning-face'. -- Variable: YaTeX-use-AMS-LaTeX If you use AMS-LaTeX, set to `t' (`nil') -- Variable: YaTeX-use-LaTeX2e If you use LaTeX2e, set to `t' (`t') -- Variable: YaTeX-template-file File name which is automatically inserted at creation (`~/work/template.tex') -- Variable: YaTeX-search-file-from-top-directory Non-nil means to search input-files from the directory where main file exists (`t') -- Variable: YaTeX-use-font-lock Use font-lock to fontify buffer or not (`(featurep 'font-lock)' -- Variable: YaTeX-use-hilit19 Use hilit19 to highlight buffer or not (`(featurep 'hilit19)' -- Variable: YaTeX-use-italic-bold YaTeX tries to search italic, bold fontsets or not (`t' if Emacs-20 or later). This variable is effective only when font-lock is used. (`(featurep 'hilit19)' -- Variable: YaTeX-singlecmd-suffix Suffix which is always inserted after maketitle-type macros. `"{}"' is recommended. -- Variable: YaTeX-package-alist-private Alist of LaTeX2e-package name vs. lists of macros in it. Set this alist properly and YaTeX automatically check the declaratiion of `usepackage' for corresponding macro, when you input that macro with completion. If required `usepackage' is not found, YaTeX also automatically inserts `\usepackage'. Alist is as follows; '((PackageName1 (completionType ListOfMacro) (completionType ListOfMacro)) (PackageName2 (completionType ListOfMacro) (completionType ListOfMacro...))....) completionType is one of `env, section, maketitle'. Consult the value of `YaTeX-package-alist-default' as an example. -- Variable: YaTeX-tabular-indentation At indentation by `C-i' in tabular or array environment, YaTeX put the additional spaces to the normail indentation depth. The number of additional spaces is the product of YaTeX-tabular-indentation and the number of column position in tabular. -- Variable: YaTeX-noindent-env-regexp Regexp of environment names that should begin with no indentation. All verbatime-like environment name should match with. -- Variable: YaTeX-electric-indent-mode Emacs 24.4 introduces automatic indentation of current and new lines. This might be annoying for some people. Pass this value to the function 'electric-indent-local-mode. If you prefer to stop electric-indent-mode in yatex-mode, set `-1' to this variable. -- Variable: YaTeX-ref-default-label-string Default \\ref time string format. This format is like strftime(3) but allowed conversion char are as follows; %y -> Last 2 digit of year, %b -> Month name, %m -> Monthe number(1-12), %d -> Day, %H -> Hour, %M -> Minute, %S -> Second, %qx -> alphabetical-decimal conversion of yymmdd. %qX -> alphabetical-decimal conversion of HHMMSS. Beware defualt label-string should be always unique. So this format string should have both time part (%H+%M+%S or %qX) and date part (%y+(%b|%m)+%d or %qx). -- Variable: YaTeX-ref-generate-label-function Function to generate default label string for unnamed \\label{}s. The function pointed to this value should take two arguments. First argument is LaTeX macro's name, second is macro's argument. Here is an example for using this value. (setq YaTeX-ref-generate-label-function 'my-yatex-generate-label) (defun my-yatex-generate-label (command value) (and (string= command "caption") (re-search-backward "\\\\begin{\\(figure\\|table\\)}" nil t) (setq command (match-string 1))) (let ((alist '(("chapter" . "chap") ("section" . "sec") ("subsection" . "subsec") ("figure" . "fig") ("table" . "tbl")))) (if (setq command (cdr (assoc command alist))) (concat command ":" value) (YaTeX::ref-generate-label nil nil))))  File: yatexe, Node: Sample definitions, Next: Hook variables, Prev: All customizable variables, Up: Lisp variables Sample definitions ------------------ For instance, to change the prefix key stroke to `ESC', and name of the user dictionary `~/src/emacs/yatexrc', and set `fill-prefix' to single TAB character, add the following `setq' to `~/.emacs'. (setq YaTeX-prefix "\e" YaTeX-user-completion-table "~/src/emacs/yatexrc" YaTeX-fill-prefix " ")  File: yatexe, Node: Hook variables, Next: Hook file, Prev: Sample definitions, Up: Lisp variables Hook variables -------------- More customizations will be done by the hook-function defined in hook-variable `yatex-mode-hook'. This is useful to define a shortcut key sequence to enter some environments other than `document' and `enumerate' etc. The following statement defines `[prefix] ba' to enter `\begin{abstract}' ... `=end{abstract}' immediately. (setq yatex-mode-hook '(lambda() (YaTeX-define-begend-key "ba" "abstract"))) You should use functions `YaTeX-define-key', or `YaTeX-define-begend-key' to define all the key sequences of yatex-mode.  File: yatexe, Node: Hook file, Prev: Hook variables, Up: Lisp variables Hook file --------- You can stuff all of YaTeX related expressions into a file named `yatexhks.el' if you have a lot of codes. YaTeX automatically load this file at the initialization of itself. Using `yatexhks.el' makes `yatex-mode-load-hook' unnecessary.  File: yatexe, Node: Add-in functions, Next: Add-in generator, Prev: Lisp variables, Up: Customizations Add-in functions ================ You can easily define a function to input detailed arguments with completion according to LaTeX environments or commands. What is add-in functions? ------------------------- When you input `tabular' environment, don't you think "I want YaTeX to complete its argument toward my favorite one such as `{|c|c|c|}'..."? Yes, you can define the function to complete arguments for any environment and any LaTeX commands. Procedure --------- Here is the procedure to define add-in functions. 1. Define the function 2. Put the function into `yatexhks.el' * Menu: * How the add-in function works:: * How the function is called:: * Useful functions for creating add-in:: * Contribution::  File: yatexe, Node: How the add-in function works, Next: How the function is called, Prev: Add-in functions, Up: Add-in functions How the add-in function works ----------------------------- There are three types of add-in. 1. Option add-in 2. argument add-in 3. enclosing add-in "Option add-in" returns the LaTeX's optional parameters such as optional strings after `\begin{ENV}', optional strings between a section-type command and its first argument, and optional strings just after type maketitle-type command. The following illustrates the name of add-in functions, where underlined strings are generated by add-in functions. \begin{table}[ht] (Function name: YaTeX:table) ~~~~ \put(100,200){} (Function name: YaTeX:put) ~~~~~~~~~ \sum_{i=0}^{n} (Function name: YaTeX:sum) ~~~~~~~~~~ Obviously, the function name is decided by concatenating the prefix `YaTeX:' and LaTeX command's name. Another add-in type is "argument add-in", which completes arguments for section-type commands. \newcommand{\foo}{bar} (Function name: YaTeX::newcommand) ~~~~ ~~~ When the section-type command is inputted, the function named by 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 referring the value of its argument. "enclosing add-in" is for modifying and/or checking the region that will be enclosed by section-type commands via `[prefix] S'. An enclosing add-in function will be called with two arguments, beginning of the enclosed region and end of the region. Suppose you want to enclose the existing text `(a+b)/c' by `\frac{}'. a/c | | A B You do set-mark-command at point A and then move to point B. Typing `[prefix] S' and input `frac' enclose the region like this; \frac{a/c} Normally, the expression `a/c' is translated to `\frac{a}{c}'. An enclosing add-in is useful for modifying `/' to `}{'. * Menu: * Defining option-add-in:: * Defining argument-add-in:: * Defining enclosing-add-in::  File: yatexe, Node: Defining option-add-in, Next: Defining argument-add-in, Prev: How the add-in function works, Up: How the add-in function works Defining `option add-in' ........................ If you want `{|c|c|c|}' for all `tabular' environment, (defun YaTeX:tabular () "{|c|c|c|}") is enough. If you want more complicated format, define as below. (defun YaTeX:tabular () "{@{\\vrule width 1pt\\ }|||@{\\ \\vrule width 1pt}}") Note that the character `\' must be described as `\\' in Emacs-Lisp. The next example reads the tabular format from keyboard. (defun YaTeX:tabular () (concat "{" (read-string "Rule: ") "}"))  File: yatexe, Node: Defining argument-add-in, Next: Defining enclosing-add-in, Prev: Defining option-add-in, Up: How the add-in function works Defining `argument add-in' .......................... This section describes how to define the add-in function for `\newcommand'. The first argument of `\newcommand' begins always with `\'. The second argument is usually so complex that we can not edit them in the minibuffer. Here is the created function considering this. (defun YaTeX::newcommand (n) ;n is argument position (cond ((= n 1) ;1st argument is macro name (read-string "Command: " "\\")) ;initial input `\' ((= n 2) "") ;do nothing when reading arg#2 (t nil))) Note that when the `argument add-in' function return `nil', normal argument reader will be called.  File: yatexe, Node: Defining enclosing-add-in, Prev: Defining argument-add-in, Up: How the add-in function works Defining `enclosing add-in' ........................... This section describes how to define the add-in function for text enclosed by `\frac{}'. When enclosing the text `5/3' by `\frac{}', you might want to replace `/' with `}{'. Enclosing function `YaTeX::frac-region' is called with two arguments, beginning of enclosed text and end of enclosed text. The function is expected to replace `/' with `}{'. Here is an example expression. (defun YaTeX::frac-region (beg end) (catch 'done (while (search-forward "/" end t) (goto-char (match-beginning 0)) (if (y-or-n-p "Replace this slash(/) with `}{'") (throw 'done (replace-match "}{"))) (goto-char (match-end 0)))))  File: yatexe, Node: How the function is called, Next: Useful functions for creating add-in, Prev: How the add-in function works, Up: Add-in functions How the function is called -------------------------- YaTeX calls the add-in functions for specified begin-type, section-type, and maketitle-type command, if any. `Option add-in' functions for begin-type are called when `\begin{ENV}' has been inserted, functions for section-type are called just before input of the first argument, and functions for maketitle-type is called after maketitle-type command has been inserted. `Argument add-in' functions are called at each entry of arguments for section-type commands.  File: yatexe, Node: Useful functions for creating add-in, Next: Contribution, Prev: How the function is called, Up: Add-in functions Useful functions for creating add-in ------------------------------------ Many add-in functions for typical LaTeX commands are defined in `yatexadd.el'. Those are also useful as references. Here are the short descriptions on useful functions, where [F] means function, [A] means arguments, [D] means description. `[F]' YaTeX:read-position `[A]' Character list which can show up in the brackets `[D]' Return the location specifier such as `[htb]'. When nothing is entered, omit [] itself. If the possible characters are "htbp", call this function as `(YaTeX:read-position "htbp")' `[F]' YaTeX:read-coordinates `[A]' Base prompt, X-axis prompt, Y-axis prompt (each optional) `[D]' Read the coordinates with the prompt "BasePrompt X-axisPrompt:" for X-axis, "BasePrompt Y-axisPrompt:" for Y-axis, and return it in the form of "(X,Y)". The default prompts are `Dimension', `X', `Y' respectively. `[F]' YaTeX:check-completion-type `[A]' One of the symbols: 'begin, 'section, or 'maketitle `[D]' Check the current completion type is specified one and cause error if not. The variable `YaTeX-current-completion-type' holds the symbol according to the current completion type.  File: yatexe, Node: Contribution, Prev: Useful functions for creating add-in, Up: Add-in functions Contribution ------------ If you make your own pretty function and you let it be in public, please send me the function. I'm going to include it in the next release.  File: yatexe, Node: Add-in generator, Prev: Add-in functions, Up: Customizations Add-in generator ================ First, don't forget to read the section of add-in functions *Note Add-in functions::. If you easily understand how to define them, there's no need to read this section. But being not familiar with Emacs-Lisp, when you don't have clear idea what to do, this section describes how to get YaTeX make add-in function. There are two methods of generation. One is for fully interactive generator for beginners and another requires little knowledge of Emacs-Lisp. Generator for beginners ----------------------- The former generator is called by `M-x YaTeX-generate' strokes. All you have to do is follow the guidances. Defying them may cases the disaster (I wonder what is it???). So when you make some mistake, it is recommendable to type `C-g' and start afresh. Simple generator ---------------- The latter generator is invoked by the next sequence. `M-x YaTeX-generate-simple' This generator can make both "option add-in" and "argument add-in" (*refer the section add-in functions* *Note How the add-in function works::), whereas `YaTeX-generate' cannot make "argument addin". For example, assume you have the LaTeX command as follows. \epsinput[t](250,50){hoge.eps}{plain}{Picture of foo} (A) (B) (1) (2) (3) (A)Optional parameter to specify the position One of t(top), b(bottom), l(left), r(right) (B)Maximum size of frame (1)1st argument is filename of EPS file (2)2nd argument indicates plain do nothing frame make frame around image dframe make double-frame around image for included EPS file. (3)Caption for the picture Now get start with generation. Typing `M-x YaTeX-generate-simple' brings the prompt: (O)ption? (A)rgument? Generating "option add-in" .......................... Since (A), (B) above are optional argument, all we have to do to complete them is define the option add-in for them. Let's generate the function to complete (A). M-x YaTeX-generate-simple RET epsinput RET o Typing as above leads the next prompt. Read type(1): (S)tring (C)omplete (F)ile ([)option (P)osition co(O)rd. (q)uit This asks that "Which type is the completion style of 1st argument?". Here are the possible completion style. `String' read plain string `Complete' read with completion `File' read file name `Option' read optional string (if string omitted, omit [] too) `Position' read positional option (like [htbp]) `Coord.' read coordinates `Quit' quit from generating Since (A) is the optional argument to specify the location of included EPS file, the completion style is `Position', and the possible characters are t, b, l, and r. To tell these information to generator, operate as follows. Read type(1).... p Acceptable characters: tblr RET (B) is coordinate. So its completion style is coOrd. We want a prompt meaning "Maximum size" when completion. Read type(2).... o Prompt for coordinates: Max size RET That's all for optional argument. Select quit. Read type(3).... q Then the generated option add-in function for \epsinput will be shown in the next window. Generating "argument add-in" ............................ Next, create the argument add-in. The arguments for \epsinput are EPS file name, framing style, and caption string in sequence. M-x YaTeX-generate-simple RET epsinput RET a Above key strokes bring the prompt that asks the number of argument. Answer it with 3. How many arguments?: 3 RET Then the generator asks the completion style and prompt for completion. Answer them. `f' for FileName and prompt string. Read type(1).... f Prompt for argument#1 EPS file name RET The second argument is one of selected symbol. So the completion type is `Completion'. Read type(2).... c Prompt for argument#2 Include style RET Then all the candidates ready to be read. Type single RET after entering all. Item[1](RET to exit): plain RET Item[2](RET to exit): frame RET Item[3](RET to exit): dframe RET Item[4](RET to exit): RET The following prompt asks whether the entered string must belong to candidates or not. In this case, since the argument must be one of `plain', `frame', and `dframe', type `y'. Require match? (y or n) y The last argument is the caption string for which any completion is needed. Read type(3).... s Prompt for argument#3 Caption RET default: Figure of RET Finally we'll get the argument add-in in the next window. Contribution ------------ If you get your own pretty function and you let it be in public, please 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.  File: yatexe, Node: Etcetera, Next: Copying, Prev: Customizations, Up: Top Etcetera ******** The standard completion tables provided in `yatex.el' contain a few LaTeX commands I frequently use. This is to lessen the key strokes to complete entire word, because too many candidates rarely used often cause too many hits. Therefore always try to use completion in order to enrich your dictionary, and you will also find `Wild Bird' growing suitable for your LaTeX style. The package name `Wild Bird' is the English translation of Japanese title `Yachou', which is a trick on words of Japanese.  File: yatexe, Node: Copying, Prev: Etcetera, Up: Top Copying ******* This program is distributed as a free software. You can use/copy/modify/redistribute this software freely but with NO warranty to anything as a result of using this software. Adopting code from this program is also free. But I would not do contract act. This software can be treated with: "The 2-Clause BSD License" (since 2017-09-09, yatex 1.80). Any reports and suggestions are welcome as long as I feel interests in this software. My possible e-mail address is `yuuji@yatex.org'. (as of Sep.2017) And there is mailing list for YaTeX. Although the common language is Japanese, questions in English will be welcome. To join the ML, send the mail whose subject is `append' to the address `yatex@yatex.org. If you have some question, please ask to `yatex-admin@yatex.org'. The specification of this software will be surely modified (depending on my feelings) without notice :-p. HIROSE Yuuji  Tag table: Node: Top256 Node: What is YaTeX?1583 Node: Main features1956 Node: Installation3591 Node: Typesetting4368 Node: Calling typesetter5489 Node: Calling previewer8016 Node: Printing out8377 Node: %#notation8669 Node: Changing typesetter9069 Node: Splitting input files9433 Node: Static region for typesetting10862 Node: Special Filtering Region11991 Node: Lpr format12723 Node: Controlling which command to invoke13796 Node: Editing %# notation14753 Node: Completion15297 Node: Begin-type completion15833 Node: Section-type completion18687 Node: view-sectioning21103 Node: Label Generation22682 Node: Large-type completion23582 Node: Maketitle-type completion24228 Node: Arbitrary completion24780 Node: End completion25170 Node: Accent completion25640 Node: Image completion26257 Node: Greek letters completion28512 Node: Inserting parentheses29268 Node: Local dictionaries29675 Node: Commenting out30612 Node: Cursor jump32071 Node: Jump to corresponding object32362 Node: Invoking image processor33762 Node: Jump to main file35105 Node: Jumping around the environment35471 Node: Jumping to last completion position35889 Node: Changing and Deleting36398 Node: Changing LaTeX commands36779 Node: Killing LaTeX commands37956 Node: Filling39141 Node: Updation of includeonly40996 Node: What column41793 Node: Intelligent newline42878 Node: Usepackage checker44539 Node: Online help45130 Node: Browsing file hierarchy46805 Node: Cooperation with other packages48542 Node: Customizations49247 Node: Lisp variables49543 Node: All customizable variables50502 Node: Sample definitions62467 Node: Hook variables62980 Node: Hook file63684 Node: Add-in functions64023 Node: How the add-in function works64861 Node: Defining option-add-in67047 Node: Defining argument-add-in67769 Node: Defining enclosing-add-in68650 Node: How the function is called69506 Node: Useful functions for creating add-in70182 Node: Contribution71592 Node: Add-in generator71866 Node: Etcetera77442 Node: Copying78047  End tag table yatex1.81/docs/yatexe.tex010064400037440000000000002501001332771661300145240ustar yuujiwheel\def\lang{jp} % -*- texinfo -*- \input texinfo.tex @setfilename yatexe @settitle Yet Another tex-mode for Emacs @direntry * YaTeX-e: (yatexe). Yet Another tex-mode for Emacs (English). @end direntry @iftex @c @syncodeindex fn cp @c Last modified Sat Jan 6 23:42:24 2018 on firestorm @syncodeindex vr cp @end iftex @titlepage @sp 10 @center @subtitle Yet Another tex-mode for emacs @title Wild Bird @subtitle // YaTeX // @author @copyright{} 1991-2017 by HIROSE, Yuuji [yuuji@@yatex.org] @end titlepage @node Top, What is YaTeX?, (dir), (dir) @comment node-name, next, previous, up @cindex Demacs @cindex Mule @cindex LaTeX @cindex YaTeX @menu * What is YaTeX?:: * Main features:: What YaTeX can do * Installation:: Guide to install * Typesetting:: Call typesetting processes * %#notation:: Meta-keyword `%#' * 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 includeonly:: Free from maintaining includeonly * What column:: Check what table-column the cursor belong * Intelligent newline:: Guess requisites of new line * Usepackage checker:: Selecting correct \usepackage is YaTeX's job * Online help:: On-line documentation of LaTeX * Browsing file hierarchy:: Walking through file hierarchy * Cooperation with other packages:: Work well with gmhist, min-out * Customizations:: How to breed `Wild Bird' * Etcetera:: YaTeX is acquisitive. * Copying:: Redistribution @end menu @node What is YaTeX?, Main features, Top, Top @comment node-name, next, previous, up @chapter What is YaTeX? YaTeX automates typesetting and previewing of LaTeX and enables completing input of LaTeX mark-up command such as @code{\begin@{@}}..@code{\end@{@}}. YaTeX also supports Demacs which runs on MS-DOS(386), Mule (Multi Language Enhancement to GNU Emacs), and latex on DOS. @node Main features, Installation, What is YaTeX?, Top @comment node-name, next, previous, up @chapter Main features @itemize @item Invocation of typesetter, previewer and related programs(@kbd{C-c t}) @item Typesetting on static region which is independent from point @item Semiautomatic replacing of @code{\includeonly} @item Jumping to error line(@kbd{C-c '}) @item Completing-read of La@TeX{} commands such as @code{\begin@{@}}, @code{\section} etc. (@kbd{C-c b}, @kbd{C-c s}, @kbd{C-c l}, @kbd{C-c m}) @item Enclosing text into La@TeX{} environments or commands (@var{AboveKeyStrokes} after region setting) @item Displaying the structure of text at entering sectioning commands @item Lump shifting of sectioning commands (@ref{view-sectioning}) @item Learning unknown/new La@TeX{} commands for the next completion @item Argument reading with a guide for complicated La@TeX{} commands @item Generating argument-readers for new/unsupported commands(@file{yatexgen}) @item Quick changing or deleting of La@TeX{} commands(@kbd{C-c c}, @kbd{C-c k}) @item Jumping from and to inter-file, begin<->end, ref<->label(@kbd{C-c g}) @item Blanket commenting out or uncommenting (@kbd{C-c >}, @kbd{C-c <}, @kbd{C-c ,}, @kbd{C-c .}) @item Easy input of accent mark, math-mode's commands and Greek letters (@kbd{C-c a}, @kbd{;}, @kbd{:}) @item Online help for the popular La@TeX{} commands (@kbd{C-c ?}, @kbd{C-c /}) @item Document files hierarchy browser (@kbd{C-c d}) @item Adding automatically \usepackage corresponding to inputting LaTeX macro with completion @item Allow you to forget creating \label@{@}s, \ref@{@} or \cite@{@} completion automatically generate labels. @item \includegraphics by Drag&Drop of image file @end itemize @node Installation, Typesetting, Main features, Top @comment node-name, next, previous, up @chapter Installation @cindex installation @cindex .emacs @cindex auto-mode-alist @cindex autoload Put next two expressions into your @file{~/.emacs}. @lisp (setq auto-mode-alist (cons (cons "\\.tex$" 'yatex-mode) auto-mode-alist)) (autoload 'yatex-mode "yatex" "Yet Another La@TeX{} mode" t) @end lisp Next, add certain path name where you put files of YaTeX to your load-path. If you want to put them in @file{~/src/emacs}, write @lisp (setq load-path (cons (expand-file-name "~/src/emacs") load-path)) @end lisp @noindent in your @file{~/.emacs} Then, yatex-mode will be automatically loaded when you visit a file which has extension @file{.tex}. If yatex-mode is successfully loaded, mode string on mode line will be turned to "YaTeX". @node Typesetting, %#notation, Installation, Top @comment node-name, next, previous, up @chapter Typesetting @cindex typesetting @cindex previewer @cindex typesetter @cindex latex @cindex printing out The prefix key stroke of yatex-mode is @kbd{C-c} (Press 'C' with Control key) by default. If you don't intend to change the prefix key stroke, assume all @kbd{[prefix]} as @kbd{C-c} in this document. These key strokes execute typeset or preview command. @table @kbd @item [prefix] t j @dots{} invoke typesetter @item [prefix] t r @dots{} invoke typesetter on region @item [prefix] t e @dots{} `on-the-fly preview' on current environment or whole portion of current formulas in math-mode @item [prefix] t d @dots{} invoke dvipdfmx after successful typesetting @item [prefix] t k @dots{} kill current typesetting process @item [prefix] t b @dots{} invoke bibtex @item [prefix] t i @dots{} invoke makeindex @item [prefix] t d @dots{} invoke latex && dvipdfmx @item [prefix] t p @dots{} preview @item [prefix] t l @dots{} lpr dvi-file @item [prefix] t s @dots{} search current string on xdvi-remote @end table @menu * Calling typesetter:: * Calling previewer:: * Printing out:: @end menu @node Calling typesetter, Calling previewer, Typesetting, Typesetting @comment node-name, next, previous, up @section Calling typesetter Typing @kbd{[prefix] t j}, the current editing window will be divided horizontally when you invoke latex command, and log message of La@TeX{} typesetting will be displayed in the other window; called typesetting buffer. The typesetting buffer automatically scrolls up and traces La@TeX{} warnings and error messages. If you see latex stopping by an error, you can send string to latex in the typesetting buffer. If an error stops the La@TeX{} typesetting, this key stroke will move the cursor to the line where La@TeX{} error is detected. @table @kbd @item [prefix] ' @itemx ([prefix]+single quotation) @dots{} jump to the previous error or warning @end table If you find a noticeable error, move to the typesetting buffer and move the cursor on the line of error message and type @kbd{SPACE} key. This makes the cursor move to corresponding source line. YaTeX-typeset-region invoked by @kbd{[prefix] tr} call typesetter for region. The region is specified by standard point and mark, or by @code{%#BEGIN} and @code{%#END} marks. Selected region will be copied to the temporary file @file{texput.tex} with the same preamble as the main file of current editing sources. Be sure to put all local macro settings in preamble, not after @code{\begin@{document@}}. The method of specification of the region is shown in the section @xref{%#notation}. The documentclass for typeset-region is the same as that of editing file if you edit one file, and is the same as main file's if you edit splitting files. The @kbd{[prefix] te} key automatically marks current inner environment or inner math mode or paragraph, and then call typeset-region with marked region. This is convenient to quick view of current tabular environment or current editing formulas. If running Emacs has the ability of displaying images, typeset image will be shown in the next window. Further more, if you modify the content within that environment, YaTeX performs `on-the-fly' preview that automatically update preview image as you typed. If your Emacs does not supply on-the-fly preview, keeping previewer window for @file{texput.dvi} is handy for debugging. Since @kbd{[prefix] te} selects the inner-most environment as region, it is not suitable for partial typesetting of doubly or more composed environment. If you want to do partial typesetting for a nested environment, use @kbd{[prefix] tr} for static-region, which is described in the section @xref{%#notation}. @node Calling previewer, Printing out, Calling typesetter, Typesetting @comment node-name, next, previous, up @section Calling previewer @kbd{[prefix] t p} invokes the TeX previewer. And if you are using xdvi-remote, which can be controled from other terminals, @kbd{[prefix] t s} enables you to search current string at the cursor on the running xdvi window. @node Printing out, , Calling previewer, Typesetting @comment node-name, next, previous, up @section Printing out When you type @code{[preifx] t l}, YaTeX asks you the range of dvi-printing by default. You can skip this by invoking it with universal-argument as follows: @example C-u [prefix] tl @end example @node %#notation, Completion, Typesetting, Top @comment node-name, next, previous, up @chapter %# notation @cindex %# notation You can control the typesetting process by describing @code{%#} notations in the source text. @menu * Changing typesetter:: * Splitting input files:: * Static region for typesetting:: * Special Filtering Region:: * Lpr format:: * Controlling which command to invoke:: * Editing %# notation:: @end menu @node Changing typesetter, Splitting input files, %#notation, %#notation @comment node-name, next, previous, up @section To change the `latex' command or to split a source text. @cindex typesetter To change the typesetting command, write @example %#!latex-big @end example @noindent 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 @section Splitting input files And if you split the source text and edit subfile that should be included from main text. @example %#!latex main.tex @end example @noindent will be helpful to execute latex on main file from sub text buffer. Since this command line after @kbd{%#!} will be sent to shell literally, next description makes it convenient to use ghostview as dvi-previewer. @example %#!latex main && dvi2ps main.dvi > main @end example @noindent 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. The @code{%f} notation in this line is replaced by main file name, and @code{%r} replaced by root name of main file name. If you specify @code{%f} or @code{%r}, YaTeX always ask you the name of main file at the first typesetting. 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 You can put split texts in sub directory, but not in sub directory of sub directory. @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} is in the parent directory(not %#!latex ../main.tex). @end itemize @node Static region for typesetting, Lpr format, Splitting input files, %#notation @comment node-name, next, previous, up @section Static region @cindex static region @cindex Fixed region Typeset-region by @kbd{[prefix] tr} passes the region between point and mark to typesetting command by default. But when you want to typeset static region, enclose the region by @code{%#BEGIN} and @code{%#END} as follows. @example %#BEGIN TheRegionYouWantToTypesetManyTimes %#END @end example This is the rule of deciding the region. @enumerate @item If there exists %#BEGIN before point, @enumerate @item If there exists %#END after %#BEGIN, @itemize @item From %#BEGIN to %#END. @end itemize @item If %#END does not exist after %#BEGIN, @itemize @item From %#BEGIN to the end of buffer. @end itemize @end enumerate @item If there does not exist %#BEGIN before point, @itemize @item Between point and mark(standard method of Emacs). @end itemize @end enumerate It is useful to write @code{%#BEGIN} in the previous line of \begin and @code{%#END} in the next line of \@code{end} when you try complex environment such as `tabular' many times. It is also useful to put only @code{%#BEGIN} alone at the middle of very long text. Do not forget to erase @code{%#BEGIN} @code{%#END} pair. @node Special Filtering Region, Lpr format, Static region for typesetting, %#notation @section Special Filtering Region A region like below will be passed to external filter command. @example %#BEGIN FILTER{foo.pdf}{dot -T %t -o %o} \if0 ....blah blah blah... ....blah blah blah... ....blah blah blah... \fi %#END @end example In this case, typing @kbd{[prefix] t e} send three `blah' lines to "dot -T pdf -o foo.pdf" as standard-input. It is useful to have source of text-origin graphic generated by such tools as graphviz or blockdiag, in La@TeX{} source. This special form of region can be inserted via feeding @code{.dot} into environment completion by @kbd{[prefix] t b}. @node Lpr format, Controlling which command to invoke, Static region for typesetting, %#notation @comment node-name, next, previous, up @section Lpr format @cindex lpr format Lpr format is specified by three Lisp variables. Here are the default values of them. @table @code @item (1)dviprint-command-format @code{"dvi2ps %f %t %s | lpr"} @item (2)dviprint-from-format @code{"-f %b"} @item (3)dviprint-to-format @code{"-t %e"} @end table On YaTeX-lpr, @code{%s} in (1) is replaced by the file name of main text, @code{%f} by contents of (2), %t by contents of (3). At these replacements, @code{%b} in (2) is also replaced by the number of beginning page, @code{%e} in (3) is replaced by the number of ending page. But @code{%f} and @code{%t} are ignored when you omit the range of print-out by @kbd{C-u [prefix] tl}. If you want to change this lpr format temporarily, put a command such as follows somewhere in the text: @example %#LPR dvi2ps %f %t %s | 4up -page 4 | texfix | lpr -Plp2 @end example And if you want YaTeX not to ask you the range of printing out, the next example may be helpful. @example %#LPR dvi2ps %s | lpr @end example @node Controlling which command to invoke, Editing %# notation, Lpr format, %#notation @comment node-name, next, previous, up @section Controlling which command to invoke These %# notation below can control which command to invoke for La@TeX{} related process. @table @code @item %#PREVIEW @dots{} Command line for DVI viewing ([prefix] t p) @item %#MAKEINDEX @dots{} Command line for makeindex ([prefix] t i) @item %#BIBTEX @dots{} Command line for bibtex ([prefix] t b) @item %#DVIPDF @dots{} Command line for dvipdf(mx) ([prefix] t b) @item %#LPR @dots{} Command line for printing out([prefix] t l) @item %#PDFVIEW @dots{} Command line for PDF viewing @item %#IMAGEDPI @dots{} DPI value for converting to on-the-fly prewview image @end table If you want to invoke ``makeidx hogehoge'' to update index, put the next line some upper place in the source, for example. @example %#MAKEINDEX makeidx hogehoge @end example @node Editing %# notation, , Controlling which command to invoke, %#notation @comment node-name, next, previous, up @section Editing %# notation To edit @code{%#} notation described above, type @table @kbd @item [prefix] % @dots{} editing %# notation menu @end table @noindent and select one of the entry of the menu as follows. @example !)Edit-%#! B)EGIN-END-region L)Edit-%#LPR @end example @noindent Type @kbd{!} to edit @code{%#!} entry, @code{b} to enclose the region with @code{%#BEGIN} and @code{%#END}, and @code{l} to edit @code{%#LPR} entry. When you type @kbd{b}, all @code{%#BEGIN} and @code{%#END} are automatically erased. @node Completion, Local dictionaries, %#notation, Top @comment node-name, next, previous, up @chapter Completion @cindex completion YaTeX makes it easy to input the La@TeX{} commands. There are several kinds of completion type, begin-type, section-type, large-type, etc... @menu * Begin-type completion:: * Section-type completion:: * Label Generation:: * Large-type completion:: * Maketitle-type completion:: * Arbitrary completion:: * End completion:: * Accent completion:: * Image completion:: * Greek letters completion:: * Inserting parentheses:: @end menu @node Begin-type completion, Section-type completion, Completion, Completion @comment node-name, next, previous, up @section Begin-type completion @cindex begin-type completion @cindex environment @cindex prefix b "Begin-type completion" completes commands of @code{\begin@{env@}} ... @code{\end@{env@}}. All of the begin-type completions begin with this key sequence. @table @kbd @item [prefix] b @dots{} start begin-type completion @end table @noindent An additional key stroke immediately completes a frequently used La@TeX{} @code{\begin@{@}}...@code{\@code{end}@{@}} environment. @table @kbd @item [prefix] b c @dots{} @code{\begin@{center@}...\end@{center@}} @item [prefix] b d @dots{} @code{\begin@{document@}...\end@{document@}} @item [prefix] b D @dots{} @code{\begin@{description@}...\end@{description@}} @item [prefix] b e @dots{} @code{\begin@{enumerate@}...\end@{enumerate@}} @item [prefix] b E @dots{} @code{\begin@{equation@}...\end@{equation@}} @item [prefix] b i @dots{} @code{\begin@{itemize@}...\end@{itemize@}} @item [prefix] b l @dots{} @code{\begin@{flushleft@}...\end@{flushleft@}} @item [prefix] b m @dots{} @code{\begin@{minipage@}...\end@{minipage@}} @item [prefix] b t @dots{} @code{\begin@{tabbing@}...\end@{tabbing@}} @item [prefix] b T @dots{} @code{\begin@{tabular@}...\end@{tabular@}} @item [prefix] b^T @dots{} @code{\begin@{table@}...\end@{table@}} @item [prefix] b p @dots{} @code{\begin@{picture@}...\end@{picture@}} @item [prefix] b q @dots{} @code{\begin@{quote@}...\end@{quote@}} @item [prefix] b Q @dots{} @code{\begin@{quotation@}...\end@{quotation@}} @item [prefix] b r @dots{} @code{\begin@{flushright@}...\end@{flushright@}} @item [prefix] b v @dots{} @code{\begin@{verbatim@}...\end@{verbatim@}} @item [prefix] b V @dots{} @code{\begin@{verse@}...\end@{verse@}} @end table Any other La@TeX{} environments are made by completing-read of the Emacs function. @table @kbd @item [prefix] b SPACE @dots{} begin-type completion @end table @noindent The next message will show up in the minibuffer @example Begin environment(default document): @end example @noindent by typing @kbd{[prefix] b}. Put the wishing environment with completion in the minibuffer, and @code{\begin@{env@}}...\@code{\end@{env@}} will be inserted in the La@TeX{} source text. If the environment you want to put does not exist in the YaTeX completion table, it will be registered in the user completion table. YaTeX automatically saves the user completion table in the user dictionary file at exiting of emacs. At the completion of certain environments, the expected initial entry will automatically inserted such as @code{\item} for @code{itemize} environment. If you don't want the entry, it can be removed by undoing. If you want to enclose some paragraphs which have already been written into environment, invoke the begin-type completion right after region marking. @cindex enclose region into environment If you set @code{transient-mark-mode} to @code{nil} in your @file{~/.emacs}, typing @kbd{C-space} (@code{set-mark-command}) twice turns @code{transient-mark-mode} on temporarily. Then, type call begin-type completion to enclose text into a environment. @node Section-type completion, Label Generation, Begin-type completion, Completion @comment node-name, next, previous, up @section Section-type completion @cindex section-type completion @cindex prefix s "Section-type completion" completes section-type commands which take an argument or more such as @code{\section@{foo@}}. To invoke section-type completion, type @table @kbd @item [prefix] s @dots{} section-type completion @end table @noindent then the prompt @example (C-v for view) \???@{@} (default documentclass): @end example @noindent will show up in the minibuffer. Section-type La@TeX{} commands are completed by space key, and the default value is selected when you type nothing in the minibuffer. Next, @example \section@{???@}: @end example @noindent prompts you the argument of section-type La@TeX{} command. For example, the following inputs @example \???@{@} (default documentclass): section \section@{???@}: Hello world. @end example @noindent will insert the string @example \section@{Hello world.@} @end example in your La@TeX{} source. When you neglect argument such as @example (C-v for view) \???@{@} (default section): vspace* \vspace*@{???@}: @end example YaTeX puts @example \vspace*@{@} @end example @noindent and move the cursor in the braces. In La@TeX{} command, there are commands which take more than one arguments such as @code{\addtolength@{\topmargin@}@{8mm@}}. To complete these commands, invoke section-type completion with universal argument as, @cindex number of argument @example C-u 2 [prefix] s (or ESC 2 [prefix] s) @end example @noindent and make answers in minibuffer like this. @example (C-v for view) \???@{@} (default vspace*): addtolength \addtolength@{???@}: \topmargin Argument 2: 8mm @end example @code{\addtolength} and the first argument @code{\topmargin} can be typed easily by completing read. Since YaTeX also learns the number of arguments of section-type command and will ask that many arguments in future completion, you had better tell the number of arguments to YaTeX at the first completion of the new word. But you can change the number of arguments by calling the completion with different universal argument again. Invoking section-type completion with @code{[Prefix] S} (Capital `S') includes the region as the first argument of section-type command. The section/large/maketitle type completion can work at the prompt for the argument of other section-type completion. Nested La@TeX{} commands are efficiently read with the recursive completion by typing YaTeX's completion key sequence in the minibuffer. @menu * view-sectioning:: @end menu @node view-sectioning, , Section-type completion, Section-type completion @comment node-name, next, previous, up @subsection view-sectioning @cindex view sectioning @cindex outline In the minibuffer at the prompt of section-type command completion, typing @kbd{C-v} shows a list of sectioning commands in source text(The line with @code{<<--} mark is the nearest sectioning command). Then, default sectioning command appears in the minibuffer. You can go up/down sectioning command by typing @kbd{C-p}/@kbd{C-n}, can scrolls up/down the listing buffer by @kbd{C-v}/@kbd{M-v}, and can hide sectioning commands under certain level by 0 through 6. Type @kbd{?} in the minibuffer of sectioning prompt for more information. You can generate this listing buffer (@code{*Sectioning Lines*} buffer) by typing @table @kbd @item M-x YaTeX-section-overview @dots{} Generate *Sectioning Lines* buffer @end table @cindex{Generate the listing of sectioning units} from the LaTeX source buffer. In this listing buffer, typing @kbd{u} on the sectioning command shifts up the corresponding sectioning command in source text and @kbd{d} shifts down. After marking lines in the listing buffer, typing @kbd{U} shifts up all sectioning commands in the region, and @kbd{U} shifts down. Here are all the key bindings of @code{*Sectioning Lines*} buffer. @table @kbd @item SPC @dots{} Jump to corresponding source line @item . @dots{} Display corresponding source line @item u @dots{} Shift up a sectioning line @item d @dots{} Shift down a sectioning line @item U @dots{} Shift up sectioning lines in region @item D @dots{} Shift down sectioning lines in region @item 0@dots{}6 @dots{} Hide sectioning commands whose level is lower than n @end table @node Label Generation, Large-type completion, Section-type completion, Completion @section Label Generation @comment label generation @cindex label generation @cindex ref label cite When you want to type-in references of @code{\ref} or @code{\cite}, all you have to do is type @kbd{[prefix] s ref} without adding labels beforehand. You will see possible La@TeX{}-counters in the next window even if some counter does not have @code{\label}. Selecting the counter will automatically set the label to that counter. All possible counter list in the buffer tends to be large. You can reduce the number of list by filtering type of counters by key-commands as follows. @table @kbd @item M-a @dots{} Show all(disable filtering) @item M-c @dots{} Captions only @item M-e @dots{} equations (with counters) only @item M-i @dots{} numbers items only @item M-s @dots{} sections only @item M-m @dots{} other counters only @end table @node Large-type completion, Maketitle-type completion, Label Generation, Completion @comment node-name, next, previous, up @section Large-type completion "Large-type completion" inputs the font or size changing descriptions such as @code{@{\large @}}. When you type @table @kbd @item [prefix] l @dots{} large-type completion @end table @noindent the message in the minibuffer @example @{\??? @} (default large): @end example prompts prompts you large-type command with completing-read. There are TeX commands to change fonts or sizes, @code{it}, @code{huge} and so on, in the completion table. Region-based completion is also invoked by calling completion after region activated. @node Maketitle-type completion, Arbitrary completion, Large-type completion, Completion @comment node-name, next, previous, up @section Maketitle-type completion @cindex maketitle-type completion We call it "maketitle-type completion" which completes commands such as @code{\maketitle}. Take notice that maketitle-type commands take no arguments. Then, typing @table @kbd @item [prefix] m @dots{} maketitle-type completion @end table @noindent begins maketitle-completion. Above mentioned method is true for maketitle-completion, and there are La@TeX{} commands with no arguments in completion table. @node Arbitrary completion, End completion, Maketitle-type completion, Completion @comment node-name, next, previous, up @section Arbitrary completion @cindex arbitrary completion @noindent You can complete certain La@TeX{} command anywhere without typical completing method as described, by typing @table @kbd @item [prefix] SPC @dots{} arbitrary completion @end table @noindent after the initial string of La@TeX{} command that is preceded by @code{\}. @node End completion, Accent completion, Arbitrary completion, Completion @comment node-name, next, previous, up @section End completion @cindex end completion @noindent YaTeX automatically detects the opened environment and close it with \@code{\end@{environment@}}. Though proficient YaTeX users never fail to make environment with begin-type completion, some may begin an environment manually. In that case, type @table @kbd @item [prefix] e @dots{} @code{end} completion @end table @noindent at the end of the opened environment. @node Accent completion, Image completion, End completion, Completion @comment node-name, next, previous, up @section Accent completion @cindex accent completion When you want to write the European accent marks(like @code{\`@{o@}}), @table @kbd @item [prefix] a @dots{} accent completion @end table @noindent shows the menu @example 1:` 2:' 3:^ 4:" 5:~ 6:= 7:. u v H t c d b @end example @noindent in the minibuffer. Chose one character or corresponding numeric, and you will see @example \`@{@} @end example @noindent in the editing buffer with the cursor positioned in braces. Type one more character `o' for example, then @example \`@{o@} @end example @noindent will be completed, and the cursor gets out from braces. @node Image completion, Greek letters completion, Accent completion, Completion @comment node-name, next, previous, up @section Image completion of mathematical sign @cindex image completion @cindex math-mode @cindex sigma @cindex leftarrow @cindex ; Arrow marks, sigma mark and those signs mainly used in the TeX's math environment are completed by key sequences which imitate the corresponding symbols graphically. This completion only works in the math environment. YaTeX automatically detects whether the cursor located in math environment or not, and change the behavior of key strokes @kbd{;} and @kbd{:}. By the way, we often express the leftarrow mark by `<-' for example. Considering such image, you can write @code{\leftarrow} by typing @kbd{<-} after @kbd{;} (semicolon) as a prefix. In the same way, @code{\longleftarrow} (@code{<--}) is completed by typing @kbd{;<--}, infinity mark which is imitated by @code{oo} is completed by typing @kbd{;oo}. Here are the sample operations in YaTeX math-mode. @example INPUT Completed La@TeX{} commands ; < - @code{\leftarrow} ; < - - @code{\longleftarrow} ; < - - > @code{\longleftrightarrow} ; o @code{\circ} ; o o @code{\infty} @end example In any case, you can quit from image completion and can move to the next editing operation if the La@TeX{} command you want is shown in the buffer. @code{;} itself in math-environment is inserted by @kbd{;;}. Typing @kbd{TAB} in the midst of image completion shows all of the La@TeX{} commands that start with the same name as string you previously typed in. In this menu buffer, press @kbd{RET} after moving the cursor (by @kbd{n}, @kbd{p}, @kbd{b}, @kbd{f}) to insert the La@TeX{} command. To know all of the completion table, type @kbd{TAB} just after @kbd{;}. And here is the sample menu by @kbd{TAB} after @kbd{;<}. @example KEY LaTeX sequence sign < \leq < ~ << \ll << <- \leftarrow <- <= \Leftarrow <= @end example You can define your favorite key-vs-sequence completion table in the Emacs-Lisp variable @code{YaTeX-math-sign-alist-private}. See also @file{yatexmth.el} for the information of the structure of this variable. @node Greek letters completion, Inserting parentheses, Image completion, Completion @comment node-name, next, previous, up @section Greek letters completion @cindex Greek letters completion @cindex : Math-mode of YaTeX provides another image completion, Greek letters completion in the same method. After prefix @kbd{:}, typing @kbd{a} makes @code{\alpha}, @kbd{b} makes @code{\beta} and @kbd{g} makes @code{\gamma} and so on. First, type @kbd{:TAB} to know all the correspondence of alphabets vs. Greek letters. If you will find @kbd{;} or @kbd{:} doesn't work in correct position of math environment, it may be a bug of YaTeX. Please send me a bug report with the configuration of your text, and avoid it temporarily by typing @kbd{;} or @kbd{:} after universal-argument(@kbd{C-u}) which forces @kbd{;} and @kbd{:} to work as math-prefix. @node Inserting parentheses, , Greek letters completion, Completion @section Inserting parentheses Typing opening parenthesis, one of @code{(}, @code{@{ and @code{[}}, automatically inserts the closing one. If a opening bracket is typed after @code{\}, @code{\]} is automatically inserted with computed indentation. If you stop automatic insertion, type @kbd{C-q} before opening parenthesis. @node Local dictionaries, Commenting out, Completion, Top @comment node-name, next, previous, up @chapter Local dictionaries @cindex local dictionaries @cindex nervous users Tables for completion consist of three dictionaries; `standard dictionary' built in @file{yatex.el}, `user dictionary' for your common private commands, and `local dictionary' that is effective in a certain directory. When you input the command unknown to YaTeX at a completion in the minibuffer, YaTeX asks you with the following prompt; @example `foo' is not in table. Register into: U)serDic L)ocalDic N)one D)iscard @end example @noindent 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} @lisp (setq YaTeX-nervous nil) @end lisp @node Commenting out, Cursor jump, Local dictionaries, Top @comment node-name, next, previous, up @chapter Commenting out @cindex commenting out @cindex prefix > @cindex prefix < @cindex prefix , @cindex prefix . You may want to comment out some region. @table @kbd @item [prefix] > @dots{} comment out region by % @item [prefix] < @dots{} uncomment region @end table @noindent cause an operation to the region between point and mark. @table @kbd @item [prefix] . @dots{} comment out current paragraph @item [prefix] , @dots{} uncomment current paragraph @end table @noindent comments or uncomments the paragraph where the cursor belongs. This `paragraph' means the region marked by the function mark-paragraph, bound to @kbd{ESC h} by default. It is NOT predictable what will happen when you continuously comment out some paragraph many times. You can also comment out an environment between @code{\begin} and @code{\end}, or a @code{\begin}-\@code{\end} pair themselves, by making the following key strokes on the line where @code{\begin@{@}} or @code{\end@{@}} exists. @table @kbd @item [prefix] > @dots{} comment out from \begin to \@code{end} @item [prefix] < @dots{} uncomment from \begin to \@code{end} @end table @noindent comment whole the contents of environment. Moreover, @table @kbd @item [prefix] . @dots{} comment out \begin and \@code{end} @item [prefix] , @dots{} uncomment \begin and \@code{end} @end table @noindent (un)comments out only environment declaration: @code{\begin@{@}} and @code{\end@{@}}. NOTE that even if you intend to comment out some region, invoking @kbd{[prefix] >} on the @code{\begin},@code{\end} line decides to work in `commenting out from @code{\begin} to @code{\end}' mode. @node Cursor jump, Changing and Deleting, Commenting out, Top @comment node-name, next, previous, up @chapter Cursor jump @cindex cursor jump @cindex prefix g @menu * Jump to corresponding object:: * Invoking image processor:: * Jump to main file:: * Jumping around the environment:: * Jumping to last completion position:: @end menu @node Jump to corresponding object, Invoking image processor, Cursor jump, Cursor jump @comment node-name, next, previous, up @section Jump to corresponding object Typing @table @kbd @item [prefix] g @dots{} go to corresponding object @end table @noindent in a certain place move the cursor to the place corresponding to the La@TeX{} command of last place. YaTeX recognize the followings as pairs that have relation each other. @itemize @bullet @item @code{\begin@{@}} <-> @code{\end@{@}} @item @code{%#BEGIN} <-> @code{%#END} @item On the image-including line -> corresponding viewer or drawing tool @item @code{\label@{@}} <-> @code{\ref@{@}} @item @code{\include(\input)} -> included file @item @code{\bibitem@{@}} <-> @code{\cite@{@}} @end itemize 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 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 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}. @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. @node Invoking image processor, Jump to main file, Jump to corresponding object, Cursor jump @comment node-name, next, previous, up @section Invoking image processor @cindex{Drawing tool invocation} `image-including line' described above means such lines as @code{\epsfile@{file=foo.ps@}}. If you type @kbd{[prefix] g} on that line, YaTeX automatically searches source of `foo.ps' and invokes image viewer or drawing tool correspoinding to it. For example; if you draw an image foo.obj with Tgif and enclose its product named foo.eps by @code{\epsfile} command. Typing @kbd{[prefix] g} on @code{\epsfile} line make YaTeX invoke @code{tgif foo.obj}. How a processor is choosen is as follows. @enumerate @item If there is an expression matching with one of the pattern defined in @code{YaTeX-processed-file-regexp-alist}, extract file name from regexp group surrounded by \\(\\). (Which group corresponds is written in the cdr part of each list.) If no matches were found, do nothing. @item If there is a pattern as `%PROCESSOR' which is defined in the variable @code{YaTeX-file-processor-alist}, call that processor giving the file name with corresponding extension. @item If not, check the existence of each file which is supplied the extension in the cdr part of each list of @code{YaTeX-file-processor-alist}. If any, call the corresponding image viewer or drawing tool. @end enumerate @node Jump to main file, Jumping around the environment, Invoking image processor, Cursor jump @comment node-name, next, previous, up @section Jump to main file Typing @table @kbd @item [prefix] ^ @dots{} visit main file @item [prefix] 4^ @dots{} visit main file in other buffer @end table @cindex prefix ^ @cindex prefix 4 ^ in a sub text switch the buffer to the main text specified by @code{%#!} notation. @node Jumping around the environment, Jumping to last completion position, Jump to main file, Cursor jump @comment node-name, next, previous, up @section Jumping around the environment And these are the functions which work on the current La@TeX{} environment: @table @kbd @item M-C-a @dots{} beginning of environment @item M-C-e @dots{} @code{end} of environment @item M-C-@@ @dots{} mark environment @end table @cindex M-C-a @cindex M-C-e @cindex M-C-@@ @node Jumping to last completion position, , Jumping around the environment, Cursor jump @comment node-name, next, previous, up @section Jumping to last completion position YaTeX always memorize the position of completion into register @code{3}. So every time you make a trip to any other part of text other than you are writing, you can return to the editing paragraph by calling register-to-point with argument YaTeX-current-position-register, which is achieved by typing @kbd{C-x j 3}(by default). @node Changing and Deleting, Filling, Cursor jump, Top @comment node-name, next, previous, up @chapter Changing and Deleting These functions are for change or deletion of La@TeX{} commands already entered. @table @kbd @item [prefix] c @dots{} change La@TeX{} command @item [prefix] k @dots{} kill La@TeX{} command @end table @cindex prefix c @cindex prefix k @menu * Changing LaTeX commands:: * Killing LaTeX commands:: @end menu @node Changing LaTeX commands, Killing LaTeX commands, Changing and Deleting, Changing and Deleting @comment node-name, next, previous, up @section Changing La@TeX{} commands @kbd{[prefix] c} can change the various (La)@TeX{} commands. This can change the followings. @itemize @bullet @item Environment names @item Section-type commands @item Argument of section-type commands @item Optional parameters (enclosed by []) of section-type commands @item Font/size designators @item Math-mode's maketitle-type commands that can be inputted with image completion @end itemize Typing @kbd{[prefix] c} on one of above objects you want to change brings a suitable reading function sometimes with completion. Note: If you want to change the argument of section-type command that contains other La@TeX{} commands, type @kbd{[prefix] c} either of surrounding braces of the argument in order to make YaTeX ignore the internal La@TeX{} sequences as an object of changing. Anyway, it is very difficult to know which argument position the cursor belongs because the La@TeX{} commands can be nested and braces can freely emerge. So keep it mind to put the cursor on a brace when you are thinking of changing a complicated argument. @node Killing LaTeX commands, , Changing LaTeX commands, Changing and Deleting @comment node-name, next, previous, up @section Killing La@TeX{} commands @cindex Killing La@TeX{} commands @kbd{[prefix] k} kills the La@TeX{} commands sometimes with their arguments. Following table illustrates the correspondence of the invoking position and what is killed. @example [Invoking position] [action] \begin, \end line kill \begin,\end pairs %#BEGIN, %#END line kill %#BEGIN,%#END pairs on a Section-type command kill section-type command on a parenthesis kill parentheses @end example Note that when killing @code{\begin, \end} or @code{%#BEGIN, %#END} pair, the lines @code{\begin, \end} or @code{%#BEGIN, %#END} exist will be killed entirely. So take care not to create any line that contains more than one @code{\begin} or so. While all operations above are to kill `containers' which surround some text, universal argument (@kbd{C-u}) for these commands kills not only `containers' but also `contents' of them. See below as a sample. @example Original text: [prefix] k C-u [prefix] k Main \footnote@{note@} here. Main note here. Main here. ~(cursor) @end example @node Filling, Updation of includeonly, Changing and Deleting, Top @comment node-name, next, previous, up @chapter Filling @cindex filling @section Filling an item @cindex filling an item @cindex prefix i To fill a term (descriptive sentences) of @code{\item}, type @c @table @kbd @c @item [prefix] i @c @dots{} fill item @c @end table @table @kbd @item M-q @dots{} fill item @end table @noindent on that item. 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(e.g. @code{\underlineitem}), put @lisp (setq YaTeX-item-regexp "\\(\\\\\\(sub\\)*item\\)\\|\\(\\\\underlineitem\\)") @end lisp @cindex YaTeX-item-regexp in your @file{~/.emacs}. If you are not familiar with regular expression for Emacs-Lisp, name a newcommand for `itemize' beginning with @code{\item} such as @code{\itembf}, not @code{\bfitem}. This function reformats the @code{\item} into `hang-indented' style. For example: @example itemize, enumerate environment: > >\item[foo] `foo' is the typical word for describing an > arbitrarily written.... description environment: > \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 an @code{\item} word 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 includeonly, What column, Filling, Top @comment node-name, next, previous, up @chapter Updation of @code{\includeonly} @cindex includeonly When you edit splitting source texts, the notation @example \includeonly@{CurrentEditingFileName@} @end example @noindent in the main file reduces the time of typesetting. If you want to hack other file a little however, you have to rewrite it to @example \includeonly@{OtherFileNameYouWantToFix@} @end example @noindent in the main file. YaTeX automatically detects that the current edited text is not in includeonly list and prompts you @example A)dd R)eplace %)comment? @end example in the minibuffer. Type @kbd{a} if you want to add the current file name to @code{\includeonly} list, @kbd{r} to replace \@code{includeonly} list with the current file, and type @kbd{%} to comment out the @code{\includeonly} line. @node What column, Intelligent newline, Updation of includeonly, Top @comment node-name, next, previous, up @chapter What column? @cindex what column @cindex complex tabular @cindex prefix & We are often get tired of finding the corresponding column in large tabulars. For example, @example \begin@{tabular@}@{|c|c|c|c|c|c|c|c|@}\hline Name&Position&Post No.&Addr.&Phone No.&FAX No.& Home Addr.&Home Phone\\ \hline Thunder Bird & 6 & 223 & LA & xxx-yyy & zzz-www & Japan & 9876-54321 \\ & 2 & \multicolumn@{2@}@{c|@}@{Unknown@} &&&(???) \\ \hline \end@{tabular@} @end example Suppose you have the cursor located at @code{(???)} mark, can you tell which column it is belonging at once? Maybe no. In such case, type @table @kbd @item [prefix] & @dots{} What column @end table @noindent in that position. YaTeX tells you the column header of the current field. Since YaTeX assumes the first line of tabular environment as a row of column headers, you can create a row of virtual column headers by putting them in the first line and commenting that line with @code{%}. @node Intelligent newline, Usepackage checker, What column, Top @comment node-name, next, previous, up @chapter Intelligent newline @cindex Intelligent newline @cindex ESC RET @cindex M-C-m At the end of begin-type completion of tabular[*], array, itemize, enumerate or tabbing environment, or typing @table @kbd @item ESC RET @dots{} Intelligent newline @end table @noindent in these environments inserts the contents corresponding to the current environment in the next line. (At the begin-type completion, this contents can be removed by `undo'.) In @code{tabular} environment, for example, @kbd{ESC RET} inserts the certain number of @code{&} and trailing @code{\\}, and @code{\hline} if other @code{\hline} is found in backward. Here are the list of contents vs. environments. @itemize @item @code{tabular}, @code{tabular*}, @code{array} Corresponding number of @code{&} and @code{\\}. And @code{\hline} if needed. @item @code{tabbing} The same number of @code{\>} as @code{\=} in the first line. @item @code{itemize}, @code{enumerate}, @code{description}, @code{list} @code{\item} or @code{item[]}. @end itemize Note that since this function works seeing the contents of the first line, please call this after the second line if possible. If you want to apply these trick to other environments, @code{foo} environment for example, define the function named @code{YaTeX-intelligent-newline-foo} to insert corresponding contents. That function will be called at the beginning of the next line after the newline is inserted to the current line. Since the function @code{YaTeX-indent-line} is designed to indent the current line properly, calling this function before your code to insert certain contents must be useful. See the definition of the function @code{YaTeX-intelligent-newline-itemize} as an example. @node Usepackage checker, Online help, Intelligent newline, Top @comment node-name, next, previous, up @chapter Usepackage checker @cindex usepackage When you input begint-type, section-type, maketitle-type macros with completion, and it requires some LaTeX2e package, YaTeX examines the existence of correct @code{\usepackage}. If not, YaTeX inserts the @code{\usepackage@{@}} declaration corresponding to input macro. To activate the package completion for your favarite package, set the variable @code{YaTeX-package-alist-private} correctly. Please refere the value of @code{YaTeX-package-alist-default} as an example. @node Online help, Browsing file hierarchy, Usepackage checker, Top @comment node-name, next, previous, up @chapter Online help @cindex online help @cindex prefix ? @cindex prefix / @cindex apropos @cindex keyword search YaTeX provides you the online help with popular La@TeX{} commands. Here are the key strokes for the online help. @table @kbd @item [prefix] ? @dots{} Online help @item [prefix] / @dots{} Online apropos @end table @section Online help `Online help' shows the documentation for the popular La@TeX{} commands(defaults to the commands on the cursor) in the next buffer. There are two help file, `global help' and `private help'. The former file contains the descriptions on the standard La@TeX{} command and is specified its name by variable @code{YaTeX-help-file}. Usually, the global help file should be located in public space (@code{$EMACSEXECPATH} by default) and should be world writable so that anyone can update it to enrich its contents. The latter file contains descriptions on non-standard or personal command definitions and is specified by @code{YaTeX-help-file-private}. This file should be put into private directory. @section Online apropos `Online apropos' is an equivalent of GNU Emacs's apropos. It shows all the documentations that contains the keyword entered by the user. @section When no descriptions are found... If there is no description on a command in help files, YaTeX requires you to write a description on that command. If you are willing to do, determine which help file to add and write the description on it referring your manual of (La)TeX. Please send me your additional descriptions if you describe the help on some standard commands. I might want to include it in the next distribution. @node Browsing file hierarchy, Cooperation with other packages, Online help, Top @comment node-name, next, previous, up @chapter Browsing file hierarchy @cindex hierarchy @cindex browsing When you are editing multi-file source, typing @table @kbd @item [prefix] d @dots{} browse file hierarchy @end table @noindent asks you the parent-most file (which may be defaulted) and displays the documentation hierarchy in the next window. In this buffer, the following commands are available. @table @kbd @item n @dots{} move to the next line and show its contents @item p @dots{} move to the previous line and show its contents @item N @dots{} move to the next file in the same inclusion level @item P @dots{} move to the previous file in the same inclusion level @item j @dots{} move to the next line @item k @dots{} move to the previous line @item u @dots{} move to the parent file @item . @dots{} show the current files contents in the next window @item SPC @dots{} scroll up the current file window @item DEL, b @dots{} scroll down the current file window @item < @dots{} show the beginning of the current file @item > @dots{} show the end of the current file @item > @dots{} return to the previous postion after @kbd{<} or @kbd{>} @item RET, g @dots{} open the current file in the next window @item mouse-2 @dots{} same as RET(available only with window system) @item o @dots{} other window @item 1 @dots{} delete other windows @item - @dots{} shrink hierarchy buffer window @item + @dots{} enlarge hierarchy buffer window @item ? @dots{} describe mode @item q @dots{} quit @end table Note that operations on the file contents in the next window do not work correctly when you close the corresponding file. @node Cooperation with other packages, Customizations, Browsing file hierarchy, Top @comment node-name, next, previous, up @chapter Cooperation with other packages YaTeX works better with other brilliant packages. @section gmhist @cindex gmhist @cindex command history @cindex minibuffer history When you are loading @file{gmhist.el} and @file{gmhist-mh.el}, you can use independent command history list at the prompt of preview command (@kbd{[prefix] tp}) and print command (@kbd{[prefix] tl}). On each prompt, you can enter the previous command line string repeatedly by typing @kbd{M-p}. @section min-out @cindex min-out @file{min-out}, the outline minor mode, can be used in yatex-mode buffers. If you want to use it with YaTeX, please refer the file @file{yatexm-o.el} as an example. @node Customizations, Etcetera, Cooperation with other packages, Top @comment node-name, next, previous, up @chapter Customizations @cindex customizations You can customize YaTeX by setting Emacs-Lisp variables and by making add-in functions. @menu * Lisp variables:: * Add-in functions:: * Add-in generator:: @end menu @node Lisp variables, Add-in functions, Customizations, Customizations @comment node-name, next, previous, up @section Lisp variables @cindex customizable variables You can change the key assignments or make completion more comfortable by setting the values of various variables which control the movement of yatex-mode. For example, if you want to change the prefix key stroke from @kbd{C-c} to any other sequence, set YaTeX-prefix to whatever you want to use. If you don't want to use the key sequence @kbd{C-c letter} which is assumed to be the user reserved sequence in Emacs world, set @code{YaTeX-inhibit-prefix-letter} to @code{t}, and all of the default key bind of @kbd{C-c letter} will turn to the corresponding @kbd{C-c C-letter} (but the region based completions that is invoked with @kbd{C-c Capital-letter} remain valid, if you want to disable those bindings, set that variable to 1 instead of @code{t}). @menu * All customizable variables:: * Sample definitions:: * Hook variables:: * Hook file:: @end menu @node All customizable variables, Sample definitions, Lisp variables, Lisp variables @comment node-name, next, previous, up @subsection All customizable variables @cindex all customizable variables Here are the customizable variables of yatex-mode. Each value setq-ed in @file{~/.emacs} is preferred and that of defined in @file{yatex.el} is neglected. Parenthesized contents stands for the default value. When you are to change some of these variables, see more detailed documentation of the variable by @kbd{M-x describe-variable}. @defvar YaTeX-japan Set this nil to produce all messages in English (@code{Depends on Japanese feature of Emacs}) @end defvar @defvar YaTeX-kanji-code Default buffer-file-coding-system for YaTeX modes' buffer. Set this 0 to no language conversion. Nil to preserve original coding-system. 1=Shift JIS, 2=JIS, 3=EUC, 4=UTF-8 (@code{1 or 2}) @end defvar @defvar YaTeX-prefix Prefix key stroke (@kbd{C-c}) @end defvar @defvar YaTeX-inhibit-prefix-letter Change key stroke from @kbd{C-c letter} to @kbd{C-c C-letter} (@code{nil}) @end defvar @defvar YaTeX-fill-prefix Fill-prefix used in yatex-mode (@code{nil}) @end defvar @defvar YaTeX-user-completion-table Name of user dictionary where learned completion table will be stored. (@code{"~/.yatexrc"}) @end defvar @defvar tex-command La@TeX{} typesetter command (@code{"latex"}) @end defvar @defvar dvi2-command Preview command (@code{"xdvi -geo +0+0 -s 4"}) @end defvar @defvar dviprint-command-format Command format to print dvi file (@code{"dvi2ps %f %t %s | lpr"}) @end defvar @defvar dviprint-from-format Start page format of above %f. %b will turn to start page (@code{"-f %b"}) @end defvar @defvar dviprint-to-format End page format of above %t. %e will turn to @code{end} page (@code{"-t %e"}) @end defvar @defvar makeindex-command Default makeindex command (@code{"makeindex"} (@code{"makeind"} on MS-DOS)) @end defvar @defvar YaTeX-dvipdf-command Default command name to convert .dvi to PDF (@code{"dvipdfmx"}) @end defvar @defvar YaTeX-on-the-fly-preview-interval Interval time in seconds of idle to trigger on-the-fly preview of environment by @kbd{[prefix] t e}(0.9). @code{Nil} disables on-the-fly preview. @end defvar @defvar YaTeX-on-the-fly-math-preview-engine Function symbol to use on-the-fly preview of MATH environment started by @kbd{[prefix] t e} (@code{'YaTeX-typeset-environment-by-lmp} which calls latex-math-preview-expression function if latex-math-preview is available, otherwise @code{'YaTeX-typeset-environment-by-builtin} which alls built-in function). @code{Nil} disables on-the-fly preview. @end defvar @defvar YaTeX-cmd-gimp Command name of GIMP (code{"gimp"}) @end defvar @defvar YaTeX-cmd-tgif Command name of tgif (code{"tgif"}) @end defvar @defvar YaTeX-cmd-inkscape Command name of Inkscape (code{"inkscape"}) @end defvar @defvar YaTeX-cmd-dia Command name of Dia (code{"dia"}) @end defvar @defvar YaTeX-cmd-ooo Command name of OpenOffice.org/LibreOffice (code{"soffice"}) @end defvar @defvar YaTeX-cmd-gs Command name of Ghostscript (code{"gs"}) @end defvar @defvar YaTeX-cmd-dvips Command name of dvips (code{"dvips"}) @end defvar @defvar YaTeX-cmd-displayline Command name of displayline (code{"/Applications/Skim.app/Contents/SharedSupport/displayline"}) @end defvar @defvar YaTeX-cmd-edit-ps Command name for editing PostScript files(Value of code{"YaTeX-cmd-gimp"}) @end defvar @defvar YaTeX-cmd-edit-pdf Command name for editing PDF files(Value of code{"YaTeX-cmd-ooo"}) @end defvar @defvar YaTeX-cmd-edit-ai Command name for editing `.ai' files(Value of code{"YaTeX-cmd-inkscape"}) @end defvar @defvar YaTeX-cmd-edit-svg Command name for editing SVG files(Value of code{"YaTeX-cmd-inkscape"}) @end defvar @defvar YaTeX-cmd-edit-images Command name for editing image files(Value of code{"YaTeX-cmd-gimp"}) @end defvar @defvar YaTeX-need-nonstop Put @code{\nonstopmode@{@}} or not (@code{nil}) @end defvar @defvar latex-warning-regexp Regular expression of warning message latex command puts out (@code{"line.* [0-9]*"}) @end defvar @defvar latex-error-regexp Regular expression of error message (@code{"l\\.[1-9][0-9]*"}) @end defvar @defvar latex-dos-emergency-message Message latex command running on DOS puts at abort (@code{"Emergency stop"}) @end defvar @defvar YaTeX-item-regexp Regular expression of item command (@code{"\\\\item"}) @end defvar @defvar YaTeX-verb-regexp Regexp of verb family. Omit \\\\. (@code{"verb\\*?\\|path"}) @end defvar @defvar YaTeX-nervous T for using local dictionary (@code{t}) @end defvar @defvar YaTeX-sectioning-regexp Regexp of La@TeX{} sectioning command (@code{"\\(part\\|chapter\\*?\\|\\(sub\\)*\\(section\\|paragraph\\)\\*?\\)\\b"}) @end defvar @defvar YaTeX-fill-inhibit-environments Inhibit fill in these environments (@code{'("tabular" "tabular*" "array" "picture" "eqnarray" "eqnarray*" "equation" "math" "displaymath" "verbatim" "verbatim*")}) @end defvar @defvar YaTeX-uncomment-once T for deleting all preceding @code{%} (@code{nil}) @end defvar @defvar YaTeX-close-paren-always T for always close all parenthesis automatically, @code{nil} for only eol (@code{t}) @end defvar @defvar YaTeX-auto-math-mode 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 the percentage of the screen-height. @code{nil} for half height (10) @end defvar @defvar YaTeX-help-file Global online help file name (@file{$doc-directory/../../site-lisp/YATEXHLP.eng}) @end defvar @defvar YaTeX-help-file-private Private online help file name (@file{"~/YATEXHLP.eng"}) @end defvar @defvar YaTeX-no-begend-shortcut Disable [prefix] b ?? shortcut (@code{nil)} @end defvar @defvar YaTeX-hilit-pattern-adjustment-private List of the list that contain the regular expression and the symbol of logical meaning of the string that matches the pattern. See also the value from @code{(assq 'yatex-mode hilit-patterns-alist)} and the value of @code{YaTeX-hilit-pattern-adjustment-default} (and even the document of hilit19.el). @end defvar @defvar YaTeX-sectioning-level Alist of LaTeX's sectioning command vs its height. @end defvar @defvar YaTeX-hierarchy-ignore-heading-regexp @code{YaTeX-display-hierarchy} searches for sectioning command first, and comment line secondary as a file headings. In latter case, ignore lines that match with regular expression of this variable. Default value of this variable is RCS header expressions and mode specifying line `-*- xxxx -*'. @end defvar @defvar YaTeX-skip-default-reader Non-nil for this variable skips the default argument reader of section-type command when add-in function for it is not defined (@code{nil}) @end defvar @defvar YaTeX-create-file-prefix-g When typing @kbd{prefix g} on the @code{\include} line, open the target file even if the file doesn't exist (@code{nil}) @end defvar @defvar YaTeX-simple-messages Simplyfy messages of various completions (@code{nil}) @end defvar @defvar YaTeX-hilit-sectioning-face When hilit19 and yatex19 is active, YaTeX colors the sectioning commands. This variable specifies the foreground and background color of @code{\part} macro. The default value is @code{'(yellow/dodgerblue yellow/slateblue)}. The first element of this list is for the screen when @code{hilit-background-mode} is @code{'light}, and the second element is for @code{'dark}. You should specify both color as `forecolor/backcolor'. @end defvar @defvar YaTeX-hilit-sectioning-attenuation-rate When color mode, this variable specifies how much attenuate the color density of @code{\subparagraph} compared with that of @code{\chapter} (@code{'(15 40)}) See also @code{YaTeX-hilit-sectioning-face}. @end defvar @defvar YaTeX-use-AMS-LaTeX If you use AMS-LaTeX, set to @code{t} (@code{nil}) @end defvar @defvar YaTeX-use-LaTeX2e If you use LaTeX2e, set to @code{t} (@code{t}) @end defvar @defvar YaTeX-template-file File name which is automatically inserted at creation (@code{~/work/template.tex}) @end defvar @defvar YaTeX-search-file-from-top-directory Non-nil means to search input-files from the directory where main file exists (@code{t}) @end defvar @defvar YaTeX-use-font-lock Use font-lock to fontify buffer or not (@code{(featurep 'font-lock)} @end defvar @defvar YaTeX-use-hilit19 Use hilit19 to highlight buffer or not (@code{(featurep 'hilit19)} @end defvar @defvar YaTeX-use-italic-bold YaTeX tries to search italic, bold fontsets or not (@code{t} if Emacs-20 or later). This variable is effective only when font-lock is used. (@code{(featurep 'hilit19)} @end defvar @defvar YaTeX-singlecmd-suffix Suffix which is always inserted after maketitle-type macros. @code{"@{@}"} is recommended. @end defvar @defvar YaTeX-package-alist-private Alist of LaTeX2e-package name vs. lists of macros in it. Set this alist properly and YaTeX automatically check the declaratiion of `usepackage' for corresponding macro, when you input that macro with completion. If required `usepackage' is not found, YaTeX also automatically inserts `\usepackage'. Alist is as follows; @lisp '((PackageName1 (completionType ListOfMacro) (completionType ListOfMacro)) (PackageName2 (completionType ListOfMacro) (completionType ListOfMacro...))....) @end lisp completionType is one of @code{env, section, maketitle}. Consult the value of @code{YaTeX-package-alist-default} as an example. @end defvar @defvar YaTeX-tabular-indentation At indentation by @kbd{C-i} in tabular or array environment, YaTeX put the additional spaces to the normail indentation depth. The number of additional spaces is the product of YaTeX-tabular-indentation and the number of column position in tabular. @end defvar @defvar YaTeX-noindent-env-regexp Regexp of environment names that should begin with no indentation. All verbatime-like environment name should match with. @end defvar @defvar YaTeX-electric-indent-mode Emacs 24.4 introduces automatic indentation of current and new lines. This might be annoying for some people. Pass this value to the function 'electric-indent-local-mode. If you prefer to stop electric-indent-mode in yatex-mode, set `-1' to this variable. @end defvar @defvar YaTeX-ref-default-label-string Default \\ref time string format. This format is like strftime(3) but allowed conversion char are as follows; %y -> Last 2 digit of year, %b -> Month name, %m -> Monthe number(1-12), %d -> Day, %H -> Hour, %M -> Minute, %S -> Second, %qx -> alphabetical-decimal conversion of yymmdd. %qX -> alphabetical-decimal conversion of HHMMSS. Beware defualt label-string should be always unique. So this format string should have both time part (%H+%M+%S or %qX) and date part (%y+(%b|%m)+%d or %qx). @end defvar @defvar YaTeX-ref-generate-label-function Function to generate default label string for unnamed \\label@{@}s. The function pointed to this value should take two arguments. First argument is LaTeX macro's name, second is macro's argument. Here is an example for using this value. @lisp (setq YaTeX-ref-generate-label-function 'my-yatex-generate-label) (defun my-yatex-generate-label (command value) (and (string= command "caption") (re-search-backward "\\\\begin@{\\(figure\\|table\\)@}" nil t) (setq command (match-string 1))) (let ((alist '(("chapter" . "chap") ("section" . "sec") ("subsection" . "subsec") ("figure" . "fig") ("table" . "tbl")))) (if (setq command (cdr (assoc command alist))) (concat command ":" value) (YaTeX::ref-generate-label nil nil)))) @end lisp @end defvar @node Sample definitions, Hook variables, All customizable variables, Lisp variables @comment node-name, next, previous, up @subsection Sample definitions @cindex prefix key stroke @cindex fill-prefix For instance, to change the prefix key stroke to @kbd{ESC}, and name of the user dictionary @file{~/src/emacs/yatexrc}, and set @code{fill-prefix} to single TAB character, add the following @code{setq} to @file{~/.emacs}. @lisp (setq YaTeX-prefix "\e" YaTeX-user-completion-table "~/src/emacs/yatexrc" YaTeX-fill-prefix " ") @end lisp @node Hook variables, Hook file, Sample definitions, Lisp variables @comment node-name, next, previous, up @subsection Hook variables @cindex hook variables More customizations will be done by the hook-function defined in hook-variable @code{yatex-mode-hook}. This is useful to define a shortcut key sequence to enter some environments other than @code{document} and @code{enumerate} etc. The following statement defines @code{[prefix] ba} to enter @code{\begin@{abstract@}} ... @code{=end@{abstract@}} immediately. @lisp (setq yatex-mode-hook '(lambda() (YaTeX-define-begend-key "ba" "abstract"))) @end lisp You should use functions @code{YaTeX-define-key}, or @code{YaTeX-define-begend-key} to define all the key sequences of yatex-mode. @node Hook file, , Hook variables, Lisp variables @comment node-name, next, previous, up @subsection Hook file @cindex hook file You can stuff all of YaTeX related expressions into a file named @file{yatexhks.el} if you have a lot of codes. YaTeX automatically load this file at the initialization of itself. Using @file{yatexhks.el} makes @code{yatex-mode-load-hook} unnecessary. @node Add-in functions, Add-in generator, Lisp variables, Customizations @comment node-name, next, previous, up @section Add-in functions @cindex add-in functions @cindex yatexadd.el You can easily define a function to input detailed arguments with completion according to La@TeX{} environments or commands. @c @node What is add-in functions?, , Add-in functions, Add-in functions @comment node-name, next, previous, up @subsection What is add-in functions? @cindex tabular When you input @code{tabular} environment, don't you think ``I want YaTeX to complete its argument toward my favorite one such as @code{@{|c|c|c|@}}...''? Yes, you can define the function to complete arguments for any environment and any La@TeX{} commands. @subsection Procedure Here is the procedure to define add-in functions. @enumerate @item Define the function @item Put the function into @file{yatexhks.el} @end enumerate @menu * How the add-in function works:: * How the function is called:: * Useful functions for creating add-in:: * Contribution:: @end menu @node How the add-in function works, How the function is called, Add-in functions, Add-in functions @comment node-name, next, previous, up @subsection How the add-in function works There are three types of add-in. @enumerate @item Option add-in @item argument add-in @item enclosing add-in @end enumerate @dfn{Option add-in} returns the La@TeX{}'s optional parameters such as optional strings after @code{\begin@{ENV@}}, optional strings between a section-type command and its first argument, and optional strings just after type maketitle-type command. The following illustrates the name of add-in functions, where underlined strings are generated by add-in functions. @display \begin@{table@}[ht] (Function name: YaTeX:table) ~~~~ \put(100,200)@{@} (Function name: YaTeX:put) ~~~~~~~~~ \sum_@{i=0@}^@{n@} (Function name: YaTeX:sum) ~~~~~~~~~~ @end display Obviously, the function name is decided by concatenating the prefix `YaTeX:' and La@TeX{} command's name. Another add-in type is @dfn{argument add-in}, which completes arguments for section-type commands. @display \newcommand@{\foo@}@{bar@} (Function name: YaTeX::newcommand) ~~~~ ~~~ @end display When the section-type command is inputted, the function named by 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 referring the value of its argument. @dfn{enclosing add-in} is for modifying and/or checking the region that will be enclosed by section-type commands via @kbd{[prefix] S}. An enclosing add-in function will be called with two arguments, beginning of the enclosed region and end of the region. Suppose you want to enclose the existing text @code{(a+b)/c} by @code{\frac@{@}}. @display a/c | | A B @end display You do set-mark-command at point A and then move to point B. Typing @kbd{[prefix] S} and input @code{frac} enclose the region like this; @display \frac@{a/c@} @end display Normally, the expression @code{a/c} is translated to @code{\frac@{a@}@{c@}}. An enclosing add-in is useful for modifying @code{/} to @code{@}@{}. @menu * Defining option-add-in:: * Defining argument-add-in:: * Defining enclosing-add-in:: @end menu @node Defining option-add-in, Defining argument-add-in, How the add-in function works, How the add-in function works @comment node-name, next, previous, up @subsubsection Defining `option add-in' If you want @code{@{|c|c|c|@}} for all @code{tabular} environment, @lisp (defun YaTeX:tabular () "@{|c|c|c|@}") @end lisp @noindent is enough. If you want more complicated format, define as below. @lisp (defun YaTeX:tabular () "@{@@@{\\vrule width 1pt\\ @}|||@@@{\\ \\vrule width 1pt@}@}") @end lisp @noindent Note that the character @code{\} must be described as @code{\\} in Emacs-Lisp. The next example reads the tabular format from keyboard. @lisp (defun YaTeX:tabular () (concat "@{" (read-string "Rule: ") "@}")) @end lisp @node Defining argument-add-in, Defining enclosing-add-in, Defining option-add-in, How the add-in function works @comment node-name, next, previous, up @subsubsection Defining `argument add-in' This section describes how to define the add-in function for @code{\newcommand}. The first argument of @code{\newcommand} begins always with @code{\}. The second argument is usually so complex that we can not edit them in the minibuffer. Here is the created function considering this. @lisp (defun YaTeX::newcommand (n) ;n is argument position (cond ((= n 1) ;1st argument is macro name (read-string "Command: " "\\")) ;initial input `\' ((= n 2) "") ;do nothing when reading arg#2 (t nil))) @end lisp Note that when the `argument add-in' function return `nil', normal argument reader will be called. @node Defining enclosing-add-in, , Defining argument-add-in, How the add-in function works @comment node-name, next, previous, up @subsubsection Defining `enclosing add-in' This section describes how to define the add-in function for text enclosed by @code{\frac@{@}}. When enclosing the text @code{5/3} by @code{\frac@{@}}, you might want to replace @code{/} with @code{@}@{}. Enclosing function @code{YaTeX::frac-region} is called with two arguments, beginning of enclosed text and end of enclosed text. The function is expected to replace @code{/} with @code{@}@{}. Here is an example expression. @lisp (defun YaTeX::frac-region (beg end) (catch 'done (while (search-forward "/" end t) (goto-char (match-beginning 0)) (if (y-or-n-p "Replace this slash(/) with `@}@{'") (throw 'done (replace-match "@}@{"))) (goto-char (match-end 0))))) @end lisp @node How the function is called, Useful functions for creating add-in, How the add-in function works, Add-in functions @comment node-name, next, previous, up @subsection How the function is called YaTeX calls the add-in functions for specified begin-type, section-type, and maketitle-type command, if any. `Option add-in' functions for begin-type are called when @code{\begin@{ENV@}} has been inserted, functions for section-type are called just before input of the first argument, and functions for maketitle-type is called after maketitle-type command has been inserted. `Argument add-in' functions are called at each entry of arguments for section-type commands. @node Useful functions for creating add-in, Contribution, How the function is called, Add-in functions @comment node-name, next, previous, up @subsection Useful functions for creating add-in Many add-in functions for typical La@TeX{} commands are defined in @file{yatexadd.el}. Those are also useful as references. Here are the short descriptions on useful functions, where [F] means function, [A] means arguments, [D] means description. @table @kbd @item [F] YaTeX:read-position @itemx [A] Character list which can show up in the brackets @itemx [D] Return the location specifier such as `[htb]'. When nothing is entered, omit [] itself. If the possible characters are "htbp", call this function as @code{(YaTeX:read-position "htbp")} @item [F] YaTeX:read-coordinates @itemx [A] Base prompt, X-axis prompt, Y-axis prompt (each optional) @itemx [D] Read the coordinates with the prompt ``BasePrompt X-axisPrompt:'' for X-axis, ``BasePrompt Y-axisPrompt:'' for Y-axis, and return it in the form of ``(X,Y)''. The default prompts are @code{Dimension}, @code{X}, @code{Y} respectively. @item [F] YaTeX:check-completion-type @itemx [A] One of the symbols: 'begin, 'section, or 'maketitle @itemx [D] Check the current completion type is specified one and cause error if not. The variable @code{YaTeX-current-completion-type} holds the symbol according to the current completion type. @end table @node Contribution, , Useful functions for creating add-in, Add-in functions @comment node-name, next, previous, up @subsection Contribution If you make your own pretty function and you let it be in public, please send me the function. I'm going to include it in the next release. @node Add-in generator, , Add-in functions, Customizations @comment node-name, next, previous, up @section Add-in generator First, don't forget to read the section of add-in functions @ref{Add-in functions}. If you easily understand how to define them, there's no need to read this section. But being not familiar with Emacs-Lisp, when you don't have clear idea what to do, this section describes how to get YaTeX make add-in function. There are two methods of generation. One is for fully interactive generator for beginners and another requires little knowledge of Emacs-Lisp. @subsection Generator for beginners The former generator is called by @center @kbd{M-x YaTeX-generate} @noindent strokes. All you have to do is follow the guidances. Defying them may cases the disaster (I wonder what is it???). So when you make some mistake, it is recommendable to type @kbd{C-g} and start afresh. @subsection Simple generator The latter generator is invoked by the next sequence. @center @kbd{M-x YaTeX-generate-simple} This generator can make both ``option add-in'' and ``argument add-in'' (@emph{refer the section add-in functions} @ref{How the add-in function works}), whereas @code{YaTeX-generate} cannot make ``argument addin''. For example, assume you have the LaTeX command as follows. @example \epsinput[t](250,50)@{hoge.eps@}@{plain@}@{Picture of foo@} (A) (B) (1) (2) (3) (A)Optional parameter to specify the position One of t(top), b(bottom), l(left), r(right) (B)Maximum size of frame (1)1st argument is filename of EPS file (2)2nd argument indicates plain do nothing frame make frame around image dframe make double-frame around image for included EPS file. (3)Caption for the picture @end example Now get start with generation. Typing @kbd{M-x YaTeX-generate-simple} brings the prompt: @display (O)ption? (A)rgument? @end display @subsubsection Generating ``option add-in'' @cindex option add-in Since (A), (B) above are optional argument, all we have to do to complete them is define the option add-in for them. Let's generate the function to complete (A). @display M-x YaTeX-generate-simple RET epsinput RET o @end display @noindent Typing as above leads the next prompt. @display Read type(1): (S)tring (C)omplete (F)ile ([)option (P)osition co(O)rd. (q)uit @end display @noindent This asks that ``Which type is the completion style of 1st argument?''. Here are the possible completion style. @table @code @item String read plain string @item Complete read with completion @item File read file name @item Option read optional string (if string omitted, omit [] too) @item Position read positional option (like [htbp]) @item Coord. read coordinates @item Quit quit from generating @end table Since (A) is the optional argument to specify the location of included EPS file, the completion style is @code{Position}, and the possible characters are t, b, l, and r. To tell these information to generator, operate as follows. @display Read type(1).... p Acceptable characters: tblr RET @end display (B) is coordinate. So its completion style is coOrd. We want a prompt meaning ``Maximum size'' when completion. @display Read type(2).... o Prompt for coordinates: Max size RET @end display That's all for optional argument. Select quit. @display Read type(3).... q @end display Then the generated option add-in function for \epsinput will be shown in the next window. @subsubsection Generating ``argument add-in'' @cindex argument add-in Next, create the argument add-in. The arguments for \epsinput are EPS file name, framing style, and caption string in sequence. @display M-x YaTeX-generate-simple RET epsinput RET a @end display Above key strokes bring the prompt that asks the number of argument. Answer it with 3. @display How many arguments?: 3 RET @end display Then the generator asks the completion style and prompt for completion. Answer them. @kbd{f} for FileName and prompt string. @display Read type(1).... f Prompt for argument#1 EPS file name RET @end display The second argument is one of selected symbol. So the completion type is @code{Completion}. @display Read type(2).... c Prompt for argument#2 Include style RET @end display Then all the candidates ready to be read. Type single RET after entering all. @display Item[1](RET to exit): plain RET Item[2](RET to exit): frame RET Item[3](RET to exit): dframe RET Item[4](RET to exit): RET @end display The following prompt asks whether the entered string must belong to candidates or not. In this case, since the argument must be one of @code{plain}, @code{frame}, and @code{dframe}, type @code{y}. @display Require match? (y or n) y @end display The last argument is the caption string for which any completion is needed. @display Read type(3).... s Prompt for argument#3 Caption RET default: Figure of RET @end display Finally we'll get the argument add-in in the next window. @subsection Contribution If you get your own pretty function and you let it be in public, please 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 @comment node-name, next, previous, up @chapter Etcetera The standard completion tables provided in @file{yatex.el} contain a few La@TeX{} commands I frequently use. This is to lessen the key strokes to complete entire word, because too many candidates rarely used often cause too many hits. Therefore always try to 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 @chapter Copying This program is distributed as a free software. You can use/copy/modify/redistribute this software freely but with NO warranty to anything as a result of using this software. Adopting code from this program is also free. But I would not do contract act. This software can be treated with: ``The 2-Clause BSD License'' (since 2017-09-09, yatex 1.80). Any reports and suggestions are welcome as long as I feel interests in this software. My possible e-mail address is `yuuji@@yatex.org'. (as of Sep.2017) And there is mailing list for YaTeX. Although the common language is Japanese, questions in English will be welcome. To join the ML, send the mail whose subject is `append' to the address `yatex@@yatex.org. If you have some question, please ask to `yatex-admin@@yatex.org'. The specification of this software will be surely modified (depending on my feelings) without notice :-p. @flushright HIROSE Yuuji @end flushright @bye Local variables: mode: texinfo fill-prefix: nil fill-column: 74 End: yatex1.81/docs/yatexgen.doc010044400037440000000000000124551303342261200150100ustar yuujiwheel----------------------------------------------------------------------------- 野鳥用付加関数を自動的に作ろう! ----------------------------------------------------------------------------- 【はじめに】 まず、yatexadd.doc には目を通して下さい。それを読んで、なにか独 自の関数をすぐに作りたくなったあなたには、このドキュメントも、 yatexgen.el も必要有りません。しかし、Emacs-Lisp をよく知らないた め、どのように作ってよいのかピンと来ない方のために、野鳥自身に付加 関数を自動的に作らせる時の説明をするのが、このドキュメントです。 ただ、自動的に作るわけですから、気の利いた関数などは作れません。 \documentstyle{} を入れる時に、オプション([twocolumn,12pt]とか)を 自動的にキーボードから読み込むようにする程度のものだけなので、それ 以上を望む場合は、ちゃんと yatexadd.el を参考にして、すごいのを作 りましょう:-)。 【作り方その1】 Emacs-Lispなんか全然知らないよ〜んという人向け: M-x YaTeX-generate ぺし あとは、画面に出て来る指示通りに操作して下さい。これを無視してい いかげんに操作すると、とんでもないことになります(なんだろう?)。失 敗した、と思ったら、^G して最初からやり直すのが無難です。 【作り方その2】 他の付加関数を見て何をやってるかの想像が付く人、あるいは Emacs-Lisp は知ってるが単に作るのが面倒な人向け: M-x YaTeX-generate-simple RET こっちでは追加型付加関数と引数型付加関数(yatexadd.docもちゃんと 読んでね;-)の両方が作れます(その1は追加型しか作れない)。 では、例として次のような LaTeX コマンドがあったとしましょう。 (実際にはないよー) \epsinput[t](250,50){hoge.eps}{plain}{ほげほげの絵} (A) (B) (1) (2) (3) (A)位置を指定するオプション引数(なくても良い) t(top) b(bottom) l(left) r(right) のどれかが入る (B)枠の最大の大きさ (1)第1引数は取り込むEPSファイル名 (2)第2引数は取り込む時に plain 何もしない frame 枠を付ける dframe 二重枠を付ける のどれかのスタイルを選べたりする (3)絵に付けるキャプションを指定 早速付加関数を作りましょう。M-x YaTeX-generate-simple とすると Making add-in function for (default ???): epsinput RET と聞いて来るので何用の付加関数を作るか答えます。さらに (o)追加型? (a)引数型? と、聞いて来るのでどちらを作るか答えます。ではそれぞれの場合につい て例を追ってみましょう。 (o)追加型付加関数を作る (A),(B)の部分はオプション引数なので、追加型付加関数で補完します。 (1)〜(3)は実際の引数なので引数型付加関数で補完します。では(A)を補 完するための関数を作りましょう。 M-x YaTeX-generate-simple RET epsinput RET o すると次のメニューが出ます。 Read type(1): (S)tring (C)omplete (F)ile ([)option (P)osition co(O)rd. (q)uit 「Read type(1)」というのは「1番目のオプションの補完スタイルはなあ に?」という意味です。補完スタイルには以下のものがあります。 String 普通の文字列を読み込む Complete いくつかの候補の中から読み込む File ファイル名を読み込む Option オプション引数を読む(省略すると[]がつかない) Position 場所指定オプションを読む([htbp] みたいなの) Coord. 座標を読み込む Quit おしまい さて(A)はEPSファイルを配置する場所指定オプションなので補完タイプは Position、さらにその候補は t, b, l, r のどれかなので、以下のように 操作します。 Read type(1).... p Acceptable characters: tblr RET 次の(B)は座標なので補完タイプは coOrd. 最大サイズと言う意味のプロ ンプトを出したいので次のようにします。 Read type(2).... o Prompt for coordinates: Max size RET もうオプション引数はないので、quitを選びます。 Read type(3).... q これで隣のウィンドウに \epsinput 用の追加型付加関数が生成されます。 (a)引数型付加関数を作る さて \epsinput の引数の種別は順に、EPSファイル名、枠付スタイル、 キャプション文字列でした。これらを読み込む(引数型)付加関数を作りま しょう。 M-x YaTeX-generate-simple RET epsinput RET a すると引数の数を聞いて来るのでそれに答えます。 How many arguments?: 3 RET すると第1引数について補完タイプを聞いて来るので、「ファイル名(f)」 を選び、ファイル名を読む時に出したいプロンプト文字列を入れます。 Read type(1).... f Prompt for argument#1 EPS file name RET 第2引数は複数候補から選択するので補完タイプは Completion。 Read type(2).... c Prompt for argument#2 Include style RET すると全候補の入力を促すので、順次入力し最後にRETを空打ちします。 Item[1](RET to exit): plain RET Item[2](RET to exit): frame RET Item[3](RET to exit): dframe RET Item[4](RET to exit): RET さらに補完候補以外の選択を認めるかを聞いて来るので、y か n で答え ます。この場合 plain, frame, dframe 以外は選べないので Require match? (y or n) y のように y と答えます。 最後の引数は単に文字列を読めば良いので、補完タイプは String。 「default:」ではミニバッファで入力する時にデフォルトで入力されてい る文字列を入れます。必要なければRETを空打ちします。 Read type(3).... s Prompt for argument#3 Caption RET default: の絵 RET これで隣のウィンドウに \epsinput 用の引数型付加関数が生成されま す。 【できあがり】 言われた通りに正しく指示を与えると、お望みのお手軽関数が出来上 がります。これを切り取って、~/yatexhks.el にでも放り込みましょう。 本当はこれも自動化しようと思ったのですが、これに失敗すると命がい くつあっても足りないので、やめておきました。第一それも面倒な人は、 野鳥なんか使っていないよね? 【最後に】 快適な関数を定義したなら、そしてそれを公開してもよいと思われたな ら、幸福感に浸るだけにして、決して筆者まで送ったりしないで下さい。 yatexgen が作るんだから、ろくな関数じゃないことは分かってます:-p。 広瀬雄二 yuuji@yatex.org yatex1.81/docs/yatexj010064400037440000000000002473641333006131600137370ustar yuujiwheelInfo file: yatexj, -*-Text-*- produced by `texinfo-format-buffer' from file `yatexj.tex' using `texinfmt.el' version 2.42 of 7 Jul 2006. START-INFO-DIR-ENTRY * YaTeX: (yatexj). Yet Another tex-mode for Emacs (Japanese). END-INFO-DIR-ENTRY  File: yatexj, Node: Top, Next: Intro, Prev: (dir), Up: (dir) * Menu: * Intro:: はじめに * Terminology:: マニュアル参照上の注意 * Main features:: 主な機能 * Installation:: インストール * Invocation:: プロセス起動 * %#notation :: * Completion:: 補完入力 * Local dictionary:: ローカル辞書 * Commenting out:: コメントアウト * Cursor jump:: カーソルジャンプ * Modifying/Deleting:: LaTeXコマンドの変更/削除 * Filling:: 桁揃え * Includeonly:: 勝手に includeonly * What column:: カラム位置ガイド * Intelligent newline:: おまかせ改行 * Usepackage cheker:: 先回りusepackage * Changing mode of YaTeX:: 野鳥動作モード変更 * Online help:: LaTeXオンラインヘルプ * Inclusion hierarchy browser:: ファイル分割階層構造の表示 * Cooperation with other packages:: 他パッケージとの連携 * Customizations:: カスタマイズ * Etc:: その他 * Copying:: 取り扱い * Concept Index:: 索引  File: yatexj, Node: Intro, Next: Terminology, Prev: Top, Up: Top はじめに ******** 野鳥は、GNU Emacs で LaTeX 用の文書を作成する時に pLaTeX などのタイ プセットコマンドや、プレヴューアの起動を Emacs 編集画面中から行えるよ うにすると共に、拡張性の高い種々の補完機能によりソーステキストの編集を 支援します。さらに LaTeX コマンドのオンラインヘルプによりマニュアルを 調べる手間を軽減します。 English manual *Note Top: (yatexe)Top.  File: yatexj, Node: Terminology, Next: Main features, Prev: Intro, Up: Top 本マニュアル参照上の注意 ************************ 本マニュアルでは以下の表記を用います。 * begin型コマンド `\begin{環境} 〜 \end{環境}'という形式のLaTeXコマンドを指します。 begin型コマンドを補完入力することをbegin型補完と呼びます。 * section型コマンド `\section{タイトル}'や`\mbox{内容}'のように引数を取るLaTeXコマン ドを指します。 * maketitle型コマンド `\maketitle'や`\tableofcontents'のように引数を取らないLaTeXコマン ドを指します。 * large型コマンド `{\large ...}' や `{\tt ...}' のようなフォント/サイズ指定子を指し ます。 * `[prefix]' 野鳥の機能を呼び出すためのプリフィクスキー。デフォルトでは`C-c'に 割り当てられているので、特に変更していない場合本マニュアルの `[prefix]' という表記は、`C-c' と読み換えてください。  File: yatexj, Node: Main features, Next: Installation, Prev: Terminology, Up: Top 主な機能 ******** * タイプセッタやプレヴューアなどの編集画面からの起動(`C-c t') * カーソル位置によらない固定リジョンの部分タイプセット * \includeonlyのワンタッチ更新 * エラー箇所への自動ジャンプ(`C-c '') * `\begin{}, \end{}, \section...' などの LaTeXコマンドの補完入力 (`C-c b', `C-c s', `C-c l', `C-c m') * 既に入力したテキストを環境やコマンド引数の中に取り込む括り補完(リ ジョン指定後に通常補完キー) * セクション区切り入力時の文書構造アウトライン表示 * セクションコマンドの一括シフト (*Note view-sectioning::) * 補完辞書の学習 * LaTeX の環境やコマンドに応じたガイド付き引数入力 * 野鳥にないガイド付き引数入力関数の自動生成(`yatexgen.el') * LaTeX コマンドの削除/変更(`C-c k', `C-c c') * ファイル間、`\begin'<->`\end'間、 `\ref'<->`\label'間、 `\cite'<->`\bibitem'ジャンプ(`C-c g') * 一括コメントアウト/アンコメントアウト(`C-c >', `C-c <', `C-c ,', `C-c .') * アクセント記号/数式環境用コマンド/ギリシャ文字の入力支援(`C-c a', `;', `/') * tabular/array環境のカラム位置ガイド * 標準的 LaTeX コマンドのオンラインヘルプ(`C-c ?', `C-c /') * ドキュメントのインクルード構造の視覚的表示とバッファ切り替え(`C-c d') * 補完入力したマクロに応じて必要な \userpackage を入れてくれる先回 りuserpackage * \labelを打つことはもう忘れよう! refやcite補完入力で自動生成します * 画像ファイルのドラッグ&ドロップによる自動 \includegraphics  File: yatexj, Node: Installation, Next: Invocation, Prev: Main features, Up: Top 起動法 ****** 野鳥起動のための設定 ==================== ~/.emacsに下の2項目を加えます。 (setq auto-mode-alist (cons (cons "\\.tex$" 'yatex-mode) auto-mode-alist)) (autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t) 次に野鳥の emacs-lisp ファイル群を置くディレクトリを load-path に加え ます。たとえば、 `~/src/emacs/yatex'に置くのであれば、 (setq load-path (cons (expand-file-name "~/src/emacs/yatex") load-path)) などとします。 以上の設定により、拡張子が .tex であるファイルを編集すると自動的に野 鳥がロードされます。野鳥が正常に起動できたときはモードラインの表示が 「やてふ」に変わります。 タイプセッタ/プレヴューア環境の設定 =================================== 利用する外部プログラムに関する以下の変数を確認し、必要なら正しい値に 変更します。 `tex-command' ... 起動するタイプセッタのコマンド名 `dvi2-command' ... 起動するプレヴューアのコマンド名 `NTT-jTeX' ... 改行+インデントによって、タイプセット後の字間が空いて しまうのを抑制する場合にtにする(古いNTT-jTeXで顕著に現れ る)。具体的には、fillするときに各行の終わりに%を付加する ようになる。 `YaTeX-kanji-code' ... 文書を作成する時の漢字コード `dviprint-command-format' ... ファイルの印刷に使われるコマンド列の書式 `YaTeX-dvipdf-command' ... DVIをPDFに変換するコマンド これらを変更する場合は、やはり`~/.emacs'にて、たとえば (setq tex-command "pdflatex") のようにしてください。どのような値をセットすれば良いかについては、 *Note All customizable variables::を参照してください。  File: yatexj, Node: Invocation, Next: %#notation, Prev: Installation, Up: Top latexコマンド起動 ***************** LaTeXソースの編集中、次のキー入力により、platex などのタイプセットプロ グラム(以後タイプセッタと呼ぶ)、プレヴューアなどの起動ができます。 `[prefix] t j' ... タイプセッタ(platex)起動 `[prefix] t r' ... タイプセッタ起動(領域指定) `[prefix] t e' ... 部分タイプセット&プレヴュー(ポイント位置の段落、環境 または数式モードのみをタイプセットして隣のバッファに組版 結果の画像を出す) `[prefix] t k' ... 動作中のタイプセッタの停止 `[prefix] t b' ... jbibtex起動 `[prefix] t i' ... makeindex起動 `[prefix] t d' ... タイプセット完了後dvipdfmx起動 `[prefix] t p' ... プレヴューア起動 `[prefix] t l' ... lpr(プリントアウト用)コマンド起動 `[prefix] t s' ... xdvi -remote でのサーチ * Menu: * Calling typesetter:: タイプセッタ起動 * Calling previewer:: プレヴューア起動 * Print out:: プリントアウト用コマンドの起動  File: yatexj, Node: Calling typesetter, Next: Calling previewer, Prev: Invocation, Up: Invocation タイプセッタ起動 ================ タイプセッタを起動すると、編集ウィンドウが2つに分割され、片方のウィ ンドウにタイプセット画面が表示されます。出力されるメッセージと連動しタ イプセットバッファは自動的にスクロールします。もし、途中でエラーが起こっ て止まってしまった場合にはタイプセットバッファに移り、(`C-x o') タイプ セッタの出している ? プロンプトに対して、`x' (処理の中断)などの指示を 送ることができます。エラーを修正する場合は、 `[prefix] '' `(prefix+アポストロフィ)' ... 直前のエラー発生行へジャンプ を入力することにより、タイプセッタがエラーを発生した行に移ることができ ます。また、タイプセッタの出力する overfull hbox などのウォーニング行 にも対応していますので、順次 `[prefix] '' を押すことにより、一つ前の ウォーニング発生行にジャンプしていきます。 もし、気になるエラー行があった場合は、タイプセットバッファで、エラー の表示されている行にカーソルを合わせスペースキーを押すと LaTeX ソース の対応する行にジャンプします。 領域タイプセット ---------------- ポイントとマークの間、あるいはテキスト中に埋め込んだ `%#BEGIN' と `%#END'の間の領域(*Note %#notation::)だけを切り取ってタイプセットする ことができます。この場合メインファイルのプリアンブルが一時ファイルのプ リアンブルとして使われます。したがってプリアンブルにないマクロ定義が領 域内にあるとエラーになります。領域タイプセットを使う場合、必ずマクロ定 義はプリアンブル(`\begin{document}'より前)に置くようにして下さい。一時 ファイルはメインファイルのあるディレクトリの`texput.tex'という名前で出 力されるので、上書きには注意してください。 環境タイプセット ---------------- `[prefix] te' を押すと、ポイント位置の最も内側の環境、または数式モー ド内の場合はその数式モード全体、あるいは環境がなければその段落が自動的 に領域選択されて、領域タイプセットを呼び出します。tabular環境や数式モー ドで複雑なものを作っている場合は確かめたい部分だけを確認できるので便利 です。Emacsが画像表示可能な場合は、部分タイプセットの結果を画像化して 隣のウィンドウに表示します。また、特定の環境で呼び出した場合は、環境内 の文字を書き換える度に自動的にプレビュー画像を更新します(on-the-flyプ レヴュー)。自動表示されない場合はプレヴューアで `texput.dvi'を開いたま まにしておけば修正と確認が素早くできるでしょう。 画像プレヴューの場合の大きさ(解像度)はデフォルトで200dpi(数式は 300dpi)です。dpiを変えたい場合はLaTeXソースのどこかに`%#PREVIEWDPI 150'のようにdpi値を書いてください。  File: yatexj, Node: Calling previewer, Next: Print out, Prev: Calling typesetter, Up: Invocation プレヴューア起動 ================ `[prefix] t p' によりプレヴューアの起動ができます。さらに、もしあな たが、-remote 機能つきのxdviを利用している場合は `[prefix] t s' を押す ことによりカーソル位置の文字列を検索してそのページを表示するようにすで に起動中のxdviに命令を送ります。これにより、現在編集中の箇所のタイプセッ ト結果を即座に見ることができます。  File: yatexj, Node: Print out, Prev: Calling previewer, Up: Invocation プリントアウト ============== `[prefix] t l'を押してプリントアウトを指示すると、出力開始/終了ペー ジを聞いてくるので、それぞれに答えます。これを省略したい時は、 universal-argument をつけ、 `C-u [prefix] t l' ... ページ確認省略lpr起動 のように起動してください。  File: yatexj, Node: %#notation, Next: Completion, Prev: Invocation, Up: Top %#記法 ****** 本文中に`%#'ではじまるキーワードを埋め込むことでタイプセッタ起動等の 制御をすることができます。 * Menu: * Changing typesetter:: タイプセット用コマンドの変更 * Splitting input files:: 入力ファイル分割 * Fix region for typesetting:: 領域の固定 * Special Filtering Region:: * lpr format:: プリントアウトコマンド用フォーマット * Controlling which command to invoke:: その他の起動コマンド制御 * Editing %# notation::  File: yatexj, Node: Changing typesetter, Next: Splitting input files, Prev: %#notation, Up: %#notation タイプセット用コマンド変更 ========================== 起動するコマンドを変えたい時は本文中に次のような行を書きます。 %#!jlatex-ntt NTT jTeX と、ASCII jTeX を使い分けたいような場合に便利でしょう。  File: yatexj, Node: Splitting input files, Next: Fix region for typesetting, Prev: Changing typesetter, Up: %#notation 入力ファイル分割 ================ また、章毎に別ファイルの .tex を作成している場合で、`main.tex'から `sub.tex' を `\include'しているような時は、`sub.tex'の任意の位置に次の ような行を埋め込みます。 %#!platex main.tex 上の例のようにコマンド名だけでなく引数も書いた場合には、全てをそのまま shell に渡すので次のように書けば、ghostview などをプレヴューアに使う時 に便利です。 %#!platex main && dvi2ps main.dvi > main なお、この行の最後の単語のピリオド以前を「メインファイル」のベースネー ムであると仮定します(上の2つの場合どちらも`main')。この行に記述した、 `%f'はメインファイル名に、 `%r' はメインファイルの拡張子を取り除いた部 分に置換されます。ただし、`%f,%r'を利用した場合、初回タイプセット時に 必ずメインファイル名の入力を促されます。 `[prefix] g' (*Note Cursor jump::参照) でのファイル間ジャンプを有効 に機能させるため、入力ファイル分割時には次のことに注意して下さい。 1. サブディレクトリを作って、その中にサブファイルを置くことはできる がサブディレクトリのサブディレクトリには置けない。 2. メインファイルからサブディレクトリ内のファイルを include する時には、 相対パス指定を用いて、 `\include{chap1/sub}'のように記述。 3. メインファイルが一つ上のディレクトリにある場合も、サブファイルに は%#!platex main.tex のように記述する(../mainではない)。  File: yatexj, Node: Fix region for typesetting, Next: lpr format, Prev: Splitting input files, Up: %#notation 領域の固定 ========== `[prefix] tr' の領域指定のタイプセットでは、とくに指定のないかぎり、 `C-SPC'でマークした位置と、ポイント(カーソル位置)の間を領域とみなしま すが、必ず決まった領域をタイプセットしたい場合は、その領域を %#BEGIN <渡したい領域> %#END のように`%#BEGIN'と`%#END'で囲み、カーソルを「`%#BEGIN'以降」に置いて ください。この時の領域決定規則をまとめると次のようになります。 1. カーソル位置よりバッファの先頭方向に`%#BEGIN'というキーワードがあ る場合 1. `%#BEGIN'よりバッファの末尾方向に`%#END'というキーワードが見つかっ た場合。 =>`%#BEGIN' から、その `%#END' のある位置まで。 2. `%#END' が見つからなかった場合。 =>バッファの最後尾まで。 2. カーソル位置よりバッファの先頭方向に `%#BEGIN' というキーワードが 見つからなかった場合。 =>マーク(`C-SPC'位置)とポイント(カーソル位置)の間の領域。 tabular 環境を何度も試行錯誤しているような場合は、`\begin'の前の行に `%#BEGIN' と書き、`\end' の次の行に `%#END' と書いておくと簡単に作表結 果をテストすることができます。また、長い .tex ファイルの後半に `%#BEGIN' を書いておけば、前半の部分は無視できます。このBEGINとENDの消 し忘れには十分ご注意下さい。  File: yatexj, Node: Special Filtering Region, Next: lpr format, Prev: Fix region for typesetting, Up: %#notation 自動外部フィルタ ================ たとえば、テキストファイルから画像を生成するようなツールに与えるソース をLaTeXソース中に埋め込み、その部分だけをツールの標準入力に渡すことが できます。そのためには以下のようなソースを文書中に書きます。 %#BEGIN FILTER{foo.pdf}{blockdiag -T %t -o %o} \if0 --- ....blah blah blah... ....blah blah blah... ....blah blah blah... --- \fi %#END この領域内で `[prefix] t e' をタイプすると、この例であればblahのある3 行が外部コマンド `"blockdiag -T pdf -o foo.pdf"' の標準入力に渡され、 結果として foo.pdf が生成されます。この特別なブロックは`[prefix] tb' の環境補完で、`.blockdiag' のようなピリオドで始まる特殊環境名を入力す ることで自動的に挿入されます。  File: yatexj, Node: lpr format, Next: Controlling which command to invoke, Prev: Fix region for typesetting, Up: %#notation lprフォーマット =============== まず、プリントアウト用コマンド列のフォーマットについて説明します。コ マンド列フォーマットは、3つの Lisp 変数によって表現されます。デフォル トの dvi2ps 用のフォーマットを例に説明します。 `(1)dviprint-command-format' `"dvi2ps %f %t %s | lpr"' `(2)dviprint-from-format' `"-f %b"' `(3)dviprint-to-format' `"-t %e"' 実際にプリントアウトする時は、(1)中の %s がファイル名に置き換えられ、 %f が(2)の内容、%t が(3)の内容に置き換えられます。その際に(2)の文字列 中の %b は「出力開始ページ」、(3)の文字列中の %e は「出力終了ページ」 に置き換えられます。もし、ページを指定しない時には、%f, %t 両方とも無 視されます。 この、dviprint-command-format を臨時に変えたい時は、LaTeX のソーステ キスト中の任意の場所に、 %#LPR dvi2ps %f %t %s | 4up -page 4 | texfix | lpr -Plp2 のように書いて下さい。プリントアウトするページ範囲をいちいち聞かせない ようにする時に %#LPR dvi2ps %s | lpr などとするのも便利かもしれません。  File: yatexj, Node: Controlling which command to invoke, Next: Editing %# notation, Prev: lpr format, Up: %#notation その他の起動コマンド制御 ======================== LaTeX 文書に関連するコマンドは以下の %# 記法で指定することができます。 `%#PREVIEW' ... Command line for DVI viewing ([prefix] t p) `%#BIBTEX' ... makeindexを行なうコマンドライン([prefix] t b) `%#MAKEINDEX' ... bibtexを行なうコマンドライン([prefix] t i) `%#DVIPDF' ... DVIからPDF変換を行なうコマンドライン([prefix] t d) `%#LPR' ... 印刷用のコマンドライン([prefix] t l) `%#PDFVIEW' ... PDFファイルを見るためのコマンドライン `%#IMAGEDPI' ... 即時プレヴュー(on-the-fly preview)用の画像のDPI 行頭がこれらのキーワードで始まる行をLaTeX文書の先頭付近に書いておけば、 それで指定したコマンドを起動できます。  File: yatexj, Node: Editing %# notation, Prev: Controlling which command to invoke, Up: %#notation %#記法自体の編集 ================ 以上のような`%#'で始まる各種制御記法を編集するためには `[prefix] %' ... `%#'記法編集メニュー を押します。 !)Edit-%#! B)EGIN-END-region L)Edit-%#LPR というメニューが出て来るので、`%#!'に続くコマンドを変更したい時には `!'を、`%#LPR'で lpr フォーマットを変えたい時は`l'を、あらか じめ設定したリジョンを `%#BEGIN' 〜 `%#END' で括りたい時は、 `b'を押します。`b'を選んだ時には、それまでバッファ中に置かれていた `%#BEGIN', `%#END' が自動的に消去されます。  File: yatexj, Node: Completion, Next: Local dictionary, Prev: %#notation, Up: Top 補完入力 ******** LaTeX での環境名などは、野鳥の補完機能を利用して能率的に入力すること ができます。 * Menu: * begin型補完:: * section型補完:: * large型補完:: * maketitle型補完:: * Arbitrary completion:: 随時補完 * end補完:: * Accent mark completion:: アクセント記号補完 * Image completion:: 数式記号イメージ補完 * Greek letter completion:: ギリシャ文字補完 * Inserting parens::  File: yatexj, Node: begin型補完, Next: section型補完, Prev: Completion, Up: Completion begin型補完 =========== `\begin{env}...\end{env}'の様な形式の入力の補完をbegin型補完と呼ぶこ とにします。begin 型補完は、 `[prefix] b' ... begin 型補完開始(標準では `C-c b') で始まります。頻繁に用いられる次の LaTeX 環境の補完は、[prefix] `b'に 続く次の1文字を入力するだけで、`\begin{xxx}...\end{xxx}'を完成させます。 `[prefix] b c' ... `\begin{center}...\end{center}' `[prefix] b d' ... `\begin{document}...\end{document}' `[prefix] b D' ... `\begin{description}...\end{description}' `[prefix] b e' ... `\begin{enumerate}...\end{enumerate}' `[prefix] b E' ... `\begin{equation}...\end{equation}' `[prefix] b i' ... `\begin{itemize}...\end{itemize}' `[prefix] b l' ... `\begin{flushleft}...\end{flushleft}' `[prefix] b m' ... `\begin{minipage}...\end{minipage}' `[prefix] b t' ... `\begin{tabbing}...\end{tabbing}' `[prefix] b T' ... `\begin{tabular}...\end{tabular}' `[prefix] b ^T' ... `\begin{table}...\end{table}' `[prefix] b p' ... `\begin{picture}...\end{picture}' `[prefix] b q' ... `\begin{quote}...\end{quote}' `[prefix] b Q' ... `\begin{quotation}...\end{quotation}' `[prefix] b r' ... `\begin{flushright}...\end{flushright}' `[prefix] b v' ... `\begin{verbatim}...\end{verbatim}' `[prefix] b V' ... `\begin{verse}...\end{verse}' 上記のもの以外の環境名は Emacs の持つインクリメンタルな補完機能を用 いて入力します(上記の環境名も以下の補完入力可能)。 `[prefix] b SPC' ... begin 型補完入力 `[prefix] b SPC' と入力すると、最下行のミニバッファに Begin environment(default document): と表示されます。ここで、何も入れずにリターンキーのみ押すと、括弧内に出 ているデフォルトの環境名が入力されますが、適当な環境名を入力すると、 `\begin{環境名} … \end{環境名}'が文書中に挿入されます。ミニバッファで 環境名を入力するときに、環境名の頭文字を入力し「スペース」をたたくと、 一致する環境名が内部テーブルに存在した場合、正しい環境名に補完されるの で、入力の手間が省けます。内部テーブルに存在しない環境名を入力した時は ユーザ専用のテーブルに登録され、さらにそのテーブルを自動的に、ユーザ辞 書(デフォルトでは `~/.yatexrc')に保存します。 さらに、特定の環境を補完入力した時にはその環境で必ず用いられるエントリ を自動挿入します(例: `itemize'環境における`\item'など)。挿入されたエン トリが不要な場合にはundoによって消去して下さい。 既に書いたテキストを環境で括る ------------------------------ ところで、最初に書いてしまったブロックを後から、itemize 環境の中 に閉じこめたいと思うことがありますが、そのようなときは、あらかじめ 閉じこめたい段落をマークして、begin 型補完の各コマンドの `[prefix]' の次の『小文字の 'b'』 を『大文字』に変えて起動して下さい。(または、 `C-u' を先に打ち、universal argument をつけても可能です) 例えばあるパラグラフを description 環境の中に入れたいときは、そのパ ラグラフをマークしてから、補完機能を呼び出してください(description環境 の場合は `[prefix] b D')。 選択された領域を括ります。ただしこれは `transient-mark-mode' が t (Emacsの標準)になっている場合のみで、普段 `transient-mark-mode' を `nil' にしている場合は、 補完キー前に `universal-argument' 指定(`C-u') をタイプしてから `[prefix] b D' など、補完キーを タイプすれば括り補完になります。 なおEmacs22以降であれば `transient-mark-mode' 無効時も `set-mark-command' (`C-space')の連打で一時的に `transient-mark-mode' が有効になります。  File: yatexj, Node: section型補完, Next: large型補完, Prev: begin型補完, Up: Completion section型補完 ============= `\section{目的}' のような形式の入力の補完を section 型補完と呼ぶこと にします。section 型補完は、 `[prefix] s' ... section 型補完 で実行します。`[prefix] s' を入力するとミニバッファに、 (C-v for view-section) \???{} (default documentclass): というプロンプトが現れるので、そこで `section' のような LaTeX コマンド 名を入力します。ここでもリターンキーのみで括弧内のデフォルト値が選択さ れるほか、`chapter'などのような頻度の高い名称入力にはスペースキーによ る補完機能が有効です。 次に、{}の中身の入力を促す、 \section{???}: というプロンプトが現れるので、セクションのタイトルなどを入力します。た とえば、 (C-v for view-section) \???{} (default documentclass): section \section{???}: 目的 のように入力した場合は、文章中に \section{目的} が挿入され、 (C-v for view-section) \???{} (default section): vspace* \vspace*{???}: のように{}の中身を省略したときは、 \vspace*{} だけが挿入され、改行はせずカーソルは自動的に中括弧の内側に移動します。 * Menu: * 2個以上の引数をとる section型コマンド:: * Enclose section-type command:: 括り補完 * Recursive completion:: 再帰補完 * view-sectioning:: セクション区切りのアウトライン表示 * label-generation:: ラベル自動生成  File: yatexj, Node: 2個以上の引数をとる section型コマンド, Next: Enclose section-type command, Prev: section型補完, Up: section型補完 2個以上の引数をとる section型コマンド ------------------------------------- ところで、`\addtolength{\topmargin}{8mm}' などのように、引数を二つ以 上取る LaTeX コマンドがあります。このようなコマンドの補完入力には、 section 型補完呼び出しに引数を付けてください。例えば上の`addtolength' の例であれば、引数2を指定します。つまり、 C-u 2 [prefix] s (または、ESC 2 [prefix] s) と section 型補完を呼び出した後、 (Ctrl-v for view-section) \???{} (default vspace*): addtolength \addtolength{???}: \topmargin Argument 2: 8mm のように入力してください。最初の addtolength の部分と、第一引数である \topmargin の入力は当然スペースによる補完入力が可能です。ユーザ辞書に 登録される LaTeX コマンドには、この引数の数も学習されるので、最初の補 完の時引数の数を指定して起動しておけば、以後の補完時には、記憶された個 数だけ引数を聞いて来るようになります。あとで引数の個数を変えたい時は、 再び `C-u' を用いて個数を指定し直すことで、自動的に辞書中の引数の個数 の部分を更新します。  File: yatexj, Node: Enclose section-type command, Next: Recursive completion, Prev: 2個以上の引数をとる section型コマンド, Up: section型補完 既に書いたテキストを括る ------------------------ また、section型補完機能の呼び出し時に領域選択状態にしておくと 領域内のテキストを section 型コマンドの第一引数として括ります。 これも普段 `transient-mark-mode' を `nil' にしている場合は `C-u' のあとに補完キーをタイプすれば強制的に括り補完になります。  File: yatexj, Node: Recursive completion, Next: view-sectioning, Prev: Enclose section-type command, Up: section型補完 再帰補完 -------- 高度な使い方になるかもしれませんが、section型補完の引数の入力時にさ らに補完入力を利用することができます(section/large/maketitle型に限る)。 section型コマンドの引数に更に LaTeX コマンドが来る場合にはミニバッファ で野鳥の補完キーを再帰的に入力することで引数の入力も効率的に行なえます。  File: yatexj, Node: view-sectioning, Next: label-generation, Prev: Recursive completion, Up: section型補完 セクション区切りのアウトライン表示 ---------------------------------- 通常のsection型補完の時にミニバッファで`C-v'を押すと現在存在するセク ション区切りコマンド全てを `*Sectioning Lines*'というバッファに一覧表 示します(「<<--」のついている行がもっとも近いセクション区切り)。この時 ミニバッファで`C-p', `C-n' を押すと`part', `chapter', ..., `subparagraph' のコマンドが論理階層の高さにしたがって上下します。また、 `C-v', `M-v' を押すとセクション区切り一覧バッファがスクロールし、数字 の`0'〜`7'を押すとある高さ以上のセクション区切りだけを選んで表示します (実際にやって見れば分かります)。 `*Sectioning Lines*'バッファは、 `M-x YaTeX-section-overview' ... セクション区切り一覧バッファを生成 で作成することができます。このバッファを選択し任意の行でスペースを押す と、該当するセクション区切りのある本文中の場所にジャンプします。さらに、 同バッファで `u' を押すと、ソーステキストの対応するセクションコマンド が一階層上がり(例: subsection が section に変わる)、`d'を押すと一階層 下がります。`*Sectioning Lines*'バッファにあるセクション区切りの行をマー クしておいて`U'を押すとリジョン内のものに対応するソーステキストのセク ションコマンドすべてが一階層上がり、`D'を押すと下がります。セクション 区切り一覧バッファで利用できるキーコマンドには以下のものがあります。 `SPC' ... 対応するソース行へジャンプ `.' ... 対応するソース行を表示 `u' ... カーソル位置に対応するセクションコマンドを一階層上げる `d' ... カーソル位置に対応するセクションコマンドを一階層下げる `U' ... マークしたセクションコマンドを一階層上げる `D' ... マークしたセクションコマンドを一階層上げる `0〜6' ... レベル n 以下のセクションコマンドを隠して表示  File: yatexj, Node: label-generation, Prev: view-sectioning, Up: section型補完 ラベル自動生成 -------------- `\ref{}' や `\cite{}' マクロをsection型補完で入れた場合参照先となり 得るものを全て探してメニューにして選択できます。参照先には`\label{}'を つけておく必要はありません。もしあれば、そのラベルを使い、なければその 場で参照先に`\label{}'を作らせてくれます。ラベル名を考えるのは苦痛に感 じるものです。全てのカウンタにラベルをつけるのもたいへんです。もうラベ ル名に何をつけるか、ラベルをつけるかつけまいか、などということは忘れま しょう! ラベルを打つべき項目の選択の際には、可能性のあるすべてのカウンタが表示 されます。これを「数式のみ」のように種別で絞りたいときは以下のキーコマ ンドが利用できます。 `M-a' ... 絞り込みを解除してすべてのカウンタを表示 `M-c' ... キャプションのみを表示 `M-e' ... 番号のつく数式のみを表示 `M-i' ... 番号つき箇条書のみを表示 `M-s' ... セクションのみを表示 `M-m' ... その他のカウンタのみを表示  File: yatexj, Node: large型補完, Next: maketitle型補完, Prev: section型補完, Up: Completion large型補完 =========== `{\large }' のような形式の補完を large 型補完と呼ぶことにします。 `[prefix] l' ... large 型補完開始 がlarge型補完の開始です。`[prefix] l' を押すと、ミニバッファに {\??? } (default large): と表示されるので、上記のものと同じ要領で補完入力して下さい。補完候補に 用意されているのは、`footnotesize' や `huge' のような文字サイズ指定子 と、`bf'や`dg'のようなフォント指定子です。 既に書いた文字を括る -------------------- また、begin型補完の時と同様、先に書いてしまった一連の文章の文字のサ イズを変えたいと思う時がありますが、そのような時は、サイズや大きさを変 えたい文字の範囲をマークしてからlarge型補完を呼んでください。  File: yatexj, Node: maketitle型補完, Next: Arbitrary completion, Prev: large型補完, Up: Completion maketitle型補完 =============== `\maketitle' の形式の補完を maketitle 型補完と呼ぶことにします。 `[prefix] m' ... maketitle 型補完開始 で、maketitle 型補完を開始します。補完の要領は今までのものとまったく同 じです。LaTeX 用のコマンド名が補完候補として用意されています。  File: yatexj, Node: Arbitrary completion, Next: end補完, Prev: maketitle型補完, Up: Completion 随時補完 ======== さて、今まで述べた典型的な LaTeX コマンド形式の補完入力を用いずに、 今入力しようとしている LaTeX コマンドを文書中の任意の位置で随時補完す ることもできます。LaTeX コマンド(先頭が\で始まる)を入力している途中で、 `[prefix] SPC' ... 随時補完 を入力すれば、全ての補完候補の中から一致するものが選ばれカーソル位置に 挿入されます。  File: yatexj, Node: end補完, Next: Accent mark completion, Prev: Arbitrary completion, Up: Completion end補完 ======= 現在開いたままの環境名を自動的に検出し、`\end{環境名}'を挿入します。 begin 型補完を用いれば環境の閉じ忘れはないのですが、時にはついつい手で `\begin{環境名}' を入れてしまい、悲しい思いをすることがあります。その ような時には気にせず続けて文章を入力し、しかるのちに `[prefix] e' ... end 補完 とすることで、現在開いている環境名で \end{} が補われます。  File: yatexj, Node: Accent mark completion, Next: Image completion, Prev: end補完, Up: Completion アクセント記号補完 ================== 欧文のアクセント記号(`\`{o}'など)を入力する時は、 `[prefix] a' ... アクセント記号入力 を押すと、ミニバッファに 1:` 2:' 3:^ 4:" 5:~ 6:= 7:. u v H t c d b というメニューが出て来るので、数字、または対応する記号/英字を入力して 下さい。すると編集バッファに、 \`{} が現われ、カーソルが{}内に位置するので、さらに一文字入力する事で、 \`{o} が完成され、カーソルは{}の外に戻ります。  File: yatexj, Node: Image completion, Next: Greek letter completion, Prev: Accent mark completion, Up: Completion 数式記号イメージ補完 ==================== 主に数式モードで使用される、矢印やΣなどの記号を擬似的に表現するキー入力 で、LaTeX コマンドを入力できます。これは野鳥自身の「数式モード」でのみ 動作します。野鳥はカーソルがTeXの数式環境の中にある時に`;'や、 `:'に特殊な機能を持たせます。 さて、例えば、←(leftarrow)をASCII文字だけで表現する場合、一般的には 「<-」のようにしますが、これを利用して、数式記号イメージ入力モードで `\leftarrow'を入力するには、`;'(セミコロン)を打ってから`<-'と入力しま す。同様に、長い矢印←-(long-leftarrow) をASCII文字だけで表現する場合 「<--」とするので、`\longleftarrow'を入力するためには、`;<--'と入力し ます。あるいは無限大記号をASCII文字だけで表現する時は「oo」のようにす ることから、`\infty' を入力する時は、`;oo'とキー入力します。 これらの操作をまとめると次のようになります。 INPUT 入力される LaTeX コマンド ; < - `\leftarrow' ; < - - `\longleftarrow' ; < - - > `\longleftrightarrow' ; o `\circ' ; o o `\infty' いずれの場合も、イメージ入力を行っている途中で望みのものがバッファに 表示されたなら、そこでイメージ入力を止めて次の編集動作に移っても構いま せん。 数式環境中で`;'自身を入力するには`;;'のようにします。イメージ入力の 途中でTABを押すと、それまで入力した文字で始まるもの一覧が表示されます。 ここで目的の LaTeX コマンドまでカーソルを移動し再度TABを押すことでその LaTeX コマンドがバッファに挿入されます。 どのキー入力にどの記号が対応しているか全て知りたい時は、`;'を押した 直後にTABを押してください。以下の例は、`;<'と押した後にTABを押したもの です。 KEY LaTeX sequence sign < \leq ≦ << \ll 《 <- \leftarrow ← <= \Leftarrow <= 左から[入力キー]、[対応する LaTeX コマンド]、[(擬似)記号図示]、という 順でメニューが出て来るので、よく使うものを覚えておくと良いでしょう。も のによってはASCII文字で表現することが困難なので、あまり覚えやすいキー 並びではないものがあるでしょうから、そのような場合は \maketitle 型補完 で入力するか、以下に述べる対応表の設定を行って単純なキー並びのものを設 定すると良いでしょう。 入力キーと LaTeX コマンド、記号の対応表を個人的に設定したい場合は Emacs-Lisp 変数 `YaTeX-math-sign-alist-private' に定義してください。そ の内容とデフォルトのものを合わせたものが対応表として使用されます (privateの方が優先される)。なお、この変数の構造については `yatexmth.el' を参照してください。  File: yatexj, Node: Greek letter completion, Next: Inserting parens, Prev: Image completion, Up: Completion ギリシャ文字補完 ================ もう一つ、数式環境中で`:'を押すとギリシャ文字入力モードに入ります。 `:'を押した直後に`a'を押すと`\alpha'が、`g' を押すと `\gamma'が、など アルファベットに対応したギリシャ文字が挿入されます。操作方法は;の数式 記号補完とまったく同じです。まずは`:'の直後にTABを押してどのアルファベッ トにどのギリシャ文字が対応しているか調べてみてください。 `;'と`:'を数式環境中で押しているにもかかわらず、イメージ補完が働かな い場合は、`C-u ;'のように universal-argument をつけてキーを押すことに より、強制的にイメージ補完に入ることができます。また、この時にどのよう な状態で数式環境内判定に失敗したかをご連絡下さい。  File: yatexj, Node: Inserting parens, Prev: Greek letter completion, Up: Completion 括弧入力補助 ============ 3種類ある括弧 () {} [] の開き括弧を入れたときに閉じ括弧を自動的に入 れます。`\' の直後にの `[' を入れると行を分けてインデントを揃え、数式 入力に備えます。その他 LaTeX のマクロに応じて括弧の釣合の取れた状態に 導きます。開き括弧そのものを1つだけ入れたいときは `C-q' でクォート入力 するか、`[prefix] w m' で修正モードをOFFにしてください。 領域選択してから開き括弧を入れるとその領域をその種類の括弧で括ります。  File: yatexj, Node: Local dictionary, Next: Commenting out, Prev: Completion, Up: Top ローカル辞書 ************ 補完入力用の候補は三種類の辞書から構成されています。一つは`yatex.el' に組み込まれた「標準辞書」、もう一つはユーザが個人的に常用するコマンド を保存する「ユーザ辞書」、そしてもうひとつはあるディレクトリでのみ有効 なコマンドを保存する「ローカル辞書」です。 補完入力時に新しい単語を入れた場合に、その単語をどの辞書に入れるか聞 いて来ます。 `foo' is not in table. Register into: U)serDic L)ocalDic N)one D)iscard というプロンプトに対し、`u'と答えると「ユーザ辞書」を、`l'と答えるとロー カル辞書を更新し、`n'と答えると辞書ファイルは更新せず現在のEmacsセッショ ンのみ有効な単語とし、`d'と答えると新たな単語を学習せずに捨てることに なります。 もし、ローカル辞書の機能はいらず、全てユーザ辞書の更新のみでよいと言 う場合には`~/.emacs'などで、 (setq YaTeX-nervous nil) として下さい。  File: yatexj, Node: Commenting out, Next: Cursor jump, Prev: Local dictionary, Up: Top コメントアウト ************** LaTeXの編集には試行錯誤がつきものです。ある部分を一括でコメントアウ トしたり、コメントを外したりしたいことがあります。 `[prefix] >' ... リジョンを % でコメントアウト `[prefix] <' ... リジョンの % のコメントを外す は、あらかじめ設定したリジョンに対しての操作、 `[prefix] .' ... 現在のパラグラフをコメントアウト `[prefix] ,' ... 現在のパラグラフのコメントを外す は、カーソルの位置するパラグラフ全体に対しての操作です。なお、ここでい う「パラグラフ」は (`mark-paragraph') 関数によりマークされる範囲を指し ます(標準設定で`ESC h'にバインドされている)。なお、既に`%'でコメントア ウトされているパラグラフに対して繰り返しパラグラフのコメントを使用した 場合の動作は保証しませんので御注意ください。 さて、文章に対してだけでなく、時には`\begin', `\end' 自体に対 してもコメントアウトの操作をしたいときがあります。このようなときは、 `\begin{}' あるいは `\end{}' の行にカーソルを合わせ、 `[prefix] >' ... `\begin{}'〜`\end{}' 全てコメントアウト `[prefix] <' ... `\begin{}'〜`\end{}' 全てコメントを外す とすることで、`\begin〜\end'で囲まれる環境全てに対してコメント操作し、 `[prefix] .' ... `\begin{}' と `\end{}' をコメントアウト `[prefix] ,' ... `\begin{}' と `\end{}' のコメントを外す は、対応する `\begin' と `\end' 2行だけを、コメント操作の対象とします。 リジョンをコメントアウトしようとして、マークを設定したのちにカーソルを 移動し`[preifx] >' を押してもカーソルが `\begin{}' の上にあると `\begin{}'〜`\end{}'モードでコメント機能が働いてしまうので注意して下さ い。  File: yatexj, Node: Cursor jump, Next: Modifying/Deleting, Prev: Commenting out, Up: Top カーソルジャンプ **************** * Menu: * 対応オブジェクトへのジャンプ:: * お絵描きツール起動:: * メインファイルへのジャンプ:: * 環境を単位としたジャンプ:: * 最後の補完位置へのジャンプ::  File: yatexj, Node: 対応オブジェクトへのジャンプ, Next: お絵描きツール起動, Prev: Cursor jump, Up: Cursor jump 対応オブジェクトへのジャンプ ============================ 文書中のいろいろな場所で `[prefix] g' ... 対応するオブジェクトにジャンプ を押すことにより、カーソル位置のLaTeXコマンドに対応する場所にジャンプ します。対応関係が存在すると解釈されるコマンドには以下のものがあります。 * `\begin{}' ←→ `\end{}' * `%#BEGIN' ←→ `%#END' * 画像ファイルの取り込みマクロ → 対応するviewer/お絵かきツール起動 * `\label{}' ←→ `\ref{}' * `\include(\input)' → 対応するファイル * `\bibitem{}' ←→ `\cite{}' `\begin{}' か `\end{}' の行で`[prefix] g'を押すことに より、対応する`end/begin'の行にジャンプします。もちろん対応するものが ない場合はエラーになります。またこれは、領域固定のための `%#BEGIN' と `%#END' のペアに対しても同様に動作します。なお、`label/ref'や `cite/bibitem'対応するものが別ファイルにある時は、ジャンプ先となるファ イルがオープンされていなければなりません。*Note %#notation::. メインの .tex ファイルの `\include{chap1}' などにカーソルを合わせ、 `[prefix] g' を押すと、`chap1.tex' にジャンプします。 また、 `[prefix] 4 g' ... 別ウィンドウで対応オブジェクトにジャンプ を押すと、対応するオブジェクトへのジャンプを別ウィンドウで行います。た だし、この機能は `begin/end', `%#BEGIN/%#END' 間のジャンプに対しては (意味がないと思われるので)機能しないので注意してください。  File: yatexj, Node: お絵描きツール起動, Next: メインファイルへのジャンプ, Prev: 対応オブジェクトへのジャンプ, Up: Cursor jump お絵描きツール起動 ================== 上記の「画像ファイルの取り込みマクロ」とは、例えば `\epsfile{file=foo}' のような挿絵取り込みコマンドのことで、この行にカー ソルを合わせて`[prefix] g'を押すとその画像ファイルの元となったファイル を対応するお絵描きツールを起動してオープンします。起動するツールの判定 は以下のようになされます。 1. カレント行が変数 `YaTeX-processed-file-regexp-alist' に定義されて いる正規表現のいずれかとマッチしたら、ファイル名に相当する部分を \\(\\)から抜き出して覚えておく(何番目の\\(\\)かは変数の各リストの cdr 部に入れておく)。マッチしなければ何もしない。 2. 行末に、変数 `YaTeX-file-processor-alist' に登録されているコマン ドが「%コマンド」 のように書いてあれば強制的に「コマンド ファイル 名.拡張子」を起動。 3. なければ、変数 `YaTeX-file-processor-alist' の各リストのcdr部に入っ ている拡張子を「ファイル名」の後ろに足したファイルが存在するか順 次調べて、存在した場合car部に入っているコマンドを起動する。 4. 以上どれかにマッチしなければあきらめる。 変数 `YaTeX-file-processor-alist' と変数 `YaTeX-file-processor-alist' の設定方法についてはそれぞれの変数について describe-variable して説明 を読んで下さい。うまく設定すると、画像ファイルにかぎらず、任意の形式の ファイルを任意のプロセッサで処理するコマンドを簡単に呼び出すことができ ます。  File: yatexj, Node: メインファイルへのジャンプ, Next: 環境を単位としたジャンプ, Prev: お絵描きツール起動, Up: Cursor jump メインファイルへのジャンプ ========================== `chap1.tex'のようなサブファイルで、 `[prefix] ^' ... メインファイルにジャンプ `[prefix] 4 ^' ... 別ウィンドウでメインファイルにジャンプ を押すと、メインファイルの編集バッファに切替えます。もし、メインファイ ルをオープンしていない場合は、カレントディレクトリから探して自動的にオー プンします。  File: yatexj, Node: 環境を単位としたジャンプ, Next: 最後の補完位置へのジャンプ, Prev: メインファイルへのジャンプ, Up: Cursor jump 環境を単位としたジャンプ ======================== さらに現在の環境を単位として機能するコマンドに以下のものがあります。 `M-C-a' ... 環境の先頭(`\begin')へジャンプ `M-C-e' ... 環境の末尾(`\end')へジャンプ `M-C-@' ... 環境全体をマーク 上記のコマンドは通常の`[prefix]'キーではなく`META'キーをプリフィクスと して機能するのでご注意下さい。  File: yatexj, Node: 最後の補完位置へのジャンプ, Prev: 環境を単位としたジャンプ, Up: Cursor jump 最後の補完位置へのジャンプ ========================== 野鳥は補完入力した位置を常にレジスタ `3'に保存しています。入力途中で如 何なるファイルの如何なる位置に行ったとしても、`C-x j 3'(`jump-to-register')を使って直ちに最後の補完入力位置に戻ることができ ます。  File: yatexj, Node: Modifying/Deleting, Next: Filling, Prev: Cursor jump, Up: Top 変更/削除 ********* 既に入力されている LaTeX コマンドの変更/削除のために以下の機能が用意 されています。 `[prefix] c' ... カーソル位置の LaTeX コマンドの変更 `[prefix] k' ... カーソル位置の LaTeX コマンドの削除 これらのコマンドは、コマンドを起動する場所によって動作を決定するので注 意して下さい。 * Menu: * Changing LaTeX command:: LaTeX コマンドの変更 * Killing LaTeX command:: LaTeX コマンドの削除  File: yatexj, Node: Changing LaTeX command, Next: Killing LaTeX command, Prev: Modifying/Deleting, Up: Modifying/Deleting LaTeX コマンドの変更 ==================== 変更したい LaTeX コマンドにカーソルを合わせて `[prefix] c' を押すとそのコマンドを補完入力などを用いて手軽に変えることができます。 `[prefix] c' で変更できるコマンドには以下のものがあります。 * `begin/end' の環境名 * section型コマンドのコマンド名 * section型コマンドの引数 * section型コマンドのオプションパラメータ([]で囲まれたもの) * large型コマンド * (イメージ補完で入力可能な)数式モード専用のmaketitle型コマンド 変えたいsection型コマンドの引数がさらに LaTeX コマンドを含む場合は、 その引数を囲む中括弧の上で `[prefix] c' を押すことで中のコマンドを変更 対象判定から除外することができます。  File: yatexj, Node: Killing LaTeX command, Prev: Changing LaTeX command, Up: Modifying/Deleting LaTeX コマンドの削除 ==================== `[prefix] k' は起動する位置により次のような動作を行います。 起動位置 動作 \begin, \endの行 `\begin\end'ペアの削除 %#BEGIN, %#END の行 %#BEGIN,%#ENDペアの削除 section型コマンドの上(中) section型コマンドの削除 フォント指定括弧の上 フォント指定の削除 括弧の上 対をなす括弧の削除 `\begin, \end' および `%#BEGIN, %#END' を削除する場合、`\begin, \end' や `%#BEGIN, %#END' の存在する行はまるごと削除されるので、それらの一行 に `\begin' などを二つ以上連ねて書かないように注意してください。上記の ものはすべて本文を囲う「容器」を削除するように働きますが、 universal-argument (`C-u') を打った後で`[prefix] k'をタイプすると、そ れぞれの「容器」に含まれる「中身」も一気に削除します。以下の例を参考に して下さい。 元のテキスト: [prefix] k C-u [prefix] k 本文\footnote{脚注}です。 本文脚注です。 本文です。 ↑(カーソル位置)  File: yatexj, Node: Filling, Next: Includeonly, Prev: Modifying/Deleting, Up: Top 桁揃え ****** itemの桁揃え ============ itemize 環境中にある`\item'の項目(文章)が複数行に渡る場合に、項目の 先頭を桁揃えしたい場合には、 `M-q' ... 桁揃え によって、その item のインデントの深さに応じて fill されます。なお、古 いNTT jTeX を使用している場合には、Lisp 変数`NTT-jTeX'を`t'にセットし て下さい。 このとき、変数`YaTeX-item-regexp'の値(標準では `"\\\\item"')を 項目指定コマンドの正規表現として検索に使用します。itemize 環境で、独自のコ マンドを定義して項目を列挙している場合(例えば`\underlineitem')は、 `~/.emacs' で次のように指定して下さい。 (setq YaTeX-item-regexp "\\(\\\\\\(sub\\)*item\\)\\|\\(\\\\underlineitem\\)") この変数の指定の仕方がよく分からない場合は、独自の項目列挙コマンドの名前を ``"\item"'で始まるものにして下さい(例えば"\itembf"')。 野鳥の `M-q' では `\item' を環境に応じて以下のように「ハングインデント」 します。 itemize, enumerate環境: >\item[ほげほげ] 英語では、特に意味のない単語を `foo' であらわしま > すが、これの日本語版ともいえる単語が「ほげほげ」 > です。 description環境: > \item[へろへろ] 「ほげほげ」をでたらめが単語として使った時に、第 > 2のでたらめな単語として「へろへろ」が使われることが多 > いようです。 パラグラフの桁揃え ================== itemize環境以外でのパラグラフの桁揃え(fill)は、基本的に他のモードと 同じように機能しますが、verbatim環境や、tabular環境など桁揃えをすると 悲惨な状況になるような環境中では機能しません。また、\verb で括ってある ものは決して行分割されません(変数 `YaTeX-verb-regexp' で制御) )。さら に、一時的にインデントの深さを変えてある箇所では、そのインデントの先頭 で`M-q'を押すことにより fill-prefix をいちいち変更しなくて桁揃えができ ます。  File: yatexj, Node: Includeonly, Next: What column, Prev: Filling, Up: Top 勝手にincludeonly ***************** ファイルを分割して文章を入力している時には、メインファイル中に \includeonly{現在編集中のファイル名} のように書いておくことで、タイプセットの時間を節約できますが、ちょっと 他のファイルを手直ししたい時には \includeonly{ちょっと手直ししたいファイル名} と書き直さなければならず手間がかかります。野鳥では現在編集しているファ イル名がメインファイルの`\includeonly'にない場合には自動的にこれを検出 し、次の指示を仰ぎます。 A)dd R)eplace %)comment? 現在編集中のファイルを `\includeonly' のリストに加えたい時には`a'を、 現在編集中のファイルだけを `\includeonly' にしたい時は`r'を、 `\includeonly' の行をコメントアウトして無効化したい時には、`%'をそれぞ れ押して下さい。  File: yatexj, Node: What column, Next: Intelligent newline, Prev: Includeonly, Up: Top ここはどこ? *********** 項目数の多い tabular などをたくさん書いていると下の方の行で、いま書 いている桁がどこに対応するのかわからなくなってしまうことがあります。例 えば、以下のような tabular において、 \begin{tabular}{|c|c|c|c|c|c|c|c|}\hline 氏名&所属&〒&住所&電話&FAX&帰省先&帰省先電話\\ \hline 矢上二郎 & 6 & 223 & 横浜市港北区日吉 & xxx-yyy & zzz-www & トンガ & 9876-54321 \\ 日吉小僧 & 2 & \multicolumn{2}{c|}{教えない} &&&(???) \\ \hline \end{tabular} (???)の部分がどの項目なのかすぐに判断するのは難しいでしょう。こんな時 は、 `[prefix] &' ... 現在のカラム表示 を押すとカーソル位置のカラムがどの項目に該当するかをミニバッファに表示 します。tabular/array環境の第1行目を項目名の並びとみなして対応するもの を探します。もし項目名として別のものを表示して欲しい場合は、行頭を`%' にしてダミーの項目並びを作っておくと良いでしょう。  File: yatexj, Node: Intelligent newline, Next: Usepackage cheker, Prev: What column, Up: Top おまかせ改行 ************ tabular[*], array, itemize, enumerate, tabbing 環境をbegin型補完で入 力した時、または各環境内で `ESC RET' ... おまかせ改行 を押すと、その環境に応じた行エントリを次の行に挿入します(begin型補完時 に自動挿入されたエントリが不要な場合は undo によって消去できます)。例 えば、tabular環境では、その環境のカラム数に対応した個数の `&' に加え、 行末の `\\' を入れます。この時それ以前に `\hline' があればそれも付け加 えます。環境とそれに応じて自動入力するものの対応は以下のようになります。 * `tabular', `tabular*', `array' カラム数-1 だけの `&' と `\\'。必要に応じて `\hline' * `tabbing' 一行目で定義している `\=' と同じ個数の `\>'。 * `itemize', `enumerate', `description', `list' `\item' または `item[]' tabular 環境の例のように、本機能は各環境の一行目の内容を参考にして動 作するので、なるべく二行目以降で呼び出すようにしてください。 もし、その他の環境、例えば `foo'、に対して`おまかせ改行'を動作 させたい時は、`YaTeX-intelligent-newline-foo' という名前の関数を定義 します。定義した関数は、現在の行に改行を挿入した直後の行頭の位置で呼ばれま す。関数 `YaTeX-indent-line' を呼ぶと現在の環境のネストに応じた深さに インデントされるので、これを呼んでから何かを挿入するようなコードを書くとよ いでしょう。`yatexenv.el'内の関数 `YaTeX-intelligent-newline-itemize' の定義などを参考にしてください。  File: yatexj, Node: Usepackage cheker, Next: Changing mode of YaTeX, Prev: Intelligent newline, Up: Top 先回りusepackage **************** begin型、section型、maketitle型、いずれかのLaTeX2eマクロを補完入力す ると、そのマクロの利用に外部パッケージを必要とする場合、そのパッケージ を本文中で `\usepackage{}' しているかどうかを調査し、もししていなけれ ばプリアンブルに対応するパッケージを引数にした `\usepackage' 文を(確認 後に)挿入します。 ただしこの機能が働くためには、パッケージ名とその中で定義されているマ クロ群をalistの形式で変数 `YaTeX-package-alist-private' に設定しておく 必要があります。  File: yatexj, Node: Changing mode of YaTeX, Next: Online help, Prev: Usepackage cheker, Up: Top 野鳥の動作モード切り替え ************************ `[prefix] w' ... 野鳥動作モード切り替えメニュー で野鳥自身の動作を決定する以下のモードを切り替えます。 * 修正モード * 野鳥数式モード 修正モードは、開き括弧入力時の処理をコントロールし、修正モードONの時は 開き括弧の入力は開き括弧のみの入力になり、修正モードOFFの時は開き括弧 の入力だけで閉じ括弧まで入力します。デフォルト(起動時)の設定は*OFF*で す。 野鳥数式モードは、変数 `YaTeX-auto-math-mode' が `nil' の時の み有効で、このとき`;'や`:'を押した時(*Note Image completion::参照)に、 どのようなイメージ補完を機能させるか、通常のキーとして機能させるかを手動で 切り替えます。自動判定が遅いマシンでは`YaTeX-auto-math-mode' `nil'にセットし、野鳥数式モードを手動で切り替えると良いでしょう。  File: yatexj, Node: Online help, Next: Inclusion hierarchy browser, Prev: Changing mode of YaTeX, Up: Top オンラインヘルプ **************** 使おうとする LaTeX コマンドの用法がよく分からない時は、オンラインヘ ルプをひきましょう。ヘルプに関するキーには以下のものがあります。 `[prefix] ?' ... オンラインヘルプ `[prefix] /' ... オンラインapropos オンラインヘルプ ================ 「オンラインヘルプ」は、一般的な LaTeX コマンド(デフォルトでカーソル 位置のコマンド)に対する説明を隣のバッファに表示します。この時参照され るヘルプ用ファイルには「グローバルヘルプ」と「プライベートヘルプ」の二 種類があり、前者は LaTeX の標準コマンドの主なものの説明を含むファイル で、変数`YaTeX-help-file'の値で指定されます。このファイルは通常公共の 場所(デフォルトで`$EMACSEXECPATH')に置かれ、誰もがその内容を更新できる ように全員に書き込み権が与えられるべきものです。後者は、非標準もしくは 個人的なマクロ定義に関する説明が書かれているファイルで、変数 `YaTeX-help-file-private'の値で指定されます。こちらはユーザのホームディ レクトリの下などに置かれます。 オンラインapropos ================= 「オンラインapropos」は GNU Emacs の apropos と同様、ユーザが指定し たキーワードを説明文に含む項目すべてを隣のバッファに表示します。 もし、調べようとしたLaTeXコマンドに対する説明がヘルプファイル中に見 つからなかった場合は、説明文の入力を求めてくるので、可能であれば参考書 などを調べてそのコマンドの説明を入力してください。もし、なにか標準的な コマンドに対する説明を書いたならばぜひ私までその説明をお送り下さい。次 回の配布に含めたいと思います。  File: yatexj, Node: Inclusion hierarchy browser, Next: Cooperation with other packages, Prev: Online help, Up: Top インクルード構造ブラウザ ************************ 複数のファイルに分割しているドキュメントを書いている場合、 `[prefix] d' ... インクルード構造ブラウズ を押すと、そのドキュメントの親ファイルを聞いて来ます。ここで全てのファ イルの親となるファイル(デフォルトが示されているので大抵はRETのみ)を入 力するとインクルードしている全てのファイルを解析し、インクルード状況を 視覚的に表示します。このバッファでは以下のキー操作が有効です。 `n' ... 次の行に移動し対応するファイルを隣のバッファに表示 `p' ... 上の行に移動し対応するファイルを隣のバッファに表示 `N' ... 同じインクルードレベルの次のファイルに移動 `P' ... 同じインクルードレベルの前のファイルに移動 `j' ... 次の行に移動 `k' ... 上の行に移動 `u' ... 一代親にあたるファイルに移動 `.' ... カーソル位置のファイルを隣のバッファに表示 `SPC' ... 隣のバッファの対応ファイルをスクロールアップ `DEL, b' ... 隣のバッファの対応ファイルをスクロールダウン `<' ... 隣のバッファの対応ファイルの先頭を表示 `>' ... 隣のバッファの対応ファイルの末尾を表示 `'' ... (`<'や`>'の後で)元の表示位置に戻る `RET, g' ... カーソル位置のファイルを隣のバッファでオープン `mouse-2' ... RETと同じ(ウィンドウ使用時のみ) `o' ... 隣のウィンドウに移動 `1' ... 他のウィンドウを消す `-' ... ブラウズウィンドウを小さくする `+' ... ブラウズウィンドウを大きくする `?' ... ヘルプ表示 `q' ... 表示前の状態に戻る ただし、隣のウィンドウのファイルの内容を表示する機能に関しては、対応 するファイルをクローズしてしまうとうまく働きませんのでご注意ください。  File: yatexj, Node: Cooperation with other packages, Next: Customizations, Prev: Inclusion hierarchy browser, Up: Top 他パッケージとの連携 ******************** gmhist ====== `gmhist.el'と`gmhist-mh.el' をロードしている場合、プレヴューコマンド の入力(`[prefix] tp]')、印刷コマンドの入力(`[prefix] tl')の時に独立し たヒストリを利用できます。それぞれのプロンプトで、`M-p' を押すと直前に 利用したコマンド文字列をくり返し呼び出すことができます。 min-out ======= `min-out.el' (`outline-minor-mode') と野鳥を組み合わせて使うこともも ちろん可能です。設定の方法に関しては`yatexm-o.el'をご覧ください。  File: yatexj, Node: Customizations, Next: Etc, Prev: Cooperation with other packages, Up: Top カスタマイズ ************ 野鳥の動作を制御する種々の変数を独自に設定することにより、補完入力を 起動するキーアサインを変えたり、環境名の補完候補をさらに充実させること などができます。 * Menu: * Lisp variables:: lisp 変数 * Add-in functions:: 付加関数(アドイン関数)  File: yatexj, Node: Lisp variables, Next: Add-in functions, Prev: Customizations, Up: Customizations lisp 変数 ========= 例えば prefix キーを `C-c' 以外のキーにしたい場合は、`YaTeX-prefix' に prefix キーにしたいシンボルを定義してください。さらに、「`C-c 英字'」 というキーバインドは独自の関数が割り当ててあるので使いたくない。このよ うな時は、`YaTeX-inhibit-prefix-letter' を `t' に設定することにより、 `C-c 英字…'のバインドが全て、対応する`C-c C-英字…'に変わります(ただ し、begin型 large型補完の大文字起動によるリジョン指定は可能なままです。 これも無効にしたい場合は`t'ではなく 1 にセットして下さい。)。 * Menu: * All customizable variables:: カスタマイズ変数一覧 * Sample definitions:: カスタマイズ変数設定例 * Hook variables:: hook変数 * Hook file:: hook用ファイル  File: yatexj, Node: All customizable variables, Next: Sample definitions, Prev: Lisp variables, Up: Lisp variables カスタマイズ変数一覧 -------------------- yatex-mode における次の変数がカスタマイズ可能です。`~/.emacs' で `setq' しておけば、そちらの定義が優先されます。括弧の中はデフォルト値 です。実際に変数の値を変更する場合は `M-x describe-variable' で変数の 詳細な説明を参照してください。 -- Variable: YaTeX-prefix yatex-mode 中のプリフィクスキー (`\C-c') -- Variable: YaTeX-inhibit-prefix-letter prefix キーの直後のキーバインドで `英字' のものを `C-英字' に変更 (`nil') -- Variable: YaTeX-fill-prefix 本文を書く時の行頭に挿入する接頭辞すなわち fill-prefix (`""(nil)') -- Variable: YaTeX-user-completion-table 学習したLaTeXコマンド保存ファイル名 (`"~/.yatexrc"') -- Variable: YaTeX-kanji-code 文書を作成する時の漢字コードnil=既存のコードのまま 0=no-conversion 1=Shift JIS, 2=JIS, 3=EUC, 4=UTF-8 (2 (MS-DOSでは 1)) -- Variable: tex-command LaTeXタイプセッタコマンド名 (`"platex"') -- Variable: dvi2-command プレヴューアコマンド名 (`"xdvi -geo +0+0 -s 4"') -- Variable: dviprint-command-format dviファイルの印刷に使われるコマンド式 (`"dvi2ps %f %t %s | lpr"') -- Variable: dviprint-from-format 上の`%f'に相当する開始ページ指定書式、`%b' が開始ページ番号に変わ る (`"-f %b"') -- Variable: dviprint-to-format `%t' に相当する終了ページ指定書式、`%e'が終了ページ番号に変わる (`"-t %e"') -- Variable: makeindex-command makeindexコマンド (`"makeindex"' (MS-DOSでは`"makeind"')) -- Variable: YaTeX-dvipdf-command dviをPDFに変換するコマンド (`"dvipdfmx"') -- Variable: YaTeX-on-the-fly-preview-interval `[prefix] t e'で環境即時previewをする場合の変換処理までの 無操作時間(秒) (0.9) `nil' の場合は即時プレヴューをしない。 -- Variable: YaTeX-on-the-fly-math-preview-engine `[prefix] t e'で数式環境を即時previewする時に用いるエンジン (latex-math-previewが利用可能なときは latex-math-preview-expression を呼ぶ `'YaTeX-typeset-environment-by-lmp'そうでないときは内蔵関数を呼ぶ `'YaTeX-typeset-environment-by-builtin') -- Variable: YaTeX-cmd-gimp GIMPを起動するコマンド (code{"gimp"}) -- Variable: YaTeX-cmd-tgif tgifを起動するコマンド (code{"tgif"}) -- Variable: YaTeX-cmd-inkscape Inkscapeを起動するコマンド (code{"inkscape"}) -- Variable: YaTeX-cmd-dia Diaを起動するコマンド (code{"dia"}) -- Variable: YaTeX-cmd-ooo OpenOffice.orgまたはLibreOfficeを起動するコマンド (code{"soffice"}) -- Variable: YaTeX-cmd-gs Ghostscriptを起動するコマンド (code{"gs"}) -- Variable: YaTeX-cmd-dvips dvipsを起動するコマンド(環境によってはpdvipsなど) (code{"dvips"}) -- Variable: YaTeX-cmd-displayline displaylineを起動するコマンド (code{"/Applications/Skim.app/Contents/SharedSupport/displayline"}) -- Variable: YaTeX-cmd-edit-ps PostScriptファイルを編集するコマンド (変数code{"YaTeX-cmd-gimp"} の値) -- Variable: YaTeX-cmd-edit-pdf PDFファイルを編集するコマンド (変数code{"YaTeX-cmd-ooo"}の値) -- Variable: YaTeX-cmd-edit-ai .aiファイルを編集するコマンド (変数code{"YaTeX-cmd-inkscape"}の値) -- Variable: YaTeX-cmd-edit-svg SVGファイルを編集するコマンド (変数code{"YaTeX-cmd-inkscape"}の値) -- Variable: YaTeX-cmd-edit-images その他画像ファイルを編集するコマンド (変数code{"YaTeX-cmd-gimp"} の値) -- Variable: YaTeX-need-nonstop `\nonstopmode{}'を自動的に付加するか (`nil') -- Variable: latex-warning-regexp latexコマンドの出力するウォーニング行の正規表現 (`"line.* [0-9]*"') -- Variable: latex-error-regexp 同じくエラー行の正規表現 (`"l\\.[1-9][0-9]*"') -- Variable: latex-dos-emergency-message MS-DOS上で動作する latex コマンドが、エラーにより停止するとき出力 するメッセージ (`"Emergency stop"') -- Variable: latex-message-kanji-code タイプセッタの出力するメッセージの漢字コード.タイプセットバッファ の出力が化ける時は、これを設定する (2, Nemacsでのみ有効) -- Variable: NTT-jTeX 古いNTT-jTeX使用時のようにインデントした行の先頭と前の行の(タイプ セット後の)字間が空いてしまうのを嫌う場合は`t'にする(`nil') -- Variable: YaTeX-item-regexp itemの桁揃えの時に用いる、itemの正規表現 (`"\\\\(sub\\)*item"') -- Variable: YaTeX-verb-regexp verbコマンドの正規表現。先頭の\\\\はつけない (`"verb\\*?\\|path"') -- Variable: YaTeX-nervous ローカル辞書を用いる時 `t' (`t') -- Variable: YaTeX-sectioning-regexp セクション区切り設定コマンドの正規表現 (`"\\(part\\|chapter\\*?\\|\\(sub\\)*\\(section\\|paragraph\\)\\*?\\)\\b"') -- Variable: YaTeX-fill-inhibit-environments fill を抑止する環境名のリスト (`'("tabular" "tabular*" "array" "picture" "eqnarray" "eqnarray*" "equation" "math" "displaymath" "verbatim" "verbatim*")') -- Variable: YaTeX-uncomment-once 領域uncommentで行頭の複数の`%'を全て削除するか (`nil') -- Variable: YaTeX-close-paren-always 開き括弧の入力で常に閉じ括弧を入力する (`t') -- Variable: YaTeX-auto-math-mode 数式モードの切り替えを自動的に行う (`t') -- Variable: YaTeX-math-key-list-private 数式イメージ補完で用いる (プリフィクスキー . 対応補完テーブル) の alist (`nil')。補完テーブルの書き方については`yatexmth.el'を参照。 -- Variable: YaTeX-default-pop-window-height 1画面の時にタイプセットバッファを初めて作成する時の高さ。数値で行 数、数字文字列でEmacsウィンドウに対する百分率 (10) -- Variable: YaTeX-help-file 共用ヘルプファイル (`$doc-directory/../../site-lisp/YATEXHLP.jp') -- Variable: YaTeX-help-file-private 個人用ヘルプファイル (`"~/YATEXHLP.jp"') -- Variable: YaTeX-no-begend-shortcut `[prefix] b ??' のショートカットを使わず、`[prefix] b' だけで補完 入力に入る (`nil') -- Variable: YaTeX-hilit-pattern-adjustment-private 正規表現とそれにマッチするものの論理的意味をシンボルであらわした もののリスト…のリスト。hilit19 を組み込んでいる時のみ有効。詳し くは `(assq 'yatex-mode hilit-patterns-alist)' した結果と、変数 `YaTeX-hilit-pattern-adjustment-default' の値(と場合によっては hilit19 のドキュメント)を参照せよ。 -- Variable: YaTeX-sectioning-level LaTeXのセクション単位宣言コマンドとその論理的高さのalist。 -- Variable: YaTeX-hierarchy-ignore-heading-regexp Hierarchy バッファは通常ファイルヘッダとして、LaTeXのセクション宣 言コマンドの引数を検索し、それがなければコメント行を探すが、その 際にヘッダとしては意味を持たないパターンをこの変数に設定する。デ フォルトでは RCS ヘッダとモード指定行(-*- xxx -*-)が設定されてい る。 -- Variable: YaTeX-skip-default-reader Non-nil に設定するとsection型コマンドの引数入力時、アドイン関数が なければミニバッファでの読み込みをせずに入力を完了させる (`nil') -- Variable: YaTeX-create-file-prefix-g `\include'などで `prefix g'した時に、ジャンプ先が存在しないファイ ルであってもオープンする (`nil') -- Variable: YaTeX-simple-messages 各種補完時のメッセージ出力を簡素化する (`nil') -- Variable: YaTeX-hilit-sectioning-face 色付けが有効な時の `\part' の色 (`'(yellow/dodgerblue yellow/slateblue)')。リストの第一要素は `hilit-background-mode' が `'light' の時の、第二要素は `'dark' の時の `\chapter' の色で、 文字色/背景色 のように指定する。 -- Variable: YaTeX-hilit-sectioning-attenuation-rate 色付けが有効な時の、`\subparagraph' の色を `\chapter' の濃度の何% 薄くしたものにするか (`'(15 40)') `YaTeX-hilit-sectioning-face'の 項参照。 -- Variable: YaTeX-use-AMS-LaTeX AMS-LaTeX を使用する場合は `t' に設定する (`nil') -- Variable: YaTeX-use-LaTeX2e LaTeX2e を使用する場合は `t' に設定する (`t') -- Variable: YaTeX-template-file 新規ファイル作成時に自動挿入するファイル名 (`~/work/template.tex') -- Variable: YaTeX-search-file-from-top-directory inputするファイルを探すときの基準ディレクトリをmainファイルのある ディレクトリにするか (`t') -- Variable: YaTeX-use-font-lock ソースの色づけパッケージとして font-lock を利用するかどうか (`(featurep 'font-lock)') -- Variable: YaTeX-use-hilit19 ソースの色づけパッケージとして hilit19 を利用するかどうか (`(featurep 'hilit19)') -- Variable: YaTeX-use-italic-bold italic, boldフォントを野鳥が探すかどうか (Emacs20以降なら`t') font-lock利用時のみ有効。(`(featurep 'hilit19)' -- Variable: YaTeX-singlecmd-suffix 全てのmaketitle型コマンドの補完入力直後に挿入する文字列。 `"{}"' などがお勧め。 -- Variable: YaTeX-package-alist-private LaTeX2eのパッケージ名とその中に含まれるマクロのリスト。適切に設定 しておくと本文入力時にマクロを補完入力するとそのマクロに必要なパッ ケージを usepackage するか自動的に検査してくれる。していなければ \usepackage を自動追加することもできる。リストは'((パッケージ名1 (補完タイプ マクロのリスト……) (補完タイプ マクロのリスト……)) (パッケージ名2 (補完タイプ マクロのリスト……) (補完タイプ マクロ のリスト……))………)という形式にする。補完タイプは `env, section, maketitle' のどれか。具体例は変数 `YaTeX-package-alist-default'の値参照。 -- Variable: YaTeX-tabular-indentation tabular/array 環境で現在行の先頭位置が表の第Nカラムのときは標準イ ンデント位置から N*YaTeX-tabular-indentation 桁下げたインデントに する。 -- Variable: YaTeX-noindent-env-regexp 別の環境内にあっても \begin{} が行頭から始まるべき環境名の正規表 現。verbatim環境などを指定する。 -- Variable: YaTeX-electric-indent-mode Emacs 24.4 で導入された改行時の、自動インデントをどうするか。 この値がそのまま electric-indent-local-mode に渡される。 -1でoff。 -- Variable: YaTeX-ref-default-label-string \ref{} のラベル補完でラベル未設定のものに自動的に生成するラベル名 の書式。strftime(3)関数に似た日付ベースで指定する。利用できる書式 は以下のとおり。%y -> 西暦下二桁, %b -> 月の英名, %m -> 月(1〜12) %d -> 日, %H -> 時, %M -> 分, %S -> 秒, %qx -> アルファベットで26 進数化した yymmdd. %qX -> アルファベットで26進数化した HHMMSS. デフォルトは "%H%M%S_%d%b%y" -- Variable: YaTeX-ref-generate-label-function \ref{}のラベル名自動生成のときに使う関数のシンボル。デフォルトは 標準の YaTeX::ref-generate-label 関数が割り当ててある。引数を2つ 取る関数を定義して、この変数にセットするとその関数を呼んだ結果を デフォルトのラベル名候補とする。設定例: (setq YaTeX-ref-generate-label-function 'my-yatex-generate-label) (defun my-yatex-generate-label (command value) (and (string= command "caption") (re-search-backward "\\\\begin{\\(figure\\|table\\)}" nil t) (setq command (match-string 1))) (let ((alist '(("chapter" . "chap") ("section" . "sec") ("subsection" . "subsec") ("figure" . "fig") ("table" . "tbl")))) (if (setq command (cdr (assoc command alist))) (concat command ":" value) (YaTeX::ref-generate-label nil nil))))  File: yatexj, Node: Sample definitions, Next: Hook variables, Prev: All customizable variables, Up: Lisp variables カスタマイズ変数設定例 ---------------------- たとえば、prefix キーとして`ESC'を使用し、新たな補完候補を格納するファ イルを、`~/src/emacs/yatexrc' にし、行頭の prefix をタブ文字一つに変え たいときは、 (setq YaTeX-prefix "\e" YaTeX-user-completion-table "~/src/emacs/yatexrc" YaTeX-fill-prefix " ") を `~/.emacs' に加えます。  File: yatexj, Node: Hook variables, Next: Hook file, Prev: Sample definitions, Up: Lisp variables hook変数 -------- また、hook 変数 `yatex-mode-hook', `yatex-mode-load-hook' を用意して います。すべての yatex-mode のバッファで作用させたいものは、 `yatex-mode-hook' に記述し、`yatex.el' をロードする時だけ作用させたい ものは`yatex-mode-load-hook' に記述します。例えば、 `outline-minor-mode' を利用する場合、それぞれのバッファで `outline-minor-mode' を有効にしたいので、`yatex-mode-hook' を次のよう に設定します。 (setq yatex-mode-hook '(lambda () (outline-minor-mode t))) 逆に、独自のキー定義を行いたい時などは、`yatex-mode-load-hook' を利用 します。例えば、begin 型補完において、 document や、enumerate 以外の環 境名もショートカットキーで入れたいなどという時は、次のようにします。以 下の例は、`[prefix] ba' で `\begin{abstract}', `\end{abstract}' を挿入 します。 (setq yatex-mode-load-hook '(lambda() (YaTeX-define-begend-key "ba" "abstract"))) なお、新たなキーの定義には、関数 `YaTeX-define-key' `YaTeX-define-begend-key'を利用するようにしてください。  File: yatexj, Node: Hook file, Prev: Hook variables, Up: Lisp variables hook用ファイル -------------- 変数 `yatex-mode-load-hook' で定義する内容が多い時は、`yatexhks.el' というファイルを作り、その中に野鳥関連の設定を書く事で、初期化の時に自 動的にロードします。  File: yatexj, Node: Add-in functions, Prev: Lisp variables, Up: Customizations 付加関数(アドイン関数) ====================== 各種補完時に、環境名やコマンド名に応じたきめ細やかな補完入力機能を実 現するための関数を作成することができます。この関数の作成方法や、組み込 み方法に関しては、`yatexadd.doc' をご覧ください。  File: yatexj, Node: Etc, Next: Copying, Prev: Customizations, Up: Top その他 ****** 野鳥の標準の LaTeX コマンドの辞書には、作者が頻繁に使うものしか登録 されていません。これは、補完候補に使いそうもないコマンドが存在して、補 完したいコマンドを出すまでのストローク数を増やしてしまう事を防止するた めです。標準辞書にないコマンドも、できるだけ補完入力方式を利用し、ユー ザ辞書を充実させることで、あなたの LaTeX スタイルにあった野鳥へと育っ ていくことでしょう。  File: yatexj, Node: Copying, Next: Concept Index, Prev: Etc, Up: Top 取り扱い ******** 本プログラムはフリーソフトウェアです。本プログラムを使用して生じたい かなる結果に対しても作者は責任を負わないこととします。転載等に関しては 制限いたしません。常識的に扱ってください。また、本プログラムに含まれる コードを利用すること、改造することも自由に行なって構いませんが、流用す ることにより契約締結の必要が生じる場合、私はいかなる契約も締結しません。 具体的にはGPLへのサインはしませんので、GNUに寄贈するものを作っている場 合私の作品から取り込んだコードを流用すると苦労するかもしれません。いか なるコード流用も拒否しませんが契約締結は辞退します。 苦情、希望、バグ報告、感想等は歓迎いたします。連絡は yuuji@yatex.org まで(2017年9月現在)。継続的に使用してくださる方はメイリングリスト「fj 野鳥の会」に是非加入してください。加入方法については本パッケージの `docs/qanda'ファイルの「その他」の章を御覧ください。 仕様は、予告なく確実に(気分次第で)変更されます:-p。 広瀬雄二  File: yatexj, Node: Concept Index, Prev: Copying, Up: Top 索引 **** * Menu: * 引数の個数を変える[ひきすうのこすうをかえる]: 2個以上の引数をとる section型コマンド. (line 26) * 引数[ひきすう]: 2個以上の引数をとる section型コマンド. (line 5) * 欧文[おうふん]: Accent mark completion. (line 5) * アクセント記号補完[あくせんときこうほかん]: Accent mark completion. (line 5) * カスタマイズ変数一覧[かすたまいすへんすういちらん]: All customizable variables. (line 5) * 随時補完[すいしほかん]: Arbitrary completion. (line 5) * %#BEGIN: Fix region for typesetting. (line 5) * C-c: Invocation. (line 5) * エラー修正[えらあしゆうせい]: Calling typesetter. (line 5) * タイプセットエラー[たいふせつとえらあ]: Calling typesetter. (line 5) * タイプセッタ起動[たいふせつたきとう]: Calling typesetter. (line 5) * 環境名の変更[かんきようめいのへんこう]: Changing LaTeX command. (line 21) * モード切り替え[もうときりかえ]: Changing mode of YaTeX. (line 5) * タイプセッタの使い分け[たいふせつたのつかいわけ]: Changing typesetter. (line 13) * 起動するコマンドを変える[きとうするこまんとをかえる]: Changing typesetter. (line 8) * コメントアウト[こめんとあうと]: Commenting out. (line 5) * その他のコマンド制御[そのたのこまんとせいきよ]: Controlling which command to invoke. (line 5) * 他パッケージとの連携[たはつけえしとのれんけい]: Cooperation with other packages. (line 5) * ヒストリ[ひすとり]: Cooperation with other packages. (line 9) * コマンドヒストリ[こまんとひすとり]: Cooperation with other packages. (line 9) * カーソルジャンプ[かあそるしやんふ]: Cursor jump. (line 5) * キーアサイン[きいあさいん]: Customizations. (line 5) * カスタマイズ[かすたまいす]: Customizations. (line 5) * Demacs: Intro. (line 5) * %#END: Fix region for typesetting. (line 5) * %#記法自体の編集[%#きほうしたいのへんしゆう]: Editing %# notation. (line 5) * 括る[くくる]: Enclose section-type command. (line 5) * パラグラフの桁揃え[はらくらふのけたそろえ]: Filling. (line 48) * 桁揃え[けたそろえ]: Filling. (line 5) * 領域決定規則[りよういきけつていきそく]: Fix region for typesetting. (line 27) * 長いファイルの編集[なかいふあいるのへんしゆう]: Fix region for typesetting. (line 36) * 固定領域のタイプセット[こていりよういきのたいふせつと]: Fix region for typesetting. (line 5) * :: Greek letter completion. (line 5) * ギリシャ文字補完[きりしやもしほかん]: Greek letter completion. (line 5) * ;自身[;ししん]: Image completion. (line 34) * ∞[むけんたい]: Image completion. (line 5) * Σ[しくま]: Image completion. (line 5) * 矢印[やしるし]: Image completion. (line 5) * 数式モード[すうしきもおと]: Image completion. (line 5) * ;: Image completion. (line 5) * イメージ補完[いめえしほかん]: Image completion. (line 5) * 数式記号イメージ補完[すうしききこういめえしほかん]: Image completion. (line 5) * 他のファイルの手直し[ほかのふあいるのてなおし]: Includeonly. (line 12) * インクルード構造[いんくるうとこうそう]: Inclusion hierarchy browser. (line 5) * 括弧入力補助[かつこにゆうりよくほしよ]: Inserting parens. (line 5) * Install: Installation. (line 5) * インストール[いんすとおる]: Installation. (line 5) * &入力[&にゆうりよく]: Intelligent newline. (line 5) * おまかせ改行[おまかせかいきよう]: Intelligent newline. (line 5) * やちょう[やちよう]: Intro. (line 5) * プリントアウト[ふりんとあうと]: Invocation. (line 5) * プレヴューア[ふれひゆうあ]: Invocation. (line 5) * タイプセッタ[たいふせつた]: Invocation. (line 5) * 環境の削除[かんきようのさくしよ]: Killing LaTeX command. (line 7) * LaTeX: Intro. (line 5) * ローカル辞書[ろおかるししよ]: Local dictionary. (line 5) * M-C-a: 環境を単位としたジャンプ. (line 8) * M-C-e: 環境を単位としたジャンプ. (line 8) * M-C- 環境を単位としたジャンプ. (line 8) * M-q: Filling. (line 48) * 変更/削除[へんこう/さくしよ]: Modifying/Deleting. (line 5) * Mule: Intro. (line 5) * NTT-jTeX[えぬていいていいしえいてつく]: Filling. (line 16) * プライベートヘルプ[ふらいへえとへるふ]: Online help. (line 17) * グローバルヘルプ[くろおはるへるふ]: Online help. (line 17) * キーワード検索[きいわあとけんさく]: Online help. (line 5) * オンラインヘルプ[おんらいんへるふ]: Online help. (line 5) * 出力終了ページ[しゆつりよくしゆうりようへえし]: Print out. (line 10) * 出力開始ページ[しゆつりよくかいしへえし]: Print out. (line 10) * 再帰補完[さいきほかん]: Recursive completion. (line 5) * 設定例[せつていれい]: Sample definitions. (line 5) * 入力ファイル分割[にゆうりよくふあいるふんかつ]: Splitting input files. (line 12) * 現在のカラム表示[けんさいのからむひようし]: What column. (line 25) * ここはどこ?[ここはとこ?]: What column. (line 5) * YaTeX-help-file: Online help. (line 17) * YaTeX-help-file-private: Online help. (line 17) * YaTeX-item-regexp: Filling. (line 21) * YaTeX-math-sign-alist-private: Image completion. (line 61) * YaTeX-nervous: Local dictionary. (line 23) * apropos: Online help. (line 5) * auto-mode-alist: Installation. (line 5) * autoload: Installation. (line 5) * begin型補完[beginかたほかん]: begin型補完. (line 5) * 環境名の補完[かんきようめいのほかん]: begin型補完. (line 5) * ユーザ辞書[ゆうさししよ]: begin型補完. (line 72) * 閉じ込める[としこめる]: begin型補完. (line 82) * ブロック[ふろつく]: begin型補完. (line 82) * .emacs: Installation. (line 5) * end補完[endほかん]: end補完. (line 5) * ghostview: Splitting input files. (line 17) * gmhist: Cooperation with other packages. (line 9) * hook変数[hookへんすう]: Hook variables. (line 5) * includeonly: Includeonly. (line 5) * 勝手にincludeonly[かつてにincludeonly]: Includeonly. (line 5) * itemなどの桁揃え[itemなとのけたそろえ]: Filling. (line 9) * jlatex: Invocation. (line 5) * ラベル自動生成[らへるしとうせいせい]: label-generation. (line 5) * large型補完[largeかたほかん]: large型補完. (line 5) * フォント指定子[ふおんとしていし]: large型補完. (line 19) * 文字サイズ指定子[もしさいすしていし]: large型補完. (line 19) * 括る[くくる]: large型補完. (line 23) * leftarrow: Image completion. (line 5) * お絵描きツール起動[おえかきつうるきとう]: お絵描きツール起動. (line 5) * 環境をマーク[かんきようをまあく]: 環境を単位としたジャンプ. (line 8) * 環境の末尾へ[かんきようのまつひへ]: 環境を単位としたジャンプ. (line 8) * 環境の先頭へ[かんきようのせんとうへ]: 環境を単位としたジャンプ. (line 8) * lpr format: lpr format. (line 5) * lprフォーマットの変更[lprふおおまつとのへんこう]: Editing %# notation. (line 20) * ページ確認省略lpr起動[へえしかくにんしようりやくlprきとう]: Print out. (line 13) * lprフォーマット[lprふおおまつと]: lpr format. (line 5) * lprふぉーまっと[lprふおおまつと]: lpr format. (line 5) * maketitle型補完[maketitleかたほかん]: maketitle型補完. (line 5) * min-out: Cooperation with other packages. (line 18) * platex: Invocation. (line 5) * prefix ,: Commenting out. (line 5) * prefix .: Commenting out. (line 5) * prefix >: Commenting out. (line 5) * prefix <: Commenting out. (line 5) * prefix /: Online help. (line 5) * prefix ?: Online help. (line 5) * prefix SPC: Arbitrary completion. (line 5) * prefix &: What column. (line 5) * prefix a: Accent mark completion. (line 5) * prefix b: begin型補完. (line 5) * prefix c: Modifying/Deleting. (line 5) * prefix d: Inclusion hierarchy browser. (line 5) * prefix e: end補完. (line 5) * prefix g: Cursor jump. (line 5) * prefix i: Filling. (line 9) * prefix k: Modifying/Deleting. (line 5) * prefix key: Invocation. (line 5) * prefix l: large型補完. (line 5) * prefix m: maketitle型補完. (line 5) * prefixキー変更[prefixきいへんこう]: Lisp variables. (line 5) * prefix s: section型補完. (line 5) * prefix w: Changing mode of YaTeX. (line 5) * section型補完[sectionかたほかん]: section型補完. (line 5) * 複雑なtabular[ふくさつなtabular]: What column. (line 5) * 先回りusepackage[さきまわり]: Usepackage cheker. (line 5) * セクション区切り一覧バッファ[せくしよんくきりいちらんはつふあ]: view-sectioning. (line 20) * ジャンプ[しやんふ]: view-sectioning. (line 44) * セクション区切り[せくしよんくきり]: view-sectioning. (line 44) * 論理階層[ろんりかいそう]: view-sectioning. (line 44) * アウトライン[あうとらいん]: view-sectioning. (line 5) * yatex-mode-hook: Hook variables. (line 5) * yatex-mode-load-hook: Hook variables. (line 5) * .yatexrc: Local dictionary. (line 5)  Tag table: Node: Top257 Node: Intro1290 Node: Terminology1593 Node: Main features2233 Node: Installation3355 Node: Invocation4615 Node: Calling typesetter5491 Node: Calling previewer6952 Node: Print out7268 Node: %#notation7534 Node: Changing typesetter7975 Node: Splitting input files8233 Node: Fix region for typesetting9189 Node: Special Filtering Region10096 Node: lpr format10732 Node: Controlling which command to invoke11542 Node: Editing %# notation12256 Node: Completion12714 Node: begin型補完13125 Node: section型補完15874 Node: 2個以上の引数をとる section型コマンド16967 Node: Enclose section-type command17783 Node: Recursive completion18107 Node: view-sectioning18412 Node: label-generation19608 Node: large型補完20282 Node: maketitle型補完20816 Node: Arbitrary completion21115 Node: end補完21428 Node: Accent mark completion21769 Node: Image completion22194 Node: Greek letter completion24009 Node: Inserting parens24493 Node: Local dictionary24841 Node: Commenting out25445 Node: Cursor jump26605 Node: 対応オブジェクトへのジャンプ26822 Node: お絵描きツール起動27808 Node: メインファイルへのジャンプ28726 Node: 環境を単位としたジャンプ29062 Node: 最後の補完位置へのジャンプ29419 Node: Modifying/Deleting29656 Node: Changing LaTeX command30062 Node: Killing LaTeX command30612 Node: Filling31484 Node: Includeonly32814 Node: What column33375 Node: Intelligent newline34155 Node: Usepackage cheker35187 Node: Changing mode of YaTeX35614 Node: Online help36190 Node: Inclusion hierarchy browser37167 Node: Cooperation with other packages38445 Node: Customizations38900 Node: Lisp variables39197 Node: All customizable variables39804 Node: Sample definitions48784 Node: Hook variables49218 Node: Hook file50113 Node: Add-in functions50319 Node: Etc50546 Node: Copying50831 Node: Concept Index51455  End tag table yatex1.81/docs/yatexj.tex010064400037440000000000002365561332771661400145550ustar yuujiwheel\def\lang{jp} % -*- texinfo -*- for Texinfo V.3.1 \input texinfo @setfilename yatexj @settitle Yet Another tex-mode for Emacs @direntry * YaTeX: (yatexj). Yet Another tex-mode for Emacs (Japanese). @end direntry @iftex @c @syncodeindex fn cp @c いつも忘れるのでここに書いとくか。 @c C-l C-c n でノード入れ @c ノードいじったら C-l C-u C-n 全部のノード更新 C-l C-u C-e @c メニュー増やしたら C-l C-u C-m 全部のメニュー更新 C-l C-u C-a @c フォーマットするときは C-l C-e C-b @c Last modified Sat Jan 6 23:49:50 2018 on firestorm @syncodeindex vr cp @end iftex @titlepage @sp 10 @center @subtitle Yet Another tex-mode for emacs @title 『野鳥』 @subtitle // YaTeX // @author @copyright{} 1991-2017 by HIROSE, Yuuji [yuuji@@yatex.org] @end titlepage @node Top, Intro, (dir), (dir) @comment node-name, next, previous, up @menu * Intro:: はじめに * Terminology:: マニュアル参照上の注意 * Main features:: 主な機能 * Installation:: インストール * Invocation:: プロセス起動 * %#notation :: * Completion:: 補完入力 * Local dictionary:: ローカル辞書 * Commenting out:: コメントアウト * Cursor jump:: カーソルジャンプ * Modifying/Deleting:: LaTeXコマンドの変更/削除 * Filling:: 桁揃え * Includeonly:: 勝手に includeonly * What column:: カラム位置ガイド * Intelligent newline:: おまかせ改行 * Usepackage cheker:: 先回りusepackage * Changing mode of YaTeX:: 野鳥動作モード変更 * Online help:: LaTeXオンラインヘルプ * Inclusion hierarchy browser:: ファイル分割階層構造の表示 * Cooperation with other packages:: 他パッケージとの連携 * Customizations:: カスタマイズ * Etc:: その他 * Copying:: 取り扱い * Concept Index:: 索引 @end menu @node Intro, Terminology, Top, Top @comment node-name, next, previous, up @chapter はじめに @cindex Demacs @cindex Mule @cindex LaTeX @cindex やちょう[やちよう] 野鳥は、GNU Emacs で La@TeX{} 用の文書を作成する時に pLa@TeX{} などの タイプセットコマンドや、プレヴューアの起動を Emacs 編集画面中から 行えるようにすると共に、拡張性の高い種々の補完機能によりソーステキ ストの編集を支援します。さらに La@TeX{} コマンドのオンラインヘルプに よりマニュアルを調べる手間を軽減します。 English manual @xref{Top, , , yatexe,YaTeX English info}. @node Terminology, Main features, Intro, Top @comment node-name, next, previous, up @chapter 本マニュアル参照上の注意 本マニュアルでは以下の表記を用います。 @itemize @bullet @item begin型コマンド @code{\begin@{環境@} 〜 \end@{環境@}}という形式のLaTeXコマンドを指します。 begin型コマンドを補完入力することをbegin型補完と呼びます。 @item section型コマンド @code{\section@{タイトル@}}や@code{\mbox@{内容@}}のように 引数を取るLaTeXコマンドを指します。 @item maketitle型コマンド @code{\maketitle}や@code{\tableofcontents}のように引数を取らないLaTeXコマ ンドを指します。 @item large型コマンド @code{@{\large ...@}} や @code{@{\tt ...@}} のようなフォント/サイズ指定子 を指します。 @item @kbd{[prefix]} 野鳥の機能を呼び出すためのプリフィクスキー。デフォルトでは@kbd{C-c}に割り 当てられているので、特に変更していない場合本マニュアルの @kbd{[prefix]} と いう表記は、@kbd{C-c} と読み換えてください。 @end itemize @node Main features, Installation, Terminology, Top @comment node-name, next, previous, up @chapter 主な機能 @itemize @bullet @item タイプセッタやプレヴューアなどの編集画面からの起動(@kbd{C-c t}) @item カーソル位置によらない固定リジョンの部分タイプセット @item \includeonlyのワンタッチ更新 @item エラー箇所への自動ジャンプ(@kbd{C-c '}) @item @code{\begin@{@}, \end@{@}, \section...} などの La@TeX{} コマンドの補完入力 (@kbd{C-c b}, @kbd{C-c s}, @kbd{C-c l}, @kbd{C-c m}) @item 既に入力したテキストを環境やコマンド引数の中に取り込む括り補完 (リジョン指定後に通常補完キー) @item セクション区切り入力時の文書構造アウトライン表示 @item セクションコマンドの一括シフト (@ref{view-sectioning}) @item 補完辞書の学習 @item La@TeX{} の環境やコマンドに応じたガイド付き引数入力 @item 野鳥にないガイド付き引数入力関数の自動生成(@file{yatexgen.el}) @item La@TeX{} コマンドの削除/変更(@kbd{C-c k}, @kbd{C-c c}) @item ファイル間、@code{\begin}<->@code{\end}間、 @code{\ref}<->@code{\label}間、 @code{\cite}<->@code{\bibitem}ジャンプ(@kbd{C-c g}) @item 一括コメントアウト/アンコメントアウト (@kbd{C-c >}, @kbd{C-c <}, @kbd{C-c ,}, @kbd{C-c .}) @item アクセント記号/数式環境用コマンド/ギリシャ文字の入力支援 (@kbd{C-c a}, @kbd{;}, @kbd{/}) @item tabular/array環境のカラム位置ガイド @item 標準的 La@TeX{} コマンドのオンラインヘルプ(@kbd{C-c ?}, @kbd{C-c /}) @item ドキュメントのインクルード構造の視覚的表示とバッファ切り替え (@kbd{C-c d}) @item 補完入力したマクロに応じて必要な \userpackage を入れてくれる先回り userpackage @item \labelを打つことはもう忘れよう! refやcite補完入力で自動生成します @item 画像ファイルのドラッグ&ドロップによる自動 \includegraphics @end itemize @node Installation, Invocation, Main features, Top @comment node-name, next, previous, up @chapter 起動法 @cindex Install @cindex インストール[いんすとおる] @cindex .emacs @cindex auto-mode-alist @cindex autoload @section 野鳥起動のための設定 ~/.emacsに下の2項目を加えます。 @lisp (setq auto-mode-alist (cons (cons "\\.tex$" 'yatex-mode) auto-mode-alist)) (autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t) @end lisp 次に野鳥の emacs-lisp ファイル群を置くディレクトリを load-path に加えます。 たとえば、 @file{~/src/emacs/yatex}に置くのであれば、 @lisp (setq load-path (cons (expand-file-name "~/src/emacs/yatex") load-path)) @end lisp @noindent などとします。 以上の設定により、拡張子が .tex であるファイルを編集すると自動的に野鳥が ロードされます。野鳥が正常に起動できたときはモードラインの表示が「やてふ」 に変わります。 @section タイプセッタ/プレヴューア環境の設定 利用する外部プログラムに関する以下の変数を確認し、必要なら正しい値に変更 します。 @table @code @item tex-command @dots{} 起動するタイプセッタのコマンド名 @item dvi2-command @dots{} 起動するプレヴューアのコマンド名 @item NTT-jTeX @dots{} 改行+インデントによって、タイプセット後の字間が空いてしま うのを抑制する場合にtにする(古いNTT-jTeXで顕著に現れる)。具体的には、 fillするときに各行の終わりに%を付加するようになる。 @item YaTeX-kanji-code @dots{} 文書を作成する時の漢字コード @item dviprint-command-format @dots{} ファイルの印刷に使われるコマンド列の書式 @item YaTeX-dvipdf-command @dots{} DVIをPDFに変換するコマンド @end table これらを変更する場合は、やはり@file{~/.emacs}にて、たとえば @lisp (setq tex-command "pdflatex") @end lisp のようにしてください。どのような値をセットすれば良いかについては、 @ref{All customizable variables}を参照してください。 @node Invocation, %#notation , Installation, Top @comment node-name, next, previous, up @chapter latexコマンド起動 @cindex prefix key @cindex C-c @cindex タイプセッタ[たいふせつた] @cindex プレヴューア[ふれひゆうあ] @cindex jlatex @cindex platex @cindex プリントアウト[ふりんとあうと] LaTeXソースの編集中、次のキー入力により、platex などのタイプセットプログラ ム(以後タイプセッタと呼ぶ)、プレヴューアなどの起動ができます。 @table @kbd @item [prefix] t j @dots{} タイプセッタ(platex)起動 @item [prefix] t r @dots{} タイプセッタ起動(領域指定) @item [prefix] t e @dots{} 部分タイプセット&プレヴュー (ポイント位置の段落、環境または数式モードのみをタイプセットして 隣のバッファに組版結果の画像を出す) @item [prefix] t k @dots{} 動作中のタイプセッタの停止 @item [prefix] t b @dots{} jbibtex起動 @item [prefix] t i @dots{} makeindex起動 @item [prefix] t d @dots{} タイプセット完了後dvipdfmx起動 @item [prefix] t p @dots{} プレヴューア起動 @item [prefix] t l @dots{} lpr(プリントアウト用)コマンド起動 @item [prefix] t s @dots{} xdvi -remote でのサーチ @end table @menu * Calling typesetter:: タイプセッタ起動 * Calling previewer:: プレヴューア起動 * Print out:: プリントアウト用コマンドの起動 @end menu @node Calling typesetter, Calling previewer, Invocation, Invocation @comment node-name, next, previous, up @section タイプセッタ起動 @cindex タイプセッタ起動[たいふせつたきとう] @cindex タイプセットエラー[たいふせつとえらあ] @cindex エラー修正[えらあしゆうせい] タイプセッタを起動すると、編集ウィンドウが2つに分割され、片方のウィンド ウにタイプセット画面が表示されます。出力されるメッセージと連動しタイプセッ トバッファは自動的にスクロールします。もし、途中でエラーが起こって止まって しまった場合にはタイプセットバッファに移り、(@kbd{C-x o}) タイプセッタの出 している ? プロンプトに対して、@kbd{x} (処理の中断)などの指示を送ることが できます。エラーを修正する場合は、 @table @kbd @item [prefix] ' @itemx (prefix+アポストロフィ) @dots{} 直前のエラー発生行へジャンプ @end table を入力することにより、タイプセッタがエラーを発生した行に移ることができます。 また、タイプセッタの出力する overfull hbox などのウォーニング行にも対応し ていますので、順次 @kbd{[prefix] '} を押すことにより、一つ前のウォーニング 発生行にジャンプしていきます。 もし、気になるエラー行があった場合は、タイプセットバッファで、エ ラーの表示されている行にカーソルを合わせスペースキーを押すと La@TeX{} ソースの対応する行にジャンプします。 @subsection 領域タイプセット ポイントとマークの間、あるいはテキスト中に埋め込んだ @code{%#BEGIN} と @code{%#END}の間の領域(@ref{%#notation})だけを切り取ってタイプセットすることが できます。この場合メインファイルのプリアンブルが一時ファイルの プリアンブルとして使われます。したがってプリアンブルにないマクロ定義が 領域内にあるとエラーになります。領域タイプセットを使う場合、 必ずマクロ定義はプリアンブル(@code{\begin@{document@}}より前)に置くよう にして下さい。一時ファイルはメインファイルのある ディレクトリの@file{texput.tex}という名前で出力されるので、 上書きには注意してください。 @subsection 環境タイプセット @kbd{[prefix] te} を押すと、ポイント位置の最も内側の環境、または数式モー ド内の場合はその数式モード全体、あるいは環境がなければその段落が自動的に 領域選択されて、領域タイプセットを呼び出します。 tabular環境や数式モードで複雑なものを作っている場合は確かめたい部分だけを 確認できるので便利です。Emacsが画像表示可能な場合は、 部分タイプセットの結果を画像化して隣のウィンドウに表示します。また、 特定の環境で呼び出した場合は、環境内の文字を書き換える度に自動的に プレビュー画像を更新します(on-the-flyプレヴュー)。 自動表示されない場合はプレヴューアで @file{texput.dvi} を開いたままにしておけば修正と確認が素早くできるでしょう。 画像プレヴューの場合の大きさ(解像度)はデフォルトで200dpi(数式は300dpi)です。 dpiを変えたい場合はLaTeXソースのどこかに @code{%#PREVIEWDPI 150} のようにdpi値を書いてください。 @node Calling previewer, Print out, Calling typesetter, Invocation @comment node-name, next, previous, up @section プレヴューア起動 @kbd{[prefix] t p} によりプレヴューアの起動ができます。さらに、もしあな たが、-remote 機能つきのxdviを利用している場合は @kbd{[prefix] t s} を押す ことによりカーソル位置の文字列を検索してそのページを表示するようにすでに起 動中のxdviに命令を送ります。これにより、現在編集中の箇所のタイプセット結果 を即座に見ることができます。 @c なお、-remote 機能付きの xdvi は @c @code{ftp://ftp.ae.keio.ac.jp/pub/text/xdvi/xdvi-remote} @c などから入手することができます。 @node Print out, , Calling previewer, Invocation @comment node-name, next, previous, up @section プリントアウト @kbd{[prefix] t l}を押してプリントアウトを指示すると、出力開始/終了ペー ジを聞いてくるので、それぞれに答えます。これを省略したい時は、 universal-argument をつけ、 @cindex 出力開始ページ[しゆつりよくかいしへえし] @cindex 出力終了ページ[しゆつりよくしゆうりようへえし] @table @kbd @item C-u [prefix] t l @dots{} ページ確認省略lpr起動 @end table @cindex ページ確認省略lpr起動[へえしかくにんしようりやくlprきとう] @noindent のように起動してください。 @node %#notation , Completion, Invocation, Top @comment node-name, next, previous, up @chapter %#記法 本文中に@code{%#}ではじまるキーワードを埋め込むことでタイプセッタ起動等 の制御をすることができます。 @menu * Changing typesetter:: タイプセット用コマンドの変更 * Splitting input files:: 入力ファイル分割 * Fix region for typesetting:: 領域の固定 * Special Filtering Region:: * lpr format:: プリントアウトコマンド用フォーマット * Controlling which command to invoke:: その他の起動コマンド制御 * Editing %# notation:: @end menu @node Changing typesetter, Splitting input files, %#notation , %#notation @comment node-name, next, previous, up @section タイプセット用コマンド変更 起動するコマンドを変えたい時は本文中に次のような行を書きます。 @cindex 起動するコマンドを変える[きとうするこまんとをかえる] @example %#!jlatex-ntt @end example NTT jTeX と、ASCII jTeX を使い分けたいような場合に便利でしょう。 @cindex タイプセッタの使い分け[たいふせつたのつかいわけ] @node Splitting input files, Fix region for typesetting, Changing typesetter, %#notation @comment node-name, next, previous, up @section 入力ファイル分割 また、章毎に別ファイルの .tex を作成している場合で、@file{main.tex}から @file{sub.tex} を @code{\include}しているような時は、@file{sub.tex}の任意の 位置に次のような行を埋め込みます。 @example %#!platex main.tex @end example @cindex 入力ファイル分割[にゆうりよくふあいるふんかつ] 上の例のようにコマンド名だけでなく引数も書いた場合には、全てをそのまま shell に渡すので次のように書けば、ghostview などをプレヴューアに使う時に便 利です。 @cindex ghostview @example %#!platex main && dvi2ps main.dvi > main @end example なお、この行の最後の単語のピリオド以前を「メインファイル」のベース ネームであると仮定します(上の2つの場合どちらも@file{main})。 この行に記述した、@code{%f}はメインファイル名に、 @code{%r} はメインファイルの拡張子を取り除いた部分に置換されます。 ただし、@code{%f,%r}を利用した場合、初回タイプセット時に必ずメインファイル 名の入力を促されます。 @kbd{[prefix] g} (@ref{Cursor jump}参照) での ファイル間ジャンプを有効に機能させるため、入力ファイル分割時には次のことに 注意して下さい。 @enumerate @item サブディレクトリを作って、その中にサブファイルを置くことはできるが サブディレクトリのサブディレクトリには置けない。 @item メインファイルからサブディレクトリ内のファイルを include する時には、 相対パス指定を用いて、 @code{\include@{chap1/sub@}}のように記述。 @item メインファイルが一つ上のディレクトリにある場合も、サブファイルには %#!platex main.tex のように記述する(../mainではない)。 @end enumerate @node Fix region for typesetting, lpr format, Splitting input files, %#notation @comment node-name, next, previous, up @section 領域の固定 @cindex 固定領域のタイプセット[こていりよういきのたいふせつと] @cindex %#BEGIN @cindex %#END @kbd{[prefix] tr} の領域指定のタイプセットでは、とくに指定のないかぎり、 @kbd{C-SPC}でマークした位置と、ポイント(カーソル位置)の間を領域とみなしま すが、必ず決まった領域をタイプセットしたい場合は、その領域を @example %#BEGIN <渡したい領域> %#END @end example @noindent のように@code{%#BEGIN}と@code{%#END}で囲み、カーソルを「@code{%#BEGIN}以降」 に置いてください。この時の領域決定規則をまとめると次のようになります。 @enumerate @item カーソル位置よりバッファの先頭方向に@code{%#BEGIN}というキーワードが ある場合 @enumerate @item @code{%#BEGIN}よりバッファの末尾方向に@code{%#END}というキーワードが見つかっ た場合。 @result{}@code{%#BEGIN} から、その @code{%#END} のある位置まで。 @item @code{%#END} が見つからなかった場合。 @result{}バッファの最後尾まで。 @end enumerate @cindex 領域決定規則[りよういきけつていきそく] @item カーソル位置よりバッファの先頭方向に @code{%#BEGIN} というキーワードが 見つからなかった場合。 @result{}マーク(@kbd{C-SPC}位置)とポイント(カーソル位置)の間の領域。 @end enumerate tabular 環境を何度も試行錯誤しているような場合は、@code{\begin}の前の行 に @code{%#BEGIN} と書き、@code{\end} の次の行に @code{%#END} と書いておく と簡単に作表結果をテストすることができます。また、長い .tex ファイルの後半 に @code{%#BEGIN} を書いておけば、前半の部分は無視できます。このBEGINとEND の消し忘れには十分ご注意下さい。 @cindex 長いファイルの編集[なかいふあいるのへんしゆう] @node Special Filtering Region, lpr format, Fix region for typesetting, %#notation @section 自動外部フィルタ たとえば、テキストファイルから画像を生成するようなツールに与えるソースを La@TeX{}ソース中に埋め込み、その部分だけをツールの標準入力に渡すことができ ます。そのためには以下のようなソースを文書中に書きます。 @example %#BEGIN FILTER{foo.pdf}{blockdiag -T %t -o %o} \if0 --- ....blah blah blah... ....blah blah blah... ....blah blah blah... --- \fi %#END @end example この領域内で @kbd{[prefix] t e} をタイプすると、この例であればblahのある3行が 外部コマンド @code{"blockdiag -T pdf -o foo.pdf"} の標準入力に渡され、 結果として foo.pdf が生成されます。この特別なブロックは @kbd{[prefix] tb} の環境補完で、@code{.blockdiag} のようなピリオドで始まる 特殊環境名を入力することで自動的に挿入されます。 @c @node Require, lpr format, Fix region for typesetting, %#notation @comment node-name, next, previous, up @node lpr format, Controlling which command to invoke, Fix region for typesetting, %#notation @comment node-name, next, previous, up @section lprフォーマット @cindex lprふぉーまっと[lprふおおまつと] @cindex lprフォーマット[lprふおおまつと] @cindex lpr format まず、プリントアウト用コマンド列のフォーマットについて説明します。 コマンド列フォーマットは、3つの Lisp 変数によって表現されます。デ フォルトの dvi2ps 用のフォーマットを例に説明します。 @table @code @item (1)dviprint-command-format @code{"dvi2ps %f %t %s | lpr"} @item (2)dviprint-from-format @code{"-f %b"} @item (3)dviprint-to-format @code{"-t %e"} @end table 実際にプリントアウトする時は、(1)中の %s がファイル名に置き換えられ、%f が (2)の内容、%t が(3)の内容に置き換えられます。その際に(2)の文字列中の %b は 「出力開始ページ」、(3)の文字列中の %e は「出力終了ページ」に置き換えられ ます。もし、ページを指定しない時には、%f, %t 両方とも無視されます。 この、dviprint-command-format を臨時に変えたい時は、La@TeX{} の ソーステキスト中の任意の場所に、 @example %#LPR dvi2ps %f %t %s | 4up -page 4 | texfix | lpr -Plp2 @end example @noindent のように書いて下さい。プリントアウトするページ範囲をいちいち聞かせないよう にする時に @example %#LPR dvi2ps %s | lpr @end example @noindent などとするのも便利かもしれません。 @node Controlling which command to invoke, Editing %# notation, lpr format, %#notation @comment node-name, next, previous, up @section その他の起動コマンド制御 @cindex その他のコマンド制御[そのたのこまんとせいきよ] La@TeX{} 文書に関連するコマンドは以下の %# 記法で指定することができます。 @table @code @item %#PREVIEW @dots{} Command line for DVI viewing ([prefix] t p) @item %#BIBTEX @dots{} makeindexを行なうコマンドライン([prefix] t b) @item %#MAKEINDEX @dots{} bibtexを行なうコマンドライン([prefix] t i) @item %#DVIPDF @dots{} DVIからPDF変換を行なうコマンドライン([prefix] t d) @item %#LPR @dots{} 印刷用のコマンドライン([prefix] t l) @item %#PDFVIEW @dots{} PDFファイルを見るためのコマンドライン @item %#IMAGEDPI @dots{} 即時プレヴュー(on-the-fly preview)用の画像のDPI @end table 行頭がこれらのキーワードで始まる行をLa@TeX{}文書の先頭付近に書いておけば、 それで指定したコマンドを起動できます。 @node Editing %# notation, , Controlling which command to invoke, %#notation @comment node-name, next, previous, up @section %#記法自体の編集 @cindex %#記法自体の編集[%#きほうしたいのへんしゆう] 以上のような@code{%#}で始まる各種制御記法を編集するためには @table @kbd @item [prefix] % @dots{} @code{%#}@var{記法編集メニュー} @end table @noindent を押します。 @example !)Edit-%#! B)EGIN-END-region L)Edit-%#LPR @end example @noindent というメニューが出て来るので、@code{%#!}に続くコマンドを変更したい時には @kbd{!}を、@code{%#LPR}で lpr フォーマットを変えたい時は@kbd{l}を、あらか じめ設定したリジョンを @code{%#BEGIN} 〜 @code{%#END} で括りたい時は、 @kbd{b}を押します。@kbd{b}を選んだ時には、それまでバッファ中に置かれていた @code{%#BEGIN}, @code{%#END} が自動的に消去されます。 @cindex lprフォーマットの変更[lprふおおまつとのへんこう] @node Completion, Local dictionary, %#notation , Top @comment node-name, next, previous, up @chapter 補完入力 La@TeX{} での環境名などは、野鳥の補完機能を利用して能率的に入力すること ができます。 @menu * begin型補完:: * section型補完:: * large型補完:: * maketitle型補完:: * Arbitrary completion:: 随時補完 * end補完:: * Accent mark completion:: アクセント記号補完 * Image completion:: 数式記号イメージ補完 * Greek letter completion:: ギリシャ文字補完 * Inserting parens:: @end menu @node begin型補完, section型補完, Completion, Completion @comment node-name, next, previous, up @section begin型補完 @cindex begin型補完[beginかたほかん] @cindex 環境名の補完[かんきようめいのほかん] @cindex prefix b @code{\begin@{env@}...\end@{env@}}の様な形式の入力の補完をbegin型補完と 呼ぶことにします。begin 型補完は、 @table @kbd @item [prefix] b @dots{} begin 型補完開始(標準では @kbd{C-c b}) @end table @noindent で始まります。頻繁に用いられる次の La@TeX{} 環境の補完は、[prefix] @kbd{b} に続く次の1文字を入力するだけで、@code{\begin@{xxx@}...\end@{xxx@}}を完成 させます。 @table @kbd @item [prefix] b c @dots{} @code{\begin@{center@}...\end@{center@}} @item [prefix] b d @dots{} @code{\begin@{document@}...\end@{document@}} @item [prefix] b D @dots{} @code{\begin@{description@}...\end@{description@}} @item [prefix] b e @dots{} @code{\begin@{enumerate@}...\end@{enumerate@}} @item [prefix] b E @dots{} @code{\begin@{equation@}...\end@{equation@}} @item [prefix] b i @dots{} @code{\begin@{itemize@}...\end@{itemize@}} @item [prefix] b l @dots{} @code{\begin@{flushleft@}...\end@{flushleft@}} @item [prefix] b m @dots{} @code{\begin@{minipage@}...\end@{minipage@}} @item [prefix] b t @dots{} @code{\begin@{tabbing@}...\end@{tabbing@}} @item [prefix] b T @dots{} @code{\begin@{tabular@}...\end@{tabular@}} @item [prefix] b ^T @dots{} @code{\begin@{table@}...\end@{table@}} @item [prefix] b p @dots{} @code{\begin@{picture@}...\end@{picture@}} @item [prefix] b q @dots{} @code{\begin@{quote@}...\end@{quote@}} @item [prefix] b Q @dots{} @code{\begin@{quotation@}...\end@{quotation@}} @item [prefix] b r @dots{} @code{\begin@{flushright@}...\end@{flushright@}} @item [prefix] b v @dots{} @code{\begin@{verbatim@}...\end@{verbatim@}} @item [prefix] b V @dots{} @code{\begin@{verse@}...\end@{verse@}} @end table 上記のもの以外の環境名は Emacs の持つインクリメンタルな補完機能を用いて 入力します(上記の環境名も以下の補完入力可能)。 @table @kbd @item [prefix] b @key{SPC} @dots{} begin 型補完入力 @end table @kbd{[prefix] b @key{SPC}} と入力すると、最下行のミニバッファに @example Begin environment(default document): @end example @noindent と表示されます。ここで、何も入れずにリターンキーのみ押すと、括弧内に出てい るデフォルトの環境名が入力されますが、適当な環境名を入力すると、 @code{\begin@{環境名@} … \end@{環境名@}}が文書中に挿入されます。ミニバッ ファで環境名を入力するときに、環境名の頭文字を入力し「スペース」をたたくと、 一致する環境名が内部テーブルに存在した場合、正しい環境名に補完されるので、 入力の手間が省けます。内部テーブルに存在しない環境名を入力した時はユーザ専 用のテーブルに登録され、さらにそのテーブルを自動的に、ユーザ辞書(デフォル トでは @file{~/.yatexrc})に保存します。 さらに、特定の環境を補完入力した時にはその環境で必ず用いられるエントリを自 動挿入します(例: @code{itemize}環境における@code{\item}など)。挿入されたエ ントリが不要な場合にはundoによって消去して下さい。 @cindex ユーザ辞書[ゆうさししよ] @subsection 既に書いたテキストを環境で括る ところで、最初に書いてしまったブロックを後から、itemize 環境の中 に閉じこめたいと思うことがありますが、そのようなときは、あらかじめ 閉じこめたい段落をマークして、begin 型補完の各コマンドの @kbd{[prefix]} の次の『小文字の 'b'』 を『大文字』に変えて起動して下さい。(または、 @kbd{C-u} を先に打ち、universal argument をつけても可能です) @cindex ブロック[ふろつく] @cindex 閉じ込める[としこめる] 例えばあるパラグラフを description 環境の中に入れたいときは、 そのパラグラフをマークしてから、補完機能を呼び出してください(description 環境の場合は @kbd{[prefix] b D})。 選択された領域を括ります。ただしこれは @code{transient-mark-mode} が t (Emacsの標準)になっている場合のみで、普段 @code{transient-mark-mode} を @code{nil} にしている場合は、 補完キー前に @code{universal-argument} 指定(@kbd{C-u}) をタイプしてから @kbd{[prefix] b D} など、補完キーを タイプすれば括り補完になります。 なおEmacs22以降であれば @code{transient-mark-mode} 無効時も @code{set-mark-command} (@kbd{C-space})の連打で一時的に @code{transient-mark-mode} が有効になります。 @node section型補完, large型補完, begin型補完, Completion @comment node-name, next, previous, up @section section型補完 @cindex section型補完[sectionかたほかん] @cindex prefix s @code{\section@{目的@}} のような形式の入力の補完を section 型補完と呼ぶこ とにします。section 型補完は、 @table @kbd @item [prefix] s @dots{} section 型補完 @end table で実行します。@kbd{[prefix] s} を入力するとミニバッファに、 @example (C-v for view-section) \???@{@} (default documentclass): @end example @noindent というプロンプトが現れるので、そこで @samp{section} のような La@TeX{} コマ ンド名を入力します。ここでもリターンキーのみで括弧内のデフォルト値が選択さ れるほか、@samp{chapter}などのような頻度の高い名称入力にはスペースキーによ る補完機能が有効です。 次に、@{@}の中身の入力を促す、 @example \section@{???@}: @end example @noindent というプロンプトが現れるので、セクションのタイトルなどを入力します。 たとえば、 @example (C-v for view-section) \???@{@} (default documentclass): section \section@{???@}: 目的 @end example @noindent のように入力した場合は、文章中に @example \section@{目的@} @end example @noindent が挿入され、 @example (C-v for view-section) \???@{@} (default section): vspace* \vspace*@{???@}: @end example @noindent のように@{@}の中身を省略したときは、 @example \vspace*@{@} @end example @noindent だけが挿入され、改行はせずカーソルは自動的に中括弧の内側に移動します。 @menu * 2個以上の引数をとる section型コマンド:: * Enclose section-type command:: 括り補完 * Recursive completion:: 再帰補完 * view-sectioning:: セクション区切りのアウトライン表示 * label-generation:: ラベル自動生成 @end menu @node 2個以上の引数をとる section型コマンド, Enclose section-type command, section型補完, section型補完 @comment node-name, next, previous, up @subsection 2個以上の引数をとる section型コマンド @cindex 引数[ひきすう] ところで、@samp{\addtolength@{\topmargin@}@{8mm@}} などのように、引数を二つ 以上取る La@TeX{} コマンドがあります。このようなコマンドの補完入力には、 section 型補完呼び出しに引数を付けてください。例えば上の@samp{addtolength} の例であれば、引数2を指定します。つまり、 @example C-u 2 [prefix] s (または、ESC 2 [prefix] s) @end example @noindent と section 型補完を呼び出した後、 @example (Ctrl-v for view-section) \???@{@} (default vspace*): addtolength \addtolength@{???@}: \topmargin Argument 2: 8mm @end example @noindent のように入力してください。最初の addtolength の部分と、第一引数である \topmargin の入力は当然スペースによる補完入力が可能です。ユーザ辞書に登録 される La@TeX{} コマンドには、この引数の数も学習されるので、最初の補完の時 引数の数を指定して起動しておけば、以後の補完時には、記憶された個数だけ引数 を聞いて来るようになります。あとで引数の個数を変えたい時は、再び @kbd{C-u} を用いて個数を指定し直すことで、自動的に辞書中の引数の個数の部分を更新しま す。 @cindex 引数の個数を変える[ひきすうのこすうをかえる] @node Enclose section-type command, Recursive completion, 2個以上の引数をとる section型コマンド, section型補完 @subsection 既に書いたテキストを括る @cindex 括る[くくる] また、section型補完機能の呼び出し時に領域選択状態にしておくと 領域内のテキストを section 型コマンドの第一引数として括ります。 これも普段 @code{transient-mark-mode} を @code{nil} にしている場合は @kbd{C-u} のあとに補完キーをタイプすれば強制的に括り補完になります。 @node Recursive completion, view-sectioning, Enclose section-type command, section型補完 @comment node-name, next, previous, up @subsection 再帰補完 @cindex 再帰補完[さいきほかん] 高度な使い方になるかもしれませんが、section型補完の引数の入力時にさらに 補完入力を利用することができます(section/large/maketitle型に限る)。section 型コマンドの引数に更に La@TeX{} コマンドが来る場合にはミニバッファで野鳥の 補完キーを再帰的に入力することで引数の入力も効率的に行なえます。 @node view-sectioning, label-generation, Recursive completion, section型補完 @comment node-name, next, previous, up @subsection セクション区切りのアウトライン表示 @cindex アウトライン[あうとらいん] 通常のsection型補完の時にミニバッファで@kbd{C-v}を押すと現在存在するセク ション区切りコマンド全てを @code{*Sectioning Lines*}というバッファに一覧表 示します(「<<--」のついている行がもっとも近いセクション区切り)。この時ミニ バッファで@kbd{C-p}, @kbd{C-n} を押すと@samp{part}, @samp{chapter}, ..., @samp{subparagraph} のコマンドが論理階層の高さにしたがって上下します。また、 @kbd{C-v}, @kbd{M-v} を押すとセクション区切り一覧バッファがスクロールし、 数字の@kbd{0}〜@kbd{7}を押すとある高さ以上のセクション区切りだけを選んで表 示します(実際にやって見れば分かります)。 @code{*Sectioning Lines*}バッファは、 @table @kbd @item M-x YaTeX-section-overview @dots{} セクション区切り一覧バッファを生成 @end table @cindex セクション区切り一覧バッファ[せくしよんくきりいちらんはつふあ] で作成することができます。このバッファを選択し任意の行でスペースを押すと、 該当するセクション区切りのある本文中の場所にジャンプします。さらに、同バッ ファで @kbd{u} を押すと、ソーステキストの対応するセクションコマンドが一階 層上がり(例: subsection が section に変わる)、@kbd{d}を押すと一階層下がり ます。@code{*Sectioning Lines*}バッファにあるセクション区切りの行をマーク しておいて@kbd{U}を押すとリジョン内のものに対応するソーステキストのセクショ ンコマンドすべてが一階層上がり、@kbd{D}を押すと下がります。セクション区切 り一覧バッファで利用できるキーコマンドには以下のものがあります。 @table @kbd @item SPC @dots{} 対応するソース行へジャンプ @item . @dots{} 対応するソース行を表示 @item u @dots{} カーソル位置に対応するセクションコマンドを一階層上げる @item d @dots{} カーソル位置に対応するセクションコマンドを一階層下げる @item U @dots{} マークしたセクションコマンドを一階層上げる @item D @dots{} マークしたセクションコマンドを一階層上げる @item 0〜6 @dots{} レベル n 以下のセクションコマンドを隠して表示 @end table @cindex 論理階層[ろんりかいそう] @cindex セクション区切り[せくしよんくきり] @cindex ジャンプ[しやんふ] @node label-generation, , view-sectioning, section型補完 @comment node-name, next, previous, up @subsection ラベル自動生成 @cindex ラベル自動生成[らへるしとうせいせい] @code{\ref@{@}} や @code{\cite@{@}} マクロをsection型補完で入れた場合 参照先となり得るものを全て探してメニューにして選択できます。参照先には @code{\label@{@}}をつけておく必要はありません。もしあれば、そのラベルを 使い、なければその場で参照先に@code{\label@{@}}を作らせてくれます。 ラベル名を考えるのは苦痛に感じるものです。全てのカウンタにラベルを つけるのもたいへんです。もうラベル名に何をつけるか、ラベルをつけるかつけま いか、などということは忘れましょう! ラベルを打つべき項目の選択の際には、可能性のあるすべてのカウンタが表示され ます。これを「数式のみ」のように種別で絞りたいときは以下のキーコマンドが 利用できます。 @table @kbd @item M-a @dots{} 絞り込みを解除してすべてのカウンタを表示 @item M-c @dots{} キャプションのみを表示 @item M-e @dots{} 番号のつく数式のみを表示 @item M-i @dots{} 番号つき箇条書のみを表示 @item M-s @dots{} セクションのみを表示 @item M-m @dots{} その他のカウンタのみを表示 @end table @node large型補完, maketitle型補完, section型補完, Completion @comment node-name, next, previous, up @section large型補完 @cindex large型補完[largeかたほかん] @cindex prefix l @code{@{\large @}} のような形式の補完を large 型補完と呼ぶことにします。 @table @kbd @item [prefix] l @dots{} large 型補完開始 @end table @noindent がlarge型補完の開始です。@kbd{[prefix] l} を押すと、ミニバッファに @example @{\??? @} (default large): @end example と表示されるので、上記のものと同じ要領で補完入力して下さい。補完候補に用意 されているのは、@samp{footnotesize} や @samp{huge} のような文字サイズ指定 子と、@samp{bf}や@samp{dg}のようなフォント指定子です。 @cindex 文字サイズ指定子[もしさいすしていし] @cindex フォント指定子[ふおんとしていし] @subsection 既に書いた文字を括る @cindex 括る[くくる] また、begin型補完の時と同様、先に書いてしまった一連の文章の文字のサイズ を変えたいと思う時がありますが、そのような時は、サイズや大きさを変えたい文 字の範囲をマークしてからlarge型補完を呼んでください。 @node maketitle型補完, Arbitrary completion, large型補完, Completion @comment node-name, next, previous, up @section maketitle型補完 @cindex maketitle型補完[maketitleかたほかん] @cindex prefix m @code{\maketitle} の形式の補完を maketitle 型補完と呼ぶことにします。 @table @kbd @item [prefix] m @dots{} maketitle 型補完開始 @end table @noindent で、maketitle 型補完を開始します。補完の要領は今までのものとまったく同じで す。La@TeX{} 用のコマンド名が補完候補として用意されています。 @node Arbitrary completion, end補完, maketitle型補完, Completion @comment node-name, next, previous, up @section 随時補完 @cindex 随時補完[すいしほかん] @cindex prefix SPC さて、今まで述べた典型的な La@TeX{} コマンド形式の補完入力を用いずに、今 入力しようとしている La@TeX{} コマンドを文書中の任意の位置で随時補完するこ ともできます。La@TeX{} コマンド(先頭が\で始まる)を入力している途中で、 @table @kbd @item [prefix] SPC @dots{} 随時補完 @end table @noindent を入力すれば、全ての補完候補の中から一致するものが選ばれカーソル位置に挿入 されます。 @node end補完, Accent mark completion, Arbitrary completion, Completion @comment node-name, next, previous, up @section end補完 @cindex end補完[endほかん] @cindex prefix e 現在開いたままの環境名を自動的に検出し、@code{\end@{環境名@}}を挿入しま す。begin 型補完を用いれば環境の閉じ忘れはないのですが、時にはついつい手で @code{\begin@{環境名@}} を入れてしまい、悲しい思いをすることがあります。そ のような時には気にせず続けて文章を入力し、しかるのちに @table @kbd @item [prefix] e @dots{} end 補完 @end table @noindent とすることで、現在開いている環境名で \end@{@} が補われます。 @node Accent mark completion, Image completion, end補完, Completion @comment node-name, next, previous, up @section アクセント記号補完 @cindex アクセント記号補完[あくせんときこうほかん] @cindex prefix a @cindex 欧文[おうふん] 欧文のアクセント記号(@code{\`@{o@}}など)を入力する時は、 @table @kbd @item [prefix] a @dots{} アクセント記号入力 @end table @noindent を押すと、ミニバッファに @example 1:` 2:' 3:^ 4:" 5:~ 6:= 7:. u v H t c d b @end example @noindent というメニューが出て来るので、数字、または対応する記号/英字を入力 して下さい。すると編集バッファに、 @example \`@{@} @end example @noindent が現われ、カーソルが@{@}内に位置するので、さらに一文字入力する事で、 @example \`@{o@} @end example @noindent が完成され、カーソルは@{@}の外に戻ります。 @node Image completion, Greek letter completion, Accent mark completion, Completion @comment node-name, next, previous, up @section 数式記号イメージ補完 @cindex 数式記号イメージ補完[すうしききこういめえしほかん] @cindex イメージ補完[いめえしほかん] @cindex ; @cindex 数式モード[すうしきもおと] @cindex 矢印[やしるし] @cindex Σ[しくま] @cindex leftarrow @cindex ∞[むけんたい] 主に数式モードで使用される、矢印やΣなどの記号を擬似的に表現するキー入力 で、La@TeX{} コマンドを入力できます。これは野鳥自身の「数式モード」でのみ 動作します。野鳥はカーソルが@TeX{}の数式環境の中にある時に@kbd{;}や、 @kbd{:}に特殊な機能を持たせます。 さて、例えば、←(leftarrow)をASCII文字だけで表現する場合、一般的には「<-」 のようにしますが、これを利用して、数式記号イメージ入力モードで @code{\leftarrow}を入力するには、@kbd{;}(セミコロン)を打ってから@kbd{<-}と 入力します。同様に、長い矢印←-(long-leftarrow) をASCII文字だけで表現する 場合「<--」とするので、@code{\longleftarrow}を入力するためには、@kbd{;<--} と入力します。あるいは無限大記号をASCII文字だけで表現する時は「oo」のよう にすることから、@code{\infty} を入力する時は、@kbd{;oo}とキー入力します。 これらの操作をまとめると次のようになります。 @example INPUT 入力される La@TeX{} コマンド ; < - @code{\leftarrow} ; < - - @code{\longleftarrow} ; < - - > @code{\longleftrightarrow} ; o @code{\circ} ; o o @code{\infty} @end example いずれの場合も、イメージ入力を行っている途中で望みのものがバッファ に表示されたなら、そこでイメージ入力を止めて次の編集動作に移っても 構いません。 @cindex ;自身[;ししん] 数式環境中で@samp{;}自身を入力するには@kbd{;;}のようにします。イメージ 入力の途中でTABを押すと、それまで入力した文字で始まるもの一覧が表示されま す。ここで目的の La@TeX{} コマンドまでカーソルを移動し再度TABを押すことで その La@TeX{} コマンドがバッファに挿入されます。 どのキー入力にどの記号が対応しているか全て知りたい時は、@kbd{;}を押した 直後にTABを押してください。以下の例は、@kbd{;<}と押した後にTABを押したもの です。 @example KEY LaTeX sequence sign < \leq ≦ << \ll 《 <- \leftarrow ← <= \Leftarrow <= @end example 左から[入力キー]、[対応する La@TeX{} コマンド]、[(擬似)記号図示]、と いう順でメニューが出て来るので、よく使うものを覚えておくと良いでしょ う。ものによってはASCII文字で表現することが困難なので、あまり覚え やすいキー並びではないものがあるでしょうから、そのような場合は \maketitle 型補完で入力するか、以下に述べる対応表の設定を行って単 純なキー並びのものを設定すると良いでしょう。 入力キーと La@TeX{} コマンド、記号の対応表を個人的に設定したい場合は Emacs-Lisp 変数 @code{YaTeX-math-sign-alist-private} に定義してください。 その内容とデフォルトのものを合わせたものが対応表として使用されます(private の方が優先される)。なお、この変数の構造については @file{yatexmth.el} を参 照してください。 @cindex YaTeX-math-sign-alist-private @node Greek letter completion, Inserting parens, Image completion, Completion @comment node-name, next, previous, up @section ギリシャ文字補完 @cindex ギリシャ文字補完[きりしやもしほかん] @cindex : もう一つ、数式環境中で@kbd{:}を押すとギリシャ文字入力モードに入ります。 @kbd{:}を押した直後に@kbd{a}を押すと@code{\alpha}が、@kbd{g} を押すと @code{\gamma}が、などアルファベットに対応したギリシャ文字が挿入されます。 操作方法は;の数式記号補完とまったく同じです。まずは@kbd{:}の直後に TABを押してどのアルファベットにどのギリシャ文字が対応しているか調べてみて ください。 @kbd{;}と@kbd{:}を数式環境中で押しているにもかかわらず、イメージ補完が働 かない場合は、@kbd{C-u ;}のように universal-argument をつけてキーを押すこ とにより、強制的にイメージ補完に入ることができます。また、この時にどのよう な状態で数式環境内判定に失敗したかをご連絡下さい。 @node Inserting parens, , Greek letter completion, Completion @section 括弧入力補助 @cindex 括弧入力補助[かつこにゆうりよくほしよ] 3種類ある括弧 () {} [] の開き括弧を入れたときに閉じ括弧を自動的に入れます。 @code{\} の直後にの @code{[} を入れると行を分けてインデントを揃え、 数式入力に備えます。その他 La@TeX{} のマクロに応じて括弧の釣合の取れた 状態に導きます。開き括弧そのものを1つだけ入れたいときは @kbd{C-q} で クォート入力するか、@kbd{[prefix] w m} で修正モードをOFFにしてください。 領域選択してから開き括弧を入れるとその領域をその種類の括弧で括ります。 @node Local dictionary, Commenting out, Completion, Top @comment node-name, next, previous, up @chapter ローカル辞書 @cindex ローカル辞書[ろおかるししよ] @cindex .yatexrc 補完入力用の候補は三種類の辞書から構成されています。一つは @file{yatex.el}に組み込まれた「標準辞書」、もう一つはユーザが個人的に常用 するコマンドを保存する「ユーザ辞書」、そしてもうひとつはあるディレクトリで のみ有効なコマンドを保存する「ローカル辞書」です。 補完入力時に新しい単語を入れた場合に、その単語をどの辞書に入れるか聞いて 来ます。 @example `foo' is not in table. Register into: U)serDic L)ocalDic N)one D)iscard @end example @noindent というプロンプトに対し、@kbd{u}と答えると「ユーザ辞書」を、@kbd{l}と答える とローカル辞書を更新し、@kbd{n}と答えると辞書ファイルは更新せず現在のEmacs セッションのみ有効な単語とし、@kbd{d}と答えると新たな単語を学習せずに捨て ることになります。 もし、ローカル辞書の機能はいらず、全てユーザ辞書の更新のみでよいと言う場 合には@file{~/.emacs}などで、 @cindex YaTeX-nervous @lisp (setq YaTeX-nervous nil) @end lisp @noindent として下さい。 @node Commenting out, Cursor jump, Local dictionary, Top @comment node-name, next, previous, up @chapter コメントアウト @cindex コメントアウト[こめんとあうと] @cindex prefix < @cindex prefix > @cindex prefix . @cindex prefix , La@TeX{}の編集には試行錯誤がつきものです。ある部分を一括でコメントアウト したり、コメントを外したりしたいことがあります。 @table @kbd @item [prefix] > @dots{} リジョンを % でコメントアウト @item [prefix] < @dots{} リジョンの % のコメントを外す @end table @noindent は、あらかじめ設定したリジョンに対しての操作、 @table @kbd @item [prefix] . @dots{} 現在のパラグラフをコメントアウト @item [prefix] , @dots{} 現在のパラグラフのコメントを外す @end table @noindent は、カーソルの位置するパラグラフ全体に対しての操作です。なお、ここでいう 「パラグラフ」は (@code{mark-paragraph}) 関数によりマークされる範囲を指し ます(標準設定で@kbd{ESC h}にバインドされている)。なお、既に@code{%}でコメ ントアウトされているパラグラフに対して繰り返しパラグラフのコメントを使用し た場合の動作は保証しませんので御注意ください。 さて、文章に対してだけでなく、時には@code{\begin}, @code{\end} 自体に対 してもコメントアウトの操作をしたいときがあります。このようなときは、 @code{\begin@{@}} あるいは @code{\end@{@}} の行にカーソルを合わせ、 @table @kbd @item [prefix] > @dots{} @code{\begin@{@}}〜@code{\end@{@}} 全てコメントアウト @item [prefix] < @dots{} @code{\begin@{@}}〜@code{\end@{@}} 全てコメントを外す @end table @noindent とすることで、@code{\begin〜\end}で囲まれる環境全てに対してコメント操作し、 @table @kbd @item [prefix] . @dots{} @code{\begin@{@}} と @code{\end@{@}} をコメントアウト @item [prefix] , @dots{} @code{\begin@{@}} と @code{\end@{@}} のコメントを外す @end table は、対応する @code{\begin} と @code{\end} 2行だけを、コメント操作の対象と します。リジョンをコメントアウトしようとして、マークを設定したのちにカーソ ルを移動し@kbd{[preifx] >} を押してもカーソルが @code{\begin@{@}} の上にあ ると@code{\begin@{@}}〜@code{\end@{@}}モードでコメント機能が働いてしまうの で注意して下さい。 @node Cursor jump, Modifying/Deleting, Commenting out, Top @comment node-name, next, previous, up @chapter カーソルジャンプ @cindex カーソルジャンプ[かあそるしやんふ] @cindex prefix g @menu * 対応オブジェクトへのジャンプ:: * お絵描きツール起動:: * メインファイルへのジャンプ:: * 環境を単位としたジャンプ:: * 最後の補完位置へのジャンプ:: @end menu @node 対応オブジェクトへのジャンプ, お絵描きツール起動, Cursor jump, Cursor jump @comment node-name, next, previous, up @section 対応オブジェクトへのジャンプ 文書中のいろいろな場所で @table @kbd @item [prefix] g @dots{} 対応するオブジェクトにジャンプ @end table @noindent を押すことにより、カーソル位置のLa@TeX{}コマンドに対応する場所にジャンプ します。対応関係が存在すると解釈されるコマンドには以下のものがあります。 @itemize @bullet @item @code{\begin@{@}} ←→ @code{\end@{@}} @item @code{%#BEGIN} ←→ @code{%#END} @item 画像ファイルの取り込みマクロ → 対応するviewer/お絵かきツール起動 @item @code{\label@{@}} ←→ @code{\ref@{@}} @item @code{\include(\input)} → 対応するファイル @item @code{\bibitem@{@}} ←→ @code{\cite@{@}} @end itemize @code{\begin@{@}} か @code{\end@{@}} の行で@kbd{[prefix] g}を押すことに より、対応する@code{end/begin}の行にジャンプします。もちろん対応するものが ない場合はエラーになります。またこれは、領域固定のための @code{%#BEGIN} と @code{%#END} のペアに対しても同様に動作します。なお、@code{label/ref}や @code{cite/bibitem}対応するものが別ファイルにある時は、ジャンプ先となるファ イルがオープンされていなければなりません。@xref{%#notation}. メインの .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} 間のジャンプに対しては (意味がないと思われるので)機能しないので注意してください。 @node お絵描きツール起動, メインファイルへのジャンプ, 対応オブジェクトへのジャンプ, Cursor jump @comment node-name, next, previous, up @section お絵描きツール起動 @cindex お絵描きツール起動[おえかきつうるきとう] 上記の「画像ファイルの取り込みマクロ」とは、例えば @code{\epsfile@{file=foo@}} のような挿絵取り込みコマンドのことで、この行に カーソルを合わせて@kbd{[prefix] g}を押すとその画像ファイルの元となったファ イルを対応するお絵描きツールを起動してオープンします。起動するツールの判定 は以下のようになされます。 @enumerate @item カレント行が変数 @code{YaTeX-processed-file-regexp-alist} に定義さ れている正規表現のいずれかとマッチしたら、ファイル名に相当する部分を \\(\\)から抜き出して覚えておく(何番目の\\(\\)かは変数の各リストの cdr 部に 入れておく)。マッチしなければ何もしない。 @item 行末に、変数 @code{YaTeX-file-processor-alist} に登録されているコマンドが 「%コマンド」 のように書いてあれば強制的に「コマンド ファイル名.拡張子」を 起動。 @item なければ、変数 @code{YaTeX-file-processor-alist} の各リストのcdr部に入って いる拡張子を「ファイル名」の後ろに足したファイルが存在するか順次調べて、存 在した場合car部に入っているコマンドを起動する。 @item 以上どれかにマッチしなければあきらめる。 @end enumerate 変数 @code{YaTeX-file-processor-alist} と変数 @code{YaTeX-file-processor-alist} の設定方法についてはそれぞれの変数につい て describe-variable して説明を読んで下さい。うまく設定すると、画像ファイ ルにかぎらず、任意の形式のファイルを任意のプロセッサで処理するコマンドを簡 単に呼び出すことができます。 @node メインファイルへのジャンプ, 環境を単位としたジャンプ, お絵描きツール起動, Cursor jump @comment node-name, next, previous, up @section メインファイルへのジャンプ @file{chap1.tex}のようなサブファイルで、 @table @kbd @item [prefix] ^ @dots{} メインファイルにジャンプ @item [prefix] 4 ^ @dots{} 別ウィンドウでメインファイルにジャンプ @end table @noindent を押すと、メインファイルの編集バッファに切替えます。もし、メインファイルを オープンしていない場合は、カレントディレクトリから探して自動的にオープンし ます。 @node 環境を単位としたジャンプ, 最後の補完位置へのジャンプ, メインファイルへのジャンプ, Cursor jump @comment node-name, next, previous, up @section 環境を単位としたジャンプ さらに現在の環境を単位として機能するコマンドに以下のものがあります。 @cindex 環境の先頭へ[かんきようのせんとうへ] @cindex 環境の末尾へ[かんきようのまつひへ] @cindex 環境をマーク[かんきようをまあく] @cindex M-C-a @cindex M-C-e @cindex M-C-@@ @table @kbd @item M-C-a @dots{} 環境の先頭(@code{\begin})へジャンプ @item M-C-e @dots{} 環境の末尾(@code{\end})へジャンプ @item M-C-@@ @dots{} 環境全体をマーク @end table 上記のコマンドは通常の@kbd{[prefix]}キーではなく@kbd{META}キーをプリフィク スとして機能するのでご注意下さい。 @node 最後の補完位置へのジャンプ, , 環境を単位としたジャンプ, Cursor jump @comment node-name, next, previous, up @section 最後の補完位置へのジャンプ 野鳥は補完入力した位置を常にレジスタ @code{3}に保存しています。 入力途中で如何なるファイルの如何なる位置に行ったとしても、 @kbd{C-x j 3}(@code{jump-to-register})を使って直ちに最後の補完入力位置に戻 ることができます。 @node Modifying/Deleting, Filling, Cursor jump, Top @comment node-name, next, previous, up @chapter 変更/削除 @cindex 変更/削除[へんこう/さくしよ] @cindex prefix c @cindex prefix k 既に入力されている La@TeX{} コマンドの変更/削除のために以下の機能が用意 されています。 @table @kbd @item [prefix] c @dots{} カーソル位置の La@TeX{} コマンドの変更 @item [prefix] k @dots{} カーソル位置の La@TeX{} コマンドの削除 @end table これらのコマンドは、コマンドを起動する場所によって動作を決定するので注意し て下さい。 @menu * Changing LaTeX command:: La@TeX{} コマンドの変更 * Killing LaTeX command:: La@TeX{} コマンドの削除 @end menu @node Changing LaTeX command, Killing LaTeX command, Modifying/Deleting, Modifying/Deleting @comment node-name, next, previous, up @section La@TeX{} コマンドの変更 変更したい La@TeX{} コマンドにカーソルを合わせて @kbd{[prefix] c} を押すとそのコマンドを補完入力などを用いて手軽に変えることができます。 @kbd{[prefix] c} で変更できるコマンドには以下のものがあります。 @itemize @item @code{begin/end} の環境名 @item section型コマンドのコマンド名 @item section型コマンドの引数 @item section型コマンドのオプションパラメータ([]で囲まれたもの) @item large型コマンド @item (イメージ補完で入力可能な)数式モード専用のmaketitle型コマンド @end itemize 変えたいsection型コマンドの引数がさらに La@TeX{} コマンドを含む場合は、 その引数を囲む中括弧の上で @kbd{[prefix] c} を押すことで中のコマンドを変更 対象判定から除外することができます。 @cindex 環境名の変更[かんきようめいのへんこう] @node Killing LaTeX command, , Changing LaTeX command, Modifying/Deleting @comment node-name, next, previous, up @section La@TeX{} コマンドの削除 @kbd{[prefix] k} は起動する位置により 次のような動作を行います。 @cindex 環境の削除[かんきようのさくしよ] @example 起動位置 動作 \begin, \endの行 @code{\begin\end}ペアの削除 %#BEGIN, %#END の行 %#BEGIN,%#ENDペアの削除 section型コマンドの上(中) section型コマンドの削除 フォント指定括弧の上 フォント指定の削除 括弧の上 対をなす括弧の削除 @end example @code{\begin, \end} および @code{%#BEGIN, %#END} を削除する場合、 @code{\begin, \end} や @code{%#BEGIN, %#END} の存在する行は まるごと削除されるので、それらの一行に @code{\begin} などを二つ以上連ねて 書かないように注意してください。 上記のものはすべて本文を囲う「容器」を削除するように働きますが、 universal-argument (@kbd{C-u}) を打った後で@kbd{[prefix] k}をタイプすると、 それぞれの「容器」に含まれる「中身」も一気に削除します。以下の例を参考にし て下さい。 @example 元のテキスト: [prefix] k C-u [prefix] k 本文\footnote@{脚注@}です。 本文脚注です。 本文です。 ↑(カーソル位置) @end example @node Filling, Includeonly, Modifying/Deleting, Top @comment node-name, next, previous, up @chapter 桁揃え @cindex 桁揃え[けたそろえ] @section itemの桁揃え @cindex itemなどの桁揃え[itemなとのけたそろえ] @cindex prefix i itemize 環境中にある@code{\item}の項目(文章)が複数行に渡る場合に、項 目の先頭を桁揃えしたい場合には、 @c @table @kbd @c @item [prefix] i @c @dots{} itemの桁揃え @c @end table @table @kbd @item M-q @dots{} 桁揃え @end table @cindex NTT-jTeX[えぬていいていいしえいてつく] @noindent によって、その item のインデントの深さに応じて fill されます。なお、古い NTT jTeX を使用している場合には、Lisp 変数@code{NTT-jTeX}を@code{t}にセッ トして下さい。 @cindex YaTeX-item-regexp このとき、変数@code{YaTeX-item-regexp}の値(標準では @code{"\\\\item"})を 項目指定コマンドの正規表現として検索に使用します。itemize 環境で、独自のコ マンドを定義して項目を列挙している場合(例えば@code{\underlineitem})は、 @file{~/.emacs} で次のように指定して下さい。 @lisp (setq YaTeX-item-regexp "\\(\\\\\\(sub\\)*item\\)\\|\\(\\\\underlineitem\\)") @end lisp この変数の指定の仕方がよく分からない場合は、独自の項目列挙コマンドの名前を @code{@code{"\item"}で始まるものにして下さい(例えば"\itembf"})。 野鳥の @kbd{M-q} では @code{\item} を環境に応じて以下のように「ハングイン デント」します。 @example itemize, enumerate環境: >\item[ほげほげ] 英語では、特に意味のない単語を `foo' であらわしま > すが、これの日本語版ともいえる単語が「ほげほげ」 > です。 description環境: > \item[へろへろ] 「ほげほげ」をでたらめが単語として使った時に、第 > 2のでたらめな単語として「へろへろ」が使われることが多 > いようです。 @end example @section パラグラフの桁揃え @cindex パラグラフの桁揃え[はらくらふのけたそろえ] @cindex M-q itemize環境以外でのパラグラフの桁揃え(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] @cindex includeonly ファイルを分割して文章を入力している時には、メインファイル中に @example \includeonly@{現在編集中のファイル名@} @end example @noindent のように書いておくことで、タイプセットの時間を節約できますが、ちょっと他の ファイルを手直ししたい時には @cindex 他のファイルの手直し[ほかのふあいるのてなおし] @example \includeonly@{ちょっと手直ししたいファイル名@} @end example と書き直さなければならず手間がかかります。野鳥では現在編集しているファイル 名がメインファイルの@code{\includeonly}にない場合には自動的にこれを検出し、 次の指示を仰ぎます。 @example A)dd R)eplace %)comment? @end example 現在編集中のファイルを @code{\includeonly} のリストに加えたい時には@kbd{a} を、現在編集中のファイルだけを @code{\includeonly} にしたい時は@kbd{r}を、 @code{\includeonly} の行をコメントアウトして無効化したい時には、@kbd{%}を それぞれ押して下さい。 @node What column, Intelligent newline, Includeonly, Top @comment node-name, next, previous, up @chapter ここはどこ? @cindex ここはどこ?[ここはとこ?] @cindex prefix & @cindex 複雑なtabular[ふくさつなtabular] 項目数の多い tabular などをたくさん書いていると下の方の行で、いま書いて いる桁がどこに対応するのかわからなくなってしまうことがあります。例えば、以 下のような tabular において、 @example \begin@{tabular@}@{|c|c|c|c|c|c|c|c|@}\hline 氏名&所属&〒&住所&電話&FAX&帰省先&帰省先電話\\ \hline 矢上二郎 & 6 & 223 & 横浜市港北区日吉 & xxx-yyy & zzz-www & トンガ & 9876-54321 \\ 日吉小僧 & 2 & \multicolumn@{2@}@{c|@}@{教えない@} &&&(???) \\ \hline \end@{tabular@} @end example (???)の部分がどの項目なのかすぐに判断するのは難しいでしょう。こんな時は、 @table @kbd @item [prefix] & @dots{} 現在のカラム表示 @end table @cindex 現在のカラム表示[けんさいのからむひようし] @noindent を押すとカーソル位置のカラムがどの項目に該当するかをミニバッファに表示しま す。tabular/array環境の第1行目を項目名の並びとみなして対応するものを探しま す。もし項目名として別のものを表示して欲しい場合は、行頭を@code{%}にしてダ ミーの項目並びを作っておくと良いでしょう。 @node Intelligent newline, Usepackage cheker, What column, Top @comment node-name, next, previous, up @chapter おまかせ改行 @cindex おまかせ改行[おまかせかいきよう] @cindex &入力[&にゆうりよく] tabular[*], array, itemize, enumerate, tabbing 環境をbegin型補完で入力し た時、または各環境内で @table @kbd @item ESC RET @dots{} おまかせ改行 @end table を押すと、その環境に応じた行エントリを次の行に挿入します(begin型補完時に自 動挿入されたエントリが不要な場合は undo によって消去できます)。例えば、 tabular環境では、その環境のカラム数に対応した個数の @code{&} に加え、行末 の @code{\\} を入れます。この時それ以前に @code{\hline} があればそれも付け 加えます。環境とそれに応じて自動入力するものの対応は以下のようになります。 @itemize @item @code{tabular}, @code{tabular*}, @code{array} カラム数-1 だけの @code{&} と @code{\\}。必要に応じて @code{\hline} @item @code{tabbing} 一行目で定義している @code{\=} と同じ個数の @code{\>}。 @item @code{itemize}, @code{enumerate}, @code{description}, @code{list} @code{\item} または @code{item[]} @end itemize tabular 環境の例のように、本機能は各環境の一行目の内容を参考にして動作す るので、なるべく二行目以降で呼び出すようにしてください。 もし、その他の環境、例えば @code{foo}、に対して@code{おまかせ改行}を動作 させたい時は、@code{YaTeX-intelligent-newline-foo} という名前の関数を定義 します。定義した関数は、現在の行に改行を挿入した直後の行頭の位置で呼ばれま す。関数 @code{YaTeX-indent-line} を呼ぶと現在の環境のネストに応じた深さに インデントされるので、これを呼んでから何かを挿入するようなコードを書くとよ いでしょう。@file{yatexenv.el}内の関数 @code{YaTeX-intelligent-newline-itemize} の定義などを参考にしてください。 @node Usepackage cheker, Changing mode of YaTeX, Intelligent newline, Top @comment node-name, next, previous, up @chapter 先回りusepackage @cindex 先回りusepackage[さきまわり] begin型、section型、maketitle型、いずれかのLaTeX2eマクロを補完入力すると、 そのマクロの利用に外部パッケージを必要とする場合、そのパッケージを 本文中で @code{\usepackage@{@}} しているかどうかを調査し、もししていなければ プリアンブルに対応するパッケージを引数にした @code{\usepackage} 文を (確認後に)挿入します。 ただしこの機能が働くためには、パッケージ名とその中で定義されているマクロ 群をalistの形式で変数 @code{YaTeX-package-alist-private} に設定しておく必 要があります。 @node Changing mode of YaTeX, Online help, Usepackage cheker, Top @comment node-name, next, previous, up @chapter 野鳥の動作モード切り替え @cindex モード切り替え[もうときりかえ] @cindex prefix w @table @kbd @item [prefix] w @dots{} 野鳥動作モード切り替えメニュー @end table @noindent で野鳥自身の動作を決定する以下のモードを切り替えます。 @itemize @bullet @item 修正モード @item 野鳥数式モード @end itemize 修正モードは、開き括弧入力時の処理をコントロールし、修正モードONの時は開き 括弧の入力は開き括弧のみの入力になり、修正モードOFFの時は開き括弧の入力だ けで閉じ括弧まで入力します。デフォルト(起動時)の設定は@emph{OFF}です。 野鳥数式モードは、変数 @code{YaTeX-auto-math-mode} が @code{nil} の時の み有効で、このとき@kbd{;}や@kbd{:}を押した時(@ref{Image completion}参照)に、 どのようなイメージ補完を機能させるか、通常のキーとして機能させるかを手動で 切り替えます。自動判定が遅いマシンでは@code{YaTeX-auto-math-mode} @code{nil}にセットし、野鳥数式モードを手動で切り替えると良いでしょう。 @node Online help, Inclusion hierarchy browser, Changing mode of YaTeX, Top @comment node-name, next, previous, up @chapter オンラインヘルプ @cindex オンラインヘルプ[おんらいんへるふ] @cindex apropos @cindex キーワード検索[きいわあとけんさく] @cindex prefix ? @cindex prefix / 使おうとする La@TeX{} コマンドの用法がよく分からない時は、オンラインヘル プをひきましょう。ヘルプに関するキーには以下のものがあります。 @table @kbd @item [prefix] ? @dots{} オンラインヘルプ @item [prefix] / @dots{} オンラインapropos @end table @section オンラインヘルプ @cindex グローバルヘルプ[くろおはるへるふ] @cindex プライベートヘルプ[ふらいへえとへるふ] @cindex YaTeX-help-file @cindex YaTeX-help-file-private 「オンラインヘルプ」は、一般的な La@TeX{} コマンド(デフォルトでカーソル 位置のコマンド)に対する説明を隣のバッファに表示します。この時参照されるヘ ルプ用ファイルには「グローバルヘルプ」と「プライベートヘルプ」の二種類があ り、前者は La@TeX{} の標準コマンドの主なものの説明を含むファイルで、変数 @code{YaTeX-help-file}の値で指定されます。このファイルは通常公共の場所(デ フォルトで@code{$EMACSEXECPATH})に置かれ、誰もがその内容を更新できるように 全員に書き込み権が与えられるべきものです。後者は、非標準もしくは個人的なマ クロ定義に関する説明が書かれているファイルで、変数 @code{YaTeX-help-file-private}の値で指定されます。こちらはユーザのホームディ レクトリの下などに置かれます。 @section オンラインapropos 「オンラインapropos」は GNU Emacs の apropos と同様、ユーザが指定したキー ワードを説明文に含む項目すべてを隣のバッファに表示します。 もし、調べようとしたLa@TeX{}コマンドに対する説明がヘルプファイル中に見つ からなかった場合は、説明文の入力を求めてくるので、可能であれば参考書などを 調べてそのコマンドの説明を入力してください。もし、なにか標準的なコマンドに 対する説明を書いたならばぜひ私までその説明をお送り下さい。次回の配布に含め たいと思います。 @node Inclusion hierarchy browser, Cooperation with other packages, Online help, Top @comment node-name, next, previous, up @chapter インクルード構造ブラウザ @cindex インクルード構造[いんくるうとこうそう] @cindex prefix d 複数のファイルに分割しているドキュメントを書いている場合、 @table @kbd @item [prefix] d @dots{} インクルード構造ブラウズ @end table @noindent を押すと、そのドキュメントの親ファイルを聞いて来ます。ここで全てのファイル の親となるファイル(デフォルトが示されているので大抵はRETのみ)を入力すると インクルードしている全てのファイルを解析し、インクルード状況を視覚的に表示 します。このバッファでは以下のキー操作が有効です。 @table @kbd @item n @dots{} 次の行に移動し対応するファイルを隣のバッファに表示 @item p @dots{} 上の行に移動し対応するファイルを隣のバッファに表示 @item N @dots{} 同じインクルードレベルの次のファイルに移動 @item P @dots{} 同じインクルードレベルの前のファイルに移動 @item j @dots{} 次の行に移動 @item k @dots{} 上の行に移動 @item u @dots{} 一代親にあたるファイルに移動 @item . @dots{} カーソル位置のファイルを隣のバッファに表示 @item SPC @dots{} 隣のバッファの対応ファイルをスクロールアップ @item DEL, b @dots{} 隣のバッファの対応ファイルをスクロールダウン @item < @dots{} 隣のバッファの対応ファイルの先頭を表示 @item > @dots{} 隣のバッファの対応ファイルの末尾を表示 @item ' @dots{} (@kbd{<}や@kbd{>}の後で)元の表示位置に戻る @item RET, g @dots{} カーソル位置のファイルを隣のバッファでオープン @item mouse-2 @dots{} RETと同じ(ウィンドウ使用時のみ) @item o @dots{} 隣のウィンドウに移動 @item 1 @dots{} 他のウィンドウを消す @item - @dots{} ブラウズウィンドウを小さくする @item + @dots{} ブラウズウィンドウを大きくする @item ? @dots{} ヘルプ表示 @item q @dots{} 表示前の状態に戻る @end table ただし、隣のウィンドウのファイルの内容を表示する機能に関しては、対応する ファイルをクローズしてしまうとうまく働きませんのでご注意ください。 @node Cooperation with other packages, Customizations, Inclusion hierarchy browser, Top @comment node-name, next, previous, up @chapter 他パッケージとの連携 @cindex 他パッケージとの連携[たはつけえしとのれんけい] @section gmhist @cindex gmhist @cindex コマンドヒストリ[こまんとひすとり] @cindex ヒストリ[ひすとり] @file{gmhist.el}と@file{gmhist-mh.el} をロードしている場合、プレヴューコ マンドの入力(@kbd{[prefix] tp]})、印刷コマンドの入力(@kbd{[prefix] tl})の 時に独立したヒストリを利用できます。それぞれのプロンプトで、@kbd{M-p} を押 すと直前に利用したコマンド文字列をくり返し呼び出すことができます。 @section min-out @cindex min-out @file{min-out.el} (@code{outline-minor-mode}) と野鳥を組み合わせて使うこ とももちろん可能です。設定の方法に関しては@file{yatexm-o.el}をご覧ください。 @node Customizations, Etc, Cooperation with other packages, Top @comment node-name, next, previous, up @chapter カスタマイズ @cindex カスタマイズ[かすたまいす] @cindex キーアサイン[きいあさいん] 野鳥の動作を制御する種々の変数を独自に設定することにより、補完入 力を起動するキーアサインを変えたり、環境名の補完候補をさらに充実さ せることなどができます。 @menu * Lisp variables:: lisp 変数 * Add-in functions:: 付加関数(アドイン関数) @end menu @node Lisp variables, Add-in functions, Customizations, Customizations @comment node-name, next, previous, up @section lisp 変数 @cindex prefixキー変更[prefixきいへんこう] 例えば prefix キーを @kbd{C-c} 以外のキーにしたい場合は、 @code{YaTeX-prefix}に prefix キーにしたいシンボルを定義してください。さら に、「@kbd{C-c 英字}」というキーバインドは独自の関数が割り当ててあるので使 いたくない。このような時は、@code{YaTeX-inhibit-prefix-letter} を @code{t} に設定することにより、@kbd{C-c 英字…}のバインドが全て、対応する@kbd{C-c C-英字…}に変わります(ただし、begin型 large型補完の大文字起動によるリジョ ン指定は可能なままです。これも無効にしたい場合は@code{t}ではなく 1 にセッ トして下さい。)。 @menu * All customizable variables:: カスタマイズ変数一覧 * Sample definitions:: カスタマイズ変数設定例 * Hook variables:: hook変数 * Hook file:: hook用ファイル @end menu @node All customizable variables, Sample definitions, Lisp variables, Lisp variables @comment node-name, next, previous, up @subsection カスタマイズ変数一覧 @cindex カスタマイズ変数一覧[かすたまいすへんすういちらん] yatex-mode における次の変数がカスタマイズ可能です。@file{~/.emacs} で @code{setq} しておけば、そちらの定義が優先されます。括弧の中はデフォルト値 です。実際に変数の値を変更する場合は @kbd{M-x describe-variable} で 変数の詳細な説明を参照してください。 @defvar YaTeX-prefix yatex-mode 中のプリフィクスキー (@kbd{\C-c}) @end defvar @defvar YaTeX-inhibit-prefix-letter prefix キーの直後のキーバインドで @kbd{英字} のものを @kbd{C-英字} に変更 (@code{nil}) @end defvar @defvar YaTeX-fill-prefix 本文を書く時の行頭に挿入する接頭辞すなわち fill-prefix (@code{""(nil)}) @end defvar @defvar YaTeX-user-completion-table 学習したLa@TeX{}コマンド保存ファイル名 (@code{"~/.yatexrc"}) @end defvar @defvar YaTeX-kanji-code 文書を作成する時の漢字コード nil=既存のコードのまま 0=no-conversion 1=Shift JIS, 2=JIS, 3=EUC, 4=UTF-8 (2 (MS-DOSでは1)) @end defvar @defvar tex-command La@TeX{}タイプセッタコマンド名 (@code{"platex"}) @end defvar @defvar dvi2-command プレヴューアコマンド名 (@code{"xdvi -geo +0+0 -s 4"}) @end defvar @defvar dviprint-command-format dviファイルの印刷に使われるコマンド式 (@code{"dvi2ps %f %t %s | lpr"}) @end defvar @defvar dviprint-from-format 上の@code{%f}に相当する開始ページ指定書式、@code{%b} が開始ページ番号に変 わる (@code{"-f %b"}) @end defvar @defvar dviprint-to-format @code{%t} に相当する終了ページ指定書式、@code{%e}が終了ページ番号に変わる (@code{"-t %e"}) @end defvar @defvar makeindex-command makeindexコマンド (@code{"makeindex"} (MS-DOSでは@code{"makeind"})) @end defvar @defvar YaTeX-dvipdf-command dviをPDFに変換するコマンド (@code{"dvipdfmx"}) @end defvar @defvar YaTeX-on-the-fly-preview-interval @kbd{[prefix] t e}で環境即時previewをする場合の変換処理までの 無操作時間(秒) (0.9) @code{nil} の場合は即時プレヴューをしない。 @end defvar @defvar YaTeX-on-the-fly-math-preview-engine @kbd{[prefix] t e}で数式環境を即時previewする時に用いるエンジン (latex-math-previewが利用可能なときは latex-math-preview-expression を呼ぶ @code{'YaTeX-typeset-environment-by-lmp} そうでないときは内蔵関数を呼ぶ @code{'YaTeX-typeset-environment-by-builtin}) @end defvar @defvar YaTeX-cmd-gimp GIMPを起動するコマンド (code{"gimp"}) @end defvar @defvar YaTeX-cmd-tgif tgifを起動するコマンド (code{"tgif"}) @end defvar @defvar YaTeX-cmd-inkscape Inkscapeを起動するコマンド (code{"inkscape"}) @end defvar @defvar YaTeX-cmd-dia Diaを起動するコマンド (code{"dia"}) @end defvar @defvar YaTeX-cmd-ooo OpenOffice.orgまたはLibreOfficeを起動するコマンド (code{"soffice"}) @end defvar @defvar YaTeX-cmd-gs Ghostscriptを起動するコマンド (code{"gs"}) @end defvar @defvar YaTeX-cmd-dvips dvipsを起動するコマンド(環境によってはpdvipsなど) (code{"dvips"}) @end defvar @defvar YaTeX-cmd-displayline displaylineを起動するコマンド (code{"/Applications/Skim.app/Contents/SharedSupport/displayline"}) @end defvar @defvar YaTeX-cmd-edit-ps PostScriptファイルを編集するコマンド (変数code{"YaTeX-cmd-gimp"}の値) @end defvar @defvar YaTeX-cmd-edit-pdf PDFファイルを編集するコマンド (変数code{"YaTeX-cmd-ooo"}の値) @end defvar @defvar YaTeX-cmd-edit-ai .aiファイルを編集するコマンド (変数code{"YaTeX-cmd-inkscape"}の値) @end defvar @defvar YaTeX-cmd-edit-svg SVGファイルを編集するコマンド (変数code{"YaTeX-cmd-inkscape"}の値) @end defvar @defvar YaTeX-cmd-edit-images その他画像ファイルを編集するコマンド (変数code{"YaTeX-cmd-gimp"}の値) @end defvar @defvar YaTeX-need-nonstop @code{\nonstopmode@{@}}を自動的に付加するか (@code{nil}) @end defvar @defvar latex-warning-regexp latexコマンドの出力するウォーニング行の正規表現 (@code{"line.* [0-9]*"}) @end defvar @defvar latex-error-regexp 同じくエラー行の正規表現 (@code{"l\\.[1-9][0-9]*"}) @end defvar @defvar latex-dos-emergency-message MS-DOS上で動作する latex コマンドが、エラーにより停止するとき出力するメッ セージ (@code{"Emergency stop"}) @end defvar @defvar latex-message-kanji-code タイプセッタの出力するメッセージの漢字コード.タイプセットバッファ の出力が化ける時は、これを設定する (2, Nemacsでのみ有効) @end defvar @defvar NTT-jTeX 古いNTT-j@TeX{}使用時のようにインデントした行の先頭と前の行の (タイプセット後の)字間が空いてしまうのを嫌う場合は@code{t}にする (@code{nil}) @end defvar @defvar YaTeX-item-regexp itemの桁揃えの時に用いる、itemの正規表現 (@code{"\\\\(sub\\)*item"}) @end defvar @defvar YaTeX-verb-regexp verbコマンドの正規表現。先頭の\\\\はつけない (@code{"verb\\*?\\|path"}) @end defvar @defvar YaTeX-nervous ローカル辞書を用いる時 @code{t} (@code{t}) @end defvar @defvar YaTeX-sectioning-regexp セクション区切り設定コマンドの正規表現 (@code{"\\(part\\|chapter\\*?\\|\\(sub\\)*\\(section\\|paragraph\\)\\*?\\)\\b"}) @end defvar @defvar YaTeX-fill-inhibit-environments fill を抑止する環境名のリスト (@code{'("tabular" "tabular*" "array" "picture" "eqnarray" "eqnarray*" "equation" "math" "displaymath" "verbatim" "verbatim*")}) @end defvar @defvar YaTeX-uncomment-once 領域uncommentで行頭の複数の@code{%}を全て削除するか (@code{nil}) @end defvar @defvar YaTeX-close-paren-always 開き括弧の入力で常に閉じ括弧を入力する (@code{t}) @end defvar @defvar YaTeX-auto-math-mode 数式モードの切り替えを自動的に行う (@code{t}) @end defvar @defvar YaTeX-math-key-list-private 数式イメージ補完で用いる (プリフィクスキー . 対応補完テーブル) の alist (@code{nil})。補完テーブルの書き方については@file{yatexmth.el}を参照。 @end defvar @defvar YaTeX-default-pop-window-height 1画面の時にタイプセットバッファを初めて作成する時の高さ。数値で行数、数字 文字列でEmacsウィンドウに対する百分率 (10) @end defvar @defvar YaTeX-help-file 共用ヘルプファイル (@file{$doc-directory/../../site-lisp/YATEXHLP.jp}) @end defvar @defvar YaTeX-help-file-private 個人用ヘルプファイル (@file{"~/YATEXHLP.jp"}) @end defvar @defvar YaTeX-no-begend-shortcut @kbd{[prefix] b ??} のショートカットを使わず、@kbd{[prefix] b} だけで補完 入力に入る (@code{nil}) @end defvar @defvar YaTeX-hilit-pattern-adjustment-private 正規表現とそれにマッチするものの論理的意味をシンボルであらわしたものの リスト…のリスト。hilit19 を組み込んでいる時のみ有効。 詳しくは @code{(assq 'yatex-mode hilit-patterns-alist)} した結果と、変数 @code{YaTeX-hilit-pattern-adjustment-default} の値(と場合 によっては hilit19 のドキュメント)を参照せよ。 @end defvar @defvar YaTeX-sectioning-level LaTeXのセクション単位宣言コマンドとその論理的高さのalist。 @end defvar @defvar YaTeX-hierarchy-ignore-heading-regexp Hierarchy バッファは通常ファイルヘッダとして、LaTeXのセクション宣言コマン ドの引数を検索し、それがなければコメント行を探すが、その際にヘッダとしては 意味を持たないパターンをこの変数に設定する。デフォルトでは RCS ヘッダとモー ド指定行(-*- xxx -*-)が設定されている。 @end defvar @defvar YaTeX-skip-default-reader Non-nil に設定するとsection型コマンドの引数入力時、アドイン関数がなければ ミニバッファでの読み込みをせずに入力を完了させる (@code{nil}) @end defvar @defvar YaTeX-create-file-prefix-g @code{\include}などで @kbd{prefix g}した時に、ジャンプ先が存在しないファイ ルであってもオープンする (@code{nil}) @end defvar @defvar YaTeX-simple-messages 各種補完時のメッセージ出力を簡素化する (@code{nil}) @end defvar @defvar YaTeX-hilit-sectioning-face 色付けが有効な時の @code{\part} の色 (@code{'(yellow/dodgerblue yellow/slateblue)})。 リストの第一要素は @code{hilit-background-mode} が @code{'light} の時の、 第二要素は @code{'dark} の時の @code{\chapter} の色で、文字色/背景色 のよ うに指定する。 @end defvar @defvar YaTeX-hilit-sectioning-attenuation-rate 色付けが有効な時の、@code{\subparagraph} の色を @code{\chapter} の濃度の何 %薄くしたものにするか (@code{'(15 40)}) @code{YaTeX-hilit-sectioning-face} の項参照。 @end defvar @defvar YaTeX-use-AMS-LaTeX AMS-LaTeX を使用する場合は @code{t} に設定する (@code{nil}) @end defvar @defvar YaTeX-use-LaTeX2e LaTeX2e を使用する場合は @code{t} に設定する (@code{t}) @end defvar @defvar YaTeX-template-file 新規ファイル作成時に自動挿入するファイル名 (@code{~/work/template.tex}) @end defvar @defvar YaTeX-search-file-from-top-directory inputするファイルを探すときの基準ディレクトリをmainファイルのあるディレクト リにするか (@code{t}) @end defvar @defvar YaTeX-use-font-lock ソースの色づけパッケージとして font-lock を利用するかどうか (@code{(featurep 'font-lock)}) @end defvar @defvar YaTeX-use-hilit19 ソースの色づけパッケージとして hilit19 を利用するかどうか (@code{(featurep 'hilit19)}) @end defvar @defvar YaTeX-use-italic-bold italic, boldフォントを野鳥が探すかどうか (Emacs20以降なら@code{t}) font-lock利用時のみ有効。 (@code{(featurep 'hilit19)} @end defvar @defvar YaTeX-singlecmd-suffix 全てのmaketitle型コマンドの補完入力直後に挿入する文字列。 @code{"@{@}"} などがお勧め。 @end defvar @defvar YaTeX-package-alist-private LaTeX2eのパッケージ名とその中に含まれるマクロのリスト。 適切に設定しておくと本文入力時にマクロを補完入力すると そのマクロに必要なパッケージを usepackage するか自動的に検査してくれる。 していなければ \usepackage を自動追加することもできる。 リストは @lisp '((パッケージ名1 (補完タイプ マクロのリスト……) (補完タイプ マクロのリスト……)) (パッケージ名2 (補完タイプ マクロのリスト……) (補完タイプ マクロのリスト……))………) @end lisp という形式にする。補完タイプは @code{env, section, maketitle} のどれか。 具体例は変数 @code{YaTeX-package-alist-default} の値参照。 @end defvar @defvar YaTeX-tabular-indentation tabular/array 環境で現在行の先頭位置が表の第Nカラムのときは 標準インデント位置から N*YaTeX-tabular-indentation 桁下げた インデントにする。 @end defvar @defvar YaTeX-noindent-env-regexp 別の環境内にあっても \begin@{@} が行頭から始まるべき環境名の正規表現。 verbatim環境などを指定する。 @end defvar @defvar YaTeX-electric-indent-mode Emacs 24.4 で導入された改行時の、自動インデントをどうするか。 この値がそのまま electric-indent-local-mode に渡される。 -1でoff。 @end defvar @defvar YaTeX-ref-default-label-string \ref@{@} のラベル補完でラベル未設定のものに自動的に生成する ラベル名の書式。strftime(3)関数に似た日付ベースで指定する。 利用できる書式は以下のとおり。 %y -> 西暦下二桁, %b -> 月の英名, %m -> 月(1〜12) %d -> 日, %H -> 時, %M -> 分, %S -> 秒, %qx -> アルファベットで26進数化した yymmdd. %qX -> アルファベットで26進数化した HHMMSS. デフォルトは "%H%M%S_%d%b%y" @end defvar @defvar YaTeX-ref-generate-label-function \ref@{@}のラベル名自動生成のときに使う関数のシンボル。 デフォルトは標準の YaTeX::ref-generate-label 関数が割り当ててある。 引数を2つ取る関数を定義して、この変数にセットするとその関数を呼んだ 結果をデフォルトのラベル名候補とする。設定例: @lisp (setq YaTeX-ref-generate-label-function 'my-yatex-generate-label) (defun my-yatex-generate-label (command value) (and (string= command "caption") (re-search-backward "\\\\begin@{\\(figure\\|table\\)@}" nil t) (setq command (match-string 1))) (let ((alist '(("chapter" . "chap") ("section" . "sec") ("subsection" . "subsec") ("figure" . "fig") ("table" . "tbl")))) (if (setq command (cdr (assoc command alist))) (concat command ":" value) (YaTeX::ref-generate-label nil nil)))) @end lisp @end defvar @node Sample definitions, Hook variables, All customizable variables, Lisp variables @comment node-name, next, previous, up @subsection カスタマイズ変数設定例 @cindex 設定例[せつていれい] たとえば、prefix キーとして@kbd{ESC}を使用し、新たな補完候補を格納するファ イルを、@file{~/src/emacs/yatexrc} にし、行頭の prefix をタブ文字一つに変 えたいときは、 @lisp (setq YaTeX-prefix "\e" YaTeX-user-completion-table "~/src/emacs/yatexrc" YaTeX-fill-prefix " ") @end lisp @noindent を @file{~/.emacs} に加えます。 @node Hook variables, Hook file, Sample definitions, Lisp variables @comment node-name, next, previous, up @subsection hook変数 @cindex hook変数[hookへんすう] @cindex yatex-mode-hook @cindex yatex-mode-load-hook また、hook 変数 @code{yatex-mode-hook}, @code{yatex-mode-load-hook} を用 意しています。すべての yatex-mode のバッファで作用させたいものは、 @code{yatex-mode-hook} に記述し、@file{yatex.el} をロードする時だけ作用さ せたいものは@code{yatex-mode-load-hook} に記述します。例えば、 @code{outline-minor-mode} を利用する場合、それぞれのバッファで @code{outline-minor-mode} を有効にしたいので、@code{yatex-mode-hook} を次 のように設定します。 @lisp (setq yatex-mode-hook '(lambda () (outline-minor-mode t))) @end lisp 逆に、独自のキー定義を行いたい時などは、@code{yatex-mode-load-hook} を利用 します。例えば、begin 型補完において、 document や、enumerate 以外の環境名 もショートカットキーで入れたいなどという時は、次のようにします。以下の例は、 @kbd{[prefix] ba} で @code{\begin@{abstract@}}, @code{\end@{abstract@}} を 挿入します。 @lisp (setq yatex-mode-load-hook '(lambda() (YaTeX-define-begend-key "ba" "abstract"))) @end lisp なお、新たなキーの定義には、関数 @code{YaTeX-define-key} @code{YaTeX-define-begend-key}を利用するようにしてください。 @node Hook file, , Hook variables, Lisp variables @comment node-name, next, previous, up @subsection hook用ファイル 変数 @code{yatex-mode-load-hook} で定義する内容が多い時は、 @file{yatexhks.el}というファイルを作り、その中に野鳥関連の設定を書く事で、 初期化の時に自動的にロードします。 @node Add-in functions, , Lisp variables, Customizations @comment node-name, next, previous, up @section 付加関数(アドイン関数) 各種補完時に、環境名やコマンド名に応じたきめ細やかな補完入力機能を実現す るための関数を作成することができます。この関数の作成方法や、組み込み方法に 関しては、@code{yatexadd.doc} をご覧ください。 @node Etc, Copying, Customizations, Top @comment node-name, next, previous, up @chapter その他 野鳥の標準の La@TeX{} コマンドの辞書には、作者が頻繁に使うものしか登録さ れていません。これは、補完候補に使いそうもないコマンドが存在して、補完した いコマンドを出すまでのストローク数を増やしてしまう事を防止するためです。標 準辞書にないコマンドも、できるだけ補完入力方式を利用し、ユーザ辞書を充実さ せることで、あなたの La@TeX{} スタイルにあった野鳥へと育っていくことでしょ う。 @node Copying, Concept Index, Etc, Top @comment node-name, next, previous, up @chapter 取り扱い 本プログラムはフリーソフトウェアです。本プログラムを使用して生じたいかな る結果に対しても作者は責任を負わないこととします。転載等に関しては制限いた しません。常識的に扱ってください。また、本プログラムに含まれるコードを利用 すること、改造することも自由に行なって構いませんが、流用することにより契約 締結の必要が生じる場合、私はいかなる契約も締結しません。具体的にはGPLへの サインはしませんので、GNUに寄贈するものを作っている場合私の作品から取り込 んだコードを流用すると苦労するかもしれません。いかなるコード流用も拒否しま せんが契約締結は辞退します。 苦情、希望、バグ報告、感想等は歓迎いたします。 連絡は yuuji@@yatex.org まで(2017年9月現在)。 継続的に使用してくださる方はメイリングリスト「fj野鳥の会」に 是非加入してください。加入方法については本パッケージの @file{docs/qanda} ファイルの「その他」の章を御覧ください。 仕様は、予告なく確実に(気分次第で)変更されます:-p。 @flushright 広瀬雄二 @end flushright @node Concept Index, , Copying, Top @comment node-name, next, previous, up @unnumbered 索引 @printindex cp @c カスタマイズ変数索引を索引と分離する場合にはコメントアウトを外す!!! @c @node Variable Index @c @comment node-name, next, previous, up @c @unnumbered カスタマイズ変数索引 @c @printindex vr @contents @bye @c Local Variables: @c fill-column: 74 @c fill-prefix: nil @c buffer-file-coding-system: sjis @c End:  Tag table:  End tag table yatex1.81/docs/yatexref.eng010044400037440000000000000140321303342261200150100ustar yuujiwheel---------------------------------------------------------------------------- YaTeX Quick Reference ---------------------------------------------------------------------------- [Caution] You can customize the prefix key (C-c by default) so this will be written as [prefix] in this document. If you have not customized [prefix] a will stand for C-c a. Begin-type commands are those like \begin-\end, Section-type commands are those that take arguments as \section{NAME}, Large-type commands are font/size definition commands that are put in parenthesis as {\tt}, Maketitle-type commands are commands that don't take arguments as \maketitle. [Completion] *Accent completion [prefix] a *Begin-type completion [prefix] b SPC *Begin-type completion (region) [prefix] B SPC *Begin-type completion (immediate) [prefix] b initial_of_environment *Begin-type completion (immediate on region) [prefix] B initial_of_environment *End completion [prefix] e *Large-type completion [prefix] l *Large-type completion (region) [prefix] L *Maketitle-type completion [prefix] m *Section-type completion [prefix] s *Section-type completion (region) [prefix] S *General completion [prefix] SPC For the initials used in immediate Begin-type completions, see the Info manual. In the (region)-mode, region between the mark and the present point will be put within a \begin{foo}...\end{foo} or {\large } and such. *Math sign image completion ; *Greek letter image completion : Above two commands may be used only in the math environment. If you want to use the completion in other environments, do C-u and then ; or :. [Process invoking] *invoke latex [prefix] tj *invoke latex (on region) [prefix] tr *on-the-fly preview environment [prefix] te *invoke bibtex [prefix] tb *invoke makeindex [prefix] ti *kill current typesetting process [prefix] tk ** *lpr dvi-file [prefix] tl *lpr dvi-file (all pages) C-u [prefix] tl *invoke previewer [prefix] tp *invoke lpq [prefix] tq Hitting [prefix] t will get you the menu, so there is no need to remember the key after [prefix] t. **Unavailable on MS-DOS The region used in [prefix] tr are the lines between %#BEGIN and %#END. If %#END is not found then from %#BEGIN and the end of the text. If both are missing then from the mark to the present point. [Cursor Jump] *To the typeset error [prefix] ' Will jump to the position where the typeset error occurred from the end. Only effective when there was a error returned from typesetter. *Jump to corresponding object [prefix] g *Jump to corresponding object (in another her window) [prefix] 4g Where to jump will be decided by what's on the line [prefix] g was hit. -on a \begin{} or \end{} to a matching \end{} or \begin{} -on a %#BEGIN or %#END to a matching %#END or %#BEGIN -on a \include(only) or \input to the matching file -on a \ref or \label to the matching \label or \ref -on a \cite or \bibitem to the matching \bibitem or \cite -other to the matching line in previewer *Jump to the main file [prefix] ^ *Jump to the main file in another window [prefix] 4^ To tell YaTeX which the main file is, write %#jlatex MAIN_FILE_NAME somewhere in the file you are creating. *Jump to beginning of environment ESC C-a *Jump to end of environment ESC C-e *Mark whole environment ESC C-h [Commenting out by %] *Comment out the region/environment [prefix] > *Uncomment the region/environment [prefix] < If the point is on a line with \begin{} or \end{}, everything within the environment will be (un)commented. Otherwise, everything between the mark and point will be (un)commented. *Comment out a paragraph or environment declaration [prefix] . *Uncomment out a paragraph or environment declaration [prefix] , If the point is on a line with \begin{} or \end, the two lines with it will be (un)commented. Otherwise the paragraph that the point is in will be (un)commented. [ETC] *Align and fill item [prefix] i Available only in an environment. Will do a hanging indent on the \item. *Change LaTeX command [prefix] c On a line with \begin{} or \end{}, will change the name of the environment. On a section-type command, will change the command name, and also change arguments if invoked on the argument. For large-type command, will change font/size definitions. On a math mode command entered using image-type completion, will return to the completion operation. *Kill commands [prefix] k For \begin{}/\end{}, %#BEGIN/%#END, and parenthesis, will delete them in pairs. For section-type commands, font/size definition, will delete the command ant parenthesis surrounding them. *Enclose region with () [prefix] ) *Enclose region with {} [prefix] } *Enclose region with [] [prefix] ] *Enclose region with $$ [prefix] $ *Toggle modes [prefix] w Will toggle between modify mode and math mode. *%# editing [prefix] % *Show columns in tabular/array [prefix] & *Online help [prefix] h *Online apropos [prefix] / *Intelligent return ESC RET Intelligent return can be used in tabular, array, itemize, enumerate, list and description environments. *Browse included structure [prefix] d *Force re-highlight font-lock [prefix] u HIROSE Yuuji yuuji@yatex.org Local variables: mode: text fill-prefix: " " End: yatex1.81/00readme010064400037440000000000000020541315523115400130650ustar yuujiwheel・Mercurialリポジトリでも公開しています(1.74以降)。 % hg clone https://www.yatex.org/hgrepos/yatex yatex でコピーし、その後は yatex/ ディレクトリ内で hg pull -u して下さい。 ・yatex-1.69 よりバイトコンパイルしないのをデフォルトとしました。 動作速度が(認識できない程度に)遅くなりますが、インストールしてある全ての Emacsで利用できます。ほんの少し速くなるだけでもいい、Emacsの種類毎に 何回もインストールしてもいい、と思う場合は make elc してから make install を行なって下さい。 ・makefile の先頭部分を編集し、 mule2(emacs-19), emacs20, XEmacs を使う場合は make install それ以外の場合は make install-nw にてLispディレクトリへのインストールが行われます。 詳細は、install ファイルを御覧下さい。 Meadow を使う人は readme.meadow.j も御覧下さい。 ・「野鳥」およびその Vz への移植版である「雷鳥」、Wzへの移植版である「白 鳥」、Hidemaruへの移植版である「飛鳥」、xyzzyへの移植版である「花鳥」 に関する情報交換のためのメイリングリスト「fj野鳥の会」に是非御参加ください。 詳しくは docs/qanda ファイル、または https://www.yatex.org/ を御覧ください。 yatex1.81/dir010064400037440000000000000004041126002671300122410ustar yuujiwheel* YaTeX: (yatexj). Yet Another tex-mode for Emacs. (Japanese). * YaTeX-e: (yatexe). Yet Another tex-mode for Emacs. (English). * yahtml: (yahtmlj). Yet Another HTML-mode for Emacs. (Japanese). * yahtml-e: (yahtmle). Yet Another HTML-mode for Emacs. (English). yatex1.81/help004075500037440000000000000000001341014627400124225ustar yuujiwheelyatex1.81/help/YATEXHLP.eng010064400037440000000000001412041255037377300144430ustar yuujiwheel%%% %%% YaTeX-LaTeX Help File(c)HIROSE Yuuji [yuuji@yatex.org] %%% You can translate this file for any device other than YaTeX via %%% any filter program. But it is not allowed to remove copyright %%% notice and any existing dictionary entiries which describes the %%% source of this file. %%% textfloatsep \addtolength{\textfloatsep}{LENGTH} Length between the text and a float at the top or bottom of page floatsep \addtolength{\floatsep}{LENGTH} Length between two floats oddsidemargin \setlength{\oddsidemargin}{LENGTH} Length between text and a line 1 inch from the left of page, on the right page pagestyle \pagestyle{STYLE} Determines header and footer styles on output page. There are the following styles plain Standard style. Page number only in footer. empty No headers or footers are output. headings Puts page number and headings according to section in header. No footer is output. myheadings User defines what goes into headings using \markbpth and \markright thispagestyle \thispagestyle{STYLE} Determines the STYLE for the current page only pagenumbering \pagenumbering{STYLE} Determines the STYLE of page numbers. Type of STYLEs are, arabic arabic numerals alph lowercase alphabets Alph uppercase alphabets roman lowercase roman numerals Roman uppercase roman numerals shortstack \shortstack[POSITION]{TEXT\\TO BE\\STACKED} Stack and display contents within {}, separated by \\. Possible [POSITION]s are, l(left), c(center), r(right). newlength \newlength{NAME} Declare NAME as a length command. addtolength \addtolength{LENGTH COMMAND}{VALUE} Adds VALUE to LENGTH COMMAND. See \setlength for major style parameters. setlength \setlength{LENGTH COMMAND}{VALUE} Set the value of LENGTH COMMAND to VALUE. Major style parameters are: (Style parameters must be changed in the preamble) \evensidemargin \footheight \footskip \headheight \headsep \marginparsep \marginparwidth \oddsidemargin \textheight \textwidth \topmargin \topskip \parindent \baselineskip \baselinestretch \parskip \columnsep \columnseprule \mathindent settowidth{\NAME}{TEXT} Set the value of \NAME to the width of \hbox{TEXT}. evensidemargin \setlength{\evensidemargin}{LENGTH} Length between body and a line 1 inch from the left of page, on the left page. footheight \setlength{\footheight}{LENGTH} Height of footer. footskip \setlength{\footskip}{LENGTH} Length between bottom of body and footer. headheight \addtolength{\headheight}{LENGTH} Height of header. headsep \setlength{\headsep}{LENGTH} Length between top of body and header. marginparsep \addtolength{\marginparsep}{LENGTH} Length between the body and marginal notes marginparwidth \addtolength{\marginparwidth}{LENGTH} Width of marginal notes. oddsidemargin \addtolength{\oddsidemargin}{LENGTH} Length between body and a line 1 inch from the left of page, on the right page. textheight \addtolength{\textheight}{LENGTH} Height of text. textwidth \addtolength{\textwidth}{LENGTH} Width of body. topmargin \addtolength{\topmargin}{LENGTH} Length between the header and a line one inch from the top of the page. topskip \addtolength{\topskip}{LENGTH} Length between top of the body to the first line of the text. parindent \setlength{\parindent}{LENGTH} Width of indentation at the beginning of a paragraph. linewidth \addtolength{\linewidth}{LENGTH} Width of lines. baselineskip \addtolength{baselineskip}{LENGTH} Minimum height between baselines (bottom of a line). baselinestretch \renewcommand{baselinestretch}{1.5} Value to multiply \baselineskip. (default is 1) (* Redefine using \renewcommand. Don't use \setlength. parskip \addtolength{\parskip}{LENGTH} Vertical space before a paragraph. columnsep \addtolength{\columnsep}{LENGTH} Width between columns in a two column environment. columnseprule \addtolength{\columnseprule}{LENGTH} Width of ruler to separate columns in a two column environment. (default is 0pt) columnwidth \addtolength{\columnwidth}{LENGTH} (\textwidth - \columnsep)/2 in a two column environment. Otherwise, equal to \textwidth. mathindent \addtolength{mathindent}{LENGTH} Width of indentation of a equation from the left margin, when fleqn is defined as style option. LaTeX \LaTeX Display \LaTeX logo. Definition of \LaTeX is; \def\LaTeX{{\rm L\kern-.36em\raise.3ex\hbox{\sc a}\kern-.15em T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}} fragile ** LaTeX term ** Any command which expanded result changes by an argument. Opposite is a robust command. robust ** LaTeX term ** Commands which expanded results are always the same. Font type/size selection commands, length commands, and most commands used within math mode is robust. (maketitle type commands that don't take any arguments) protect \protect `a fragile command' Commands that the result changes according to it's arguments are called "fragile commands". When an argument is referenced in more than one place, the command is said to "take a moving argument". chapter and caption, whose argument will be used in the table of contents, or an @ in an tabular/array environment are examples. When a "fragile command" is used in a "moving argument", it must be preceded by a \protect. Following is an example. \newcommand{\thissystem}[1]{YaTeX version #1} \chapter{About \protect \thissystem{1.50}} newcommand \newcommand{\NAME}[ARGS]{DEF} Define a macro \NAME as DEF, taking ARGS number of arguments. The nth argument will be referred as #n in the definition. If used as \newcommand{\foo}[1]{\underline{#1}} \foo{bar} will be expanded to \underline{bar}. When a font selection command is used as \newcommand{\foo}[1]{\bf #1} \foo{bar} will be expanded as \bf bar in the text, so, it must be used as \newcommand{\foo}[1]{{\bf #1}} If NAME is already defined as a macro, it will return an error. To redefine, use \renewcommand. renewcommand \renewcommand{\NAME}[ARGS]{DEF} Redefine an already defined command. newenvironment \newenvironment{NAME}[ARGS]{DEF1}{DEF2} Define a new environment. \begin{NAME} will be replaced by DEF1 and \end{NAME} will be replaced by DEF2. Same as \newcommand{\NAME}{DEF1} \def{\end{\NAME}}{DEF2} renewenvironment \renewenvironment{NAME}[ARGS]{DEF1}{DEF2} Redefine an environment NAME that already exists. typeout \typeout{MESSAGE} Output MESSAGE to the terminal while typesetting. typein \typein{MESSAGE} \typein[\MACRO]{MESSAGE} Output MESSAGE to terminal and execute the input. In the second form, \MACRO will be defined as the input. par \par Used to separate paragraphs. Same as a blank line. everypar \everypar RTFM nopagebreak \nopagebreak[i] (i = 0,1,2,3,4) Prevents pages to be broken by the strength of i. (default is 4) pagebreak \pagebreak[i] (i = 0,1,2,3,4) Forces pages to be broken by the strength of i. (default is 4) linebreak \linebreak[i] (i = 0,1,2,3,4) Forces lines to be broken by the strength of i. (default is 4) nolinebreak \nolinebreak[i] (i = 0,1,2,3,4) Prevents lines to be broken by the strength of i. (default is 4) samepage \samepage Prevents page to be broken. RTFM obeycr \obeycr Define as \\. see \restorecr restorecr \restorecr Restore 's definition changed by \obeycr. \ \\ \\[LENGTH] Breaks a line at any given point. Same as \newline if used within a paragraph. If an option argument LENGTH is given, vertical space to next line will be \vspace{LENGTH}. addvspace \addvspace{SKIP} Adds space equal to SKIP to vertical space. If more than one values are given as \addvspace{S1} \addvspace{S2}, it will be the same as \addvspace{the larger of S1, S2}. vspace \vspace{LENGTH} \vspace*{LENGTH} Adds vertical space of LENGTH. \vspace* will add space at any given position, but \vspace will not add at beginning or end of a page. vspace* \vspace{LENGTH} \vspace*{LENGTH} Adds vertical space of LENGTH. \vspace* will add space at any given position, but \vspace will not add at beginning or end of a page. hspace \hspace{LENGTH} \hspace*{LENGTH} Adds horizontal space of LENGTH. \hspace* will add space at any given position, but \hspace will not add at beginning or end of a line. hspace* \hspace{LENGTH} \hspace*{LENGTH} Adds horizontal space of LENGTH. \hspace* will add space at any given position, but \hspace will not add at beginning or end of a line. smallskip \smallskip Put a small vertical space. \def\smallskip{\vspace\smallskipamount} medskip \medskip Put a medium vertical space. \def\medskip{\vspace\medskipamount} bigskip \bigskip Put a big vertical skip. \def\bigskip{\vspace\bigskipamount} , \, Opens a thin space. Can be used in paragraph mode, LR mode, or math mode. Used to write a quote within a quote. example: ``\,`Foo', he said.'' Spaces that can be used in math mode are: \: medium space \! negative and thin space \; thick space : $\:$ Medium space. Math mode only. ! $\!$ Negative thin space. Math mode only. ; $\;$ Thick space. Math mode only. whiledo{TEST}{BODY} Repeat BODY while TEST is true. nofiles \nofiles If \nofiles is in the preamble, .aux, .idx, .lof, .lot, .toc files will not be made. includeonly \includeonly{sub1} \includeonly{sub1,sub3} Appoints actual files to be read and processed by \include{}. (.tex can be suppressed) Files not given in the argument list of \includeonly will not be processed at all. If the file has been processed before, it will be treated as if there were no changes from then. include \include{FILE} Same as \clearpage \input{FILE} \clearpage input \input{FILE} Process as if FILE.tex has been inserted at that point. setcounter \setcounter{FOO}{VAL} Set counter FOO's value to VAL. addtocounter \addtocounter{FOO}{VAL} Add value VAL to counter FOO. newcounter \newcounter{COUNTER}[OLDCTR] Defines a new counter COUNTER. If an optional argument OLDCTR is given, COUNTER's value will be reset every time OLDCTR's value is changed by \stepcounter or \addtocounter. How to Introduce new counter You'll get `Question n.' increasing n with \mondai, by setting as below. \newcounter{toi} \renewcommand{\thetoi}{Question \arabic{toi}.~ } \setcounter{toi}{0} \newcommand{\mondai}{\refstepcounter{toi}\thetoi} value \value{COUNTER} Returns value of COUNTER. Must not be preceded by \protect. stepcounter \stepcounter{FOO} Increments value of counter FOO. Also resets any counter dependent to FOO. refstepcounter \refstepcounter{FOO} Increments value of counter FOO. Also resets any counter dependent to FOO. Defers with \stepcounter as; if \label{hoge} follows immediately after \refstepcounter{FOO}, \ref{hoge}'s value will be set to \value{FOO}. arabic \arabic{COUNTER} Output COUNTER's value in arabic numerals. roman \roman{COUNTER} Output COUNTER's value in lower case roman numerals. Roman \Roman{COUNTER} Output COUNTER's value in upper case roman numerals. alph \alph{COUNTER} Output COUNTER's value in lower case alphabet. Alph \Alph{COUNTER} Output COUNTER's value in upper case alphabet. fnsymbol \fnsymbol{COUNTER} Output COUNTER's value in footnote symbols (1 = *, 2 = \dagger, ...). Math mode only. label \label{LABEL} Set value of LABEL to \ref VALUE. This value is referred by \ref{VALUE}. \pageref{LABEL} refers to the page number \label{LABEL} exists. ``\ref VALUEs'' are, section commands as \section, \item commands within an enumerate environment, values set by a theorem environment. For example, immediately after a \item of a enumerate environment, the item number will be the ``\ref VALUE''. \label{LABEL} will set the item number to LABEL. ref \ref{LABEL} Refer to LABEL's value set by \label{LABEL}. Examples of values returned are; page numbers for LABELs set in the main text, table numbers for LABELs set in a table, and the item number for LABELs set in an item of the enumerate environment. pageref \pageref{LABEL} Refer to the page number where \label{LABEL} exists. ( \( EQUATION \) Produce an in-text equation. Same as \begin{math} EQUATION \end{math} \( and \) are fragile. ) \( x^2 = 4 \) Produce an in-text equation. Same as \begin{math} EQUATION \end{math} \( and \) are fragile. [ \[ EQUATION \] Produce an equation in display mode. Same as \begin{displaymath} EQUATION \end{displaymath} \[ and \] are fragile. ) \[ EQUATION \] Produce an equation in display mode. Same as \begin{displaymath} EQUATION \end{displaymath} \[ and \] are fragile. equation \begin{equation} EQUATION \end{equation} Produce a numbered equation in displaymath mode. eqnarray \begin{eqnarray} EQNS \end{eqnarray} Produce equations aligned in three columns. The columns are separated by & as ``left member & sign & right member''. For example, \begin{eqnarray} 3x + 2y & = & 4 \\ x - 4y & = & -5 \end{eqnarray} eqnarray* \begin{eqnarray*} EQNS \end{eqnarray*} Same as eqnarray, except no equation numbers are produced. frac \frac{NUMER}{DENOM} Produce a fraction as NUMER ------ DENOM Same as {NUMER \over DENOM} sqrt \sqrt[N]{EQUATION} Produces the Nth power of EQUATION. Gives a square root if [N] is not given. lefteqn \lefteqn{EQUATION} In display math mode, presume EQUATION has zero width and print it flush left. Used in eqnarray environment when the left member is too long and needs folding. \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} TEXT \end{center} Center TEXT. Each line must be separated by \\. flushright \begin{flushright} TEXT \end{flushright} Align end of each line with right margin. Each line must be separated by \\. flushleft \begin{flushleft} TEXT \end{flushleft} Align start of each line with left margin. \\ can be given to decide point of line break. Otherwise lines will be broken at an appropriate length. centering \centering Produce a centered paragraph. Declared at the beginning of a table/figura environment, it will center until the end of the environment. raggedright \raggedright Produce flush-left paragraphs. raggedleft \raggedleft Produce flush-right paragraphs. raggedbottom \raggedbottom Allow height of each page to vary. Declared in the preamble. flushbottom \flushbottom Make all text pages the same height. Declared in the preamble. sloppy \sloppy Always breaks the line at the right-hand margin, but allows too much space between words. fussy \fussy Return to normal line breaking. sloppypar \begin{sloppypar} PARAGRAPH \end{sloppypar} Produce PARAGRAPH in \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 carriage 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 to verbatim, except that spaces print as the TeXbook's space character instead of as blank spaces. list \begin{list}{LABEL}{PARAMETER} ... \end{list} Enter list environment. Each \item will be listed with an indent. First argument gives the default label when \item's optional argument is omitted. Second argument gives parameters to be processed for each item. example: \begin{list}% {$\diamond$} {\addtolength{\leftmargin}{4em}} \item First argument is the default label when \verb|\item|'s optional argument is given. \item Second argument will be processed for each item. \item[*] If a optional argument is given such as this, it will be the label. \end{list} Variables to control the list environment are as follow; (default value) horizontal: variables to control list environment \labelwidth width of label \labelsep space between right of label and text of first item \leftmargin left margin within list environment \rightmargin right margin within list environment (0pt) \itemindent width of indent preceding item (0pt) \linewidth width of line \listparindent indent for each paragraph (except first paragraph with \item) (0pt) vertical: \topsep space between last paragraph before list environment and first item \partopsep space added to \topsep when starting a new paragraph in list environment \itemsep space between successive items \parsep space between paragraphs within the same item itemize \begin{itemize} \item ITEM1 ... \item ITEMn \end{itemize} Produce a bulleted list. Can be nested to four levels. ``bullets'' shown at top of each item of the four levels are controlled by \labelitemi, \labelitemii, \labelitemiii, \labelitemiv. Variables to control the itemize environment are; enumerate \begin{enumerate} \item ITEM1 ... \item ITEMn \end{enumerate} Produce a numbered list. Can be nested to four levels. Numbers for items on each level are held in enumi, enumii, enumiii, enumiv. Each item's label are produced by \labelenumi, ..., \labelenumiv. \p@enumN\theenumN will set \ref's value. (N is the depth of level. refer \ref for value of \ref) For example, if declared \def\theenumii{\alph{enumii}} \def\p@enumii{\theenumi\theenumii} \def\labelenumii{(\theenumii)} \ref's value will be 3a. Variables to control enumerate environment are, item \item \item[LABEL] Start an item in itemize, enumerate, description environment. Output LABEL if [LABEL] is given. description \begin{description} \item[LABEL] CONTENTS ... \end{description} Produce [LABEL] as a label. subitem \subitem ITEM Define a subitem. subsubitem \subsubitem ITEM Define a subsubitem. makebox \makebox[WID][POS]{OBJECT} \makebox(X,Y)[POS]{OBJECT} First form will place OBJECT at position POS and width WID in a \box. For POS, object will be placed flush-left if `l', flush-right if `r', splattering words in the same space if `s', and centered if nothing is given in the second form, object will be placed in a \hbox sized (X,Y) (in \unitlength) within a picture environment. POS is the same as the first form. mbox \mbox{OBJECT} Same as \makebox{OBJECT}. newsavebox \newsavebox{\CMD} Define a new box saving command. \CMD is used in a \savebox command to save boxes. Commands defined by \newsavebox are always global. savebox \savebox{\CMD}{TEXT} Save results of TEXT in \CMD to be boxed. TEXT is the same as the argument of \makebox, but the results of processing TEXT is not displayed in-place. Boxes processed by \usebox{\CMD} will be placed. sbox \sbox{\CMD}{TEXT} Same as \savebox. \sbox is robust, and \savebox is fragile. framebox \framebox[WID][POS]{OBJECT} \framebox(X,Y)[POS]{OBJECT} Do the same thing as \makebox with a frame. The frame's width and space between the object are decided by \framerule and \framesep. If used as \framebox(X,Y){OBJECT} in a picture environment, width of frame will be dependant to the picture environment's line width, and space between the object and frame can not be opened. fbox \fbox{OBJECT} Same as \framebox{OBJECT}. \fbox is robust, \framebox fragile. Rule width of \fbox can be controled by setting \fboxrule { \fboxrule=2\fboxrule \fbox{contents of double width of rule} } parbox \parbox[POS]{WIDTH}{TEXT} Make a box of width WIDTH using TEXT. The box's position by POS is; c : centering (default) b : bottom of box matches present text t : top of box matches present text In \parbox, parameters will be reset as; \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} Make a box of width WIDTH using TEXT as \parbox. The box's position by POS is; c : centering (default) b : bottom of box matches present text t : top of box matches present text TEXT will be processed as a normal paragraph, differing from \parbox. rule \rule[RAISED]{WIDTH}{HEIGHT} Make a rule of WIDTH x HEIGHT. If RAISED is given, will be raised that amount. underline \underline{TEXT} Underline TEXT. raisebox \raisebox{DISTANCE}[HEIGHT][DEPTH]{BOX} Raise BOX by DISTANCE. If HEIGHT and DEPTH are given, TeX will take it as the height and depth of the box. (see TeXBook for more info) tabbing \begin{tabbing} \= text1.1 \= text1.2 \\ \> text2.1 \> text2.2 \end{tabbing} Creates an environment of aligned columns (nesting allowed). For example, \begin{tabbing} \= ITEM1 \hspace*{2em} \= ITEM2 \hspace*{3em} \= ITEM3 \\ \> aabbcc \> ddeeff \> gghhii \+ \\ \> jjkkll \> mmnnoo \\ \> ppqqrr \- \\ \> ssttuu \> vvwwxx \> yyzzzz \end{tabbing} will be processed with three tab stops as, (1st item) (2nd item) (3rd item) aabbcc ddeeff gghhii jjkkll mmnnoo ppqqrr ssttuu vvwwxx yyzzzz \2em/ \3em/ Commands to control the tabbing environment are; (n starts from 1) \= Sets the nth tab stop position to the current position and increment the tab counter (n) by 1. \\ Start a new line and reset the tab counter (n=1) \> Set the position to the nth tab stop and increment the tab counter by 1. \+ Add 1 to the next line's tab counter's initial value. If written as \+ \\, the next line's \> will give the position of the second tab stop. Multiple \+ will accumulate tab counter's initial value. \- Reverse of \+. Decrease initial value of tab counter for next line by 1. \< Decrease value of tab counter by 1 and set the tab stop. Can be only used at the beginning of a line. \' Output at a position \tabbinsep right from the normal tab stop. \` Output remaining text flush-right. \pushtabs Push all tab stop positions being used. \poptabs Push all tab stop positions being used. \pushtabs and \poptabs must be used in pairs. Nesting allowed. \aX In a tabbing environment, accents are produced by \a=, \a', \a` \kill Without outputting text, parse tabbing definition. 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. This is useful when each column contains long sentences. [[Usable commands in array, tabular environment]] \multicolumn \vline \hline \cline{i-j} \extracolsep{W} See below as an example. \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)\] \begin{tabular}{lp{0.7\textwidth} \hline ---------------------------- \verb|.| & Period matches with . Period matches with any any single character.\\ single character. \verb|*| & Asterisk matches with * Asterisk matches with 0 0 or more repetition or more repetition of of preceding regexp. preceding regexp. \\ \hline ---------------------------- \end{tabular} (End of example) \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 command. Tabular environment cannot spread across pages. `supertabular.sty' allows this. tabular* \begin{tabular*}{WIDTH}{PREAMBLE} ... \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 normal unsrt without sorting alpha gives tag like "Foo94" abbrv omit the first name of author, publishing month, book title thebibliography \begin{thebibliography}{LONGEST-LABEL} \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. LONGEST-LABEL is a dummy string to notify the maximum width of label. --- 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. If you want footnote number as marks, define as follows in preamble; \renewcommand{\thefootnote}{\fnsymbol{footnote}} The next definition produces dagger marks followed by sequential number. \renewcommand{\thefootnote}{$\dagger$\arabic{footnote}} (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 one's file with the command as above which loads the OPTION's respectively and \input's the file STYLE.sty. documentclass \documentclass[OPTION1,OPTION2, ... ,OPTIONn]{STYLE} In LaTeX2e, user starts one's file with the command as above which loads the OPTION's respectively and \input's the file STYLE.cls. usepackage \usepackage[OPTIONS]{PACKAGE} Use additional package `PACKAGE' with option `OPTION'. 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. If you want to output one-column title page with two-column body, describe like this; \twocolumn[ \begin{titlepage} {\LARGE YourTitle} \vspace*{1em} \begin{abstract} Your Abstract blah blah... \end{abstract} \end{titlepage} ] ->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. breakbox \begin{breakbox} ... \end{breakbox} Make a surrounding frame extended across pages. Useful for cite a long program list. Requires `\usepackage{eclbkbox}' verbfile \verbfile{FILE} Include a FILE in verbatim format. Requires `\usepackage{misc}' See also \listing listing \listing{FILE} Include a FILE in verbatim format with line number. Requires `\usepackage{misc}' See also \verbfile ascmac \usepackage{ascmac} The `ascmac' package provides * \boxnote environment notebook-like box * \screen environment corner-rounded box suitable for screen output * \itembox environment itemizing box * \shadebox environment shaded box * \keytop macro keytop * \yen Yen mark * \return-key * \mask, \maskbox boxnote \begin{boxnote} ... \end{boxnote} Enclose with notebook-like square. Defined in ascmac.sty. screen \begin{screen} ... \end{screen} Enclose with corner-rounded square which stands for screen output. Requires `\usepackage{ascmac}' itembox \begin{itembox}{ITEMSTRING} ... \end{itembox} Enclose box with ITEMSTRING header. Requires `\usepackage{ascmac}' shadebox \begin{shadebox} ... \end{shadebox} Enclose shaded box. Requires `\usepackage{ascmac}' keytop \keytop{KEY} Output a keytop designed character. Requires `\usepackage{ascmac}' mask \mask{STRING}{MASKTYPE} Make a masked STRING. MASKTYPE is one of character A through K. eg.) \mask{This is a pen!}{C} Mask types are viewed at http://www.yatex.org/help/ascmac-mask.jpg Defined in `\usepackage{ascmac}' maskbox \maskbox{WIDTH}{HEIGHT}{MASKTYPE}{POS}{STRING} Make a masked box of WIDTH x HEIGHT which contains STRING located in POS. Masking type MASKTYPE is one of character A through K. eg.) \maskbox{5cm}{2.5em}{G}{c}{Year!} Mask types are viewed at http://www.yatex.org/help/ascmac-mask.jpg Requires `\usepackage{ascmac}' alltt \begin{alltt} ... \end{alltt} An environment like verbatim except in which TeX macro can be used. comment \begin{comment} ... \end{comment} Comment out enclosed environment. But if \includeversion{comment} appears, enclosed part activated. Putting \excludeversion{ENV} defines new environment ENV which works equivalently to comment environment. Requires `\usepackage{version}' bou \bou{STRING} Put the emphasizing dot on each characters in STRING. Requires `\usepackage{plext}' url \url{URL_STRING} Put URL string with reasonable folding. Requires `\usepackage{url}' longtable \begin{longtable}{POSSTRING} ... \end{longtable} Same as table, but can be spreaded across pages. Requires `\usepackage{longtable}' fancybox \usepackage{fancybox} Provides some fancy boxes. * \shadowbox{} * \ovalbox{} * \doublebox{} shadowbox \shadowbox{STRING} Surround a STRING by shadow box. Require `\usepackage{fancybox}` ovalbox \ovalbox{STRING} Surround a STRING by oval box Require `\usepackage{fancybox}` Ovalbox \Ovalbox{STRING} Surround a STRING by thick oval box. Require `\usepackage{fancybox}` doublebox \doublebox{STRING} Surround a STRING by double frame. Require `\usepackage{fancybox}` quote \begin{quote} ... \end{quote} quotation without paragraph quotation \begin{quotation} ... \end{quotation} quoted environment which might contains paragraphs textcircled \textcircled{CHAR} Enclose `char' with small circle. Because this circle is as large as one character, you had better encolose `CHAR' with {\small ...}, {\tiny ...}, {\scriptsize ...}. hfill \hfill Insert a space as wide as possible. Same as \hspace{\fill}. foo\hfill bar produces; foo bar foo\hfill bar\hfill baz produces; foo bar baz \hfill can't produce space at the beginning of the line because \hfill is a kind of \hspace{}. If you make right-justified world in a line, write \hspace*{\fill}. hfil \hfil Same as \hfill, but little bit weak. vfill \vfill Make vertical space in utmost length , the same as \vspace{\fill}. cf. \hfill hrulefill \hrulefill Draw underline in utmost length. backslashbox \usepackage{slashbox} \backslashbox{A}{B} Draw a back-slash in a column of tabular. \begin{tabular} \hline \backslashbox{A}{B} & hoge \\ \hline \end{tabular} +----+--------+ | \ B| | | A\ | hoge | +----+--------+ slashbox \slashbox{A}{B} Draw long slash line in a column of tabular. See also backslashbox. ooalign {\ooalign{String1\crcr String2...} Set line spacing to zero and shift to double-strike mode. This can be used for generating circled character. Look this; \newcommand{\maru}[1]{{\ooalign {\hfill$\scriptstyle#1$\hfill\crcr$\bigcirc$}}} \crcr is the equivalent of \\ for tabulars. Note that \ooalign change the spacing parameters. So you should enclose \ooalign itself with { }. maru \maru{R} Circle one character. Declare the \newcommand as below; \newcommand{\maru}[1]{{\ooalign {\hfill$\scriptstyle#1$\hfill\crcr$\bigcirc$}}} today \date{\today} Use this as the argument of \date{}. Set the document's date in title to today. NamedColor \textcolor[named]{COLOR}{TEXT}, for example. With `\usepackage{color}', you can use colors listed below. GreenYellow Yellow Goldenrod Dandelion Apricot Peach Melon YellowOrange Orange BurntOrange Bittersweet RedOrange Mahogany Maroon BrickRed Red OrangeRed RubineRed WildStrawberry Salmon CarnationPink Magenta VioletRed Rhodamine Mulberry RedViolet Fuchsia Lavender Thistle OrchidDarkOrchid Purple Plum Violet RoyalPurple BlueViolet Periwinkle CadetBlue CornflowerBlue MidnightBlue NavyBlue RoyalBlue Blue Cerulean Cyan ProcessBlue SkyBlue Turquoise TealBlue Aquamarine BlueGreen Emerald JungleGreen SeaGreen Green ForestGreen PineGreen LimeGreen YellowGreen SpringGreen OliveGreen RawSienna Sepia Brown Tan Gray Black White) See also http://www.yatex.org/help/color.tex textcolor \textcolor{COLOR}{TEXT} Put the TEXT colored with COLOR. pagecolor \pagecolor{COLOR} Set background color of the page to COLOR. color \color{COLOR} Set text color of the page to COLOR. colorbox \colorbox{COLOR}{TEXT} Put TEXT in the box whose background color is COLRO. fcolorbox \fcolorbox{FCOLOR}{BGCOLOR}{TEXT} Put text int the box whose frame color is FCOLOR and background BGCOLOR. rotatebox \rotatebox{ANGLE}{TEXT} Put TEXT with rotated by ANGLE-degrees, unclockwise. Require `\usepackage{graphicx}'. resizebox \resizebox{WIDTH}{HEIGHT}{TEXT} Put TEXT enlarging/shrinking to WIDTH and HEIGHT. You can omit either of WIDHT or HEIGHT. In that case, specify `!'. \resizebox{!}{40mm}{TEXT} outputs TEXT with 40mm in height. Require `\usepackage{graphicx}'. scalebox \scalebox{MAG}[V-MAG]{TEXT} Put TEXT maginifiyng by MAG. V-MAG for vertical magnification factor is optional. Negative values for magnification factor flip the TEXT in that direction. Require `\usepackage{graphicx}'. reflectbox \reflectbox{TEXT} Flip TEXT horizontally. Equivalent to \scalebox{-1}[1]{TEXT}. Require `\usepackage{graphicx}'. ulem \usepackage{ulem} \usepackage{ulem} The `ulem' package provides macros listed below. \uline{Underlined Text} \uwave{Waved-Unlderlined Text} \uuline{Double Underlined Text} (Information by TSUCHIYA Masatoshi ) uline \uline{TEXT} Put TEXT with underline. uwave \uwave{TEXT} Put TEXT with waved underline. uuline \uuline{TEXT} Put TEXT with double underline. showkeys.sty \usepackage[options]{showkeys} In margin area, output `(?)' marks for unlabeled math-expressions, `?label?' marks for unreferred labels. Optional arguments are one of; showrefs, norefs, showcites, nocites, msgs, nomsgs, chkunlbld, ignoreunlbld. msgs/nomsgs specifies whether output messages in *.log file or not. `\usepackage{showkeys}' should be located before the declaration for AMS-LaTeX or HyperRef, if any. Another style `refcheck.sty' can also output labeling information including `\ref{***}' macros themselves. (Information by Masaki Shigemori ) table* \begin{table*} ... \end{table*} Put tabular in one column at the top of page even if in twocolumn mode. figure* \begin{figure*} ... \end{figure*} Put figure in one column at the top of page even if in twocolumn mode. If you put figure bottom of page instead of top, use nidanfloat.sty instead. \begin{figure*}[b] \includegraphics{blahblahblah} \caption{foo bar baz} \end{figure*} includegraphics \usepackage[DRIVER]{graphicx} ... \includegraphics[Options]{graphicfile.eps} Include graphics$B!#(BRequires `graphicx' package. Typical [DRIVER] is [dvipdfmx]. Possible [Options] are as follows. scale=X width=W height=H draft (Frame only) angle=R origin=RotationOrigin (One of `c', `tl', `tr', `bl' or `br') bb=llx lly urx ury (Specify BoundingBox) viewport=llx lly urx ury (Rerative to BoundingBox) trim=left bottom right top [Example] % Preamble \usepackage[dvipdfmx]{graphicx} % document body \begin{figure}[h]\centering \includegraphics[width=0.4\columnwidth,bb=0 0 400 300]{foo.jpg} \caption{foo image}\label{foo-fig} \end{figure} Figure \ref{foo-fig} says that foo is foo. % YaTeX automatically inserts `bb=' line when you input \includegraphics{} % with completion. wrapfigure \begin{wrapfigure}[LINES]{POS}[OVH]{WIDTH} ...Images... \end{wrapfigure} LINES(Optional) Number of narrow lines POS One of `r l i o' (Right, Left, Inside, Outside) R L I O for float OVH(Optional) Overhangs for margin WIDTH Width of figure [Example] % Preamble \usepackage{wrapfig} % body of document \begin{wrapfigure}{r}{4cm} \includegraphics[width=3cm,bb=0 0 640 480,clip]{foo.jpg} \caption{foo image}\label{foo-jpg} \end{wrapfigure} abstract \begin{abstract} ... \end{abstract} Output abstract \langle $\langle$ `<' in math-modes. \langle $rlangle$ `>' in math-modes. \slash \slash slash(/) itself. \textbackslash \textbackslash backslash(\) itself. YaTeX (setq auto-mode-alist (cons '("\\.tex$" . yatex-mode) auto-mode-alist)) The mode you are probably using now. Bells and whistles for using LaTeX at a breeze. [pronunciation] ``ya-tek'' for programs as yatex.el, ``ya-cho'' when referring to the whole system. ``ya-cho'' in Japanese stands for ``wild bird'' yatex (setq auto-mode-alist (cons '("\\.tex$" . yatex-mode) auto-mode-alist))  yatex1.81/help/YATEXHLP.jp010064400037440000000000001623721332771661400143120ustar yuujiwheel%%% %%% 野鳥-LaTeXヘルプファイル(c)HIROSE Yuuji [yuuji@yatex.org] %%% このヘルプファイルを野鳥以外のデバイスで利用することを許可します。 %%% 項目の修正や追加は自由に行なって構いませんが、そのことを %%% 知らせて頂けるとありがたいです。 %%% 他のデバイスで利用する場合でも先頭のコピーライト表示と、末尾に含まれる %%% LaiTeX, laitex, YaTeX, yatex の各項目は(このヘルプファイルについての %%% 著作権表記と謝辞が含まれているので)削除しないでください。 %%% textfloatsep \addtolength{\textfloatsep}{長さ} ページ先頭のfloatまたは、ページ最下部のfloatとテキストとの間隔。 floatsep \addtolength{\floatsep}{長さ} floatとfloatの間隔。 pagestyle \pagestyle{スタイル} 出力ページのヘッダとフッタのスタイルを決める。スタイルには以下のものがある: plain 標準スタイル. フッタにページ番号だけつける. empty ヘッダにもフッタにも何も出力しない. headings ヘッダにセクションに応じた見出しとページ番号をつけ フッタには何も出力しない. myheadings headingsのスタイルで、ヘッダの情報を \markbpth と \markright で指定できる. thispagestyle \thispagestyle{スタイル} 現在のページだけのスタイルを決定する。 pagenumbering \pagenumbering{スタイル} ページ番号のスタイルを決める。スタイルには以下のものがある: arabic アラビア数字 alph 小文字の英字 Alph 大文字の英字 roman 小文字のローマ数字 Roman 大文字のローマ数字 shortstack \shortstack[場所]{重ねて\\表示する\\内容} {}内の内容を\\で区切られた単位毎に積み重ねて表示する。 [場所]は、l(左寄せ)、c(センタリング)、r(右寄せ)のいずれか。 表(tabular)の中で縦書きに項目を入れたいときにも便利。 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 \settowidth{\NAME}{TEXT} \hbox{TEXT}の出力結果と同じ幅に長さ\NAME をセットする。 文書中のある文字列と同じ長さを持つ長さコマンドを作る場合は次のようにする。 \newlength{\somelength} \settowidth{\somelength}{この文字列と同じ長さ} たとえば表を作るときに、特定の列を最大の長さを持つ文字列とおなじ 幅に合わせたいときに便利である。 { \newlength{\maxwidth} \settowidth{\maxwidth}{This is Max width!} \begin{tabular}{l|p{\maxwidth}} \hline その1 & This short \\ その2 & This is Max width! \\ \hline \end{tabular} } すると右側の列が "This is Max width!" と同じ幅になる。表全体を {}で括っているのは長さコマンド \maxwidth の通用範囲を局所的にするためである。 evensidemargin \setlength{\evensidemargin}{長さ} 左ページの左端から1インチ(2.54cm)の線と本文の距離 footheight \setlength{\footheight}{長さ} フッタの高さ footskip \setlength{\footskip}{長さ} 本文の箱の下端とフッタの距離 headheight \addtolength{\headheight}{長さ} ヘッダの高さ headsep \setlength{\headsep}{長さ} ヘッダと本文の間隔 marginparsep \addtolength{\marginparsep}{長さ} 傍注と本文の間隔 marginparwidth \addtolength{\marginparwidth}{長さ} 傍注の幅 oddsidemargin \addtolength{\oddsidemargin}{長さ} 右ページの左端から1インチ(2.54cm)の線と本文の距離 textheight \addtolength{\textheight}{長さ} 本文の高さ textwidth \addtolength{\textwidth}{長さ} 本文の幅 topmargin \addtolength{\topmargin}{長さ} ページ上端から1インチの線とヘッダの距離 topskip \addtolength{\topskip}{長さ} 本文の箱の上端と一行目のテキストとの間隔 parindent \setlength{\parindent}{長さ} \parindent 段落の先頭の字下げ幅. linewidth \addtolength{\linewidth}{長さ} \linewidth 行の幅. baselineskip \addtolength{baselineskip}{長さ} \baselineskip 行のベースライン間の最低限の高さ. baselinestretch \renewcommand{\baselinestretch}{1.5} \baselinestretch \baselineskip に乗ずる係数. (default=1) (* \setlengthなどではなく、\renewcommandで再定義する。) parskip \addtolength{\parskip}{長さ} \parskip 段落前の垂直スペース. columnsep \addtolength{\columnsep}{長さ} \columnsep 2段組みの時の段間の幅. columnseprule \addtolength{\columnseprule}{長さ} 二段組の時の段間の罫線の太さ. (default=0pt) columnwidth \addtolength{\columnwidth}{長さ} 二段組の時には (\textwidth - \columnsep)/2 そうでない時は、\textwidth mathindent \addtolength{mathindent}{長さ} \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{長さ}によって確保する。 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} この辺あとで whiledo{TEST}{BODY} TESTが真の間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の値もリセッ トされる。 新しいカウンタの作り方 以下の定義で \mondai とすると、自動的にnをインクリメントして「第n問」を 出力する。 \newcounter{toi} \renewcommand{\thetoi}{第\arabic{toi}問~ } \setcounter{toi}{0} \newcommand{\mondai}{\refstepcounter{toi}\thetoi} 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} 「内容」を固定幅フォントのタイプライタ書体で表示し、すべての文字を(TeXの シーケンスとしてではなく)そのまま解釈する。 #「ばーばちむ」じゃなくて「ばーべいたむ」だ! verbatim* \begin{verbatim*} 内容 \end{verbatim*} 通常のverbatim環境において、スペース文字を空白ではなく、TeXbook に載って いるスペース文字のように印字する。 (註)こういう感じ→ |_| (苦しい…) 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の書式と同様。 LaTeX2e以降では第1の書式のPOSにsを指定でき、ボックス内に文字を均等割り付け してくれる。ボックスの幅は全角1字を表すzwを単位にすると便利だろう。 \makebox[7zw][s]{山田太郎}\\ \makebox[7zw][s]{木村花}\\ \makebox[7zw][s]{広瀬 雄二} とすると |山 田 太 郎| |木 村 花| |広 瀬 雄 二| という感じになる。 mbox \mbox{オブジェクト} \makebox{オブジェクト}と同じ。 newsavebox \newsavebox{\CMD} 新規のボックス保存用コマンドを定義する。\CMDは \savebox コマンドで ボックスを保存するために使う。\newsaveboxで宣言したコマンド名は 常にグローバルとなる。 savebox \savebox{\CMD}{テキスト} ボックスを組む内容である「テキスト」の結果を\CMDに保存する。 「テキスト」は \makebox への引数と全く同じであるが、「テキスト」を 処理した結果はその場に表示はしない。\usebox{\CMD}により処理したボックス が置かれる。 sbox \sbox{\CMD}{テキスト} \saveboxと同じ。sboxはrobust, saveboxはfragile usebox \usebox{\CMD} \saveboxで\CMDに保存されたテキストを配置する。 framebox \framebox[WID][POS]{オブジェクト} \framebox(X,Y)[POS]{オブジェクト} 「オブジェクト」に枠をつけて\makeboxと同様の処理をする。 枠の線の太さは \framerule、オブジェクトとの間隔は \framesep で決まる。た だしpicture環境で \framebox(X,Y){オブジェクト}とした場合は、picture環境 用の線の太さに従い、外枠とオブジェクトとの間隔は空けられない。 LaTeX2e以降では第1の書式のPOSにsを指定でき、ボックス内に文字を均等割付 してくれる。ボックスの幅は全角1字を表すzwを単位にすると便利だろう。 \framebox[7zw][s]{山田太郎}\\ \framebox[7zw][s]{木村花}\\ \framebox[7zw][s]{広瀬 雄二} とすると +--------------+ |山 田 太 郎| +--------------+ |木 村 花| +--------------+ |広 瀬 雄 二| +--------------+ という感じになる。 fbox \fbox{オブジェクト} \framebox{オブジェクト}と同じ。 \fboxはrobust, \frameboxはfragile \fbox の罫線の太さを変えるには,\fboxrule を変更します. { \fboxrule=2\fboxrule \fbox{2倍の太さの罫線で囲まれたボックス} } 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}{プリアンブル} C1 & C2 & .. & Cn \\ D1 ... \end{array} (数式などによる)配列を作成する。行列などは array 環境で作成する。 詳しい説明は tabular 環境を参照。 tabular \begin{tabular}[OPT]{プリアンブル} C1 & C2 & .. & Cn \\ D1 ... \end{tabular} 表を作成する。 【[OPT]】(省略可) [t] 表の上端を現在の行に合わせる [b] 表の下端を現在の行に合わせる 【プリアンブル】 c カラムを一つ指定し、そのカラムをセンタリング l カラムを一つ指定し、そのカラムを左寄せ r カラムを一つ指定し、そのカラムを右寄せ @{表現} 「表現」をカラム毎に挿入する。これを指定すると \arraycolsep や \tabcolsep のスペーシングは抑制される *{N}{PRE} PREを N 回書いたのと同様の作用 p{LEN} そのカラムをLENの長さのparboxエントリとして作成する 表の項目に長い説明分が含まれる場合に用いると良い。 【array, tabular 環境で使えるコマンド】 \multicolumn \vline \hline \cline{i-j} \extracolsep{W} 以下の例を参照せよ。 \LaTeX 表記 印刷形式 \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)\] \begin{tabular}{lp{0.7\textwidth} \hline ---------------------------- \verb|.| & ピリオドは任意の . ピリオドは任意の一文字 一文字にマッチします。\\ にマッチします。 \verb|*| & アスタリスクは直前の * アスタリスクは直前の正規 正規表現が0回以上繰り返し 表現が回以上繰り返し現れ 現れることを意味します。 ることを意味します。 \\ \hline ---------------------------- \end{tabular} array環境を \right( \left) で囲むと配列自体を大きな括弧で括る。同様に、 \right\{ \left\} で配列を中括弧で、\right[ \left] で配列を大括弧で、 \right| \left| で配列をノルム記号(絶対値記号)で括ることができる。 \right の数と \left の数は必ず同じでなければならないが、\right( \left] のように括弧の種類は違ってもよい。\right. のように . をつけると見えない 括弧が出力される。 \[ 答 \cdots \left\{ / \begin{array}{ccc} | x = 5 x & = & 5 \\ 答 ... < y & = & 3 | y = 3 \end{array} \right. \] \ array環境を制御する変数には以下のものがある: \arraycolsep : array環境の各カラム間の間隔の半分 \tabcolsep : tabular環境の各カラム間の間隔の半分 \arrayrulewidth : 罫線の幅 \doublerulesep : array, tabular環境での隣接した罫線(二重罫線?)間の間隔 \arraystretch : \baselinestretch と同様行間スペースの比率を決める \renewcommandで再定義する tabular環境は、ページを跨ることができない。これを可能にするスタイルファ イルとして、supertab.styがある。 l, c, r 指定した1つのカラムに2行以上の項目を入れたいときはparboxを利用する (shortstackを利用すると上にずれるのでraiseboxで調整しなければならない)。 \begin{tabular}{lp{0.5\columnwidth}} \parbox[t]{7em}{あ\\い} & あぶらかだぶらあぶらかだぶらあぶらかだぶら \end{tabular} は、以下のようにレイアウトされる。 あ あぶらかだ い ぶらあぶら かだぶら tabular* \begin{tabular*}{幅}{プリアンブル} ... \end{tabular*} 幅を指定してtabular環境を作成。 この幅を充填するだけのスペースをプリアンブルの \extracolsep{} コマンドで 確保する。 \begin{tabular*}{10em}[b]{|c@{\extracolsep{\fill}}|c|c|} \hline a & b & c \\ \hline 1 & 2 & 3 \end{tabular*} tabular環境の説明を参照のこと。 multicolumn \multicolumn{N}{FORMAT}{ITEM} tabular環境で現在のカラムを含めNこのカラムをFORMATに従った ITEMで埋める。FORMATはl,r,cのうち(最大)ひとつ vline \vline tabular環境でそのカラムに縦線を引く. 縦線の位置はそのカラムに 指定されている l, r, c によって決まる hline \hline tabular環境で、行間に水平線を引く. 環境の最初のエントリの直前、 もしくは \\ の直後に来なければならない. もし \hline を続けて 指定すると\doublerulesep 分の空白が空けられる(標準では罫線の 箱自体が分割されてしまう) cline \cline{i-j} tabular環境中、i番目からj番目のカラムに横線を引く. \hlineと同様 extracolsep \extracolsep{W} tabular環境の@表現の中で用いると、幅Wのスペースをそれ以降の 全てのカラムの左側に加える picture \begin{picture}(WIDTH,HEIGHT)(X,Y) ..contents.. \end{picture} 幅WIDTH, 高さHEIGHT の描画ボックスを作成。このボックスの左下の座標は (X,Y) となる(省略すると(0,0))。これらの引数の数値を含め、picuture環境の 数値は \unitlength に対する相対値であらわされる。\unitlength の既定値は 1pt. 今時picture環境じゃないと思うので用法しか書かないよーん。 【コマンド】 \put(X座標,Y座標){描画オブジェクト} \multiput(X座標,Y座標)(Xの増分,Yの増分){繰り返し回数}{描画オブジェクト} 【描画オブジェクト】 \makebox(X座標,Y座標)[POS]{テキスト} (箱) \framebox(X座標,Y座標)[POS]{テキスト} (枠付きの箱) \dashbox(X座標,Y座標)[POS]{テキスト} (破線枠付きの箱) (以上POS = l, r, b, t) \line(ΔX,ΔY){水平方向の長さ} (直線) \vector(ΔX,ΔY){水平方向の長さ} (矢印) (ΔX,ΔY = ±1, ±2, ..., ±6 で互素, それぞれ基準は始点) \shortstack[POS]{一行\\二行\\三行} \circle{直径} (円) \circle*{直径} (塗り潰した円) (それぞれ基準は円の中心, 最大直径は40pt, 15pt) \oval(直径X,直径Y)[POS] (楕円風 POS = l, r, t, b) \frame{描画オブジェクト} \thinlines, \thicklines (細,太線を選ぶ) \linethickness{太さ} newtheorem \newtheorem{NAME}{TEXT}[COUNTER] \newtheorem{NAME}[OLDNAME]{TEXT} 定理型の新しい環境「NAME」を定義する。 TEXT 定理番号のキャプションとして出される文字列 COUNTER NAMEのカウンタの親となるカウンタ名. 通常section. 第2の形式では OLDNAME と同じカウンタ形式を使うことを指示する。 NAME環境のカウンタ形式は \theNAME コマンドを再定義する。これのデフォルトは \theCOUNTER.\arabic{NAME} title \title{タイトル} \maketitleコマンドで出力するタイトル名を設定する。 author \author{著者名} \maketitleコマンドで出力する著者を設定する。 複数の著者を書くときは \and で区切って名前を書く。 date \date{日付} \maketitleコマンドで出力する日付を設定する。 \date を省略するとタイプセットした日の日付が出力される。 thanks \thanks{脚注} タイトル中(\title, \author, \date)での脚注(謝辞や住所など)の出力を行う。 maketitle \maketitle タイトルを出力する。document環境中で宣言されなければならない。 タイトルを構成する項目は以下のコマンドで定義する。 \title{タイトル} \author{著者名} \date{日付} (省略するとタイプセットした日の日付) \thanks{脚注} (謝辞や所属名などを脚注形式で出すために用いる) part \part{第?部のタイトル} chapter \chapter{章のタイトル} 文を区切るコマンド一覧: \part 第?部 \chapter ?章 (articleにはない) \section ?節 \subsection ?.?節 \subsubsection ?.?.?節 \paragraph 段落 \subparagraph 副段落 section \section{セクション名} 第一引数のセクション名でセクションの区切りを設定。 subsection \subsection{サブセクション名} 第一引数の名前でサブセクションの区切りを設定。 subsubsection \subsubsection{サブサブセクション名} 第一引数の名前でサブサブセクションの区切りを設定。 paragraph \paragraph{パラグラフ名} 第一引数の名前でパラグラフの区切りを設定。 subparagraph \subparagraph{サブパラグラフ名} 第一引数の名前でサブパラグラフの区切りを設定。 appendix \appendix 付録部に入る宣言。 セクションコマンドの番号の方式を付録用に変える。 contentsline \contentsline{TYPE}{ENTRY}{PAGE} \contentsline{subsection}{\makebox{30pt}[r]{1.4.3} Gnats and Gnus}{22} とすると .toc ファイルに ENTRY を吐き出す。 TYPEはセクションコマンドのどれか。 addcontentsline \addcontentsline{TABLE}{TYPE}{ENTRY} TABLEで指定したファイル(toc, lof, lot のどれか)にENTRYというエントリを出 力する。TYPEはTABLEの値によって変わり、 toc: セクションコマンドのどれか lof: figure lot: table である。 addtocontents \addtocontents{TABLE}{TEXT} TEXTをTABLEで指定したテーブルファイル(toc, lof, lot のどれか)に出力する。 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} BibTeXで読み込むファイルを指定する。 bibliographystyle \bibliographystyle{スタイル} plain 通上 unsrt ソートしない alpha "Foo94" のようなタグをつける abbrv 著者のファーストネーム、発行月、書籍名が省略される thebibliography \begin{thebibliography}{LONGESTLABEL} \bibitem{アイテム}… \end{thebibliography} 参考文献データの登録環境を開始する。 データは \bibitem コマンドによって登録する。 \bibitem コマンドの用法は以下の通り。 bibitem \bibitem{NAME} \bibitem[LABEL]{NAME} \bibitem{NAME}の書式では、\cite{NAME}で参照され、[1],[2] のような形で引用記号が 出力される、\bibitem[LABEL]{NAME}の書式では、\cite{NAME}で参照され、 [LABEL] のような引用記号が出力される。 LONGESTLABEL は、ラベルの最長を示すためのダミー文字列。 cite \cite{NAME} \cite[LABEL]{NAME} \cite{NAME}の書式では、NAMEで参照され、[1],[2] のような形で引用記号が 出力される、\cite[LABEL]{NAME}の書式では、[1,LABEL] のような引用記号 が出力される。 footnote \footnote{NOTE} NOTEという内容の脚注を生成する。 \footnote[NUM]{NOTE} とすると、番号をNUMで指定できる。 脚注がうまく出力されないような場所では \footnotemark と \footnotetext を 組み合わせて出力する。 fragile ダガー(†)にするなど,記号にしたいときはプリアンブルで \renewcommand{\thefootnote}{\fnsymbol{footnote}} とする。 †1, †2, ...にしたいときは \renewcommand{\thefootnote}{$\dagger$\arabic{footnote}} footnotemark \footnotemark[NUM] 脚注番号のみ出力する時に使う。tabbing環境のように、脚注が出力されないと ころで、\footnotetext と組み合わせて使う。[NUM]は省略可。 footnotetext \footnotetext[NUM]{TEXT} 脚注番号を出力せず脚注のみ出力する。 通常 \footnotemark と組み合わせて使う。 footnotesize \footnotesize 文字サイズを脚注用のサイズに変更する。 footnotesep \footnotesep 各脚注の最初に置かれる空白の高さ(数値)。 footnoterule \footnoterule 本文と脚注のあいだに引かれる罫線を出力。 documentstyle \documentstyle[OPTION1,OPTION2, ... ,OPTIONn]{STYLE} 文書スタイルを指定する。 [OPTION...] を指定すると、STYLE.sty を読んだ後に、 OPTIONn.sty が順次読み込まれる。 documentclass \documentclass[OPTION1,OPTION2, ... ,OPTIONn]{STYLE} 文書スタイルを指定する(LaTeX2e)。 [OPTION...] を指定すると、STYLE.cls を読んだ後に、 OPTIONn.sty が順次読み込まれる。 usepackage \usepackage[オプション]{パッケージ} LaTeX2e の記法を拡張する「パッケージ」をロードする。 verb \verb#内容# \verbの直後に来る文字と、次にあらわれる同じ文字とのあいだに挟まれたもの を verbatim で表示する。\verb|foo| と \verb,foo, は同じ結果が得られる。 styleparameter まだ訳していないスタイルパラメータ。 % \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}{長さ} Same as \topfigrule, but put after the \textfloatsep skip separating text from the floats at bottom of page. intextsep \setlength{\intextsep}{長さ} 文書中フロートの上下に残された空白の長さ newpage \newpage 改頁を行う。 \clearpage 未出力の図表があれば独立した図表用頁を出力してから 改頁を行う。 \cleardoublepage clearpageと同じだが、 両画面スタイル(bookなど)の 場合は、奇数頁から始まるように改頁する。 \newpage 二段組みの時は現在の段を終了する。 clearpage \clearpage cleardoublepage \cleardoublepage 長さ 長さに使える単位には以下のものがある。 cm センチ em 大文字Mの幅 ex 小文字xの高さ in インチ(約2.54cm) mm ミリメートル pc パイカ(=12pt) pt ポイント(72.27pt=1インチ) zw 日本語全角1字の幅 zh 日本語全角1字の高さ \fill 自然長は0だが、任意の長さに伸びることのできる伸縮長 \stretch{X} \fill のX倍 stretch \stretch{X} twocolumn \twocolumn[STRING] 改頁したあと二段組みでの組版を開始する。 [STRING]を指定すると、STRINGを二段ぶち抜きのタイトルとして出力。 本文が二段組みでタイトルとアブストラクトのみを1段組にしたい場合は \twocolumn[ \begin{titlepage} {\LARGE 和文タイトル等} \vspace*{1em} \begin{abstract} 和文抄録 \end{abstract} \renewcommand{\abstractname}{\textbf{Abstract}} \begin{abstract} 英文アブストラクト \end{abstract} \end{titlepage} ] のようにすると良い。 →onecolumn onecolumn \onecolumn 改頁したあとで一段組みでの組版を開始する。 →twocolumn topnewpage \topnewpage{BOX} 新しいページを開始し、\textwidthのBOXをparboxで作成する。 二段組みページでぶち抜きタイトルを作成する時に用いるとよい。 breakbox \begin{breakbox} ... \end{breakbox} ページをまたがる枠で囲む 要 `\usepackage{eclbkbox}' verbfile \verbfile{FILE} FILE を verbatim 環境的に取り込む。 要 `\usepackage{misc}' cf) \listing listing \listing{FILE} FILE を verbatim 環境的に取り込む(行番号つき)。 要 `\usepackage{misc}' cf) \verbfile ascmac \usepackage{ascmac} `ascmac' パッケージで定義されている代表的なマクロ * \boxnote 環境 帳面風のボックス * \screen 環境 スクリーン出力風の枠 * \itembox 環境 目立つ枠 * \shadebox 環境 影つきボックス * \keytop{} キートップ * \yen 円記号 * \return-key リターンキー * \mask, \maskbox 網掛け文字 boxnote \begin{boxnote} ... \end{boxnote} 帳面風の枠で囲む 要 ascmac.sty screen \begin{screen} ... \end{screen} スクリーン出力風の枠で囲む 要 `\usepackage{ascmac}' itembox \begin{itembox}{ITEMSTRING} ... \end{itembox} 見出し(ITEMSTRING)つきの枠で囲む 要 `\usepackage{ascmac}' shadebox \begin{shadebox} ... \end{shadebox} 行幅いっぱいの影つきの枠で囲む 要 `\usepackage{ascmac}' keytop \keytop{KEY} キートップ風に KEY を出力 要 `\usepackage{ascmac}' mask \mask{文字列}{網掛けタイプ} 「文字列」を指定した網掛けタイプで装飾する。 網掛けタイプは A〜K のどれか。 例) \mask{御食事券発覚!}{C} どんな見映えかは以下を見よ。 http://www.yatex.org/help/ascmac-mask.jpg 要 `\usepackage{ascmac}' maskbox \maskbox{WIDTH}{HEIGHT}{MASKTYPE}{POS}{STRING} 指定した幅(WIDTH)と高さ(HEIGHT)で指定した網掛けタイプ(MASKTYPE) のボックスを作り、その中の指定した位置(POS)にSTRINGを配置する。 POSは l c rのどれかで、それぞれ、左寄せ、中央寄せ、右寄せ。 網掛けタイプは A〜K のどれか。 例) \maskbox{0.7\columnwidth}{6em}{A}{c}{\shortstack{これは\\大事件だ!}} マスクタイプA〜Kがどんな見映えかは以下を見よ。 http://www.yatex.org/help/ascmac-mask.jpg 要 `\usepackage{ascmac}' alltt \begin{alltt} ... \end{alltt} TeXマクロの使えるverbitam環境。 comment \begin{comment} ... \end{comment} 環境内の全てを出力しないようにする。 ただし、 \includeversion{comment} と書くと環境を出力するようになる。 また \excludeversion{ENV} とすると新しい環境 ENV が comment 環境 と同じ機能を持つものとして使えるようになる。 要 `\usepackage{version}' bou \bou{STRING} 横書き環境で STRING に傍点を付ける。 要 `\usepackage{plext}' url \url{URL_STRING} overfullしがちなURLを頑張って折り返してくれる。 要 `\usepackage{url}' longtable \begin{longtable}{POSSTRING} ... \end{longtable} ページをまたぐ表が作れる。 table環境も参照せよ。 fancybox \usepackage{fancybox} 各種の見栄えの良いボックスが定義されている。 * \shadowbox{} * \ovalbox{} * \doublebox{} shadowbox \shadowbox{STRING} STRINGをその幅で影つきボックスで囲む。 要 `\usepackage{fancybox}` ovalbox \ovalbox{STRING} 角の丸い四角枠で STRING を囲む。 要 `\usepackage{fancybox}` Ovalbox \Ovalbox{STRING} 角の丸い四角枠で STRING を囲む。ovalboxより線が太い。 要 `\usepackage{fancybox}` doublebox \doublebox{STRING} 二重四角枠で STRING を囲む。 quote \begin{quote} ... \end{quote} 段落を含まない引用 quotation \begin{quotation} ... \end{quotation} 段落を含む引用 要 `\usepackage{fancybox}` textcircled \textcircled{文字} 「文字」を丸枠で囲む。1文字と同じ大きさの丸枠なので {\small ...}, {\tiny ...}, {\scriptsize ...} などで括った方が良い。 hfill \hfill できるだけ広い間隔を開ける。\hspace{\fill} と同じ。 あ\hfill い とすると あ い あ\hfill い\hfill う とすると あ い う のように最大限に間隔を延ばしてくれる。ただし \hspace{} 相当なので 行頭だとうまく行かない。右寄せしたいなら \hspace*{\fill} とする。 hfil \hfil \hfill より弱い間隔開け。 \hfill も参照のこと。 vfill \vfill 縦方向に最大限の空白を開ける。\vspace{\fill} と同じ。 \hfill も参照のこと。 hrulefill \hrulefill 可能な限り長い下付罫線を引く。 あんまりいい説明じゃないな。 backslashbox \backslashbox{A}{B} tabular環境の(主に)左上のカラムで用いて右下がり斜線で区切った2項目を書く。 要 \usepackage{slashbox} \begin{tabular} \hline \backslashbox{A}{B} & hoge \\ \hline \end{tabular} +------+--------+ | \ B | | | A \ | hoge | +------+--------+ slashbox \slashbox{A}{B} tabular環境の(主に)右上のカラムで用いて右上がり斜線で区切った2項目を書く。 backslashboxも参照せよ。 ooalign {\ooalign{文字列1\crcr 文字列2……} 行送りゼロの設定に変更して文字の重ね打ちを可能にする。 ○つき文字を作るための有名なマクロ \maru{} は便利。 \newcommand{\maru}[1]{{\ooalign {\hfill$\scriptstyle#1$\hfill\crcr$\bigcirc$}}} \crcr は\ooalign内での改行を意味する。\hfill は「最大に延びる空白」とい うことで、文字の左右に配置することでセンタリングの効果が得られる。 \ooalign は改行幅などの長さパラメータをいじってしまうので全体を {} で 括る必要があることに注意。 maru \maru{あ} 文字(1文字に限る)を○で囲む。プリアンブルで以下の \newcommand をせよ。 \newcommand{\maru}[1]{{\ooalign {\hfill$\scriptstyle#1$\hfill\crcr$\bigcirc$}}} today \date{\today} 作成日の日付けの出力を指定する。プリアンブルで \date とともに使う。 和暦 \和暦 \和暦 は日付けを元号での表記にする。 \西暦 は西暦での表記にする。 \maketitle より先に指定する。 西暦 \西暦 colorの名前つきカラー \textcolor[named]{色名}{内容} など、[named] を指定する。 \usepackage{color} によって使用可能。 使える色は以下の通り。 GreenYellow Yellow Goldenrod Dandelion Apricot Peach Melon YellowOrange Orange BurntOrange Bittersweet RedOrange Mahogany Maroon BrickRed Red OrangeRed RubineRed WildStrawberry Salmon CarnationPink Magenta VioletRed Rhodamine Mulberry RedViolet Fuchsia Lavender Thistle OrchidDarkOrchid Purple Plum Violet RoyalPurple BlueViolet Periwinkle CadetBlue CornflowerBlue MidnightBlue NavyBlue RoyalBlue Blue Cerulean Cyan ProcessBlue SkyBlue Turquoise TealBlue Aquamarine BlueGreen Emerald JungleGreen SeaGreen Green ForestGreen PineGreen LimeGreen YellowGreen SpringGreen OliveGreen RawSienna Sepia Brown Tan Gray Black White) 色見本を出すソースが http://www.yatex.org/help/color.tex にあるので、試すと良い。 textcolor \textcolor{色}{内容} 文字の色を「色」に設定して「内容」を出力。 pagecolor \pagecolor{色} ページの背景色を「色」に設定する。 color \color{色} ページの文字色を「色」に設定する。 colorbox \colorbox{色}{内容} 「色」が背景のボックスを作りその中に「内容」を出力。 fcolorbox \fcolorbox{枠の色}{背景色}{内容} 枠と背景色を指定して「内容」を出力。 rotatebox \rotatebox{角度}{内容} 「内容」を「角度」回転して出力。 要 `\usepackage{graphicx}' resizebox \resizebox{横の長さ}{縦の長さ}{内容} 縦か横を省略したいときは ! を指定する。 \resizebox{!}{40mm}{内容} とすると縦が40mmで縦横比を保存して拡大する。 要 `\usepackage{graphicx}' scalebox \scalebox{倍率}[縦倍率]{内容} 「内容」を「倍率」倍して出力。縦倍率は省略可能。 倍率として負の数を指定すると反転。 要 `\usepackage{graphicx}' reflectbox \reflectbox{内容} 「内容」を左右反転して出力。\scalebox{-1}[1]{内容} と同じ。 要 `\usepackage{graphicx}' ulem \usepackage{ulem} \usepackage{ulem} すると 以下のマクロが使える。 \uline{通常の下線} \uwave{波線} \uuline{二重の下線} \underlineと\ulineは前後に単語空白が挿入されるかどうかが異なっている。 前\underline{中}後 前\uline{中}後 を typeset して比較してみると分かる。 (情報提供 TSUCHIYA Masatoshi ) uline \uline{内容} 「内容」にアンダーラインをつける。 uwave \uwave{内容} 「内容」に波下線をつける。 uuline \uuline{内容} 「内容」に二重アンダーラインをつける。 showkeys.sty \usepackage[options]{showkeys} ラベルが無い(unlabeled)数式には {?} がマージンに印刷される。 引用されなかったラベルは ?label? のように印刷される。 オプションには showrefs, norefs, showcites, nocites, msgs, nomsgs, chkunlbld, ignoreunlbld がある。msgs/nomsgs は .log ファイルに メッセージを書き込むか否か。その他のオプションは自明。 AMS-LaTeX や HyperRef と同時に使えるが、これらよりも後に \usepackage しなくてはならない。 似たような package に refcheck.sty というのがある。 これだと \ref まで見える(でもかえってうざったいかも)。 (情報提供 Masaki Shigemori ) dots \dots 点々 \dotsにはいくつも種類があるので適切に使いわけましょう。 \dotsc ... コンマで区切られた列が続くことを表わす点々. $A_1, A_2, \dotsc$ \dotsb ... 二項演算子(+など)が続くことを表わす点々.$A_1+A_2+\dotsb$ \dotsm ... 掛け算(演算子省略)が続くことを表わす点々.$A_1 A_2 \dotsm$ \dotsi ... 積分が続くことを表わす点々 \[ \int_{A_1} int_{A_2} \dotsi \] (情報提供 Ryohei SETO ) table* \begin{table*} ... \end{table*} 二段組環境でも表を上段ぶち抜きで配置 figure* \begin{figure*} ... \end{figure*} 二段組環境でも図を上段ぶち抜きで配置([t]のみ)。 下段([b])に置きたいときは nidanfloat.sty を使う。 \begin{figure*}[b] 〜〜\includegraphicsとか図をいれるマクロ〜〜 \caption{標題} \end{figure*} includegraphics \usepackage[ドライバ]{graphicx} ... \includegraphics[オプション]{IMG.eps} 画像を取り込む。要 graphicx パッケージ。 「ドライバ」は dvipdfmx 等。 「オプション」は以下のものが指定可能。 scale=拡大率 width=幅 height=高さ draft (草稿モード; 枠だけ表示) angle=回転角 origin=回転の中心位置 (c, tl, tr, bl, brのどれか) bb=llx lly urx ury (BoundingBoxとなる矩形対角座標を指定) viewport=llx lly urx ury (BoundingBox内の相対的座標で切り取る) trim=left bottom right top (指定した幅を切り取る) 【使用例】 % プリアンブル \usepackage[dvipdfmx]{graphicx} % 本文 \begin{figure}[h]\centering \includegraphics[width=0.4\columnwidth,bb=0 0 400 300]{hoge.jpg} \caption{hogeの仕組}\label{hoge-fig} \end{figure} 図\ref{hoge-fig}にあるとおり、ほげはほげなのだ。 % \includegraphics{} を補完入力するとbb=行はyatexが勝手に調べて入れる。 wrapfigure \begin{wrapfigure}[LINES]{POS}[OVH]{WIDTH} ...画像... \end{wrapfigure} LINES(省略可) 回り込みする行数(デフォルトは画像の高さ分) POS r l i o のどれか(右、左、見開き内側、外側) 大文字 R L I O は画像フロート OVH(省略可) 画像の張り出しマージン(\wrapoverhang 通常0) WIDTH 回り込みする(画像込みの)幅 【使用例】 % プリアンブル \usepackage{wrapfig} % 本文 \begin{wrapfigure}{r}{4cm} \includegraphics[width=3cm,bb=0 0 640 480,clip]{hoge.jpg} \caption{ほげほげ}\label{hoge-jpg} \end{wrapfigure} abstract \begin{abstract} ... \end{abstract} 抄録(アブストラクト)を出力する。 和文抄録から英文に切り替えたいときは和文のabstract環境を終えたあとで \renewcommand{\abstractname}{\textbf{Abstract}} としてから再度abstract環境を始めると良い。 \langle $\langle$ 数式モードでの`〈' \langle $rlangle$ 数式モードでの`〉' \slash \slash スラッシュそのもの \textbackslash \textbackslash バックスラッシュそのもの FILTER %#BEGIN FILTER{OUTPUT}{COMMANDLINE} ... %#END \if0 から \fi までに囲まれた領域、もしくは %#SRC{...} で指定されたファイルを 外部プログラム COMMANDLINE の標準入力として渡し、OUTPUTファイルを作成させる。 .blockdiag %#BEGIN FILTER{OUTPUT}{blockdiag -T %t -o %o -} ... %#END http://blockdiag.com/ja/ blockdiag によるテキスト→グラフ画像変換を用いる例を示す。 LaTeXソース中に以下のように書いておく %#BEGIN FILTER{graph.png}{blockdiag -T %t -o %o -} \if0 === blockdiag { default_fontsize = 24; A -> B; } === \fi %#END そして、BEGIN...ENDの領域内で [prefix] t e (環境タイプセット)を呼ぶと 2つの === で囲まれた部分を入力として blockdiag -T png -o graph.png - が呼ばれ、[ A ] -> [ B ] のようなグラフが graph.png に得られる。 これをLaTeX本文中で \includegraphics すれば画像のソースを本文と同じ ファイルで一元管理できる。 画像のソースを別ファイル(たとえば src.diag)にしたい場合は以下のようにする。 %#BEGIN FILTER{graph.png}{blockdiag -T %t -o %o -} %#SRC{src.diag} %#END .nwdiag %#BEGIN FILTER{OUTPUT}{nwdiag -T %t -o %o -} ... %#END .seqdiag %#BEGIN FILTER{OUTPUT}{seqdiag -T %t -o %o -} ... %#END .actdiag %#BEGIN FILTER{OUTPUT}{actdiag -T %t -o %o -} ... %#END .rackdiag %#BEGIN FILTER{OUTPUT}{rackdiag -T %t -o %o -} ... %#END .dot %#BEGIN FILTER{OUTPUT}{dot -T %t -o %o} ... %#END http://www.graphviz.org/ https://ja.wikipedia.org/wiki/Graphviz Graphviz によるテキスト→グラフ画像変換を用いる例を示す。 LaTeXソース中に以下のように書いておく %#BEGIN FILTER{graph.png}{dot -T %t -o %o} \if0 === digraph { graph [charset="utf-8"] A -> B } === \fi そして、BEGIN...ENDの領域内で [prefix] t e (環境タイプセット)を呼ぶと 2つの === で囲まれた部分を入力として dot -T png -o graph.png が呼ばれ、 [ A ] ↓ [ B ] のようなグラフが graph.png に得られる。 LaiTeX a Little Assistant Interface for TeX on Vz おそらくあなたが今 Vz 上で使っているこのモード。 LaTeXを効率的に使うための多くの機能を盛り込んでいます。 【発音について】 laitex.defなどプログラムを指す時は「らいてっく」、システムを指す時は「ら いちょう」と読みます。 【補足】 「雷鳥」の旧仮名遣いは「らいてう」だそうです。 【謝辞】 以下の方々の御協力を頂きました。ここに感謝申し上げます。 (順不同/代表項目のみ) 横田和也さん(マツダ) 転載を行って頂きました。 北岸隆史さん(豊橋技術科学大) 小林克志さん(広島大) 保甫恒喜さん(立命館大) 小島昭二さん(静岡大) 小林肇さん(金沢工業大) 坂田一生さん(niftyserve) 山際直之さん(niftyserve) 並川仁さん(niftyserve) バグの指摘や、要望、励ましのメールを頂きました。 (まとめてでごめんなさい -- 桂川) 柴田みゆきさん(京都ソフトウェアリサーチ) Software Design 誌で本ソフトをご紹介いただきました。 バッキー"毒ラッコ"トミザワさん(筑波大) 雷鳥の為にノートパソコンを無償で貸与して下さいました。 彼のおかげで、雷鳥ははばたくことが出来ました。 laitex a Little Assistant Interface for TeX on Vz YaTeX (setq auto-mode-alist (cons '("\\.tex$" . yatex-mode) auto-mode-alist)) おそらくあなたが今 Emacs で使っているこのモード。 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(雷鳥) を作成されました。また、「こんな機能はどうだろう?」 と相談すると、「いらん」と一蹴し、しばらく経ってから「やっぱり欲 しい」と言うなど、多くの混乱を招かせていただきました。 1997年3月10日、交通事故により愛機ZZ-R1100(D1)と共にあの世へ旅立 たれました。享年二十六歳。彼には、野鳥だけでなく私が手掛けた数多 くのソフトウェアを作る動機、センスあふれるコメントなどを頂きまし た。現在の野鳥が皆様に支持されるように健やかに育ったのは彼のおか げと言っても過言ではありません。野鳥/雷鳥/白鳥/飛鳥/花鳥を使うと きに彼の安らかな眠りを私と共に祈って下さい。 るねきちさん(asciinet) 占い師だそうです。 http://www.gentei.org/~yuuji/lune/astrology/ 三平善郎さん(慶應大) 開き括弧の入力時の処理のモード分けのアイデアを頂きました。 萩庭崇さん(慶應大) begin型補完の内側に文字があった場合それらをインデントしてほしい という要望を頂きました。 田中健次郎さん(慶應大) タイプセット時に未セーブ状態の関連ファイルをセーブして欲しいとい う要望を頂きました。 bauerさん(asciinet) アクセント補完の要望とアクセント記号の規則の情報等を頂きました。 佐々木たろうさん(asciinet) 数式環境の処理に関する多様なアイデア、ウィンドウ選択処理に関する ユーザインタフェースの繊細な改善案などを頂きました。 Deslarさん(asciinet) byte-compile関係のバグ報告などを頂きました。 tadfさん(asciinet) Demacsでのプロセス起動時のインタフェースの不具合の報告などを頂き ました。 ほんまたけるさん(asciinet) パラグラフ境界をLaTeX用に設定しなおす要望などを頂きました。 TUSKさん(asciinet) Texinfoドキュメント(初版)を作成して頂き、第二版に関するコメント と添削をして頂きました。 横田和也さん(asciinet) dviout起動時の工夫の案、ミニバッファで読み込むもののヒストリを分 けるアイデアのきっかけを頂き、ヘルプファイルの項目の提供をして頂 きました。 Nop.Mさん(asciinet) 異なる環境での設定の不具合等のレポートを数多く頂きました。 jaybirdさん(asciinet, bekkoame) ドキュメントの多くを英訳して下さいました。 内山滋さん(成蹊大学) 日本語入力モード判定関数のバグを直すパッチ、section-view のバグ 報告、* 付きセクションコマンド対応の要望、\right, \left のアドイ ン関数作成に関する有用な情報などを頂きました。 神貞介さん(niftyserve) dviout起動オプションに関するコメント、ヘルプファイルのバグ報告等 を頂きました。 藤枝和宏さん(JAIST) 野鳥/雷鳥の Mailing List を設立して頂きました。 松本憲彦さん(東京学芸大) マニュアルのバグを指摘して頂きました。 小宮山康子さん(成蹊大) \item[] などの補完後 [] の中にカーソルを置く要望を頂きました。 竹中浩さん(東京大) M-q (YaTeX-fill-paragraph) のバグを報告して頂きました。 YaTeX-insert-amper をcontributeして頂きました。 作者の数多くの凡ミスを丁寧に拾って下さいました。 YaTeX-shift-section-undo の実現方法を教えていただきました。 Wzへの移植版 HackTeX を作成されました。 佐藤圭さん(慶應大) ネストした同種のitemize環境でのindentationの不具合を指摘して頂き ました。 石川洋介さん(富士通) Mule2で斜体フォントを使用するための手順、auto-insertの存在を教え て頂きました。 井上浩一さん(九州大学) MuleでフォーマットしたinfoファイルをNemacs用にコンバートする方法 を教えて頂きました。 田口直文さん(慶應大) font-lock の使い方を調査するといって、まだ何も教えてくれません。 早くしてください:-)。 吉田尚志さん(慶應大) label/ref補完で、labelやrefで始まる単語全てを候補にいれてしまう バグを報告して頂きました。 吉田尚志さん(NTT DATA) Win32関連で多大なる貢献をして頂きました。 上田佳明さん(豊橋技科大) Emacs 19.29 以降で生じるYaTeX-indent-new-comment-lineの不具合を 指摘して頂きました。 成宮隆之さん 「野鳥わぁるど」というCoolなWWWページを作成して下さいました。 田中敏さん(富山大学) AMS-LaTeX に対応するためのパッチを送って頂きました。 西澤幸司さん(東北大学) 田仲稔さん([株]ケイケンエンジニアリングシステム) begin型補完でおまかせ改行関数があれば、補完時に初期エントリを挿 入するというアイデアを提供していただきました。 葛西澄人さん(慶應大) YaTeX-default-pop-window-height の原案を頂きました。 $ \% $ のような場合の数式モード終了判定のミスを指摘して頂きました。 安藤利和さん(金沢工大) 野鳥を使うTipsをまとめた「あなたもわたしも野鳥の…」というWWWペー ジを作成して下さいました。 小原功任さん(神戸大学) AMS-LaTeXでの数式環境の不足分定義と、\[ .. \] ではfillしない事を 指摘して頂きました。 竹内 奏吾さん(電通大) YaTeX-section-overview の不具合を修正するパッチを送って頂きました。 宇佐見 Kousukeさん() 数式モードでのセクション型マクロ対応の要望と足すべきマクロ一覧を 頂きました。 松田茂樹さん(千葉大) AMS LaTeX用のいくつかの関数、YaTeX-change-parentheses などを作成 して頂きました。 安宅 正之さん(東京理科大) かな漢字変換自動OFF機能の T-Code 対応パッチを送って頂きました。 土屋 雅稔さん(京大) 用紙指定オプションなどたくさんのパッチとコメントを頂きました。 太田康広さん(buffalo.edu) 山尾貴則さん(東北大) Meadowユーザのための詳細インストールドキュメントを書いて下さいました。 重森正樹さん(東京大) 数え切れないバグレポートとコメントを頂きました。 瀬戸亮平さん(立命館大) Carbon Emacs(MacOS X) での使用のための情報をたくさん頂きました。 AMS-LaTeXで使う重要なマクロの情報をたくさん頂きました。 yatex (setq auto-mode-alist (cons '("\\.tex$" . yatex-mode) auto-mode-alist))  yatex1.81/newpage.rb010075500037440000000000000060361255037446600135430ustar yuujiwheel#!/usr/bin/env ruby # THIS is very very tentative. Insufficient examination of function. # Create new HTML file referring other HTML file in the same directory. # (C)2010 by HIROSE Yuuji [yuuji@yatex.org] # Last modified Mon Sep 6 16:16:33 2010 on firestorm # $Id: newpage.rb,v 510106cf15fb 2015-07-12 10:06 +0900 yuuji $ # http://www.yatex.org # Example: # newpage.rb Create new index.html by copying template. # newpage.rb foo.html Create new foo.html whose by copying header # and footer from index.html. # newpage.rb d/sub.html Create new directory d (if necessary) and # d/sub.html by copying header/footer from # index.html in a same directory or parent # directory rewriting href to css file # considering relative path. # newpage.rb -o [file] Forcibly overwrite existing file. # newpage.rb -c cssfile Set `cssfile' as defualt css. # newpage.rb -t template Set `template' as HTML template. require 'fileutils' mydir=File.dirname($0) myname=File.basename($0, ".rb") index = 'index.html' cssdefault = nil overwrite = nil template = __FILE__ #File.expand_path(myname+".html", mydir) def guesscss(dir) end while ARGV[0] && /^-/ =~ (a0=ARGV[0].dup) && ARGV.shift break if /^--$/ =~ a0 while /^-[A-Za-z]/ =~ a0 case a0 when "-c" # css ARGV.shift; cssdefault = ARGV[0] when "-t" # template ARGV.shift; cssdefault = ARGV[0] when "-o" # overwrite overwrite = true end a0.sub!(/-.(.*)/, '-\\1') end end outfile = ARGV[0]||index if !overwrite && test(?s, outfile) then STDERR.printf("File \`%s' exists. Use -o option to overwrite.\n", outfile) exit 1 end # set css default file dots = 0 of = outfile dots+=1 while "." != (of=File.dirname(of)) cssdir = "../"*dots # set copy source outdir = File.dirname(outfile) if "index.html" == File.basename(outfile) src = (dots == 0 ? template : "index.html") elsif test(?s, outdir+"/index.html") src = outdir+"/index.html" else src = template end FileUtils.mkdir_p(outdir) cssfile = cssdir+"main.css" name = File.basename(outfile, ".html") begin open(outfile, "w") do |out| #IO.foreach(src) do |line| if src == __FILE__ input = DATA else input = open(src, "r") end begin html = input.readlines.join html.sub!(%r|^|i, sprintf("

    %s

    \n", name)) if !html.gsub!("__CSSFILE__", cssfile) html.gsub!(/href=(['\"])(.*\.css)\1/, 'href="'+cssdir+'\2"') end html.gsub!("__TITLE__", name) out.print html ensure input.close end end printf(<<_EOS_, outfile, name) %s _EOS_ rescue p $! STDERR.printf(<<'_EOS_', outfile, outfile) Cannot output to [%s]. Do chmod +w %s or chmod +w . or change output directory. _EOS_ exit 1 end __END__ __TITLE__

    __TITLE__

    yatex1.81/install010064400037440000000000000062671255037377300131640ustar yuujiwheel# (This file is encoded with MS-KANJI(Shift JIS) coding system) Installation of YaTeX / 野鳥のインストール ****************************************** First, take a look at makefile to confirm or modify EMACS= and PREFIX= lines and exec the next command. このディレクトリにある makefile の EMACS= と PREFIX= の行を確認し、 必要なら修正した後に以下のコマンドを起動してください。 % make install (or "sudo make install") Then, type `make show-init' on the shell in this directory as below and ou will get elisp expressions. Add the expressions to your ~/.emacs. 続いて以下のようにコマンドを起動し、得られた結果出力を ~/.emacs に足してください。 % make show-init After copying output from make command to your ~/.emacs, you will be able to use yatex-mode for *.tex files. 以上で、初期設定は終わりです。 Without installing to default-dir, you can use yatex by adding the elisp obtained by below to ~/.emacs. インストールしなくても以下のコマンド出力を ~/.emacs に追加すれば 普通に使えます。 % make show-init2 About yahtml / yahtmlについて ***************************** Yahtml is a different package for writing HTML files with Emacs. It is very far from html-mode, html-helper-mode or other existing HTML modes. It is a good successor of YaTeX in HTML world. Do not want it to behave as modes you used. Yahtml doesn't lessen the number of initial typing not so much. But it lessens your effort of polishing/debugging your source, tracing links between file or URL, and browsing the result with browsers. If you had not used YaTeX, the concept of `C-c g', `C-c k', and `C-c c' are very new to you. If you are interested in the philosophy of YaTeX, please take a look at the info file of YaTeX. yahtml.el は html-mode とか html-helper-mode とかとはじぇえ〜〜んじぇん 違います。「html-helper-mode でいうところのあの機能はないの〜」とかそう いう気持で使うと、すげー調子悪いです。逆に、野鳥のインタフェースを知って 使っているとかなり調子良いです。 Installation of yahtml / yahtmlのインストール ********************************************* Follow the guidance in the beginning of yahtml.el. yahtml.el の先頭部分にある [Installation] にしたがって下さい。 Then the set some variables correctly. Here are the major of them. Parenthesized values are default. 以下の変数を環境に合わせて設定して下さい(括弧内はデフォルト値)。 * yahtml-kanji-code HTML文書のデフォルト漢字コード 1=SJIS, 2=JIS, 3=EUC, 4=UTF-8 * yahtml-image-viewer Image viewer / 画像ヴューア * yahtml-www-browser WWW browser / WWWブラウザ * yahtml-path-url-alist List of unix path name vs. its URL name within the WWW world. See the definition of it (in yahtml.el) as an example. UNIXパス名と、そのWWWでのURL名の対応リス ト。yahtml.el のこの変数の定義を参考にあ なた自身のサイトの対応リストを設定して下 さい。 * yahtml-directory-index Directory index file, which is a file to be opened when URL is ended with directory name. If you're not sure of this, ask it to WWW administrator. Typically `index.html' if your site is running apache, or `Welcome.html' if CERN httpd. URLでファイル名を省略した時にオープンさ れるファイル。WWW管理者に聞いて下さい。 たいてい index.html でしょう。 yatex1.81/makefile010064400037440000000000000162561332771661400132700ustar yuujiwheel# # Makefile for YaTeX/yahtml # # Edit these variables to be suitable for your site EMACS = emacs #EMACS = mule PREFIX = `${EMACS} -batch --eval '(princ (expand-file-name "../../../.." data-directory))'` # PREFIX = /usr/local #EMACSDIR= ${PREFIX}/lib/${EMACS} ## emacs20 or later EMACSDIR= ${PREFIX}/share/${EMACS} ## XEmacs #EMACS = xemacs #EMACSDIR= ${PREFIX}/lib/${EMACS} ## Meadow (Sample) #EMACS = meadow #EMACSDIR = c:/usr/local/meadow ## Cocoa(or Carbon)Emacs on Darwin (Sample) #EMACS = /Applications/Emacs.app/Contents/MacOS/Emacs #PREFIX = /Applications/Emacs.app/Contents/Resources #EMACSDIR = ${PREFIX} LISPDIR = ${EMACSDIR}/site-lisp/yatex # LISPDIR = ${EMACSDIR}/site-packages/lisp/yatex DOCDIR = ${LISPDIR}/docs HELPDIR = ${LISPDIR}/help INFODIR = ${PREFIX}/share/info TAR = tar INSTALL = install -c -m 444 MKDIR = mkdir -p INSTINFO= install-info # Comment out below if you are using Emacs Windows(meadow, etc) GEO = -geometry 80x20+0+0 ################### # Do not edit below ################### # make install to install YaTeX into public space # make ajimi to feel taste # make ajimi-nw same as above, but -nw mode # make package to create package for relase # make yahtmlpack to create package for relase # make clean to delete all producted files # make tag to add release tags LISP = ${LISP18} ${LISP19} ${LISP23} YAHTML = yahtml.el COMMON = yatexlib.el yatexprc.el yatexhlp.el LISP18 = yatex.el yatexadd.el yatexgen.el yatexenv.el \ ${COMMON} \ yatexmth.el yatexhks.el yatexhlp.el yatexflt.el \ yatexm-o.el yatexsec.el yatexhie.el yatexpkg.el ${YAHTML} LISP19 = yatex19.el LISP23 = yatex23.el DOCS = ${DOCSRC} ${DOCOBJ} ${NEWS} NEWS = yatex.new DOCHTML = docs/htmlqa docs/htmlqa.eng docs/yahtmlj.tex docs/yahtmle.tex DOCSRC = docs/yatexj.tex docs/yatexe.tex \ docs/yatex.ref docs/yatexref.eng \ docs/yatexadd.doc docs/yatexgen.doc \ docs/qanda docs/qanda.eng ${DOCHTML} DOCOBJ = docs/yatexj docs/yatexe docs/yahtmlj docs/yahtmle HELP = help/YATEXHLP.jp help/YATEXHLP.eng MANIFEST= manifest EXTRA = dir install 00readme makefile readme.meadow.j newpage.rb DISTRIB = ${EXTRA} ${LISP} ${DOCS} ${MANIFEST} ${HELP} RCSFILE = ${LISP} ${NEWS} ${DOCSRC} ${HELP} YAHTMLLISP = ${YAHTML} ${COMMON} YAHTMLDIST = ${YAHTMLLISP} install 00readme makefile newpage.rb PACK = `ls ${DISTRIB}` TMPDIR = /tmp VERSION = `head -20 yatex.el|awk -F'"' '/revision/{print $$2}'` PACKDIR = ${TMPDIR}/yatex${VERSION} all: @echo "Edit this makefile first." @echo 'Type "${MAKE} install" to install YaTeX.' @echo 'Type "${MAKE} install-yahtml" to install yahtml.' @echo 'If you love elc files, type "${MAKE} elc" before ${MAKE} install' # @echo "If you don't use X-clinet of Emacs," # @echo 'type "make install-nw" instead.' install: install-real install-message #install-yahtml: bytecompile-yahtml install-yahtml: [ -d ${LISPDIR} ] || mkdir ${LISPDIR} for f in *.el; do \ rm -f ${LISPDIR}/$${f}c; \ done ${INSTALL} *.el* ${LISPDIR} install-real: [ -d ${LISPDIR} ] || ${MKDIR} ${LISPDIR} [ -d ${HELPDIR} ] || ${MKDIR} ${HELPDIR} [ -d ${DOCDIR} ] || ${MKDIR} ${DOCDIR} [ -d ${INFODIR} ] || ${MKDIR} ${INFODIR} for f in *.el; do \ rm -f ${LISPDIR}/$${f}c; \ done ${INSTALL} *.el* ${NEWS} ${LISPDIR} ${INSTALL} ${DOCSRC} ${DOCDIR} ${INSTALL} ${DOCOBJ} ${INFODIR} ${INSTALL} ${HELP} ${HELPDIR} install-message: @echo "--------------------------------" @echo "If you have install-info command, type '${MAKE} install-info'." @echo "If not, add next lines into your site's info dir manually." @cat dir @echo "--------------------------------" @echo "=== INSTALLATION DONE ===" @echo " You might need to add these expression below to your ~/.emacs" @echo " 螳御コ. ~/.emacs 遲峨↓莉・荳九r霑ス蜉縺吶k蠢隕√′縺ゅk縺九b縺励l縺セ縺帙s." @echo @echo ";;; ------ Startup definitions for YaTeX ------ ;;;" @${MAKE} show-init @echo ";;; ------------------------------------------- ;;;" @echo @echo " To get elisp above again, call ${MAKE} command as below." @echo " 荳願ィ脇lisp繧貞榊コヲ蠕励k縺ォ縺ッ莉・荳九ョ繧医≧縺ォ${MAKE}繧定オキ蜍輔@縺ヲ縺上□縺輔>." @echo " % ${MAKE} $${PREFIX:+PREFIX=$$PREFIX }show-init" install-info: for f in ${DOCOBJ}; do \ b=`basename $$f | sed 's,/.*,,'`; \ ${INSTINFO} --entry="`grep $$b dir`" --section=TeX \ --section=Emacs $${f} ${INFODIR}/dir; \ done show-init: @printf '%s\n' \ '(setq auto-mode-alist' \ " (cons (cons \"\\.tex$$\" 'yatex-mode) auto-mode-alist))" \ "(autoload 'yatex-mode \"yatex\" \"Yet Another LaTeX mode\" t)" \ "(add-to-list 'load-path \"${LISPDIR}\")" \ "(setq YaTeX-help-file \"${LISPDIR}/help/YATEXHLP.eng\")" @printf '(setq tex-command "%s")\n' \ `CMDS='platex pdflatex ptex2pdf lualatex' DFLT=latex \ ${MAKE} -s search-cmd` @printf '(setq dvi2-command "%s")\n' \ `CMDS='pxdvi xdvik kxdvi dviout texworks' DFLT=xdvi \ ${MAKE} -s search-cmd` @printf '(setq tex-pdfview-command "%s")\n' \ `CMDS='evince mupdf xpdf kpdf texworks sumatrapdf' \ DFLT=acroread \ ${MAKE} -s search-cmd` show-init2: @${MAKE} LISPDIR=$$PWD show-init search-cmd: @for f in $$CMDS; do \ type $$f >/dev/null 2>&1 && echo $$f && exit 0; done; echo $$DFLT install-nw: bytecompile-nw install-real elc: bytecompile bytecompile: lp if [ "$$DISPLAY"x = ""x ]; then \ echo "Set DISPLAY environment variable!!"; exit 1; fi ${EMACS} -q ${GEO} -l ./yatexlib.el -e bcf-and-exit ${LISP} bytecompile-nw: lp1 ${EMACS} -batch -l ./yatexlib.el -e batch-byte-compile ${LISP18} bytecompile-yahtml: if [ "$$DISPLAY"x = ""x ]; then \ echo "Set DISPLAY environment variable!!"; exit 1; fi ${EMACS} -q -g 80x20+0+0 -l ./yatexlib.el -e bcf-and-exit ${YAHTMLLISP} lp: echo '(setq load-path (cons "." load-path))' > lp.el echo '(load-file "./yatexlib.el")' >>lp.el lp1: lp echo '(load-file "./yatex.el")' >>lp.el lp2: echo '(setq load-path (cons "'`pwd`'" load-path))' >>lp.el echo '(setq auto-mode-alist' >>lp.el echo '(cons (cons "\\.tex" '"'yatex-mode) auto-mode-alist))" >>lp.el echo '(load-library "yatex")' >>lp.el ajimi: lp lp2 ${EMACS} -l ./lp.el -e yatex-mode ajimi-nw: lp lp2 ${EMACS} -nw -l ./lp.el -e yatex-mode clean: rm -f *.elc *~ lp.el info: docs/yatexj docs/yatexe docs/yahtmlj docs/yahtmle docs/yatexj: docs/yatexj.tex (cd docs; ${EMACS} -batch -l ../yatexlib.el -e tfb-and-exit yatexj.tex) docs/yatexe: docs/yatexe.tex (cd docs; ${EMACS} -batch -l ../yatexlib.el -e tfb-and-exit yatexe.tex) docs/yahtmlj: docs/yahtmlj.tex (cd docs;${EMACS} -batch -l ../yatexlib.el -e tfb-and-exit yahtmlj.tex) docs/yahtmle: docs/yahtmle.tex (cd docs;${EMACS} -batch -l ../yatexlib.el -e tfb-and-exit yahtmle.tex) package: info @-mkdir ${PACKDIR} @tar cf - ${PACK} | (cd ${PACKDIR}; tar xf -) ( version=${VERSION}; cd ${TMPDIR}; \ ${TAR} vzcf ${TMPDIR}/yatex$$version.tar.gz yatex$$version) yahtmlpack: @-mkdir ${PACKDIR} @tar cf - ${YAHTMLDIST} | (cd ${PACKDIR}; tar xf -) ( version=${VERSION}; cd ${TMPDIR}; \ ${TAR} vzcf ${TMPDIR}/yahtml$$version.tar.gz yatex$$version) tag: hg tag yatex-${VERSION} # ci: # ci -r${VERSION} -sRel -f ${RCSFILE} # ci -u${VERSION} makefile 00readme # co: # co ${RCSFILE} RSYNCDIR = ${HOME}/http/yatex/rsync/yatex sync: -hg push -hg push git -hg push cvs (cd ${RSYNCDIR} && hg up -Cv dev && cvs ci -m '') yatex1.81/manifest010064400037440000000000000032161332771661400133110ustar yuujiwheeldir sample `dir' file for Info docs/htmlqa yahtmlに関する一般的な質問と回答 docs/htmlqa.eng Q and A on using yahtml docs/qanda 野鳥に関する一般的な質問と回答 docs/qanda.eng Q and A on using YaTeX docs/yahtmle yahtml Texinfo Manual docs/yahtmle.tex yahtml Texinfo Manual source text docs/yahtmlj yahtml 日本語 Texinfo マニュアル docs/yahtmlj.tex yahtml 日本語 Texinfo マニュアルのソース docs/yatex.ref 野鳥・キーバインド早見表 docs/yatexadd.doc 野鳥用付加関数の仕様説明 docs/yatexe YaTeX Texinfo Manual docs/yatexe.tex YaTeX Texinfo Manual source text docs/yatexgen.doc 付加関数自動作成モード使用上の注意 docs/yatexj 野鳥・日本語 Texinfo マニュアル docs/yatexj.tex 野鳥・日本語 Texinfo マニュアルのソース docs/yatexref.eng Quick reference of YaTeX's key bindings help/YATEXHLP.jp オンラインヘルプデータ help/YATEXHLP.eng LaTeX on-line help text install インストールガイド newpage.rb yahtml用新規ページ生成補助スクリプト readme.meadow.j Meadow 用インストールガイド yahtml.el 野鳥風 html モード yatex.el 野鳥・主 Emacs-Lisp ファイル yatex.new 各バージョンの変更履歴 yatex19.el Emacs-19(Mule2)用の設定 yatex23.el Emacs-23以降用の設定 yatexadd.el 付加関数の定義例 yatexenv.el LaTeX 環境依存の関数 yatexflt.el 外部フィルタコマンドとの連携 yatexgen.el 野鳥用付加関数自動作成モード yatexhie.el 野鳥用ドキュメント階層表示プログラム yatexhks.el hook を詰め込むために使う(ユーザ用) yatexhlp.el オンラインヘルププログラム yatexlib.el 野鳥用ライブラリ関数 yatexm-o.el .emacs の設定例(min-outを使用) yatexmth.el 数式環境用記号補完モード yatexpkg.el 野鳥用 \usepackage 解決プログラム yatexprc.el 野鳥・プロセス処理関数 yatexsec.el セクション抽出関数 yatex1.81/readme.meadow.j010064400037440000000000000103041126002671400144240ustar yuujiwheel Meadow(Mule for Windows) への 野鳥のインストール ************************************************************* 野鳥のインストールは、以下の3ステップで完了します。 (1) 初期設定ファイル(~/.emacs)の設定 (2) Emacs Lispファイル(*.el)のコピー (3) 取扱説明書(help/info)の設定 順に説明します。 (1) 初期設定ファイル(~/.emacs)の設定 Emacsは、ユーザそれぞれの初期設定をホームディレクトリ(~/)の中にある .emacsというファイル(あるいは.emacs.elというファイル)から読み込みます。 ここでは、拡張子が.texであるファイルを読み込むと、自動的に野鳥が読み込 まれるように設定します。 まず ~/.emacsに下の2項目を加えます。 (setq auto-mode-alist (cons (cons "\\.tex$" 'yatex-mode) auto-mode-alist)) (autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t) 次に野鳥の emacs-lisp ファイル群を置くディレクトリを load-path に加えます。 たとえば、`~/src/emacs/yatex'に置くのであれば、 (setq load-path (cons "~/src/emacs/yatex" load-path)) などとします。もし、pLaTeX2e, dviout などのコマンドをインストールした場 所にPATHを通していないときはこれらを明示的に指定します。以下の例は c:\ptex\bin にLaTeX関係のコマンドをインストールしてある場合の指定です。 (setq tex-command "c:/ptex/bin/platex") (setq dvi2-command "c:/ptex/bin/dviout") これで、初期設定ファイルの設定は終了です。 (2) Emacs Lispファイル(*.el)のコピー Emacs Lispで書かれた野鳥本体をインストールするには、(i) makeを使う方法 と、(ii) 手動でコピーする方法とがあります。 (i) makeを使う方法 Windows環境に Unix ライクなコマンドを提供する「Cygwin」を導入したりし て、makeが使える環境にある方は、次のような方法でインストールできます。 そうでない方は(ii)に進んでください。 まず、Emacsなどのエディタでこのファイルと同じディレクトリにある makefileというファイルを開き、自分の環境にあわせて編集します。 たとえば、 PREFIX = /usr/localを、PREFIX = /usrにしたり、 ## mule2 EMACS = mule EMACSDIR= ${PREFIX}/lib/${EMACS} ## emacs20 #EMACS = emacs #EMACSDIR= ${PREFIX}/share/${EMACS} ## XEmacs #EMACS = xemacs #EMACSDIR= ${PREFIX}/lib/${EMACS} を自分の使っているEmacsの種類にあわせたりします。行頭に#をつけるとコメ ント扱いとなり、その行は無効化されます。その行を有効にするためには、行 頭の#を外します。 また、次の行の行頭に#をつけてください。 GEO = -geometry 80x20+0+0 以下は書き換えた部分の例です PREFIX=/usr/local/meadow EMACS=meadow EMACSDIR=${PREFIX}/site-lisp #GEO = -geometry 80x20+0+0 以上の作業が終わったら、makefileを保存し、bashなどのシェルで、 % export DISPLAY=":0.0" % make install とすれば、インストールされます。 (3)の取扱説明書のインストールも基本的には終わっていますが、Emacsから読 めるようにするために、info ディレクトリの dir というファイルにこのディ レクトリの dir ファイルの中身を追加してください。 (ii) 手動でコピーする方法 Windows環境などでmakeがなかったり、上記(i)のmake installが失敗する場合 は、手動で必要ファイルをインストール(コピー)することができます。 たとえば、Meadow 用の外部Emacs-Lispパッケージをインストールするディレク トリが /usr/local/meadow/site-lisp/ だったとします。その場合、 このアーカイブ(yatex.tar.gz)を展開したディレクトリ (yatex) をそこに移動します。すると、 /usr/local/meadow/site-lisp/yatex/ というディレクト リになりますので、これをバージョン番号無しの /usr/local/meadow/site-lisp/yatex/ にします。 これで野鳥は使えるようになっているはずですが、さらに実行速度をわずかばか り稼ぐため、Emacs Lispファイルをコンパイル(バイトコンパイル)することもで きます。ただし、バイトコンパイルする手順が決まっているので手動でやるのは Emacsについての知識が必要です。さらにバイトコンパイルしても実感できるほ ど速くはならないのであまりお勧めしません。それでもバイトコンパイルしたい 場合は、Cygwinなど、makeの使える環境を用意して、それで自動的に処理する方 が良いと思います。 (3) 取扱説明書(help/info)の設定 次に、各種の説明書をインストールします。 LaTeXマクロの利用解説書である help/YATEXHLP.jp ファイルを /usr/local/meadow/site-lisp/ にコピーします。 野鳥自身のマニュアルである docs/yatexj, docs/yatexe と yahtml のマニュアルである docs/yahtmlj, docs/yahtmle を /usr/local/meadow/1.10/info/ にコピーし、info ディレクトリの dir というファイルに このディレクトリの dir ファイルの中身を追加します。 以上でインストールは完了です。 yatex1.81/yahtml.el010064400037440000000000003516711333666763100134170ustar yuujiwheel;;; yahtml.el --- Yet Another HTML mode -*- coding: sjis -*- ;;; (c) 1994-2017 by HIROSE Yuuji [yuuji(@)yatex.org] ;;; $Id: yahtml.el,v d97881f33e28 2018-08-21 10:49 +0900 yuuji $ (defconst yahtml-revision-number "1.80" "Revision number of running yahtml.el") ;;; Commentary: ;;;[Installation] ;;; ;;; First, you have to install YaTeX and make sure it works fine. Then ;;; put these expressions into your ~/.emacs ;;; ;;; (setq auto-mode-alist ;;; (cons (cons "\\.html$" 'yahtml-mode) auto-mode-alist)) ;;; (autoload 'yahtml-mode "yahtml" "Yet Another HTML mode" t) ;;; (setq yahtml-www-browser "firefox") ;;; ;Write your favorite browser. But firefox is advantageous. ;;; (setq yahtml-path-url-alist ;;; '(("/home/yuuji/public_html" . "http://www.mynet/~yuuji") ;;; ("/home/staff/yuuji/html" . "http://www.othernet/~yuuji"))) ;;; ;Write correspondence alist from ABSOLUTE unix path name to URL path. ;;; ;;;[インストール方法] ;;; ;;; yahtml.el, yatexlib.el, yatexprc.el を load-path の通ったディレクト ;;; リにインストールしてください。その後、以下を参考に ~/.emacs に設定を ;;; 追加して下さい。 ;;; ;;; (setq auto-mode-alist ;;; (cons (cons "\\.html$" 'yahtml-mode) auto-mode-alist)) ;;; (autoload 'yahtml-mode "yahtml" "Yet Another HTML mode" t) ;;; (setq yahtml-www-browser "firefox") ;;; ;お気に入りのブラウザを書いて下さい。firefoxが便利です。 ;;; (setq yahtml-path-url-alist ;;; '(("/home/yuuji/public_html" . "http://www.mynet/~yuuji") ;;; ("/home/staff/yuuji/html" . "http://www.othernet/~yuuji"))) ;;; ;UNIXの絶対パスと対応するURLのリストを書いて下さい。 ;;; ;;; HTMLファイル漢字コードが正しく判別されるようにホームディレクトリに ;;; .htaccess ファイルを作り以下のどれか1行を選んで書いて下さい。 ;;; ;;; AddType "text/html; charset=Shift_JIS" .html (SJISの場合) ;;; AddType "text/html; charset=iso2022-jp" .html (JISの場合) ;;; AddType "text/html; charset=EUC-JP" .html (EUCの場合) ;;; AddType "text/html; charset=utf-8" .html (UTF-8の場合) ;;; ;;; .htaccess が作れない場合は ;;; (setq yahtml-kanji-code 2) ;;; ;HTMLファイルの漢字コードを変更する場合は ;;; ;1=SJIS、2=JIS、3=EUC 4=UTF-8 ;;; ;で設定して下さい。デフォルトは 4 です。 ;;; ;;; を適切に書き換えて ~/.emacs に足して下さい。 ;;; ;;;[Commentary] ;;; ;;; It is assumed you are already familiar with YaTeX. The following ;;; completing featureas are available: ([prefix] means `C-c' by default) ;;; ;;; * [prefix] b X Complete environments such as `H1' which ;;; normally requires closing tag ` ;;; ... is also classified into ;;; this group ;;; When input `href=...', you can complete file ;;; name or label(href="#foo") by typing TAB. ;;; * [prefix] l Complete typeface-changing commands such as ;;; ` ... ' or ` ... ' ;;; This completion can be used to make in-line ;;; tags which is normally completed with [prefix] b. ;;; * [prefix] s Complete declarative notations such as ;;; `' ;;; `' ;;; * [prefix] m Complete single commands such as ;;; `
    ' or `
    or
  • ...' ;;; * [prefix] p Insert

    on the point ;;; * M-RET Intelligent newline; if current TAG is one of ;;; ul, ol, or dl. insert newline and
  • or ;;;
    or
    suitable for current condition. ;;; * menu-bar yahtml Complete all by selecting a menu item (Though I ;;; hate menu, this is most useful) ;;; * [prefix] g Goto corresponding Tag or HREF such as ;;;
    <->
    or href="xxx". ;;; Or invoke image viewer if point is on . ;;; * [prefix] k Kill html tags on the point. If you provide ;;; universal-argument, kill surrounded contents too. ;;; * [prefix] c Change html tags on the point. ;;; When typeing [prefix] c on `href="xxx"', you can ;;; change the reference link with completion. ;;; * [prefix] t j Call weblint on current file. ;;; * [prefix] t p View current html with WWW browser ;;; (To activate this, never fail to set the lisp ;;; variable yahtml-www-browser. Recommended value ;;; is "firefox") ;;; * [prefix] a YaTeX's accent mark's equivalent of yahtml. ;;; This function can input $lt, $gt or so. ;;; * [prefix] ; Translate chars of `>', `<', `&', and `"' to ;;; `>', `<', `&', `"' respectively ;;; in the region. ;;; * [prefix] : Do translation opposite to above, in the region. ;;; * [prefix] # Translate unsafe-chars and unreserved-chars to ;;; URLencoded string in the region. ;;; ;;;[キーの説明] ;;; ;;; 以下の説明において、特にカスタマイズをしていない限り、[prefix] は ;;; C-c キーを意味します。 ;;; ;;; * [prefix] b X `' といった終了タグが必要となる`H1'のよう ;;; な環境を補完入力します。 ... ;;; もこのグループです。 ;;; `href=...' と入力した後、TABキーを押すことで、 ;;; ファイル名や (href="#foo") のようなラベルも補完 ;;; できます。 ;;; * [prefix] s 以下のような宣言の補完を行います。 ;;; `' ;;; `' ;;; * [prefix] l ` ... ' や ` ... ' のよう ;;; なテキストスタイル指定のタグを補完します。 ;;; この補完機能は通常 [prefix] b で補完できるものを ;;; 一行内で書きたいときにも用いることが出来ます。 ;;; * [prefix] m `
    ' や `
    '、`
  • ' 等の単体タグの補完 ;;; を行います。 ;;; * [prefix] p カーソル位置に

    を挿入します。 ;;; * M-RET おまかせ改行; もしul、ol、dl等のタグ(リスト)を ;;; 使っている場合に、環境に合わせて改行と
  • 、 ;;;
    を入力します。 ;;; * menu-bar yahtml 選択したアイテムをメニューより補完できます。 ;;; (私はメニューが嫌いなんですが、htmlに関してはメ ;;; ニューは一番ありがたいかも) ;;; * [prefix] g 対応するタグ、
    <->
    や href="xxx" の ;;; ような TAG にジャンプします。 ;;; の場合はイメージビューワを呼び出 ;;; します。href=hoge.html の場合はhoge.htmlに飛びま ;;; す。 ;;; * [prefix] k ポイント上の HTML タグを消去します。 ;;; もし universal-argument を付けた場合(C-uを先に押 ;;; す)HTMLタグで囲まれた内容も同時に消去します。 ;;; * [prefix] c ポイント上のタグを変更します。 ;;; `href="xxx"'の上で [prefix] c を利用した場合は、 ;;; 参照しているリンクを補完機能を使いながら変更で ;;; きます。 ;;; * [prefix] t j カレントファイルに対して jweblint を呼び出しま ;;; す。ファイル先頭付近に ;;; ;;; と書いておくとそのコマンドを呼びます。 ;;; * [prefix] t p WWW ブラウザでカレントファイルを表示します。 ;;; (lisp変数 yahtml-www-browser の設定をお忘れな ;;; く。お推めは "firefox" です) ;;; * [prefix] a YaTeX のアクセント記号補完と同じです。 ;;; < > 等が入力できます。 ;;; * [prefix] ; 指定したリジョン中の > < & " をそれぞれ ;;; > < & " に変換します。 ;;; * [prefix] : 指定したリジョン中で上と逆の変換をします。 ;;; * [prefix] # 指定したリジョン中で%エンコードの必要な文字が ;;; あればそれらをエンコードします。 ;;; * [prefix] } リジョン内の特定文字区切りのレコードを 並びに ;;; 変換します。C-u (universal-argument) 付きで起動 ;;; するとtd以外の任意要素で括ります。thdを指定する ;;; と最初の1つだけth,残りすべてをtdで括ります。 ;;; * [prefix] ] リジョン内のすべての行をフィールドごとにtdで括り, ;;; さらに各行をtrで括ります。universal-argument を ;;; 付けるとフィールド括りをtd以外に指定できます。 ;;; * [prefix] ESC yahtml-mode を抜け yahtml-mode に入る前に動作し ;;; ていたメジャーモードに戻ります。 ;;; ;;; [謝辞] ;;; ;;; fj野鳥の会の皆さんには貴重な助言を頂きました。また、下に示す方々には ;;; 特に大きな協力を頂きました。あわせてここに感謝申し上げます。 ;;; ;;; * 横田和也さん(マツダ) ;;; マニュアルの和訳をして頂きました。 ;;; * 吉田尚志さん(NTT Data) ;;; Mule for Win32 での動作のさせ方を教えて頂きました。 ;;; (というかほとんどやってもらった ^^;) ;;; ;;; Code: (require 'yatexlib) ;;; --- customizable variable starts here --- (defvar yahtml-prefix "\C-c" "*Prefix key stroke of yahtml functions.") (defvar yahtml-image-viewer "display" "*Image viewer program") (defvar yahtml-www-browser "firefox" "*WWW Browser command") (defvar yahtml-kanji-code 4 "*Kanji coding system number of html file; 1=sjis, 2=jis, 3=euc, 4=UTF-8") ;;(defvar yahtml-coding-system ;; (cdr (assq yahtml-kanji-code YaTeX-kanji-code-alist)) ;; "Kanji coding system") (and (featurep 'mule) (integerp yahtml-kanji-code) (setq yahtml-kanji-code (cdr (assq yahtml-kanji-code YaTeX-kanji-code-alist)))) (defvar yahtml-fill-column 72 "*fill culumn used for yahtml-mode") (defvar yahtml-fill-prefix nil "*fill prefix for yahtml-mode") ;;(defvar yahtml-www-server "www" "*Host name of your domain's WWW server") (defvar yahtml-path-url-alist nil "*Alist of unix path name vs. URL name of WWW server. Ex. '((\"/usr/home/yuuji/http\" . \"http://www.comp.ae.keio.ac.jp/~yuuji\") (\"/home/yuuji/http\" . \"http://www.gentei.org/~yuuji\"))") (defvar yahtml-directory-index "index.html" "*Directory index file name; Consult your site's WWW administrator.") (defvar yahtml-environment-indent 1 "*Indentation depth of HTML's listing environment") ;; YaTeX-japan is defined in yatexlib.el (defvar yahtml-lint-program (if YaTeX-japan "jweblint" "weblint") "*Program name to lint HTML file") (defvar yahtml-hate-too-deep-indentation nil "*Non-nil for this variable suppress deep indentation in listing environments.") (defvar yahtml-always-/p t "*Those who always use

    with

    set this to t.") (defvar yahtml-always-/li nil "*Those who always use
  • with
  • set this to t.") (defvar yahtml-always-/dt nil "*Those who always use
    with
    set this to t.") (defvar yahtml-always-/dd nil "*Those who always use
    with
    set this to t.") (defvar yahtml-p-prefered-env-regexp "^\\(body\\|dl\\|blockquote\\)" "*Regexp of envs where paragraphed sentences are prefered.") (defvar yahtml-template-file "~/public_html/template.html" "*Template HTML file. It'll be inserted to empty file.") (defvar yahtml-prefer-upcases nil "*Non-nil for preferring upcase TAGs") (defvar yahtml-prefer-upcase-attributes nil "*Non-nil for preferring upcase attributes") (defvar yahtml-server-type 'apache "*WWW server program type") (defvar yahtml-apache-access-file ".htaccess" "*Server access file name for apache") (defvar yahtml-use-css t "*Use stylesheet or not") (defvar yahtml-image-inspection-bytes 500000 "*Number of bytes to inspect the image for geometry information") (defvar yahtml:img-default-alt-format "%xx%y(%sbytes)" "*Default format of img entity's ALT attributes. %x: width, %y: height, %s: size in bytes, %c: first comment string, %f: filename") (defvar yahtml-faithful-to-htmllint yahtml-always-/li "*Non-nil doesn't put space after opening tags.") (defvar yahtml-error-line-regexp "^\\(.*\\)(\\([0-9]+\\)):\\|^line \\([0-9]+\\)" "*Regexp of error position which is produced by lint program.") (defvar yahtml-translate-hyphens-when-comment-region t "*Non-nil for translate hyphens to - when comment-region") (defvar yahtml-escape-chars 'ask "*Escape reserved characters to URL-encoding or not. Nil for never, t for everytime, and 'ask for inquiring at each reserved chars.") (defvar yahtml-use-font-lock (and (featurep 'font-lock) (fboundp 'font-lock-fontify-region)) "*Non-nil means to use font-lock to fontify buffer.") (defvar yahtml-use-hilit19 (and (featurep 'hilit19) (not yahtml-use-font-lock)) "*Non-nil means to Use hilit19 to highlight buffer") (defvar yahtml-mode-abbrev-table nil "*Abbrev table in use in yahtml-mode buffers.") (define-abbrev-table 'yahtml-mode-abbrev-table ()) (defvar yahtml-indentation-boundary "^\\s *" "*Boundary regexp for indentation calculation.") (defvar yahtml-html4-strict t "*Non-nil means editing HTML 4.01 Strict. Completing read for obsoleted attributes disabled.") (defvar yahtml-electric-indent-mode -1 "*(Emacs 24.4+) Pass this value to electric-indent-local-mode. -1 means `off'.") ;;; --- customizable variable ends here --- (defvar yahtml-prefix-map nil) (defvar yahtml-mode-map nil "Keymap used in yahtml-mode.") (defvar yahtml-lint-buffer-map nil "Keymap used in lint buffer.") (defvar yahtml-shell-command-option (or (and (boundp 'shell-command-option) shell-command-option) (if (eq system-type 'ms-dos) "/c" "-c"))) (defvar yahtml-use-highlighting (or yahtml-use-font-lock yahtml-use-hilit19)) (defun yahtml-define-begend-key-normal (key env &optional map) "Define short cut yahtml-insert-begend key." (YaTeX-define-key key (list 'lambda '(arg) '(interactive "P") (list 'yahtml-insert-begend 'arg env)) map)) (defun yahtml-define-begend-region-key (key env &optional map) "Define short cut yahtml-insert-begend-region key." (YaTeX-define-key key (list 'lambda nil '(interactive) (list 'yahtml-insert-begend t env)) map)) (defun yahtml-define-begend-key (key env &optional map) "Define short cut key for begin type completion both for normal and region mode. To customize yahtml, user should use this function." (yahtml-define-begend-key-normal key env map) (if YaTeX-inhibit-prefix-letter nil (yahtml-define-begend-region-key (concat (upcase (substring key 0 1)) (substring key 1)) env map))) (if yahtml-mode-map nil (setq yahtml-mode-map (make-sparse-keymap) yahtml-prefix-map (make-sparse-keymap)) (define-key yahtml-mode-map yahtml-prefix yahtml-prefix-map) (define-key yahtml-mode-map "\M-\C-@" 'yahtml-mark-begend) (if (and (boundp 'window-system) (eq window-system 'x) YaTeX-emacs-19) (define-key yahtml-mode-map [?\M-\C- ] 'yahtml-mark-begend)) (define-key yahtml-mode-map "\M-\C-a" 'YaTeX-beginning-of-environment) (define-key yahtml-mode-map "\M-\C-e" 'YaTeX-end-of-environment) (define-key yahtml-mode-map "\M-\C-m" 'yahtml-intelligent-newline) (define-key yahtml-mode-map "\M-\C-j" 'yahtml-intelligent-newline) (define-key yahtml-mode-map "\C-i" 'yahtml-indent-line) (define-key yahtml-mode-map "&" 'yahtml-insert-amps) (let ((map yahtml-prefix-map)) (YaTeX-define-key "^" 'yahtml-visit-main map) (YaTeX-define-key "4^" 'yahtml-visit-main-other-window map) (YaTeX-define-key "4g" 'yahtml-goto-corresponding-*-other-window map) (YaTeX-define-key "44" 'YaTeX-switch-to-window map) (and YaTeX-emacs-19 window-system (progn (YaTeX-define-key "5^" 'yahtml-visit-main-other-frame map) (YaTeX-define-key "5g" 'yahtml-goto-corresponding-*-other-frame map) (YaTeX-define-key "55" 'YaTeX-switch-to-window map))) (YaTeX-define-key "v" 'yahtml-version map) (YaTeX-define-key "s" 'yahtml-insert-form map) (YaTeX-define-key "l" 'yahtml-insert-tag map) (YaTeX-define-key "L" 'yahtml-insert-tag-region map) (YaTeX-define-key "m" 'yahtml-insert-single map) (YaTeX-define-key "n" (function(lambda () (interactive) (insert (if yahtml-prefer-upcases "
    " "
    ")))) map) (YaTeX-define-key "-" (function(lambda () (interactive) (insert (if yahtml-prefer-upcases "
    " "
    ") "\n"))) map) (YaTeX-define-key "p" 'yahtml-insert-p map) (if YaTeX-no-begend-shortcut (progn (YaTeX-define-key "B" 'yahtml-insert-begend-region map) (YaTeX-define-key "b" 'yahtml-insert-begend map)) (yahtml-define-begend-key "bh" "html" map) (yahtml-define-begend-key "bH" "head" map) (yahtml-define-begend-key "bt" "title" map) (yahtml-define-begend-key "bT" "table" map) (yahtml-define-begend-key "bb" "body" map) (yahtml-define-begend-key "bc" "center" map) (yahtml-define-begend-key "bd" "dl" map) (yahtml-define-begend-key "bu" "ul" map) (yahtml-define-begend-key "bo" "ol" map) (yahtml-define-begend-key "b1" "h1" map) (yahtml-define-begend-key "b2" "h2" map) (yahtml-define-begend-key "b3" "h3" map) (yahtml-define-begend-key "ba" "a" map) (yahtml-define-begend-key "bf" "form" map) (yahtml-define-begend-key "bl" "label" map) (yahtml-define-begend-key "bs" "select" map) (yahtml-define-begend-key "bv" "div" map) (yahtml-define-begend-key "bS" "span" map) (yahtml-define-begend-key "bp" "pre" map) (YaTeX-define-key "b " 'yahtml-insert-begend map) (YaTeX-define-key "B " 'yahtml-insert-begend-region map)) (YaTeX-define-key "e" 'YaTeX-end-environment map) (YaTeX-define-key ">" 'yahtml-comment-region map) (YaTeX-define-key "<" 'yahtml-uncomment-region map) (YaTeX-define-key "g" 'yahtml-goto-corresponding-* map) (YaTeX-define-key "k" 'yahtml-kill-* map) (YaTeX-define-key "c" 'yahtml-change-* map) (YaTeX-define-key "t" 'yahtml-browse-menu map) (YaTeX-define-key "a" 'yahtml-char-entity-ref map) (YaTeX-define-key "'" 'yahtml-prev-error map) (YaTeX-define-key ";" 'yahtml-translate-region map) (YaTeX-define-key ":" 'yahtml-translate-reverse-region map) (YaTeX-define-key "#" 'yahtml-escape-chars-region map) (YaTeX-define-key "}" 'yahtml-td-region map) (YaTeX-define-key "]" 'yahtml-tr-region map) ;;;;;(YaTeX-define-key "i" 'yahtml-fill-item map) (YaTeX-define-key "\e" 'yahtml-quit map)) (substitute-all-key-definition 'fill-paragraph 'yahtml-fill-paragraph yahtml-mode-map) (substitute-all-key-definition 'kill-buffer 'YaTeX-kill-buffer yahtml-mode-map)) (if yahtml-lint-buffer-map nil (setq yahtml-lint-buffer-map (make-keymap)) (define-key yahtml-lint-buffer-map " " 'yahtml-jump-to-error-line)) (defvar yahtml-paragraph-start (concat "^$\\|") (comment-start-skip . comment-start) (indent-line-function . yahtml-indent-line))) (if yahtml-use-font-lock (progn (yahtml-font-lock-set-default-keywords) (or (featurep 'xemacs) (progn (set (make-local-variable 'font-lock-defaults) '(yahtml-font-lock-keywords nil t)) ;;(font-lock-mode -1) (font-lock-mode 1) ;;Why should I fontify again??? ;; in yatex-mode, there's no need to refontify... (font-lock-fontify-buffer))))) ;; +dnd for X11 w/ emacs23+ (and window-system (featurep 'dnd) (set (make-local-variable 'dnd-protocol-alist) (cons (cons "^\\(file\\|https?\\):" 'yahtml-dnd-handler) dnd-protocol-alist))) (set-syntax-table yahtml-syntax-table) (use-local-map yahtml-mode-map) (YaTeX-read-user-completion-table) (yahtml-css-scan-styles) ;(turn-on-auto-fill) ;Sorry, this is prerequisite (and (= 0 (buffer-size)) (file-exists-p yahtml-template-file) (y-or-n-p (format "Insert %s?" yahtml-template-file)) (insert-file-contents (expand-file-name yahtml-template-file))) (if (fboundp 'electric-indent-local-mode) (electric-indent-local-mode yahtml-electric-indent-mode)) (run-hooks 'text-mode-hook 'yahtml-mode-hook) ;; This warning should be removed after a while(2000/12/2) (let ((fld (or (and (local-variable-p 'font-lock-defaults (current-buffer)) font-lock-defaults) (get 'yahtml-mode 'font-lock-defaults)))) (and fld (not (memq 'yahtml-font-lock-keywords fld)) (YaTeX-warning-font-lock "yahtml")))) (defun yahtml-version () "Return string of the version of running yahtml." (interactive) (message (concat "Yet Another HTML-mode " (if YaTeX-japan "「HTML屋」" "`yahtml'") " Revision " yahtml-revision-number))) (defun yahtml-quit () (interactive) (and yahtml-mode-old-mode (fboundp yahtml-mode-old-mode) (funcall yahtml-mode-old-mode))) (defun yahtml-define-menu (keymap bindlist) (cond ((featurep 'xemacs) (let ((name (keymap-name (symbol-value keymap)))) (set keymap nil) (mapcar (function (lambda (bind) (setq bind (cdr bind)) (if (eq (car (cdr bind)) 'lambda) (setcar (cdr bind) 'progn)) (if (stringp (car (cdr bind))) (set keymap (cons (cdr bind) (symbol-value keymap))) (set keymap (cons (vector (car bind) (cdr bind) t) (symbol-value keymap)))))) bindlist) (set keymap (cons name (symbol-value keymap))))) (t (mapcar (function (lambda (bind) (define-key (symbol-value keymap) (vector (car bind)) (cdr bind)))) bindlist)))) (defvar yahtml-menu-map nil "Menu map of yahtml") (defvar yahtml-menu-map-sectioning nil "Menu map of yahtml(sectioning)") (defvar yahtml-menu-map-listing nil "Menu map of yahtml(listing)") (defvar yahtml-menu-map-logical nil "Menu map of yahtml(logical tags)") (defvar yahtml-menu-map-typeface nil "Menu map of yahtml(typeface tags)") ;;; Variables for mosaic url history (defvar yahtml-urls nil "Alist of global history") (defvar yahtml-urls-private nil) (defvar yahtml-urls-local nil) (cond ((and YaTeX-emacs-19 (null yahtml-menu-map)) (setq yahtml-menu-map (make-sparse-keymap "yahtml")) (setq yahtml-menu-map-sectioning (make-sparse-keymap "sectioning menu")) (YaTeX-define-menu 'yahtml-menu-map-sectioning (nreverse '((1 "H1" . (lambda () (interactive) (yahtml-insert-begend nil "H1"))) (2 "H2" . (lambda () (interactive) (yahtml-insert-begend nil "H2"))) (3 "H3" . (lambda () (interactive) (yahtml-insert-begend nil "H3"))) (4 "H4" . (lambda () (interactive) (yahtml-insert-begend nil "H4"))) (5 "H5" . (lambda () (interactive) (yahtml-insert-begend nil "H5"))) (6 "H6" . (lambda () (interactive) (yahtml-insert-begend nil "H6"))) ))) (setq yahtml-menu-map-logical (make-sparse-keymap "logical tags")) (YaTeX-define-menu 'yahtml-menu-map-logical (nreverse '((em "Embolden" . (lambda () (interactive) (yahtml-insert-tag nil "EM"))) (dfn "Define a word" . (lambda () (interactive) (yahtml-insert-tag nil "DFN"))) (cite "Citation" . (lambda () (interactive) (yahtml-insert-tag nil "CITE"))) (code "Code" . (lambda () (interactive) (yahtml-insert-tag nil "CODE"))) (kbd "Keyboard" . (lambda () (interactive) (yahtml-insert-tag nil "KBD"))) (samp "Sample display" . (lambda () (interactive) (yahtml-insert-tag nil "SAMP"))) (strong "Strong" . (lambda () (interactive) (yahtml-insert-tag nil "STRONG"))) (VAR "Variable notation" . (lambda () (interactive) (yahtml-insert-tag nil "var")))))) (setq yahtml-menu-map-typeface (make-sparse-keymap "typeface tags")) (YaTeX-define-menu 'yahtml-menu-map-typeface (nreverse '((b "Bold" . (lambda () (interactive) (yahtml-insert-tag nil "b"))) (i "Italic" . (lambda () (interactive) (yahtml-insert-tag nil "i"))) (tt "Typewriter" . (lambda () (interactive) (yahtml-insert-tag nil "tt"))) (u "Underlined" . (lambda () (interactive) (yahtml-insert-tag nil "u")))))) (setq yahtml-menu-map-listing (make-sparse-keymap "listing")) (YaTeX-define-menu 'yahtml-menu-map-listing (nreverse '((ul "Unordered" . (lambda () (interactive) (yahtml-insert-begend nil "ul"))) (ol "Ordered" . (lambda () (interactive) (yahtml-insert-begend nil "ol"))) (dl "Definition" . (lambda () (interactive) (yahtml-insert-begend nil "dl")))))) (setq yahtml-menu-map-item (make-sparse-keymap "item")) (YaTeX-define-menu 'yahtml-menu-map-item (nreverse '((li "Simple item" . (lambda () (interactive) (yahtml-insert-single "li"))) (dt "Define term" . (lambda () (interactive) (yahtml-insert-single "dt"))) (dd "Description of term" . (lambda () (interactive) (yahtml-insert-single "dd")))))) (define-key yahtml-mode-map [menu-bar yahtml] (cons "yahtml" yahtml-menu-map)) (YaTeX-define-menu 'yahtml-menu-map (nreverse (list (cons (list 'sect "Sectioning") (cons "sectioning" yahtml-menu-map-sectioning)) (cons (list 'list "Listing") (cons "Listing" yahtml-menu-map-listing)) (cons (list 'item "Item") (cons "Itemizing" yahtml-menu-map-item));;; (cons (list 'logi "Logical tags") (cons "logical" yahtml-menu-map-logical)) (cons (list 'type "Typeface tags") (cons "typeface" yahtml-menu-map-typeface))))) (if (featurep 'xemacs) (add-hook 'yahtml-mode-hook (function (lambda () (or (assoc "yahtml" current-menubar) (progn (set-buffer-menubar (copy-sequence current-menubar)) (add-submenu nil yahtml-menu-map))))))))) ;;; ----------- Completion ---------- (defvar yahtml-last-begend "html") (defun yahtml-insert-begend (&optional region env) "Insert ... ." (interactive "P") (setq yahtml-current-completion-type 'multiline region (or region (YaTeX-region-active-p))) (let*((completion-ignore-case t) (cmd (or env (YaTeX-cplread-with-learning (format "Environment(default %s): " yahtml-last-begend) 'yahtml-env-table 'yahtml-user-env-table 'yahtml-tmp-env-table))) (bolp (save-excursion (skip-chars-backward " \t" (point-beginning-of-line)) (bolp))) (cc (current-column))) (if (string< "" cmd) (setq yahtml-last-begend cmd)) (setq yahtml-last-begend (or (cdr (assoc yahtml-last-begend yahtml-env-table)) yahtml-last-begend)) (setq cmd yahtml-last-begend) (setq cmd (funcall (if yahtml-prefer-upcases 'upcase 'downcase) cmd)) (if region ;; We want to keep region effective for new tagged environment ;; to enable continuous regioning by another environment (let ((beg (region-beginning)) (end (region-end)) (addin (yahtml-addin cmd))) (save-excursion (goto-char end) (insert-before-markers (format "%s" cmd (if bolp "\n" ""))) (goto-char beg) (insert (format "<%s%s>%s" cmd addin (if bolp "\n" ""))))) (insert (format "<%s%s>" cmd (yahtml-addin cmd))) (save-excursion (insert "\n") (indent-to-column cc) (insert (format "" cmd))) (if (string-match "^[ap]$" cmd) ;aとp決め打ちってのが美しくない… (newline) (yahtml-intelligent-newline nil)) (yahtml-indent-line)))) (defun yahtml-insert-begend-region () "Call yahtml-insert-begend in the region mode." (interactive) (yahtml-insert-begend t)) (defun yahtml-insert-form (&optional form) "Insert
    ." (interactive) (setq yahtml-current-completion-type 'single) (or form (let ((completion-ignore-case t)) (setq form (YaTeX-cplread-with-learning (format "Form(default %s): " yahtml-last-form) 'yahtml-form-table 'yahtml-user-form-table 'yahtml-tmp-form-table)))) (let ((p (point)) q) (if (string= form "") (setq form yahtml-last-form)) (setq yahtml-last-form form) (if yahtml-prefer-upcases (setq form (upcase form))) (insert (format "<%s%s>" form (yahtml-addin form))) ;;(indent-relative-maybe) (if (cdr (assoc form yahtml-form-table)) (save-excursion (insert (format "" form)))) (if (search-backward "\"\"" p t) (forward-char 1)))) (defun yahtml-read-css (alist &optional element) (let ((completion-ignore-case t) (delim " ") (minibuffer-completion-table alist) (quotekey (substitute-command-keys "\\[quoted-insert]"))) (read-from-minibuffer-with-history (if YaTeX-japan (format "%sクラス(複数指定は%s SPCで区切る): " (if element (concat element "の") "") quotekey) (format "class%s(multiple class can be delimited by %s SPC): " (if element (concat " for " element) "") quotekey)) nil YaTeX-minibuffer-completion-map nil))) (defvar yahtml-newpage-command "newpage.rb" "*Command name to create new HTML file referring to index.html. This command should create new HTML file named argument 1 and output string like `anchor tag'. This program should take -o option to overwrite existing HTML file.") (defun yahtml-newpage (file ov) "Create newpage via newpage script" (interactive (list (let (insert-default-directory) (read-file-name "New webpage file name: " "")) current-prefix-arg)) (if (and (file-exists-p file) (not ov)) (error "%s already exists. Call this with universal argument to force overwrite." file)) (insert (substring (YaTeX-command-to-string (concat yahtml-newpage-command " " (if ov "-o ") file)) 0 -1))) ;;; ---------- Add-in ---------- (defun yahtml-addin (form) "Check add-in function's existence and call it if exists." (let ((addin (concat "yahtml:" (downcase form))) s a) (concat (and (setq a (yahtml-css-get-element-completion-alist form)) (not (equal (YaTeX-last-key) ?\C-j)) (memq yahtml-current-completion-type '(multiline inline)) (not (string-match "#\\|source" form)) (yahtml-make-optional-argument ;should be made generic? "class" (yahtml-read-css a form))) (if (and (intern-soft addin) (fboundp (intern-soft addin)) (stringp (setq s (funcall (intern addin)))) (string< "" s)) (if (eq (aref s 0) ? ) s (concat " " s)) "")))) (defvar yahtml-completing-buffer nil) (defun yahtml-collect-labels (&optional file ptn withouthash) "Collect current buffers label (). If optional argument FILE is specified collect labels in FILE." (let ((attrptn (concat "\\(" (or ptn "name\\|id") "\\)\\s *=")) (hash (if withouthash "" "#")) list end) (save-excursion (set-buffer (or yahtml-completing-buffer (current-buffer))) (if file (let (hilit-auto-highlight) (set-buffer (find-file-noselect file)))) (save-excursion (goto-char (point-min)) (while ;(re-search-forward "<\\w+\\b" nil t) (re-search-forward attrptn nil t) ;(setq bound (match-end 0)) ;(search-forward ">" nil t) (setq end (match-end 0)) (if (and ;(re-search-backward "\\(name\\|id\\)\\s *=" bound t) (yahtml-on-assignment-p) (progn (goto-char end) (skip-chars-forward " \t\n") (looking-at "\"?#?\\([^\">]+\\)\"?\\b"))) (setq list (cons (list (concat hash (YaTeX-match-string 1))) list)))) list)))) (defun yahtml-collect-ids (&optional file) (yahtml-collect-labels file "id" 'withouthash)) (defvar yahtml-url-completion-map nil "Key map used in URL completion buffer") (if yahtml-url-completion-map nil (setq yahtml-url-completion-map (copy-keymap minibuffer-local-completion-map)) (define-key yahtml-url-completion-map "\t" 'yahtml-complete-url) (define-key yahtml-url-completion-map " " 'yahtml-complete-url)) (defun yahtml-complete-url () "Complete external URL from history or local file name." (interactive) (let ((p (point)) initial i2 cmpl path dir file listfunc beg labels (lim (YaTeX-minibuffer-begin)) (min (if (fboundp 'field-beginning) (field-beginning) (point-min)))) (setq initial (YaTeX-minibuffer-string)) (cond ((string-match "^htt" initial) (setq cmpl (try-completion initial yahtml-urls) listfunc (list 'lambda nil (list 'all-completions initial 'yahtml-urls)) beg min)) ((setq beg (string-match "#" initial)) (or (equal beg 0) ;begin with # (progn (setq path (substring initial 0 beg)) (if (string-match "^/" path) (setq path (yahtml-url-to-path path))))) (setq initial (substring initial beg)) (setq labels (yahtml-collect-labels path) cmpl (try-completion initial labels) listfunc (list 'lambda () (list 'all-completions initial (list 'quote labels))) beg (+ min beg))) (t (setq path (if (string-match "^/" initial) (or (yahtml-url-to-path initial) initial) initial)) (setq dir (or (file-name-directory path) ".") file (file-name-nondirectory path) initial file cmpl (file-name-completion file dir) listfunc (list 'lambda nil (list 'file-name-all-completions file dir)) beg (save-excursion (skip-chars-backward "^/" lim) (point))))) (cond ((stringp cmpl) (if (string= initial cmpl) (with-output-to-temp-buffer "*Completions*" (princ "Possible completinos are:\n") (princ (mapconcat (function(lambda (x) x)) (funcall listfunc) "\n"))) (delete-region (point) beg) (insert cmpl))) ((null cmpl) (ding)) ((eq t cmpl) (save-excursion (unwind-protect (progn (goto-char p) (insert " [Sole completion]")) (delete-region p (point-max)))))))) ; ; Subject: [yatex:02849] Re: [yahtml] tilda in href tag ; From: Masayasu Ishikawa sfc.keio.ac.jp> ; To: yatexarcadia.jaist.ac.jp ; Date: Mon, 31 May 1999 21:09:31 +0900 ; RFC 2396 の "2.4.3. Excluded US-ASCII Characters" によると、以下の文字 ; は必ずエスケープしないといけません。 ; ; control = ; space = ; delims = "<" | ">" | "#" | "%" | <"> ; unwise = "{" | "}" | "|" | "\" | "^" | "[" | "]" | "`" (defvar yahtml-unsafe-chars-regexp "[][\x0- \x7f <>%\"{}|\\^`]" ;#は除去する "Characters regexp which must be escaped in URI.") ; ; また、以下の文字は予約された用法以外に用いる場合にはエスケープしないと ; いけないことになっています。 ; ; reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | ; "$" | "," (defvar yahtml-unreserved-chars-regexp "[;/?:@&=+$,]" "Characters regexp which should be escaped in URI on certain conditions. Not used yet.") (defun yahtml-escape-chars-string (str) "Translate reserved chars to URL encoded string." (let ((p 0) (target "") (ask (eq yahtml-escape-chars 'ask))) (cond ((null yahtml-escape-chars) str) (t (while (and (string< "" str) (setq p (string-match yahtml-unsafe-chars-regexp str))) (if (and ask (y-or-n-p (format "Escape char [%c] of `%s'" (aref str p) (substring str 0 (1+ p))))) (setq target (concat target (substring str 0 p) (format "%%%x" (aref str p)))) (setq target (concat target (substring str 0 (1+ p))))) (setq str (substring str (1+ p)))) (concat target str))))) (defun yahtml-unescape-string (str) "Untranslate reserved URL-encoded string." (let ((p 0) c (target "") (md (match-data)) (case-fold-search nil)) (unwind-protect (progn (while (string-match "%\\([0-9a-f][0-9a-f]\\)" str p) (setq target (concat target (substring str p (1- (match-beginning 1)))) p (match-end 0) c (YaTeX-hex (substring str (match-beginning 1) (match-end 1))) target (concat target (format "%c" c)))) (concat target (substring str p))) (store-match-data md)))) (defun yahtml-escape-chars-region (beg end) "Translate reserved chars to encoded string in the region." (interactive "r") (save-excursion (let ((e (set-marker (make-marker) end)) c m yes) (goto-char beg) (while (and (< (point) e) (re-search-forward (concat yahtml-unsafe-chars-regexp "\\|" yahtml-unreserved-chars-regexp) e t)) (sit-for 0) ; (setq m (buffer-modified-p) ; c (char-after (1- (point)))) ; (save-excursion (backward-char 1) (insert " ==>")) ; (unwind-protect ; (setq yes (y-or-n-p (format "Replace: [%c]" c))) ; (save-excursion ; (backward-char 1) ; (delete-backward-char 4)) ; (set-buffer-modified-p m)) (message "Replace: [%c] (y or n):" (setq c (char-after (1- (point))))) (if (memq (read-char) '(?y ?Y)) (progn (delete-region (match-beginning 0) (match-end 0)) (insert (format "%%%x" c))))) (set-marker e nil)))) ;; ab%defgls/.| (defun yahtml-read-url (prompt) (let ((href "")) (setq yahtml-completing-buffer (current-buffer) yahtml-urls (append yahtml-urls-private yahtml-urls-local) href (yahtml-escape-chars-string (read-from-minibuffer-with-history prompt "" yahtml-url-completion-map))) (prog1 href (if (and (string-match "^https?://" href) (null (assoc href yahtml-urls-private)) (null (assoc href yahtml-urls-local))) (YaTeX-update-table (list href) 'yahtml-urls-private 'yahtml-urls-private 'yahtml-urls-local))))) (defun yahtml:a () "Add-in function for " (let ((href (yahtml-read-url "href: "))) (concat (yahtml-make-optional-argument "href" href) (yahtml-make-optional-argument "name" (read-string-with-history "name: "))))) (defvar yahtml-parameters-completion-alist '(("align" ("top") ("middle") ("bottom") ("left") ("right") ("center")) ("clear" ("left") ("right") ("center") ("all") ("none")) ("lang" ("ja") ("en") ("kr") ("ch") ("fr")) ("src" . file) ("file" . file) ("poster" . file) ("background" . file) ("class file name" . file) ("data" . file) ("method" ("POST") ("GET")) ("rev" . yahtml-link-types-alist) ("rel" . yahtml-link-types-alist) ("type" . yahtml-content-types-alist) ("codetype" . yahtml-content-types-alist) ("http-equiv" ("Refresh") ("Content-Language") ("Content-Type")) ("charset" ("utf-8")("euc-jp")("iso-2022-jp")("iso-8859-1")("shift_jis")))) (defvar yahtml-link-types-alist '(("alternate") ("stylesheet") ("start") ("next") ("prev") ("contents") ("index") ("glossary") ("chapter") ("section") ("subsection") ("appendix") ("help") ("bookmark"))) (defvar yahtml-content-types-alist '(("text/css") ("text/html") ("text/plain") ("text/richtext") ("text/sgml") ("text/xml") ("text/javascript") ("text/tcl") ("text/vbscript") ("application/octet-stream") ("application/postscript") ("application/pdf") ("application/java") ("image/jpeg") ("image/gif") ("image/tiff") ("image/png") ("video/mpeg")) "Alist of content-types") (defun yahtml-read-parameter (par &optional default alist predicate) (let* ((alist (cdr-safe (assoc (downcase par) (or alist yahtml-parameters-completion-alist)))) (prompt (concat par ": ")) v) (cond ((eq alist 'file) (let ((insert-default-directory)) (read-file-name prompt "" default nil "" predicate))) ((eq alist 'command) (if (fboundp 'read-shell-command) (read-shell-command prompt) (read-string-with-history prompt))) ((and alist (symbolp alist)) (completing-read-with-history prompt (symbol-value alist) nil nil default)) (alist (completing-read-with-history prompt alist nil nil default)) (t (read-string-with-history prompt default))))) (defun yahtml-read-file-name-regexp (prompt regexp &optional dir default-filename mustmatch initial) (let ((pred (function (lambda (f) (or (file-name-directory f) (string-match regexp f))))) (insert-default-directory nil)) (read-file-name prompt dir default-filename mustmatch initial pred))) (defun yahtml-make-optional-argument (opt arg) "Make optional argument string." (if (or (null arg) (string= "" arg)) "" (concat " " (if yahtml-prefer-upcase-attributes (upcase opt) (downcase opt)) "=\"" arg "\""))) (defun yahtml:html () "Add-in for " (setq yahtml-last-begend "head" yahtml-last-typeface-cmd "head") (yahtml-make-optional-argument "lang" (yahtml-read-parameter "lang" (if YaTeX-japan "ja")))) (defun yahtml:head () "Add-in for " (setq yahtml-last-begend "title" yahtml-last-typeface-cmd "title") "") (defun yahtml:body () "Add-in function for " (cond (yahtml-html4-strict nil) (t (let ((b (read-string-with-history "bgcolor=")) (bg (yahtml-read-parameter "background" "")) (x (read-string-with-history "text color=")) (l (read-string-with-history "link color=")) (v (read-string-with-history "vlink color="))) (concat (yahtml-make-optional-argument "bgcolor" b) (yahtml-make-optional-argument "background" bg) (yahtml-make-optional-argument "text" x) (yahtml-make-optional-argument "link" l) (yahtml-make-optional-argument "vlink" v)))))) (defun yahtml-make-style-parameter (proplist) "Make CSS property definitions in style attribute." (mapconcat (function (lambda (x) (if (and (cdr x) (string< "" (cdr x))) (format "%s: %s;" (car x) (cdr x))))) (delq nil proplist) " ")) (defun yahtml:img () "Add-in function for " (let ((src (yahtml-read-parameter "src")) (alg (if yahtml-html4-strict nil (yahtml-read-parameter "align"))) alt (brd (read-string-with-history "border=")) (l yahtml-prefer-upcase-attributes) info width height bytes comments) (and (stringp src) (string< "" src) (file-exists-p src) (setq info (yahtml-get-image-info src)) (car info) (setq width (int-to-string (car info)) height (int-to-string (car (cdr info))) bytes (car (cdr (cdr info))) comments (nth 4 info))) (if info (setq alt (YaTeX-replace-formats yahtml:img-default-alt-format (list (cons "x" width) (cons "y" height) (cons "s" (int-to-string bytes)) (cons "f" (file-name-nondirectory src)) (cons "c" (car comments)))))) (setq alt (yahtml-read-parameter "alt" alt)) (setq width (yahtml-read-parameter "width" width) height (yahtml-read-parameter "height" height)) (concat (if l "SRC" "src") "=\"" src "\"" (yahtml-make-optional-argument "alt" alt) (yahtml-make-optional-argument "width" width) (yahtml-make-optional-argument "height" height) (if yahtml-html4-strict (yahtml-make-optional-argument "style" (if (or brd alg) (yahtml-make-style-parameter (list (if (string< "" alg) (cons "align" alg)) (if (string< "" brd) (cons "border" (format "%dpx" (YaTeX-str2int brd)))))))) (concat (yahtml-make-optional-argument "border" brd) (yahtml-make-optional-argument "align" alg)))))) (defun yahtml-file-truename (file) (cond ((fboundp 'file-truename) (file-truename (expand-file-name file))) (t (let ((new file)) (while (and (stringp (setq new (nth 0 (file-attributes file)))) (not (equal new file))) (setq file new)) file)))) (defun yahtml-hex-value (point length &optional little-endian) "Return the hex value the POINT positions LENGTH byte stream represents. Optional third argument LITTLE-ENDIAN is self extplanatory." (setq point (1+ point)) ;translate file offset to Emacs's point value (let ((mlt 1) (pos (if little-endian point (+ point length -1))) (direc (if little-endian 1 -1)) (value 0)) (while (> length 0) (setq value (+ value (* mlt (char-after pos))) pos (+ pos direc) mlt (* mlt 256) length (1- length))) value)) (defun yahtml-get-image-info (file) "Return the information on the image file FILE. Returns list of '(WIDTH HEIGHT BYTES DEPTH COMMENTLIST)." (save-excursion (let*((tmpbuf (get-buffer-create " *imgheader*")) width height bytes depth comment (file-coding-system-alist (list (cons "." 'no-conversion))) ;20 (file-coding-system-for-read (and (boundp '*noconv*) *noconv*)) ;19 (coding-system-for-read 'no-conversion) (seekpoint 1) c1 c2 c3 c4 beg end (case-fold-search nil)) (setq bytes (nth 7 (file-attributes (yahtml-file-truename file)))) (set-buffer tmpbuf) (if (boundp 'mc-flag) (set (make-local-variable 'mc-flag) nil)) (erase-buffer) (if (fboundp 'set-buffer-multibyte) (set-buffer-multibyte nil)) (unwind-protect (progn (message "Inspecting image information of %s..." file) ;; Read 4bytes-more than inspection-bytes in case that ;; JPEG marker delimiter (4bytes) is on the alignment. (YaTeX-insert-file-contents file nil 0 (+ yahtml-image-inspection-bytes 4)) (goto-char (point-min)) ;assertion (setq c1 (char-after 1) ;cache first 4 bytes c2 (char-after 2) c3 (char-after 3) c4 (char-after 4)) (cond ((and (eq c1 ?\377) (eq c2 ?\330)) ; 0xff 0xd8 ;;JPEG images need JPEG markers inspection ;;JPEG markers consist of [ 0xff ID(B) LEN(S) CONTENTS... ] ;; Warning: here seekpoint is measured by Emacs's point value ;; while yahtml-hex-vale requires file offset (setq seekpoint 3) ;where the first JPEG marker exists (catch 'exit (while (< seekpoint (- (buffer-size) 4)) (cond ((not (eq (char-after seekpoint) ?\377)) ;maybe corrupted, exit from loop (throw 'exit t)) ((memq (char-after (1+ seekpoint)) '(?\300 ?\301 ?\302 ?\303 ?\305 ?\306 ?\307 ?\311 ?\312 ?\313 ?\315 ?\316 ?\317)) ;;'(192 193 194 195 197 198 199 201 202 203 205 206 207 ;;found! (setq height (yahtml-hex-value (+ seekpoint 4) 2) width (yahtml-hex-value (+ seekpoint 6) 2) depth (yahtml-hex-value (+ seekpoint 3) 1))) ((eq (char-after (1+ seekpoint)) ?\376) ;0xFE = comment ;; JPEG comment area (setq beg (+ seekpoint 2 2) end (+ seekpoint (yahtml-hex-value (1+ seekpoint) 2) 2)) (setq comment (cons (buffer-substring beg end) comment))) (t ;other markers nil)) ;just skip it (setq seekpoint (+ seekpoint 2) seekpoint (+ seekpoint (yahtml-hex-value (1- seekpoint) 2)))))) ((and (eq c1 ?\211) ;0x89 (eq c2 ?P) (eq c3 ?N) (eq c4 ?G)) ;;PNG Image data X=@0x10(L), Y=@0x14(L), D=@0x18(B) (setq width (yahtml-hex-value 16 4) height (yahtml-hex-value 20 4) depth (yahtml-hex-value 24 1))) ((looking-at "GIF8") ;;GIF Image data X=@0x6(leshort), Y=@0x8(leshort) (setq width (yahtml-hex-value 6 2 t) height (yahtml-hex-value 8 2 t))) ((looking-at "BM") ;;# OS/2, Windoze BMP files ;;@0x0e = 12 -> OS/2 1.x - X=@0x12(leshort), Y=@0x14(leshort) ;;@0x0e = 64 -> OS/2 2.x - X=@0x12(leshort), Y=@0x14(leshort) ;;@0x0e = 40 -> Windows 3.x - X=@0x12(lelong), Y=@0x16(lelong) (cond ((eq (yahtml-hex-value 14 2 t) 40) (setq width (yahtml-hex-value 18 4 t) height (yahtml-hex-value 22 4 t))) (t (setq width (yahtml-hex-value 18 2 t) height (yahtml-hex-value 20 2 t))))))) (message "") (kill-buffer tmpbuf)) (list width height bytes depth (nreverse comment))))) (defun yahtml:form () "Add-in function `form' input format" (concat " " (if yahtml-prefer-upcase-attributes "METHOD" "method") "=\"" (completing-read-with-history "Method: " '(("POST") ("GET")) nil t) "\"" (yahtml-make-optional-argument (if yahtml-prefer-upcase-attributes "ENCTYPE" "enctype") (completing-read-with-history "Enctype: " '(("application/x-www-form-urlencoded") ("multipart/form-data")))) " " (if yahtml-prefer-upcase-attributes "ACTION" "action") "=\"" (read-string-with-history "Action: ") "\"")) (defun yahtml:select () "Add-in function for `select' input format" (setq yahtml-last-single-cmd "option" ;;<- it's old yahtml-last-typeface-cmd "option") (concat " " (if yahtml-prefer-upcase-attributes "NAME" "name") "=\"" (read-string-with-history "name: ") "\"")) (defun yahtml:label () "Add-in function for `
      " (setq yahtml-last-typeface-cmd "li") (let ((start (YaTeX-read-string-or-skip "start=")) (type (YaTeX-completing-read-or-skip "type=" '(("1") ("a") ("A") ("i") ("I")) nil t))) (concat (yahtml-make-optional-argument "start" start) (yahtml-make-optional-argument "type" type)))) (defun yahtml:ul () (setq yahtml-last-typeface-cmd "li") "") (defun yahtml:dl () (setq yahtml-last-typeface-cmd "dt") "") (defun yahtml:dt () (setq yahtml-last-typeface-cmd "dd") "") (defun yahtml:p () (if yahtml-html4-strict nil (let ((alg (yahtml-read-parameter "align"))) (yahtml-make-optional-argument "align" alg)))) (defvar yahtml-input-types '(("text") ("password") ("checkbox") ("radio") ("submit") ("reset") ("image") ("hidden") ("file"))) (defun yahtml:input () "Add-in function for `input' form" (let ((size "") name type value id (maxlength "") (l yahtml-prefer-upcase-attributes)) (setq name (read-string-with-history "name: ") type (YaTeX-completing-read-or-skip "type (default=text): " yahtml-input-types nil t) value (YaTeX-read-string-or-skip "value: ")) (or (string-match "submit\\|reset" type) (setq id (YaTeX-read-string-or-skip "id: "))) (if (string-match "text\\|password\\|^$" type) (setq size (YaTeX-read-string-or-skip "size: ") maxlength (YaTeX-read-string-or-skip "maxlength: "))) (concat (if l "NAME" "name") "=\"" name "\"" (yahtml-make-optional-argument "type" type) (yahtml-make-optional-argument "value" value) (yahtml-make-optional-argument "id" id) (yahtml-make-optional-argument "size" size) (yahtml-make-optional-argument "maxlength" maxlength)))) (defun yahtml:datalist () "Add-in function for `datalist' form" (setq yahtml-last-typeface-cmd "option") (let ((ids (yahtml-collect-ids))) (yahtml-make-optional-argument "id" (YaTeX-completing-read-or-skip "id: " ids nil t)))) (defun yahtml:textarea () "Add-in function for `textarea'" (interactive) (let (name rows cols) (setq name (read-string-with-history "Name: ") cols (read-string-with-history "Columns: ") rows (read-string-with-history "Rows: ")) (concat (concat (if yahtml-prefer-upcase-attributes "NAME=" "name=") "\"" name "\"") (yahtml-make-optional-argument "cols" cols) (yahtml-make-optional-argument "rows" rows)))) (defun yahtml:table () "Add-in function for `table'" (let ((b (read-string-with-history "border=")) (a (if yahtml-html4-strict "" (yahtml-read-parameter "align" nil '(("align" ("right")("center"))))))) (if yahtml-html4-strict (yahtml-make-optional-argument "style" (if (or (string< "" b) (string< "" a)) (yahtml-make-style-parameter (append (if (string< "" b) (list (cons "border" (format "%dpx solid" (YaTeX-str2int b))) (cons "border-collapse" "collapse"))) (if (string< "" a) (cond ((string-match "right" a) (list (cons "margin-left" "auto") (cons "margin-right" "0"))) ((string-match "center" a) (list (cons "margin-left" "auto") (cons "margin-right" "auto"))))))))) (concat (yahtml-make-optional-argument "border" b) (yahtml-make-optional-argument "align" a))))) ;(fset 'yahtml:caption 'yahtml:p) (defun yahtml:caption () "Add-in function for `caption' in table tag" (let ((par (yahtml-read-parameter "align"))) (if yahtml-html4-strict (yahtml-make-optional-argument "style" (if par (yahtml-make-style-parameter (list (cons "caption-side" par))))) (yahtml-make-optional-argument "align" par)))) (defun yahtml:font () "Add-in function for `font'" (concat (yahtml-make-optional-argument "color" (read-string-with-history "color=")) (yahtml-make-optional-argument "size" (read-string-with-history "size=")))) (defun yahtml:style () "Add-in function for `style'" (yahtml-make-optional-argument "type" (read-string-with-history "type=" "text/css"))) (defun yahtml:script () "Add-in function for `script'" (concat (yahtml-make-optional-argument "type" (yahtml-read-parameter "type" "text/javascript")) (yahtml-make-optional-argument "src" (yahtml-read-parameter "src" "")))) (defun yahtml:tr () "Add-in function for `tr'" (setq yahtml-last-typeface-cmd "td") "") (defun yahtml:link () "Add-in function for `link' (まだちょっと良く分かってない)" (let (rel rev type href) (setq rel (yahtml-read-parameter "rel")) (cond ((equal rel "") (concat (yahtml-make-optional-argument "rev" (yahtml-read-parameter "rev")) (yahtml-make-optional-argument "href" (yahtml-read-parameter "href") ;;他に良く使うのって何? ))) ((string-match "stylesheet" rel) (concat (yahtml-make-optional-argument "rel" rel) (yahtml-make-optional-argument "type" (yahtml-read-parameter "type" "text/css")) (progn (setq href (read-from-minibuffer-with-history "href: " "" yahtml-url-completion-map)) (if (string< "" href) (progn (if (and (file-exists-p (yahtml-url-to-path href)) (y-or-n-p "Load css symbols now? ")) (setq yahtml-css-class-alist (yahtml-css-collect-classes-file (yahtml-url-to-path href) yahtml-css-class-alist))) (message "") (yahtml-make-optional-argument "href" href)))))) (t (concat (yahtml-make-optional-argument "rel" rel) (yahtml-make-optional-argument "type" (yahtml-read-parameter "type" "text/css")) (yahtml-make-optional-argument "href" (read-from-minibuffer-with-history "href: " "" yahtml-url-completion-map))))))) (defvar yahtml:meta-attrs '(("charset" value) ("name" content ("keywords")("author")("copyright")("date")("GENERATOR") ("viewport")) ("http-equiv" content))) (defun yahtml:meta () (let ((attr (completing-read-with-history "Meta Attribute: " yahtml:meta-attrs)) (case-fold-search t) (completion-ignore-case t) todonext name http-equiv content) (cond ((string= "" attr) nil) ((and (setq todonext (cdr-safe (assoc attr yahtml:meta-attrs))) (eq 'value (car todonext))) (yahtml-make-optional-argument attr (yahtml-read-parameter attr))) ((eq 'content (car todonext)) (setq name (if (cdr todonext) (completing-read-with-history (format "%s: " attr) (cdr todonext)) (yahtml-read-parameter attr))) (concat (yahtml-make-optional-argument attr name) (yahtml-make-optional-argument "content" (cond ((string-match "date" name) (read-string-with-history "Date: " (current-time-string))) ((string-match "author" name) (read-string-with-history "Author: " (if (and (user-full-name) (string< "" (user-full-name))) (user-full-name) (user-login-name)))) ((string-match "GENERATOR" name) (setq content (read-string-with-history "Generator: " "User-agent: ")) (if (string-match "yahtml" content) (message "Thank you!")) content) ((string-match "content-type" name) (if (string-match "http-equiv" attr ) (error "Use and put cursor inside of them." (interactive "P") (setq yahtml-current-completion-type 'inline region-mode (or region-mode (YaTeX-region-active-p))) (or tag (let ((completion-ignore-case t)) (setq tag (YaTeX-cplread-with-learning (format "Tag %s(default %s): " (if region-mode "region: " "") yahtml-last-typeface-cmd) 'yahtml-typeface-table 'yahtml-user-typeface-table 'yahtml-tmp-typeface-table)))) (if (string= "" tag) (setq tag yahtml-last-typeface-cmd)) (setq tag (or (cdr (assoc tag yahtml-typeface-table)) tag)) (setq yahtml-last-typeface-cmd tag tag (funcall (if yahtml-prefer-upcases 'upcase 'downcase) tag)) (if region-mode (if (if (string< "19" emacs-version) (mark t) (mark)) (save-excursion (if (> (point) (mark)) (exchange-point-and-mark)) (insert (format "<%s%s>" tag (yahtml-addin tag))) (exchange-point-and-mark) (insert "")) (message "No mark set now")) (insert (format "<%s%s>" tag (yahtml-addin tag))) (save-excursion (insert (format "" tag))))) (defun yahtml-insert-tag-region (&optional tag) "Call yahtml-insert-tag with region mode." (interactive) (yahtml-insert-tag t tag)) (defvar yahtml-need-single-closer nil) ;for test (defun yahtml-insert-single (cmd) "Insert ." (interactive (list (let ((completion-ignore-case t)) (YaTeX-cplread-with-learning (format "Command%s: " (if yahtml-last-single-cmd (concat "(default " yahtml-last-single-cmd ")") "")) 'yahtml-single-cmd-table 'yahtml-user-single-cmd-table 'yahtml-tmp-single-cmd-table)))) (if (string= "" cmd) (setq cmd yahtml-last-single-cmd)) (setq yahtml-last-single-cmd (or (cdr (assoc cmd yahtml-single-cmd-table)) cmd)) (setq cmd (funcall (if yahtml-prefer-upcases 'upcase 'downcase) yahtml-last-single-cmd)) (insert (format "<%s%s%s>" cmd (yahtml-addin cmd) (if (and yahtml-need-single-closer (assoc cmd '(("br")("hr")))) " /" ""))) (if (assoc cmd yahtml-env-table) (save-excursion (insert (format "" cmd))))) (defun yahtml-insert-p (&optional arg) "Convenient function to insert

      " (interactive "P") (if (or yahtml-always-/p arg) (yahtml-insert-tag arg "p") (yahtml-insert-single "p"))) (defun yahtml-insert-amps (arg) "Insert char-entity references via ampersand" ;; Thanks; http://www.tsc.co.jp/~asada/html/wdg40_f/entities/ (interactive "P") (let*((mess "") c (list (append yahtml-entity-reference-chars-alist-default yahtml-entity-reference-chars-alist)) (l list)) (while l (setq mess (format "%s %c" mess (car (car l)) (cdr (car l))) l (cdr l))) (message "Char-entity reference: %s SPC=& RET=&; BS=%s Other=&#..;" mess (if YaTeX-japan "直前の文字" "Preceding-Char")) (setq c (read-char)) (cond ((equal c (car-safe (assoc c list))) (insert (format "&%s;" (cdr (assoc c list))))) ((or (equal c ?\n) (equal c ?\r)) (insert "&;") (forward-char -1)) ((equal c ? ) (insert ?&)) ((and (memq c '(127 8)) (setq c (preceding-char)) (delete-backward-char 1) nil)) ;Fall through to the next 't block (t (insert (format "&#x%x;" c)))))) (defun yahtml:!--\#include () (let ((file (yahtml-read-parameter "file" ""))) (format "%s=\"%s\"--" (if (string-match "/" file) "virtual" "file") file))) (defun yahtml:!--\#exec () (format "cmd=\"%s\"--" (yahtml-read-parameter "cmd" "" '(("cmd" . command))))) (defun yahtml:media-read-options (&optional opts-alist) (let*((delim " ") (minibuffer-completion-table (or opts-alist '(("autoplay") ("controls") ("loop") ("preload")))) (quotekey (substitute-command-keys "\\[quoted-insert]"))) (read-from-minibuffer-with-history (format "Media Opts(`%s SPC' for more options): " quotekey) "controls" YaTeX-minibuffer-completion-map))) (defun yahtml:audio () ;preload autoplay loop controls: `src' be specified via `source' (yahtml:media-read-options)) (defun yahtml:video () ;`src' be specified via `source' (let ((poster (yahtml-make-optional-argument "poster" (yahtml-read-file-name-regexp "Poster: " "\\.\\(gif\\|png\\|jpg\\|w?bmp\\|pict\\|tif\\)" ""))) (opts (yahtml:media-read-options))) (concat poster (if (string< "" opts) (concat " " opts))))) (defvar yahtml-media-file-regexp "\\.\\(mp[0-9]\\|wav\\|og[gv]\\|opus\\|aac\\)" "*Default filename regexp of media files.") (defun yahtml:source () ;; source element must have src attribute (format "src=\"%s\"" (yahtml-read-file-name-regexp "source: " yahtml-media-file-regexp "" "" nil ""))) (defun yahtml:figure () (setq yahtml-last-typeface-cmd "figcaption")) (defun yahtml:iframe () (let ((src (yahtml-read-url "src: "))) (concat (yahtml-make-optional-argument "src" src) (yahtml-make-optional-argument "width" (YaTeX-read-string-or-skip "width: ")) (yahtml-make-optional-argument "height" (YaTeX-read-string-or-skip "height: "))))) ;;; ---------- Jump ---------- (defun yahtml-on-href-p () "Check if point is on href clause." (let ((p (point)) e cmd (case-fold-search t)) (save-excursion (and ;;(string= (YaTeX-inner-environment t) "a") ;aでなくても許可にした (save-excursion ;;(search-forward "
      " nil t) ;aでなくても許可にした (search-forward "[\" \t\n]" nil t) (setq e (point))) ;(goto-char (get 'YaTeX-inner-environment 'point)) (re-search-backward "<\\(a\\|link\\)\\>" nil t) (search-forward "href" e t) (search-forward "=" e t) (progn (skip-chars-forward " \t\n") (looking-at "\"?\\([^\"> \t\n]+\\)\"?")) (< p (match-end 0)) (yahtml-unescape-string (YaTeX-match-string 1)))))) (defun yahtml-netscape-sentinel (proc mes) (cond ((null (buffer-name (process-buffer proc))) (set-process-buffer proc nil)) ((eq (process-status proc) 'exit) (let ((cb (current-buffer))) (set-buffer (process-buffer proc)) (goto-char (point-min)) (if (search-forward "not running" nil t) (progn (message "Starting netscape...") (start-process "browser" (process-buffer proc) shell-file-name yahtml-shell-command-option (format "%s \"%s\"" yahtml-www-browser (get 'yahtml-netscape-sentinel 'url))) (message "Starting netscape...Done"))) (set-buffer cb))))) (defvar yahtml-browser-process nil) (defun yahtml-browse-html (href) "Call WWW Browser to see HREF." (let ((pb "* WWW Browser *") (cb (current-buffer))) (cond ((string-match "^start\\>" yahtml-www-browser) (if (get-buffer pb) (progn (set-buffer pb) (erase-buffer) (set-buffer cb))) (put 'yahtml-netscape-sentinel 'url href) (set-process-sentinel (setq yahtml-browser-process (start-process "browser" pb shell-file-name yahtml-shell-command-option (format "%s \"%s\"" yahtml-www-browser href))) 'yahtml-netscape-sentinel)) ((and (string-match "[Nn]etscape\\|[Ff]irefox\\|[Mm]ozilla" yahtml-www-browser) (not (eq system-type 'windows-nt))) (if (get-buffer pb) (progn (set-buffer pb) (erase-buffer) (set-buffer cb))) (put 'yahtml-netscape-sentinel 'url href) (set-process-sentinel (setq yahtml-browser-process (start-process "browser" pb shell-file-name yahtml-shell-command-option ;"-c" (format "%s -remote \"openURL(%s)\"" yahtml-www-browser href))) 'yahtml-netscape-sentinel)) ((and (string= "w3" yahtml-www-browser) (fboundp 'w3-fetch)) (w3-fetch href)) ((stringp yahtml-www-browser) (if (and yahtml-browser-process (eq (process-status yahtml-browser-process) 'run)) (message "%s is already running" yahtml-www-browser) (setq yahtml-browser-process (start-process "browser" "* WWW Browser *" shell-file-name yahtml-shell-command-option (format "%s \"%s\"" yahtml-www-browser href))))) (t (message "Sorry, jump across http is not supported."))))) (defun yahtml-goto-corresponding-href (&optional other) "Go to corresponding name." (let ((href (yahtml-on-href-p)) file name (parent buffer-file-name)) (if href (cond ((string-match "^\\(ht\\|f\\)tps?:" href) (yahtml-browse-html href)) (t (if (string-match "\&" href) (setq href (yahtml-untranslate-string href))) (setq file (substring href 0 (string-match "#" href))) (if (string-match "#" href) (setq name (substring href (1+ (string-match "#" href))))) (if (string< "" file) (progn (if (string-match "/$" file) (or (catch 'dirindex (mapcar (function (lambda (f) (if (file-exists-p (concat file f)) (throw 'dirindex (setq file (concat file f)))))) (yahtml-get-directory-index)) nil) (setq file (concat file yahtml-directory-index)))) (if (string-match "^/" file) (setq file (yahtml-url-to-path file))) (if other (YaTeX-switch-to-buffer-other-window file) (YaTeX-switch-to-buffer file)) (or YaTeX-parent-file (setq YaTeX-parent-file parent)))) (if name (progn (set-mark-command nil) (yahtml-jump-to-name name))) t))))) (defun yahtml-jump-to-name (name) "Jump to html's named tag." (setq name (format "\\(name\\|id\\)\\s *=\\s *\"?%s\\>\"?" name)) (or (and (re-search-forward name nil t) (goto-char (match-beginning 0))) (and (re-search-backward name nil t) (goto-char (match-beginning 0))) (message "Named tag `%s' not found" (substring href 1)))) (defun yahtml-on-begend-p (&optional p) "Check if point is on begend clause." (let ((p (or p (point))) cmd (case-fold-search t)) (save-excursion (goto-char p) (if (equal (char-after (point)) ?<) (forward-char 1)) (if (and (re-search-backward "<" nil t) (looking-at ;(concat "<\\(/?" yahtml-struct-name-regexp "\\)\\b") "<\\(/?[A-Z][A-Z0-9]*\\)\\b") (condition-case nil (forward-list 1) (error nil)) (< p (point))) (YaTeX-match-string 1))))) (defun yahtml-goto-corresponding-begend (&optional noerr) "Go to corresponding opening/closing tag. Optional argument NOERR causes no error for unballanced tag." (let ((cmd (yahtml-on-begend-p)) m0 (p (point)) (case-fold-search t) func str (nest 0)) (cond (cmd (setq m0 (match-beginning 0)) (if (= (aref cmd 0) ?/) ;on line (setq cmd (substring cmd 1) str (format "\\(<%s\\)\\|\\(= nest 0) (funcall func str nil t)) (if (equal m0 (match-beginning 0)) nil (setq nest (+ nest (if (match-beginning 1) -1 1))))) (if (< nest 0) (goto-char (match-beginning 0)) (funcall (if noerr 'message 'error) "Corresponding tag of `%s' not found." cmd) (goto-char p) nil)) (t nil)))) (defun yahtml-current-tag () "Return the current tag name including #exec and #include." (save-excursion (let ((p (point)) b tag) (or (bobp) (looking-at "<") (progn (skip-chars-backward "^<") (forward-char -1))) (setq b (point)) (skip-chars-forward "<") (setq tag (YaTeX-buffer-substring (point) (progn (skip-chars-forward "^ \t\n") (point)))) (goto-char b) (forward-list 1) (and (< p (point)) tag)))) (defun yahtml-get-attrvalue (attr) "Extract current tag's attribute value from buffer." (let (e (case-fold-search t)) (save-excursion (or (looking-at "<") (progn (skip-chars-backward "^<") (backward-char 1))) (setq e (save-excursion (forward-list 1) (point))) (if (and (re-search-forward (concat "\\b" attr "\\b") e t) (progn (skip-chars-forward " \t\n=") (looking-at "\"?\\([^\"> \t\n]+\\)\"?"))) (YaTeX-match-string 1))))) (defun yahtml-goto-corresponding-img () "View image on point" (let ((tag (yahtml-current-tag)) image (p (point)) (case-fold-search t)) (if (and tag (string-match "img" tag) (setq image (yahtml-unescape-string (yahtml-get-attrvalue "src")))) (progn (message "Invoking %s %s..." yahtml-image-viewer image) (start-process "Viewer" " * Image Viewer *" shell-file-name yahtml-shell-command-option ;"-c" (concat yahtml-image-viewer " " image)) (message "Invoking %s %s...Done" yahtml-image-viewer image))))) (defun yahtml-goto-corresponding-source (&optional other) "Goto applet's or script's source." (let ((env (yahtml-current-tag)) s (p (point))) (cond ((string-match "applet" env) (if (setq s (yahtml-unescape-string (yahtml-get-attrvalue "code"))) (progn (setq s (YaTeX-match-string 1) s (concat (substring s 0 (string-match "\\.[A-Za-z]+$" s)) ".java")) (if other (YaTeX-switch-to-buffer-other-window s) (YaTeX-switch-to-buffer s)) s) ;return source file name (message "No applet source specified") (sit-for 1) nil)) ((string-match "script" env) (if (setq s (yahtml-get-attrvalue "src")) (progn (funcall (if other 'YaTeX-switch-to-buffer-other-window 'YaTeX-switch-to-buffer) (yahtml-url-to-path s)) s))) ((string-match "!--#include" env) (cond ((setq s (yahtml-get-attrvalue "file")) ; (if other (YaTeX-switch-to-buffer-other-window s) (YaTeX-switch-to-buffer s)) s) ((setq s (yahtml-get-attrvalue "virtual")); (setq s (yahtml-url-to-path s)) (if other (YaTeX-switch-to-buffer-other-window s) (YaTeX-switch-to-buffer s)) s))) ((and (string-match "!--#exec" env) (setq s (yahtml-get-attrvalue "cmd"))) (setq s (substring s 0 (string-match " \t\\?" s))) ;get argv0 (let ((b " *yahtmltmp*")) ;peek a little (unwind-protect (progn (set-buffer (get-buffer-create b)) (YaTeX-insert-file-contents s nil 0 100) (if (looking-at "#!") (if other (YaTeX-switch-to-buffer-other-window s) (YaTeX-switch-to-buffer s)))) (kill-buffer (get-buffer b))) (get-file-buffer s)))))) (defun yahtml-goto-corresponding-* (&optional other) "Go to corresponding object." (interactive "P") (cond ((yahtml-goto-corresponding-href other)) ((yahtml-goto-corresponding-img)) ((yahtml-goto-corresponding-source other)) ((yahtml-goto-corresponding-begend)) (t (message "I don't know where to go.")))) (defun yahtml-goto-corresponding-*-other-window () "Go to corresponding object." (interactive) (yahtml-goto-corresponding-* t)) (defun yahtml-visit-main () "Go to parent file from where you visit current file." (interactive) (if YaTeX-parent-file (YaTeX-switch-to-buffer YaTeX-parent-file))) ;;; ---------- killing ---------- (defun yahtml-kill-begend (&optional whole) (let ((tag (yahtml-on-begend-p)) p q r bbolp) (if tag (save-excursion (or (looking-at "<") (progn (skip-chars-backward "^<") (forward-char -1))) (setq p (point)) (yahtml-goto-corresponding-begend) (or (looking-at "<") (progn (skip-chars-backward "^<") (forward-char -1))) (if (< (point) p) ;if on the opening tag (progn (setq q p p (point)) (goto-char q)) (setq q (point))) ;now q has end-line's (point) (if (not whole) (kill-region (progn (skip-chars-backward " \t") (if (setq bbolp (bolp)) (point) q)) (progn (forward-list 1) (setq r (point)) (skip-chars-forward " \t") (if (and bbolp (eolp) (not (eobp))) (1+ (point)) r)))) (goto-char p) (skip-chars-backward " \t") (if (not whole) (progn (kill-append (buffer-substring (setq p (if (setq bbolp (bolp)) (point) p)) (setq q (progn (forward-list 1) (setq r (point)) (skip-chars-forward " \t") (if (and bbolp (eolp) (not (eobp))) (1+ (point)) r)))) t) (delete-region p q)) (kill-region (if (bolp) (point) p) (progn (goto-char q) (forward-list 1) (setq r (point)) (skip-chars-forward " \t") (if (and (eolp) (not (eobp))) (1+ (point)) r)))) tag)))) (defun yahtml-kill-* (whole) "Kill current position's HTML tag (set)." (interactive "P") (cond ((yahtml-kill-begend whole)))) ;;; ---------- changing ---------- (defun yahtml-on-assignment-p () "Return if current point is on parameter assignment. If so, return parameter name, otherwise nil. This function should be able to treat white spaces in value, but not yet." (let ((p (point))) (save-excursion (put 'yahtml-on-assignment-p 'region nil) (skip-chars-backward "^ \t\n") (and (looking-at "\\([A-Za-z0-9]+\\)\\s *=\\s *\"?\\([^ \t\"]+\\)\"?") (< p (match-end 0)) (>= p (1- (match-beginning 2))) (put 'yahtml-on-assignment-p 'region (cons (match-beginning 2) (match-end 2))) (YaTeX-match-string 1))))) (defun yahtml-change-begend () (let ((tag (yahtml-on-begend-p)) (completion-ignore-case t) (case-fold-search t) (p (point)) (q (make-marker)) (default (append yahtml-env-table yahtml-typeface-table)) (user (append yahtml-user-env-table yahtml-user-typeface-table)) (tmp (append yahtml-tmp-env-table yahtml-tmp-typeface-table)) href b1 e1 attr new css) (cond (tag (cond ((and (string-match "^a$" tag) (save-excursion (and (re-search-backward "" nil t)) (setq e1 (match-beginning 0)) (goto-char b1) (re-search-forward "href\\s *=" e1 t) (>= p (point)) (progn (goto-char (match-end 0)) (skip-chars-forward " \t\n") (looking-at "\"?\\([^\"> \t\n]+\\)\"?")) (< p (match-end 0))))) (setq b1 (match-beginning 1) e1 (match-end 1) yahtml-completing-buffer (current-buffer) ;; yahtml-urls-local is buffer-local, so we must put ;; that into yahtml-urls here yahtml-urls (append yahtml-urls-private yahtml-urls-local) href (read-from-minibuffer "Change href to: " "" yahtml-url-completion-map)) (if (string< "" href) (progn ;;(setq href ;?? ;; (if yahtml-prefer-upcases (upcase href) (downcase href))) (delete-region b1 e1) (goto-char b1) (insert href)))) ((setq attr (yahtml-on-assignment-p)) ;if on the assignment to attr (if (and (equal attr "class") ;treat "class" attribute specially (setq css (yahtml-css-get-element-completion-alist tag))) (setq new (yahtml-read-css css tag)) ;;other than "class", read parameter normally (setq new (yahtml-read-parameter attr))) (goto-char (car (get 'yahtml-on-assignment-p 'region))) (delete-region (point) (cdr (get 'yahtml-on-assignment-p 'region))) (insert new)) (t (save-excursion (if (= (aref tag 0) ?/) (setq tag (substring tag 1))) (or (= (char-after (point)) ?<) (skip-chars-backward "^<")) (skip-chars-forward "^A-Za-z") (set-marker q (point)) (setq p (point)) (yahtml-goto-corresponding-begend) (or (= (char-after (point)) ?<) (skip-chars-backward "^<")) (skip-chars-forward "^A-Za-z") (if (= (char-after (1- (point))) ?/) (progn (set-marker q (point)) (goto-char p))) (setq tag (let ((completion-ignore-case t)) (YaTeX-cplread-with-learning (format "Change `%s' to(default %s): " tag yahtml-last-begend) 'default 'user 'tmp))) (delete-region (point) (progn (skip-chars-forward "^>") (point))) (if (string= "" tag) (setq tag yahtml-last-begend)) (setq yahtml-last-begend (or (cdr (assoc tag yahtml-env-table)) tag) tag yahtml-last-begend) (setq tag (if yahtml-prefer-upcases (upcase tag) (downcase tag))) (insert (format "%s%s" tag (yahtml-addin tag))) (goto-char q) (set-marker q nil) (delete-region (point) (progn (skip-chars-forward "^>") (point))) (insert tag)))) t)))) (defun yahtml-change-command () (let ((p (point)) (case-fold-search t) cmd par new (beg (make-marker)) (end (make-marker))) (skip-chars-backward "^<") (if (and (looking-at yahtml-command-regexp) (progn (set-marker beg (match-beginning 0)) (set-marker end (match-end 0)) t) ;for further work (progn (forward-char -1) (condition-case nil (forward-list 1) (error nil)) (< p (point)))) (progn (goto-char p) (if (setq par (yahtml-on-assignment-p)) (progn (setq new (yahtml-read-parameter par)) (set-marker beg (car (get 'yahtml-on-assignment-p 'region))) (set-marker end (cdr (get 'yahtml-on-assignment-p 'region)))) (setq new (YaTeX-cplread-with-learning "Change form to: " 'yahtml-form-table 'yahtml-user-form-table 'yahtml-tmp-form-table))) (delete-region beg end) (goto-char beg) (set-marker beg nil) (set-marker end nil) (insert new) t) (goto-char p) nil))) (defun yahtml-change-* () "Change current position's HTML tag (set)." (interactive) (cond ((yahtml-change-begend)) ((yahtml-change-command)))) ;;; ---------- commenting ---------- (defun yahtml-comment-region (&optional uncom) "Comment out region or environment." (interactive) (let ((e (make-marker)) be beg p) (cond (;(marker-position (set-marker e (yahtml-on-begend-p))) (setq be (yahtml-on-begend-p)) (save-excursion (setq p (point)) (if (string-match "^/" be) (setq beg (progn (forward-line 1) (point))) (setq beg (progn (beginning-of-line) (point)))) (goto-char p) (yahtml-goto-corresponding-begend) (if (string-match "^/" be) (beginning-of-line) (forward-line 1)) (set-marker e (point)) ;(comment-region beg (point) (if uncom (list 4))))) )) (t ;(comment-region (region-beginning) (region-end) (if uncom (list 4))) (setq beg (region-beginning)) (set-marker e (region-end)))) (if yahtml-translate-hyphens-when-comment-region (let ((yahtml-entity-reference-chars-alist-default nil) (yahtml-entity-reference-chars-alist '((?- . "#45"))) yahtml-entity-reference-chars-regexp yahtml-entity-reference-chars-reverse-regexp) (yahtml-entity-reference-chars-setup) (funcall (if uncom 'yahtml-translate-reverse-region 'yahtml-translate-region) beg e))) (comment-region beg e (if uncom (list 4))) (set-marker e nil))) (defun yahtml-uncomment-region () (interactive) (yahtml-comment-region t)) ;;; ---------- translate to entity references ---------- (defvar yahtml-entity-reference-chars-alist-default ;'((?> . "gt") (?< . "lt") (?& . "amp") (?\" . "quot") (?' . "apos")) '((?> . "gt") (?< . "lt") (?& . "amp") (?\" . "quot")) "Default translation table from character to entity reference") (defvar yahtml-entity-reference-chars-alist nil "*Translation table from character to entity reference") (defvar yahtml-entity-reference-chars-regexp nil) (defvar yahtml-entity-reference-chars-reverse-regexp nil) (defun yahtml-entity-reference-chars-setup () (let ((list (append yahtml-entity-reference-chars-alist-default yahtml-entity-reference-chars-alist))) (setq yahtml-entity-reference-chars-regexp "[" yahtml-entity-reference-chars-reverse-regexp "&\\(") (while list (setq yahtml-entity-reference-chars-regexp (concat yahtml-entity-reference-chars-regexp (char-to-string (car (car list)))) yahtml-entity-reference-chars-reverse-regexp (concat yahtml-entity-reference-chars-reverse-regexp (cdr (car list)) (if (cdr list) "\\|"))) (setq list (cdr list))) (setq yahtml-entity-reference-chars-regexp (concat yahtml-entity-reference-chars-regexp "]") yahtml-entity-reference-chars-reverse-regexp (concat yahtml-entity-reference-chars-reverse-regexp "\\);")))) (yahtml-entity-reference-chars-setup) (defun yahtml-translate-region (beg end) "Translate inhibited literals." (interactive "r") (save-excursion (save-restriction (narrow-to-region beg end) (let ((ct (append yahtml-entity-reference-chars-alist yahtml-entity-reference-chars-alist-default))) (goto-char beg) (while (re-search-forward yahtml-entity-reference-chars-regexp nil t) ;(setq c (preceding-char)) (replace-match (concat "&" (cdr (assoc (preceding-char) ct)) ";"))))))) (defun yahtml-translate-reverse-region (beg end) "Translate entity references to literals." (interactive "r") (save-excursion (save-restriction (narrow-to-region beg end) (let ((ct (append yahtml-entity-reference-chars-alist yahtml-entity-reference-chars-alist-default)) ec) (goto-char beg) (while (re-search-forward yahtml-entity-reference-chars-reverse-regexp nil t) ;(setq c (preceding-char)) (setq ec (YaTeX-match-string 1)) (delete-region (match-end 0) (match-beginning 0)) (insert (car (YaTeX-rassoc ec ct)))))))) (defun yahtml-inner-environment-but (exclude &optional quick) "Return the inner environment but matches with EXCLUDE tag." (let (e (case-fold-search t)) (save-excursion (while (and (setq e (YaTeX-inner-environment quick)) (string-match exclude e)) (goto-char (get 'YaTeX-inner-environment 'point)))) e)) (defun yahtml-untranslate-string (str) "Untranslate entity reference." (let ((md (match-data)) (left "") (right str) b0 ch (ct (append yahtml-entity-reference-chars-alist yahtml-entity-reference-chars-alist-default)) (revrex yahtml-entity-reference-chars-reverse-regexp)) (unwind-protect (progn (while (string< "" right) (cond ((string-match revrex right) (setq ch (YaTeX-rassoc (substring right (match-beginning 1) (match-end 1))) b0 (substring right 0 (match-beginning 0)) right (substring right (match-end 0)) left (concat left (substring right 0 (match-beginning 0)) (char-to-string ch)))) ((string-match "\\&#\\(x\\)?\\([0-9a-f]+\\);" right) (setq ch (substring right (match-beginning 2) (match-end 2)) b0 (substring right 0 (match-beginning 0)) right (substring right (match-end 0)) left (concat left b0 (char-to-string (if (match-beginning 1) (YaTeX-hex ch) (string-to-number ch)))))) (t (setq left (concat left right) right "")))) left) (store-match-data md)))) ;;; ---------- table-ize region ---------- (defun yahtml-td-region (e delim beg end) "Enclose each item in a region with ... Interactive prefix argument consults enclosing element other than td." (interactive "P\nsDelimiter(s): \nr") (let ((e (cond ((null e) "td") ((stringp e) e) (t (read-string-with-history "Enclose with(`thd' means th td td..): " "th")))) (ws "[ \t]") elm p i) (if (string= delim "") (setq delim " \t\n")) (setq delim (concat "[" delim "]+") elm (if (string= "thd" e) (cons "th" "td") (cons e e))) (save-excursion (save-restriction (narrow-to-region beg end) (goto-char (setq p (point-min))) (setq i 0 e (car elm)) (while (re-search-forward delim nil t) (setq e (if (= (setq i (1+ i)) 1) (car elm) (cdr elm))) (goto-char (match-beginning 0)) (insert "") (save-excursion (goto-char p) (insert "<" e ">")) (setq p (point)) (while (and (not (eobp)) (looking-at ws)) (delete-char 1)) (if (looking-at delim) (delete-char 1))) (insert "<" e ">") (goto-char (point-max)) (insert ""))))) (defun yahtml-tr-region (e delim beg end) "Enclose lines in a form tab-sv/csv with ..." (interactive "P\nsDelimiter(s): \nr") (setq e (if (and e (listp e)) (read-string-with-history "Enclose with(td or th, `thd' -> th td td td...: " "th"))) (save-excursion (save-restriction (narrow-to-region (point) (mark)) (goto-char (point-min)) (while (not (eobp)) (insert "") (yahtml-td-region e delim (point) (point-end-of-line)) (end-of-line) (insert "") (forward-line 1))))) ;;; ---------- filling ---------- (defvar yahtml-saved-move-to-column (symbol-function 'move-to-column)) (defun yahtml-move-to-column (col &optional force) (beginning-of-line) (let ((ccol 0)) (while (and (> col ccol) (not (eolp))) (if (eq (following-char) ?\<) (progn (while (and (not (eq (following-char) ?\>)) (not (eolp))) (forward-char)) (or (eolp) (forward-char))) (or (eolp) (forward-char)) (if (eq (preceding-char) ?\t) (let ((wd (- 8 (% (+ ccol 8) 8)))) (if (and force (< col (+ ccol wd))) (progn (backward-char 1) (insert-char ?\ (- col ccol)) (setq ccol col)) (setq ccol (+ ccol wd)))) (setq ccol (1+ ccol))) (if (and YaTeX-japan (or (and (fboundp 'char-category) (string-match "[chj]" (char-category (preceding-char)))) (and (fboundp 'char-charset) (not (eq (char-charset (preceding-char)) 'ascii))))) (setq ccol (1+ ccol))))) (if (and force (> col ccol)) (progn (insert-char ?\ (- col ccol)) col) ccol))) (defun yahtml-fill-paragraph (arg) (interactive "P") (let*((case-fold-search t) (p (point)) fill-prefix (e (or (yahtml-inner-environment-but "^\\(a\\|p\\)\\b" t) "html")) indent (startp (get 'YaTeX-inner-environment 'point)) (prep (string-match "^pre$" e)) (ps1 (if prep (default-value 'paragraph-start) paragraph-start)) (ps2 (if prep (concat (default-value 'paragraph-start) "$\\|^\\s *") paragraph-start))) (save-excursion (unwind-protect (progn (if prep (fset 'move-to-column 'yahtml-move-to-column)) (save-excursion (beginning-of-line) (indent-to-column (yahtml-this-indent)) (setq fill-prefix (buffer-substring (point) (point-beginning-of-line))) (delete-region (point) (point-beginning-of-line))) (fill-region-as-paragraph (progn (re-search-backward paragraph-start nil t) (or (save-excursion (goto-char (match-beginning 0)) (if (looking-at "<") (forward-list) (goto-char (match-end 0)) (skip-chars-forward " \t>")) (if (looking-at "[ \t]*$") (progn (forward-line 1) (point)))) (point))) (progn (goto-char p) (re-search-forward ps2 nil t) (match-beginning 0)))) (fset 'move-to-column yahtml-saved-move-to-column))))) ;;; ;;; ---------- move forward/backward field ---------- ;;; (defun yahtml-element-path () "Return the element path from at point as a list" (let (path elm) (save-excursion (while (and (YaTeX-beginning-of-environment) (looking-at (concat "<\\(" yahtml-command-regexp "\\)\\>")) (not (string= (setq elm (downcase (YaTeX-match-string 1))) "body"))) (setq path (cons elm path) elm nil)) (and elm (setq path (cons elm path))) path))) (defun yahtml-forward-field (arg) "Move ARGth forward cell to table element. ENVINFO is a cons of target element name and its beginning point." (interactive "p") (let (inenv elm path sibs) (cond ((< arg 0) (yahtml-backward-field (- arg))) ((= arg 0) nil) ((and (setq path (nreverse (yahtml-element-path))) (catch 'sibling (while path (if (setq elm (car-safe (member (car path) '("td" "th" "li" "dt" "dd")))) (throw 'sibling elm)) (setq path (cdr path))))) (setq inenv (YaTeX-in-environment-p elm) sibs (cdr (assoc elm '(("td" . "td\\|th") ("th" . "td\\|th") ("li" . "li") ("dt" . "dt\\|dd") ("dd" . "dt\\|dd"))))) (goto-char (cdr inenv)) (while (>= (setq arg (1- arg)) 0) (yahtml-goto-corresponding-begend) (if (looking-at "<") (forward-list 1)) (skip-chars-forward "^<")) (while (looking-at "\\s \\|\\(")) (forward-list 1)) )))) ;;; ;;; ---------- indentation ---------- ;;; (defun yahtml-indent-line-1 () "Indent a line (faster wrapper)" (interactive) (let (indent) (if (and (save-excursion (beginning-of-line) (skip-chars-forward "\t ") (not (looking-at "<"))) (save-excursion (forward-line -1) (while (and (not (bobp)) (looking-at "^\\s *$")) (forward-line -1)) (skip-chars-forward "\t ") (setq indent (current-column)) (not (looking-at "<")))) (progn (save-excursion (beginning-of-line) (skip-chars-forward " \t") (or (= (current-column) indent) (YaTeX-reindent indent))) (and (bolp) (skip-chars-forward " \t"))) (yahtml-indent-line-real)))) (defun yahtml-indent-line () "Indent a line (Second level wrapper). See also yahtml-indent-line-1 and yahtml-indent-line-real." (interactive) (let ((cc (current-column)) (p (point))) (yahtml-indent-line-1) (and (= cc (current-column)) (= p (point)) (equal last-command 'yahtml-indent-line) (yahtml-forward-field 1)))) (defun yahtml-this-indent () (let ((envs "[uod]l\\|table\\|[ht][rhd0-6]\\|select\\|blockquote\\|center\\|menu\\|dir\\|d[td]\\|li") (itemizing-envs "^\\([uod]l\\|menu\\|dir\\|li\\|d[td]\\)$") (itms "<\\(dt\\|dd\\|li\\|t[rdh]\\|option\\)\\b") (excludes "\\b\\(a\\|p\\|span\\|code\\|tt\\|em\\|u\\|i\\|big\\|small\\|font\\)\\b") inenv p col peol (case-fold-search t)) (save-excursion (beginning-of-line) (setq inenv (or (yahtml-inner-environment-but excludes t) "html") col (get 'YaTeX-inner-environment 'indent) p (get 'YaTeX-inner-environment 'point) op nil)) (save-excursion (cond ((string-match (concat "^\\(" envs "\\)") inenv) (save-excursion (beginning-of-line) (skip-chars-forward " \t") (cond ;lookup current line's tag ((looking-at (concat "")) col) ((looking-at itms) (+ col yahtml-environment-indent)) ((and yahtml-hate-too-deep-indentation (looking-at (concat "<\\(" envs "\\)"))) (+ col (* 2 yahtml-environment-indent))) ((and (< p (point)) (string-match itemizing-envs inenv) (save-excursion (and (setq op (point)) (goto-char p) (re-search-forward itms op t) (progn (if yahtml-indent-listing-constant (setq col (+ (current-column) (if yahtml-faithful-to-htmllint 1 2))) (skip-chars-forward "^>") (skip-chars-forward ">") (skip-chars-forward " \t") (setq col (if (looking-at "$") (+ col yahtml-environment-indent) (current-column)))))))) col) (t (+ col yahtml-environment-indent))))) (t col))))) (defun yahtml-indent-line-real () "Indent current line." (interactive) (YaTeX-reindent (yahtml-this-indent)) (if (bolp) (skip-chars-forward " \t")) (let (peol col inenv) (if (and (setq inenv (yahtml-on-begend-p)) (string-match (concat "^\\<\\(" yahtml-struct-name-regexp "\\)") inenv)) (save-excursion (setq peol (point-end-of-line)) (or (= (char-after (point)) ?<) (progn (skip-chars-backward "^<") (forward-char -1))) (setq col (current-column)) (if (and (yahtml-goto-corresponding-begend t) (> (point) peol)) ;if on the different line (YaTeX-reindent col)))))) ;(defun yahtml-fill-item () ; "Fill item HTML version" ; (interactive) ; (let (inenv p fill-prefix peol (case-fold-search t)) ; (setq inenv (or (YaTeX-inner-environment) "html") ; p (get 'YaTeX-inner-environment 'point)) ; (cond ; ((string-match "^[uod]l" inenv) ; (save-excursion ; (if (re-search-backward "<\\(d[td]\\|li\\)>[ \t\n]*" p t) ; (progn ; (goto-char (match-end 0)) ; (setq col (current-column))) ; (error "No
    1. ,
      ,
      "))) ; (save-excursion ; (end-of-line) ; (setq peol (point)) ; (newline) ; (indent-to-column col) ; (setq fill-prefix (buffer-substring (point) (1+ peol))) ; (delete-region (point) peol) ; (fill-region-as-paragraph ; (progn (re-search-backward paragraph-start nil t) (point)) ; (progn (re-search-forward paragraph-start nil t 2) ; (match-beginning 0))))) ; (t nil)))) ;;; ;;; ---------- Lint and Browsing ---------- ;;; (defun yahtml-browse-menu () "Browsing or other external process invokation menu." (interactive) (message "J)weblint p)Browse R)eload N)ewpage...") (let ((c (char-to-string (read-char)))) (cond ((string-match "j" c) (yahtml-lint-buffer (current-buffer))) ((string-match "[bp]" c) (yahtml-browse-current-file)) ((string-match "r" c) (yahtml-browse-reload)) ((string-match "n" c) (call-interactively 'yahtml-newpage))))) (if (fboundp 'wrap-function-to-control-ime) (wrap-function-to-control-ime 'yahtml-browse-menu t nil)) (defvar yahtml-lint-buffer "*weblint*") (defun yahtml-lint-buffer (buf) "Call lint on buffer BUF." (require 'yatexprc) (interactive "bCall lint on buffer: ") (setq buf (get-buffer buf)) (YaTeX-save-buffers) (let ((bcmd (YaTeX-get-builtin "lint"))) (and bcmd (setq bcmd (yahtml-untranslate-string bcmd))) (YaTeX-typeset (concat (or bcmd yahtml-lint-program) " " (file-name-nondirectory (buffer-file-name buf))) yahtml-lint-buffer "lint" "lint"))) (defun yahtml-file-to-url (file) "Convert local unix file name to URL. If no matches found in yahtml-path-url-alist, return raw file name." (let ((list yahtml-path-url-alist) p url) (if (file-directory-p file) (setq file (expand-file-name yahtml-directory-index file)) (setq file (expand-file-name file))) (if (string-match "^[A-Za-z]:/" file) (progn ;; (aset file 1 ?|) ;これは要らないらしい… (setq file (concat "///" file)))) (while list (if (string-match (concat "^" (regexp-quote (car (car list)))) file) (setq url (cdr (car list)) file (substring file (match-end 0)) url (concat url file) list nil)) (setq list (cdr list))) (or url (concat "file:" file)))) (defun yahtml-url-to-path (file &optional basedir) "Convert local URL name to unix file name." (let ((list yahtml-path-url-alist) url realpath docroot (dirsufp (string-match "/$" file))) (setq basedir (or basedir (file-name-directory (expand-file-name default-directory)))) (cond ((string-match "^/" file) (while list (if (file-directory-p (car (car list))) (progn (setq url (cdr (car list))) (if (string-match "\\(https?://[^/]*\\)/" url) (setq docroot (substring url (match-end 1))) (setq docroot url)) (cond ((string-match (concat "^" (regexp-quote docroot)) file) (setq realpath (expand-file-name (substring file (if (= (aref file (1- (match-end 0))) ?/) (match-end 0) ; "/foo" (min (1+ (match-end 0)) (length file)))) ; "/~foo" (car (car list)))))) (if realpath (progn (setq list nil) (if (and dirsufp (not (string-match "/$" realpath))) (setq realpath (concat realpath "/"))))))) (setq list (cdr list))) realpath) (t file)))) (defun yahtml-browse-current-file () "Call WWW browser on current file." (interactive) (basic-save-buffer) (yahtml-browse-html (yahtml-file-to-url (buffer-file-name)))) (defun yahtml-browse-reload () "Send `reload' event to netscape." (let ((pb "* WWW Browser *") (cb (current-buffer))) (cond ((string-match "[Nn]etscape" yahtml-www-browser) (if (get-buffer pb) (progn (set-buffer pb) (erase-buffer) (set-buffer cb))) ;;(or (get 'yahtml-netscape-sentinel 'url) ;; (error "Reload should be called after Browsing.")) (put 'yahtml-netscape-sentinel 'url (yahtml-file-to-url (buffer-file-name))) (basic-save-buffer) (set-process-sentinel (setq yahtml-browser-process (start-process "browser" pb shell-file-name yahtml-shell-command-option ;"-c" (format "%s -remote 'reload'" yahtml-www-browser))) 'yahtml-netscape-sentinel)) (t (message "Sorry, RELOAD is supported only for Netscape."))))) ;;; ---------- Intelligent newline ---------- (defun yahtml-intelligent-newline (arg) "Intelligent newline for HTML" (interactive "P") (let (env func) (end-of-line) (setq env (downcase (or (yahtml-inner-environment-but "^\\(a\\|p\\)\\b" t) "html"))) (setq func (intern-soft (concat "yahtml-intelligent-newline-" env))) (newline) (if (and env func (fboundp func)) ;; if intelligent line function is defined, call that (funcall func) ;; else do the default action (if (string-match yahtml-p-prefered-env-regexp env) (yahtml-insert-p))))) (defun yahtml-intelligent-newline-ul () (interactive) (yahtml-insert-single "li") (or yahtml-always-/li yahtml-faithful-to-htmllint (insert " ")) (yahtml-indent-line)) (fset 'yahtml-intelligent-newline-ol 'yahtml-intelligent-newline-ul) (defun yahtml-intelligent-newline-datalist () (interactive) (yahtml-insert-form "option") (save-excursion (yahtml-insert-form "/option"))) (defun yahtml-intelligent-newline-dl () (interactive) (let ((case-fold-search t)) (if (save-excursion (re-search-backward "<\\(\\(dt\\)\\|\\(dd\\)\\)[ \t>]" (get 'YaTeX-inner-environment 'point) t)) (cond ((match-beginning 2) (yahtml-insert-single "dd") (or yahtml-always-/dd yahtml-faithful-to-htmllint (insert " ")) (setq yahtml-last-single-cmd "dt")) ((match-beginning 3) (yahtml-insert-single "dt") (or yahtml-always-/dt yahtml-faithful-to-htmllint (insert " ")) (setq yahtml-last-single-cmd "dd"))) (yahtml-insert-single "dt") (or yahtml-always-/li yahtml-faithful-to-htmllint (insert " ")) (setq yahtml-last-single-cmd "dd")) (yahtml-indent-line) (and (string-match yahtml-p-prefered-env-regexp "dl") (string-equal yahtml-last-single-cmd "dt") (yahtml-insert-p nil)))) (defun yahtml-intelligent-newline-select () (interactive) (yahtml-insert-single (if yahtml-prefer-upcases "OPTION" "option")) (yahtml-indent-line)) (defun yahtml-intelligent-newline-style () (interactive) (if (save-excursion (and (re-search-backward "") (beginning-of-line) (open-line 1) (YaTeX-reindent c)))) (defun yahtml-intelligent-newline-head () (let ((title (read-string-with-history "Document title: ")) (b "") (e "") p) (yahtml-indent-line) (insert (format "%s" (if yahtml-prefer-upcases (upcase b) b))) (setq p (point)) (insert (format "%s%s" title (if yahtml-prefer-upcases (upcase e) e))) (if (string= "" title) (goto-char p)) (setq yahtml-last-begend "body"))) (defun yahtml-intelligent-newline-script () (let ((p (point)) b) (if (save-excursion (and (setq b (re-search-backward "" nil t)) (re-search-forward "\\(javascript\\)\\|\\(tcl\\)\\|\\(vbscript\\)" p t))) (let ((js (match-end 1)) (tcl (match-end 2)) (vb (match-end 3)) c (srcp (re-search-backward "src=" b t))) (goto-char p) (yahtml-indent-line) (setq c (current-column)) (if srcp nil (insert "") (beginning-of-line) (open-line 1) (YaTeX-reindent c)))))) (defun yahtml-intelligent-newline-table () (let ((cp (point)) (p (point)) tb rb (cols 0) th line (i 0) fmt (ptn "\\(\\)\\|")) (cond ((save-excursion (setq tb (YaTeX-beginning-of-environment "table"))) (while (and (setq rb (re-search-backward ptn tb t)) (match-beginning 1)) (setq th (looking-at " cols 0) (message "%s columns found. %s" cols (if YaTeX-japan "新しいtr(N)? 前のtrの複写?(D)?: " "New tr?(N) or Duplicate"))) (cond ((and (> cols 0) (memq (read-char) '(?d ?D))) ;Duplication mode (setq line (YaTeX-buffer-substring (point) (1- cp)))) (t ;empty cells (setq line "" i 0) (if (> cols 0) (while (> cols i) (setq line (concat line (if (and (= i 0) th) "" "")) th nil i (1+ i))) (setq fmt (read-string-with-history "`th' or `td' format: " "th td td")) (while (string-match "t\\(h\\)\\|td" fmt i) (setq line (concat line (if (match-beginning 1) "" "")) i (match-end 0)))) (setq line (concat line "")))) (goto-char cp) (if th (message "Type `%s' to change td from/to th." (key-description (car (where-is-internal 'yahtml-change-*))))) (if (string< "" line) (progn (insert line) (goto-char (+ 8 cp)) (yahtml-indent-line))))))) (defun yahtml-intelligent-newline-audio () (let (b e) (if (save-excursion (goto-char (setq b (get 'YaTeX-inner-environment 'point))) (forward-list 1) (setq e (point)) (catch 'src (while (re-search-forward "\\s src\\>" e t) (skip-chars-forward " \t\n") (and (looking-at "=") (throw 'src t))))) ;; if src= attribute found, do nothing (setq yahtml-last-begend "p") (yahtml-insert-single "source") ))) (fset 'yahtml-intelligent-newline-video 'yahtml-intelligent-newline-audio) (defun yahtml-intelligent-newline-iframe () (insert "

      Your browser does not support iframes.

      ")) ;;; ---------- Marking ---------- (defun yahtml-mark-begend () "Mark current tag" (interactive) (YaTeX-beginning-of-environment) (let ((p (point))) (save-excursion (skip-chars-backward " \t" (point-beginning-of-line)) (if (bolp) (setq p (point)))) (push-mark p t)) (yahtml-goto-corresponding-begend) (forward-list 1) (if (eolp) (forward-char 1))) ;;; ---------- complete marks ---------- (defun yahtml-char-entity-ref () "Complete >, <, &, and "." (interactive) (message "1:< 2:> 3:& 4:\" 5:' 6:nbsp") (let ((c (read-char)) d) (setq d (if (or (< c ?0) (> c ?7)) (string-match (regexp-quote (char-to-string c)) "<>&\"' ") (- c ?1))) (cond ((null d) (insert (format "&#x%x;" c))) ((and (>= d 0) (<= d 6)) (insert (format "&%s;" (nth d '("lt" "gt" "amp" "quot" "apos" "nbsp")))))))) ;;; ---------- jump to error line ---------- (defun yahtml-prev-error () "Jump to previous error seeing lint buffer." (interactive) (or (get-buffer yahtml-lint-buffer) (error "No lint program ran.")) (YaTeX-showup-buffer yahtml-lint-buffer nil t) (yahtml-jump-to-error-line t)) (defun yahtml-jump-to-error-line (&optional sit) (interactive "P") (let ((p (point)) (e (point-end-of-line))) (end-of-line) (if (re-search-backward yahtml-error-line-regexp nil t) (let ((f (if (string= "" (YaTeX-match-string 1)) YaTeX-current-file-name (YaTeX-match-string 1))) (l (YaTeX-str2int (or (YaTeX-match-string 2) (YaTeX-match-string 3))))) (if sit (sit-for 1)) (forward-line -1) (YaTeX-showup-buffer (YaTeX-switch-to-buffer f t) nil t) (goto-line l)) (message "No line number usage")))) ;;; ---------- Style Sheet Support ---------- (defvar yahtml-css-class-alist nil "Alist of elements vs. their classes") (defun yahtml-css-collect-classes-region (beg end &optional initial) (save-excursion (save-restriction (narrow-to-region beg end) (goto-char (point-min)) (let ((alist initial) b e element class a) (setq b (point)) (while (re-search-forward "\\({\\)\\|\\(@import\\)" nil t) (if (match-beginning 2) (let ((f (YaTeX-buffer-substring (progn (skip-chars-forward "^\"")(1+ (point))) (progn (forward-char 1) (skip-chars-forward "^\"")(point))))) (if (file-exists-p f) (setq alist (append alist (yahtml-css-collect-classes-file f initial))))) (setq e (point)) (goto-char b) (while (re-search-forward ;ちょといい加減なREGEXP "\\([a-z*][-a-z0-9]*\\)?\\.\\([-a-z0-9][-a-z0-9]*\\)\\>" e t) (setq element (YaTeX-match-string 1) class (YaTeX-match-string 2)) ;;if starts with period (match-string 1 is nil), ;;this is global class (setq element (downcase (or element "*"))) (if (setq a (assoc element alist)) (or (assoc class (cdr a)) (setcdr a (cons (list class) (cdr a)))) (setq alist (cons (list element (list class)) alist)))) (goto-char (1- e)) (search-forward "}" nil 1) ;1=move to limit when not found. (setq b (point)))) alist)))) (defun yahtml-css-collect-classes-buffer (&optional initial) (interactive) (yahtml-css-collect-classes-region (point-min) (point-max) initial)) (defun yahtml-css-collect-classes-file (file &optional initial) (let*((hilit-auto-highlight nil) (buf (get-buffer-create (format " *css-collection*%s" (file-name-nondirectory file)))) (cb (current-buffer))) (unwind-protect (progn (set-buffer buf) (insert-file-contents file) (cd (or (file-name-directory file) ".")) (yahtml-css-collect-classes-buffer initial)) (if (eq buf cb) nil (kill-buffer buf) (set-buffer cb))))) (defun yahtml-css-scan-styles () (save-excursion (goto-char (point-min)) (set (make-local-variable 'yahtml-css-class-alist) nil) (let (b tag type e href alist) (while (re-search-forward "<\\(style\\|link\\)" nil t) (setq b (match-beginning 0) tag (YaTeX-match-string 1)) (cond ((string-match "style" tag) (goto-char b) (save-excursion (forward-list 1) (setq e (point))) (cond ((search-forward "text/css" e 1) ;css definition starts (setq alist (yahtml-css-collect-classes-region (point) (progn (search-forward "") (point)) alist))))) ((and (string-match "link" tag) (stringp (setq type (yahtml-get-attrvalue "type"))) (string-match "text/css" type) (setq href (yahtml-get-attrvalue "href")) (file-exists-p (yahtml-url-to-path href))) (setq alist (yahtml-css-collect-classes-file (yahtml-url-to-path href) alist)))) (setq yahtml-css-class-alist alist))))) (defun yahtml-css-get-element-completion-alist (element) (let ((alist (cdr-safe (assoc (downcase element) yahtml-css-class-alist))) (global (cdr-safe (assoc "*" yahtml-css-class-alist)))) (and (or alist global) (append alist global)))) ;;; ---------- ---------- ;;; ;;hilit19 ;;; (defvar yahtml-default-face-table '( (form black/ivory white/hex-442233 italic) )) (defvar yahtml-hilit-patterns-alist '( 'case-fold ;; comments ("" comment) ;; include&exec ("" include) ;; string (hilit-string-find ?\\ string) (yahtml-hilit-region-tag "<\\(strong\\|b\\)\\>" bold) ("" 0 decl) ("<\\(di\\|dt\\|li\\|dd\\)>" 0 label) (yahtml-hilit-region-tag "<\\(em\\|i\\>\\)" italic) ;("" crossref) ;good for hilit19, but odd for font-lock.. (yahtml-hilit-region-tag "<\\(a\\)\\s +href" crossref) (yahtml-hilit-region-tag-itself "" decl) )) (defun yahtml-hilit-region-tag (tag) "Return list of start/end point of form." (if (re-search-forward tag nil t) (let ((m0 (match-beginning 0)) (e0 (match-end 0)) (elm (YaTeX-match-string 1))) (skip-chars-forward "^>") (prog1 (cons (1+ (point)) (progn (re-search-forward (concat "") nil t) (match-beginning 0))) (goto-char e0))))) (defun yahtml-hilit-region-tag-itself (ptn) "Return list of start/end point of itself." (if (re-search-forward ptn nil t) (let ((m0 (match-beginning 0)) (e0 (match-end 0))) (skip-chars-forward "^<>") (if (eq (char-after (point)) ?<) nil (prog1 (cons m0 (min (point-max) (1+ (point)))) (goto-char e0)))))) ;(setq hilit-patterns-alist (delq (assq 'yahtml-mode hilit-patterns-alist) hilit-patterns-alist)) (and yahtml-use-hilit19 (or (assq 'yahtml-mode hilit-patterns-alist) (setq hilit-patterns-alist (cons (cons 'yahtml-mode yahtml-hilit-patterns-alist) hilit-patterns-alist)))) ;;; ;; for font-lock ;;; ; <> ;(defvar yahtml-font-lock-keywords ; '( ; ;; comments ; ("" . font-lock-comment-face) ; ;; include&exec ; ("" ; 0 font-lock-include-face keep) ; ;; string ; ;(hilit-string-find ?\\ string) ; ;(yahtml-hilit-region-tag "\\(em\\|strong\\)" bold) ; ("" 0 font-lock-keyword-face) ; ("<\\(di\\|dt\\|li\\|dd\\)>" 0 font-lock-label-face) ; ("" (0 font-lock-crossref-face keep)) ; ;(yahtml-hilit-region-tag-itself "" decl) ; ("" (yahtml-fontify-to-tagend nil nil)) ; ) ; "*Defualt font-lock-keywords for yahtml-mode.") (defvar yahtml-font-lock-keywords (YaTeX-convert-pattern-hilit2fontlock yahtml-hilit-patterns-alist) "Default fontifying patterns for yahtml-mode") (defun yahtml-font-lock-set-default-keywords () (put 'yahtml-mode 'font-lock-defaults '(yahtml-font-lock-keywords nil t))) (if yahtml-use-font-lock (progn (if (and (boundp 'hilit-mode-enable-list) hilit-mode-enable-list) ;;for those who use both hilit19 and font-lock (if (eq (car hilit-mode-enable-list) 'not) (or (member 'yahtml-mode hilit-mode-enable-list) (nconc hilit-mode-enable-list (list 'yahtml-mode))) (setq hilit-mode-enable-list (delq 'yahtml-mode hilit-mode-enable-list)))) (yahtml-font-lock-set-default-keywords))) (defun yahtml-font-lock-recenter (&optional arg) (interactive "P") (font-lock-mode -1) ;is stupid, but sure. (font-lock-mode 1)) ;;; ;; Drag-n-Drop ;;; (defun yahtml-dnd-handler (uri action) "DnD handler for yahtml mode Convert image URI to img-src and others to a-href." (let*((file (dnd-get-local-file-name uri)) (path (if file (file-relative-name file) uri)) (case-fold-search t) (geom "")) (cond ((memq action '(copy link move private)) (cond ((string-match "\\.\\(jpe?g\\|png\\|gif\\|bmp\\|tiff?\\)$" path) (if file (setq geom (yahtml-get-image-info path) geom (if (car geom) (apply 'format " width=\"%s\" height=\"%s\"" geom) ""))) (insert (format "\"%s\"%s" path (file-name-nondirectory path) geom))) (t (insert (format "" path)) (forward-char -4)))) (t (message "No handler for action `%s'" action)))) action) (run-hooks 'yahtml-load-hook) (provide 'yahtml) ; Local variables: ; fill-prefix: ";;; " ; paragraph-start: "^$\\| \\|;;;$" ; paragraph-separate: "^$\\| \\|;;;$" ; End: yatex1.81/yatex.el010064400037440000000000003563721341014455700132440ustar yuujiwheel;;; yatex.el --- Yet Another tex-mode for emacs //野鳥// -*- coding: sjis -*- ;;; (c)1991-2018 by HIROSE Yuuji.[yuuji@yatex.org] ;;; Last modified Mon Dec 24 20:55:33 2018 on firestorm ;;; $Id: yatex.el,v fbb636ff0fe3 2018-12-24 20:56 +0900 yuuji $ ;;; The latest version of this software is always available at; ;;; https://www.yatex.org/ ;;; This program is distributed as a free software. You can ;;; use/copy/modify/redistribute this software freely but with NO ;;; warranty to anything as a result of using this software. Adopting ;;; code from this program is also free. But I would not do contract ;;; act. ;;; ;;; This software can be treated with: ``The 2-Clause BSD License'' ;;; (since 2017-09-09, yatex 1.80). ;;; Code: (require 'yatexlib) (defconst YaTeX-revision-number "1.81" "Revision number of running yatex.el") ;---------- Local variables ---------- (defvar YaTeX-prefix "\C-c" "*Prefix key to call YaTeX functions. You can select favorite prefix key by setq in your ~/.emacs.") (defvar YaTeX-environment-indent 1 "*Indentation depth at column width in LaTeX environments.") (defvar YaTeX-fill-prefix nil "*fill-prefix used for auto-fill-mode. The default value is nil.") (defvar YaTeX-fill-column 72 "*fill-column used for auto-fill-mode.") (defvar YaTeX-comment-prefix "%" "TeX comment prefix.") (defvar YaTeX-current-position-register ?3 "*Position register to keep where the last completion was done. All of YaTeX completing input store the current position into the register YaTeX-current-position-register. So every time you make a trip to any other part of text other than you are writing, you can return to the editing paragraph by calling register-to-point with argument YaTeX-current-position-register.") (defvar YaTeX-use-LaTeX2e t "*Use LaTeX2e or not. Nil means latex 2.09") (defvar tex-command (cond (YaTeX-use-LaTeX2e "platex -kanji=%k") (YaTeX-japan "jlatex") (t "latex")) "*Default command for typesetting LaTeX text. Overridden with `%#! CommandLine...' in the buffer. `%'s followed by a character are replaced as follows: %f -> Parent(main) document file name %r -> %f without extension %k -> One of Kanji code mnemonic: euc, jis, sjis, utf8 ") (defvar bibtex-command (if YaTeX-japan "pbibtex -kanji=%k" "bibtex") "*Default command of BibTeX. Overridden with `%#BIBTEX CommandLine...' in the buffer. Pettern `%k' in a string will be replaced with Kanji-code mnemonic of ptex.") (defvar dvi2-command ;previewer command for your site (cond (YaTeX-dos "dviout -wait=0") (YaTeX-macos "open -a Preview") (t "xdvi -geo +0+0 -s 4")) "*Default previewer command including its option. Overridden with `%#PREVIEW CommandLine...' in the buffer.") (defvar YaTeX-cmd-gimp "gimp") (defvar YaTeX-cmd-tgif "tgif") (defvar YaTeX-cmd-inkscape "inkscape") (defvar YaTeX-cmd-dia "dia") (defvar YaTeX-cmd-ooo "soffice") (defvar YaTeX-cmd-gs "gs") (defvar YaTeX-cmd-dvips (if (YaTeX-executable-find "pdvips") "pdvips" "dvips")) (defvar YaTeX-cmd-displayline "/Applications/Skim.app/Contents/SharedSupport/displayline") (defvar YaTeX-cmd-edit-ps YaTeX-cmd-gimp) (defvar YaTeX-cmd-edit-pdf YaTeX-cmd-ooo) (defvar YaTeX-cmd-edit-ai YaTeX-cmd-inkscape) (defvar YaTeX-cmd-edit-svg YaTeX-cmd-inkscape) (defvar YaTeX-cmd-edit-images YaTeX-cmd-gimp) (defvar YaTeX-cmd-view-images "display -geometry +0+0") (defvar tex-pdfview-command ;previewer command for your site (cond (YaTeX-dos "acroread") (YaTeX-macos (cond ((file-executable-p YaTeX-cmd-displayline) "open -a Skim") (t "open"))) ((YaTeX-executable-find "evince") "evince") ((YaTeX-executable-find "xreader") "xreader") ((YaTeX-executable-find "atril") "atril") ((YaTeX-executable-find "okular") "okular") ((YaTeX-executable-find "kpdf") "kpdf") ((YaTeX-executable-find "xpdf") "xpdf") ((YaTeX-executable-find "mupdf") "mupdf") (t "acroread")) "*Default PDF viewer command including its option. Overridden with `%#PDFVIEW CommandLine...' in the buffer.") (defvar makeindex-command (if YaTeX-dos "makeind" "makeindex") "*Default makeindex command. Overridden with `%#MAKEINDEX CommandLine...' in the buffer.") (defvar dviprint-command-format (if YaTeX-dos "dviprt %s %f%t" "dvi2ps %f %t %s | lpr") "*Command line string to print out current file. Overridden with `%#LPR CommandLine...' in the buffer. Format string %s will be replaced by the filename. Do not forget to specify the `from usage' and `to usage' with their option by format string %f and %t. See also documentation of dviprint-from-format and dviprint-to-format.") (defvar dviprint-from-format (if YaTeX-dos "%b-" "-f %b") "*`From' page format of dvi filter. %b will turn to beginning page number.") (defvar dviprint-to-format (if YaTeX-dos "%e" "-t %e") "*`To' page format of dvi filter. %e will turn to end page number.") (defvar YaTeX-dvipdf-command "dvipdfmx" "*Command name to convert dvi file to PDF. Overridden with `%#DVIPDF CommandLine...' in the buffer.") (defvar YaTeX-default-document-style (concat (if YaTeX-japan "js") "article") "*Default LaTeX Documentstyle for YaTeX-typeset-region.") (defvar YaTeX-need-nonstop nil "*T for adding `\\nonstopmode{}' to text before invoking latex command.") (defvar latex-warning-regexp "line.* [0-9]*" "*Regular expression of line number of warning message by latex command.") (defvar latex-error-regexp "l\\.[1-9][0-9]*" "*Regular expression of line number of latex error. Perhaps your latex command stops at this error message with line number of LaTeX source text.") (defvar latex-dos-emergency-message "Emergency stop" ;<- for Micro tex, ASCII-pTeX 1.6 "Message pattern of emergency stop of typesetting. Because Demacs (GNU Emacs on DOS) cannot have concurrent process, the latex command which is stopping on a LaTeX error, is terminated by Demacs. Many latex command on DOS display some messages when it is terminated by other process, user or OS. Define to this variable a message string of your latex command on DOS shown at abnormal termination. Remember Demacs's call-process function is not oriented for interactive process.") (defvar NTT-jTeX nil "*T for using NTT-jTeX for latex command. More precisely, setting t to this variables inhibits inter-word break on typeset document by line-break of source text. That is, YaTeX automatically put % after each line at filling. 改行+インデントによって、タイプセット後の字間が空いてしまうのを抑制する場合に tにする(古いNTT-jTeXで顕著に現れる)。具体的には、fillするときに各行の終わりに %を付加する。") (defvar YaTeX-item-regexp (concat (regexp-quote "\\") "\\(sub\\|bib\\)*item") "*Regular expression of item command.") (defvar YaTeX-sectioning-regexp "\\(part\\|chapter\\*?\\|\\(sub\\)*\\(section\\|paragraph\\)\\)\\(\\*\\|\\b\\)" "*LaTeX sectioning commands regexp.") (defvar YaTeX-paragraph-start (concat "^[ \t]*%\\|^[ \t]*$\\|\\'\\|^\C-l\\|\\\\\\\\$\\|^[ \t]*\\\\\\(" YaTeX-sectioning-regexp ;sectioning commands "\\|[A-z]*item\\|begin{\\|end{" ;special declaration "\\|\\[\\|\\]" "\\|newpage\\b\\|vspace\\b" "\\)") "*Paragraph starting regexp of common LaTeX source. Use this value for YaTeX-uncomment-paragraph.") (defvar YaTeX-paragraph-separate (concat "^[ \t]*%\\|^[ \t]*$\\|^\C-l\\|\\\\\\\\$\\|^[ \t]*\\\\\\(" YaTeX-sectioning-regexp ;sectioning commands "\\|begin{\\|end{" ;special declaration "\\|\\[\\|\\]" "\\|newpage\\b\\|vspace\\b" "\\)") "*Paragraph delimiter regexp of common LaTeX source. Use this value for YaTeX-uncomment-paragraph.") (defvar YaTeX-verbatim-environments '("verbatim" "verbatim*" "alltt") "*Assume these environments of this variable disable LaTeX commands.") (defvar YaTeX-verb-regexp "verb\\*?\\|path" "*Regexp of verb family. Do not contain preceding \\\\ nor \\(\\).") (defvar YaTeX-fill-inhibit-environments (append '("tabular" "tabular*" "array" "picture" "eqnarray" "eqnarray*" "longtable" "equation" "equation*" "math" "displaymath") YaTeX-verbatim-environments) "*In these environments, YaTeX inhibits fill-paragraph from formatting. Define those environments as a form of list.") (defvar YaTeX-itemizing-env-regexp "itemize\\|enumerate\\|description\\|list\\|thebibliography" "*Regexp of itemizing environments") (defvar YaTeX-equation-env-regexp "array\\*?\\|equation\\*?" "*Regexp of environments for equations") (defvar YaTeX-array-env-regexp (concat "array\\*?\\|eqnarray\\*?\\|tabbing\\|tabular\\*?\\|" ;LaTeX "longtable\\|" ;LaTeX2e "matrix\\|pmatrix\\|bmatrix\\|vmatrix\\|Vmatrix\\|" ;AMS-LaTeX "align\\*?\\|split\\*?\\|aligned\\*?\\|alignat\\*?\\|" ;AMS-LaTeX "[bpvV]?matrix\\|smallmatrix\\|cases\\|" ;AMS-LaTeX "xalignat\\*?\\|xxalignat\\*?") ;AMS-LaTeX "*Regexp of environments where `&' becomes field delimiter.") (defvar YaTeX-uncomment-once t "*T for removing all continuous commenting character(%). Nil for removing only one commenting character at the beginning-of-line.") (defvar YaTeX-close-paren-always t "*Close parenthesis always when YaTeX-modify-mode is nil.") (defvar YaTeX-greek-by-maketitle-completion nil "*T for greek letters completion by maketitle-type completion.") (defvar YaTeX-auto-math-mode t "*T for changing YaTeX-math mode automatically.") (defvar YaTeX-use-AMS-LaTeX t "*T for using AMS-LaTeX") (defvar yatex-mode-hook nil "*List of functions to be called at the end of yatex-mode initializations.") (defvar YaTeX-search-file-from-top-directory t "*Non-nil means to search input-files from the directory where main file exists.") (defvar YaTeX-use-font-lock (and (featurep 'font-lock) (fboundp 'x-color-values) (fboundp 'font-lock-fontify-region)) "*Use font-lock to fontify buffer or not.") (defvar YaTeX-use-hilit19 (and (featurep 'hilit19) (fboundp 'x-color-values) (fboundp 'hilit-translate) (not YaTeX-use-font-lock)) "*Use hilit19 to highlight buffer or not.") (defvar YaTeX-tabular-indentation 4 "*Indentation column-depth of continueing line in tabular environment.") (defvar YaTeX-electric-indent-mode -1 "*(for Emacs 24.4+) Pass this value to electric-indent-local-mode. -1 means `off'.") ;;-- Math mode values -- (defvar YaTeX-math-key-list-default '((";" . YaTeX-math-sign-alist) (":" . YaTeX-greek-key-alist)) "Default key sequence to invoke math-mode's image completion.") (defvar YaTeX-math-key-list-private nil "*User defined alist, math-mode-prefix vs completion alist.") (defvar YaTeX-math-key-list (append YaTeX-math-key-list-private YaTeX-math-key-list-default) "Key sequence to invoke math-mode's image completion.") (defvar YaTeX-skip-default-reader nil "Non-nil skips default argument reader of section-type completion.") (defvar YaTeX-simple-messages nil "Non-nil makes minibuffer messages simpler.") (defvar YaTeX-template-file "~/work/template.tex" "*Template TeX source file. This will be inserted to empty file.") (defvar YaTeX-addin-prefix "YaTeX:") (defvar yatex-mode-abbrev-table nil "*Abbrev table in use in yatex-mode buffers.") (define-abbrev-table 'yatex-mode-abbrev-table ()) ;------------ Completion table ------------ ; Set tex-section-like command possible completion (defvar section-table (append '(("part") ("chapter") ("chapter*") ("section") ("section*") ("subsection") ("subsection*") ("subsubsection") ("paragraph") ("subparagraph") ("author") ("thanks") ("documentstyle") ("pagestyle") ("thispagestyle") ("title") ("underline") ("label") ("makebox") ("footnote") ("footnotetext") ("index") ("hspace*") ("vspace*") ("bibliography") ("bibliographystyle") ("bibitem") ("cite") ("input") ("include") ("includeonly") ("mbox") ("hbox") ("caption") ("arabic") ("centering") ("uline") ("newcounter") ("newlength") ("setlength" 2) ("addtolength" 2) ("settowidth" 2) ("setcounter" 2) ("addtocounter" 2) ("stepcounter" 2) ("newcommand" 2) ("renewcommand" 2) ("newenvironment" 3) ("newtheorem" 2) ("cline") ("framebox") ("savebox" 2) ("sbox" 2) ("newsavebox") ("usebox") ("date") ("put") ("ref") ("pageref") ("tabref") ("figref") ("raisebox" 2) ("multicolumn" 3) ("shortstack") ("parbox" 2) ;; for mathmode accent ("tilde") ("hat") ("check") ("bar") ("dot") ("ddot") ("vec") ("widetilde") ("widehat") ("overline") ("overrightarrow") ;; section types in mathmode ("frac" 2) ("sqrt") ("mathrm") ("mathbf") ("mathit") ("mathbb") ("mathscr") ("mathrsfs") ;;cleveref ("cref") ("crefrange") ("cpageref") ("labelcref") ("labelcpageref") ("frametitle") ("framesubtitle") ;; beamer ("subfigure") ;; subfigure ("ruby" 2) ("kenten") ;; okumacro ) (if YaTeX-use-LaTeX2e '(("documentclass") ("usepackage") ("textbf") ("textgt") ("textit") ("textmc") ("textmd") ("textnormal") ("textrm") ("textsc") ("textsf") ("textsl") ("texttt") ("textup") ("mathbf") ("mathcal") ("mathit") ("mathnormal") ("mathrm") ("mathsf") ("mathtt") ("text") ("textcircled") ("scalebox" 1) ;is faking of argument position ("rotatebox" 2) ("resizebox" 3) ("reflectbox") ("colorbox" 2) ("fcolorbox" 3) ("textcolor" 2) ("color") ("pagecolor") ("includegraphics") ("includegraphics*") ("includesvg") ("bou") ;defined in plext ("url") ;defined in url ("shadowbox") ("doublebox") ("ovalbox") ("Ovalbox") ("fancyoval") ;defined in fancybox ("keytop") ("mask" 2) ("maskbox" 5) ;defined in ascmac ("bm") ;deined in bm ("verbfile") ("listing") ;defined in misc ("slashbox" 2) ("backslashbox" 2) ;defined in slashbox )) (if YaTeX-use-AMS-LaTeX '(("DeclareMathOperator" 2) ("boldsymbol") ("pmb") ("eqref") ("tag") ("tag*")))) "Default completion table for section-type completion.") (defvar user-section-table nil) (defvar tmp-section-table nil) (defvar YaTeX-ams-math-begin-alist '(("align") ("align*") ("multline") ("multline*") ("gather") ("gather*") ("alignat") ("alignat*") ("xalignat") ("xalignat*") ("xxalignat") ("xxalignat*") ("flalign") ("flalign*") ("equation*"))) (defvar YaTeX-ams-math-gathering-alist '(("matrix") ("pmatrix") ("bmatrix") ("Bmatrix") ("vmatrix") ("Vmatrix") ("split") ("split*") ("aligned") ("aligned*") ("alignedat") ("gathered") ("smallmatrix") ("cases") ("subequations"))) ;; Prepare list(not alist) for YaTeX::ref in yatexadd.el (defvar YaTeX-math-other-env-alist-default '(("numcases") ("subnumcases")) "Default alist of additional environments for equations") (defvar YaTeX-math-other-env-alist-private nil "*User defined alist of additional environments for equations") (defvar YaTeX-math-other-env-alist (append YaTeX-math-other-env-alist-default YaTeX-math-other-env-alist-private) "Alist of additional environments for equations") (defvar YaTeX-math-other-env-list (mapcar 'car YaTeX-math-other-env-alist)) (defvar YaTeX-math-begin-list (mapcar 'car YaTeX-ams-math-begin-alist)) (defvar YaTeX-math-gathering-list ;used in yatexadd.el#yatex::ref (mapcar 'car YaTeX-ams-math-gathering-alist)) (defvar YaTeX-ams-env-table (append YaTeX-ams-math-begin-alist YaTeX-ams-math-gathering-alist) "*Standard AMS-LaTeX(2e) environment completion table.") (defvar YaTeX-use-dot-env-extension t "*Use YaTeX's dot-env filter special environment.") ; Set tex-environment possible completion (defvar env-table (append '(("quote") ("quotation") ("center") ("verse") ("document") ("verbatim") ("itemize") ("enumerate") ("description") ("list") ("tabular") ("tabular*") ("table") ("tabbing") ("titlepage") ("sloppypar") ("picture") ("displaymath") ("eqnarray") ("eqnarray*") ("figure") ("equation") ("equation*") ("abstract") ("array") ("thebibliography") ("theindex") ("flushleft") ("flushright") ("minipage") ("supertabular") ("wrapfigure") ("wraptable") ("frame") ("block") ("example") ("columns") ("column") ;beamer ) (if YaTeX-use-LaTeX2e '(("comment") ;defined in version ("longtable") ;defined in longtable ("screen") ("boxnote") ("shadebox") ;; ("itembox") ;in ascmac ("alltt") ;defined in alltt ("multicols") ;defined in multicol ("breakbox"))) ;defined in eclbkbox (if YaTeX-use-AMS-LaTeX YaTeX-ams-env-table) YaTeX-math-other-env-alist (and YaTeX-use-dot-env-extension (require 'yatexflt) YaTeX-filter-special-env-alist)) "Default completion table for begin-type completion.") (defvar user-env-table nil) (defvar tmp-env-table nil) ; Set {\Large }-like completion (defvar fontsize-table '(("rm") ("em") ("bf") ("boldmath") ("it") ("sl") ("sf") ("sc") ("tt") ("dg") ("dm") ("tiny") ("scriptsize") ("footnotesize") ("small")("normalsize") ("large") ("Large") ("LARGE") ("huge") ("Huge") ("rmfamily") ("sffamily") ("ttfamily") ("mdseries") ("bfseries") ("upshape") ("itshape") ("slshape") ("scshape") ) "Default completion table for large-type completion.") (defvar LaTeX2e-fontstyle-alist '(("rm" . "rmfamily") ("sf" . "sffamily") ("tt" . "ttfamily") ("md" . "mdseries") ("bf" . "bfseries") ("up" . "upshape") ("it" . "itshape") ("sl" . "slshape") ("sc" . "scshape"))) (defvar user-fontsize-table nil) (defvar tmp-fontsize-table nil) (defvar singlecmd-table (append '(("maketitle") ("makeindex") ("sloppy") ("protect") ("par") ("and") ("LaTeX") ("TeX") ("item") ("item[]") ("appendix") ("hline") ("kill") ;;("rightarrow") ("Rightarrow") ("leftarrow") ("Leftarrow") ("pagebreak") ("nopagebreak") ("tableofcontents") ("newpage") ("clearpage") ("cleardoublepage") ("footnotemark") ("verb") ("verb*") ("linebreak") ("pagebreak") ("noindent") ("indent") ("raggedright") ("raggedleft") ("centering") ("left") ("right") ("dots") ("smallskip") ("medskip") ("bigskip") ("displaystyle") ("onslide") ("pause") ;beamer ) (if YaTeX-greek-by-maketitle-completion '(("alpha") ("beta") ("gamma") ("delta") ("epsilon") ("varepsilon") ("zeta") ("eta") ("theta")("vartheta") ("iota") ("kappa") ("lambda") ("mu") ("nu") ("xi") ("pi") ("varpi") ("rho") ("varrho") ("sigma") ("varsigma") ("tau") ("upsilon") ("phi") ("varphi") ("chi") ("psi") ("omega") ("Gamma") ("Delta") ("Theta") ("Lambda")("Xi") ("Pi") ("Sigma") ("Upsilon") ("Phi") ("Psi") ("Omega"))) (if YaTeX-use-LaTeX2e '(("return") ("Return") ("yen"))) ;defined in ascmac (if YaTeX-use-AMS-LaTeX '(("nonumber"))) ) "Default completion table for maketitle-type completion.") (defvar user-singlecmd-table nil) (defvar tmp-singlecmd-table nil) ;---------- Key mode map ---------- ;;; ;; Create new key map: YaTeX-mode-map ;; Do not change this section. ;;; (defvar YaTeX-mode-map nil "Keymap used in YaTeX mode") (defvar YaTeX-prefix-map nil "Keymap used when YaTeX-prefix key pushed") (defvar YaTeX-user-extensional-map (make-sparse-keymap) "*Keymap used for the user's customization") (defvar YaTeX-current-completion-type nil "Has current completion type. This may be used in YaTeX addin functions.") (defvar YaTeX-modify-mode nil "*Current editing mode. When non-nil, each opening parentheses only opens, nil enters both open/close parentheses when opening parentheses key pressed.") (defvar YaTeX-math-mode nil "Holds whether current mode is math-mode.") ;;; ;; Define key table ;;; (if YaTeX-mode-map nil (setq YaTeX-mode-map (make-sparse-keymap)) (setq YaTeX-prefix-map (make-sparse-keymap)) (define-key YaTeX-mode-map "\"" 'YaTeX-insert-quote) (define-key YaTeX-mode-map "{" 'YaTeX-insert-braces) (define-key YaTeX-mode-map "(" 'YaTeX-insert-parens) (define-key YaTeX-mode-map "$" 'YaTeX-insert-dollar) (define-key YaTeX-mode-map "|" 'YaTeX-insert-bar) (define-key YaTeX-mode-map "&" 'YaTeX-insert-amper) (define-key YaTeX-mode-map "[" 'YaTeX-insert-brackets) (define-key YaTeX-mode-map YaTeX-prefix YaTeX-prefix-map) (define-key YaTeX-mode-map "\M-\C-@" 'YaTeX-mark-environment) (define-key YaTeX-mode-map "\M-\C-a" 'YaTeX-beginning-of-environment) (define-key YaTeX-mode-map "\M-\C-e" 'YaTeX-end-of-environment) (define-key YaTeX-mode-map "\M-\C-m" 'YaTeX-intelligent-newline) (define-key YaTeX-mode-map "\C-i" 'YaTeX-indent-line) (YaTeX-define-key "%" 'YaTeX-%-menu) (YaTeX-define-key "t" 'YaTeX-typeset-menu) (YaTeX-define-key "w" 'YaTeX-switch-mode-menu) (YaTeX-define-key "'" 'YaTeX-prev-error) (YaTeX-define-key "^" 'YaTeX-visit-main) (YaTeX-define-key "4^" 'YaTeX-visit-main-other-window) (YaTeX-define-key "4g" 'YaTeX-goto-corresponding-*-other-window) (YaTeX-define-key "44" 'YaTeX-switch-to-window) (and YaTeX-emacs-19 window-system (progn (YaTeX-define-key "5^" 'YaTeX-visit-main-other-frame) (YaTeX-define-key "5g" 'YaTeX-goto-corresponding-*-other-frame) (YaTeX-define-key "55" 'YaTeX-switch-to-window))) (YaTeX-define-key " " 'YaTeX-do-completion) (YaTeX-define-key "v" 'YaTeX-version) (YaTeX-define-key "}" 'YaTeX-insert-braces-region) (YaTeX-define-key "]" 'YaTeX-insert-brackets-region) (YaTeX-define-key ")" 'YaTeX-insert-parens-region) (YaTeX-define-key "$" 'YaTeX-insert-dollars-region) (YaTeX-define-key "i" 'YaTeX-fill-item) (YaTeX-define-key "\\" (function(lambda () (interactive) (insert (if (YaTeX-in-math-mode-p) "\\backslash" "\\textbackslash"))))) (if YaTeX-no-begend-shortcut (progn (YaTeX-define-key "B" 'YaTeX-make-begin-end-region) (YaTeX-define-key "b" 'YaTeX-make-begin-end)) (YaTeX-define-begend-key "bc" "center") (YaTeX-define-begend-key "bd" "document") (YaTeX-define-begend-key "bD" "description") (YaTeX-define-begend-key "be" "enumerate") (YaTeX-define-begend-key "bE" "equation") (YaTeX-define-begend-key "bi" "itemize") (YaTeX-define-begend-key "bl" "flushleft") (YaTeX-define-begend-key "bm" "minipage") (YaTeX-define-begend-key "bt" "tabbing") (YaTeX-define-begend-key "bT" "tabular") (YaTeX-define-begend-key "b\^t" "table") (YaTeX-define-begend-key "bp" "picture") (YaTeX-define-begend-key "bq" "quote") (YaTeX-define-begend-key "bQ" "quotation") (YaTeX-define-begend-key "br" "flushright") (YaTeX-define-begend-key "bv" "verbatim") (YaTeX-define-begend-key "bV" "verse") (YaTeX-define-key "B " 'YaTeX-make-begin-end-region) (YaTeX-define-key "b " 'YaTeX-make-begin-end)) (YaTeX-define-key "e" 'YaTeX-end-environment) (YaTeX-define-key "S" 'YaTeX-make-section-region) (YaTeX-define-key "s" 'YaTeX-make-section) (YaTeX-define-key "L" 'YaTeX-make-fontsize-region) (YaTeX-define-key "l" 'YaTeX-make-fontsize) (YaTeX-define-key "m" 'YaTeX-make-singlecmd) (YaTeX-define-key "." 'YaTeX-comment-paragraph) (YaTeX-define-key "," 'YaTeX-uncomment-paragraph) (YaTeX-define-key ">" 'YaTeX-comment-region) (YaTeX-define-key "<" 'YaTeX-uncomment-region) (YaTeX-define-key "g" 'YaTeX-goto-corresponding-*) (YaTeX-define-key "k" 'YaTeX-kill-*) (YaTeX-define-key "c" 'YaTeX-change-*) (YaTeX-define-key "a" 'YaTeX-make-accent) (YaTeX-define-key "?" 'YaTeX-help) (YaTeX-define-key "/" 'YaTeX-apropos) (YaTeX-define-key "&" 'YaTeX-what-column) (YaTeX-define-key "d" 'YaTeX-display-hierarchy) (YaTeX-define-key "x" YaTeX-user-extensional-map) (YaTeX-define-key "n" (function(lambda () (interactive) (insert "\\" (if (YaTeX-on-section-command-p "o?oalign") "crcr" "\\"))))) (if YaTeX-dos (define-key YaTeX-prefix-map "\C-r" (function(lambda () (interactive) (YaTeX-set-screen-height YaTeX-saved-screen-height) (recenter)))))) (defvar YaTeX-section-completion-map nil "*Key map used at YaTeX completion in the minibuffer.") (if YaTeX-section-completion-map nil (setq YaTeX-section-completion-map (copy-keymap (or (and (boundp 'gmhist-completion-map) gmhist-completion-map) minibuffer-local-completion-map))) (define-key YaTeX-section-completion-map " " 'YaTeX-minibuffer-complete) (define-key YaTeX-section-completion-map "\C-i" 'YaTeX-minibuffer-complete) (define-key YaTeX-section-completion-map "\C-v" 'YaTeX-read-section-with-overview)) (defvar YaTeX-recursive-map nil "*Key map used at YaTeX reading arguments in the minibuffer.") (if YaTeX-recursive-map nil (setq YaTeX-recursive-map (copy-keymap global-map)) (define-key YaTeX-recursive-map YaTeX-prefix YaTeX-prefix-map) (mapcar (function (lambda (key) (define-key YaTeX-mode-map (car key) 'YaTeX-math-insert-sequence) (define-key YaTeX-recursive-map (car key) 'YaTeX-math-insert-sequence))) YaTeX-math-key-list)) ;---------- Define other variable ---------- (defvar YaTeX-env-name "document" "*Initial tex-environment completion") (defvar YaTeX-section-name (if YaTeX-use-LaTeX2e "documentclass" "documentstyle") "*Initial tex-section completion") (defvar YaTeX-fontsize-name "large" "*Initial fontsize completion") (defvar YaTeX-single-command "maketitle" "*Initial LaTeX single command") (defvar YaTeX-kanji-code nil "*File kanji code used by Japanese TeX. nil: Do not care (Preserve coding-system) 0: no-conversion (mule) 1: Shift JIS 2: JIS 3: EUC 4: UTF-8") (defvar YaTeX-coding-system nil "File coding system used by Japanese TeX.") (cond (YaTeX-emacs-20 (setq YaTeX-coding-system (cdr (assoc YaTeX-kanji-code YaTeX-kanji-code-alist)))) ((boundp 'MULE) (setq YaTeX-coding-system (symbol-value (cdr (assoc YaTeX-kanji-code YaTeX-kanji-code-alist)))))) (defvar YaTeX-mode-syntax-table nil "*Syntax table for yatex-mode") (if YaTeX-mode-syntax-table nil (setq YaTeX-mode-syntax-table (make-syntax-table (standard-syntax-table))) (modify-syntax-entry ?\n " " YaTeX-mode-syntax-table) (modify-syntax-entry ?\{ "(}" YaTeX-mode-syntax-table) (modify-syntax-entry ?\} "){" YaTeX-mode-syntax-table) (modify-syntax-entry ?\t " " YaTeX-mode-syntax-table) (modify-syntax-entry ?\f ">" YaTeX-mode-syntax-table) (modify-syntax-entry ?\n ">" YaTeX-mode-syntax-table) (modify-syntax-entry ?$ "$$" YaTeX-mode-syntax-table) (modify-syntax-entry ?% "<" YaTeX-mode-syntax-table) (modify-syntax-entry ?\\ "/" YaTeX-mode-syntax-table) (modify-syntax-entry ?~ " " YaTeX-mode-syntax-table)) (defvar YaTeX-mode-syntax-table-nonparen nil "Syntax table for yatex-mode with normal parentheses treated white spaces") (if YaTeX-mode-syntax-table-nonparen nil (setq YaTeX-mode-syntax-table-nonparen (make-syntax-table YaTeX-mode-syntax-table)) (let ((zenparens "()()「」『』【】[]{}《》〈〉〔〕") (i 0) s) (while (string-match "." zenparens i) (setq s (substring zenparens (match-beginning 0) (match-end 0)) i (1+ i)) (modify-syntax-entry (string-to-char s) " " YaTeX-mode-syntax-table-nonparen)))) ;---------- Provide YaTeX-mode ---------- ;;; ;; Major mode definition ;;; (defun yatex-mode () " Yet Another LaTeX mode: Major mode for editing input files of LaTeX. -You can invoke processes concerning LaTeX typesetting by \\[YaTeX-typeset-menu] -Complete LaTeX environment form of `\\begin{env} ... \\end{env}' by \\[YaTeX-make-begin-end] -Enclose region into some environment by \\[universal-argument] \\[YaTeX-make-begin-end] -Complete LaTeX command which takes argument like `\\section{}' by \\[YaTeX-make-section] -Put LaTeX command which takes no arguments like `\\maketitle' by \\[YaTeX-make-singlecmd] -Complete font or character size descriptor like `{\\large }' by \\[YaTeX-make-fontsize] -Enclose region into those descriptors above by \\[universal-argument] \\[YaTeX-make-fontsize] -Enter European accent notations by \\[YaTeX-make-accent] -Toggle various modes of YaTeX by \\[YaTeX-switch-mode-menu] -Change environt name (on the begin/end line) by \\[YaTeX-change-*] -Kill LaTeX command/environment sequences by \\[YaTeX-kill-*] -Kill LaTeX command/environment with its contents \\[universal-argument] \\[YaTeX-kill-*] -Go to corresponding object (begin/end, file, labels) by \\[YaTeX-goto-corresponding-*] or \\[YaTeX-goto-corresponding-*-other-window] (in other window) \\[YaTeX-goto-corresponding-*-other-frame] (in other frame) -Go to main LaTeX source text by \\[YaTeX-visit-main] or \\[YaTeX-visit-main-other-window] (in other window) \\[YaTeX-visit-main-other-frame] (in other frame) -Comment out or uncomment region by \\[YaTeX-comment-region] or \\[YaTeX-uncomment-region] -Comment out or uncomment paragraph by \\[YaTeX-comment-paragraph] or \\[YaTeX-uncomment-paragraph] -Make an \\item entry hang-indented by \\[YaTeX-fill-item] -Enclose the region with parentheses by \\[YaTeX-insert-parens-region] \\[YaTeX-insert-braces-region] \\[YaTeX-insert-brackets-region] \\[YaTeX-insert-dollars-region] -Look up the corresponding column header of tabular environment by \\[YaTeX-what-column] -Enter a newline and an entry suitable for environment by \\[YaTeX-intelligent-newline] -View the structure of file inclusion by \\[YaTeX-display-hierarchy] -Refer the online help of popular LaTeX commands by \\[YaTeX-help] (help) \\[YaTeX-apropos] (apropos) -Edit `%# notation' by \\[YaTeX-%-menu] Those are enough for fastening your editing of LaTeX source. But further more features are available and they are documented in the manual. " (interactive) (kill-all-local-variables) (setq major-mode 'yatex-mode) (setq mode-name (if YaTeX-japan "やてふ" "YaTeX")) (mapcar 'make-local-variable '(dvi2-command fill-column fill-prefix tmp-env-table tmp-section-table tmp-fontsize-table tmp-singlecmd-table paragraph-start paragraph-separate YaTeX-math-mode indent-line-function comment-line-break-function comment-start comment-start-skip )) (YaTeX-set-file-coding-system YaTeX-kanji-code YaTeX-coding-system) (setq fill-column YaTeX-fill-column fill-prefix YaTeX-fill-prefix paragraph-start YaTeX-paragraph-start paragraph-separate YaTeX-paragraph-separate indent-line-function 'YaTeX-indent-line comment-start YaTeX-comment-prefix comment-end "" comment-start-skip "[^\\\\]%+[ \t]*" local-abbrev-table yatex-mode-abbrev-table) (if (fboundp 'comment-indent-new-line) ;for Emacs21 (setq comment-line-break-function 'YaTeX-comment-line-break)) ;; +dnd for X11 w/ emacs23+ (and window-system (featurep 'dnd) (require 'yatex23 nil t) (set (make-local-variable 'dnd-protocol-alist) (cons (cons "^file:" 'YaTeX-dnd-handler) dnd-protocol-alist))) (if (and YaTeX-use-font-lock (featurep 'font-lock)) (progn (require 'yatex19) (YaTeX-font-lock-set-default-keywords) (or (featurep 'xemacs) (set (make-local-variable 'font-lock-defaults) (get 'yatex-mode 'font-lock-defaults))) ;;(font-lock-mode 1) )) (use-local-map YaTeX-mode-map) (set-syntax-table YaTeX-mode-syntax-table) (if YaTeX-dos (setq YaTeX-saved-screen-height (YaTeX-screen-height))) (YaTeX-read-user-completion-table) (and (fboundp 'YaTeX-hilit-setup-alist) (YaTeX-hilit-setup-alist)) (makunbound 'inenv) ;(turn-on-auto-fill) ;1.63 -> 1.79off (if (fboundp 'electric-indent-local-mode) (electric-indent-local-mode YaTeX-electric-indent-mode)) (and (= 0 (buffer-size)) (file-exists-p YaTeX-template-file) (y-or-n-p (format "Insert %s?" YaTeX-template-file)) (insert-file-contents (expand-file-name YaTeX-template-file))) (run-hooks 'text-mode-hook 'yatex-mode-hook)) ;---------- Define YaTeX-mode functions ---------- (defvar YaTeX-ec "\\" "Escape character of current mark-up language.") (defvar YaTeX-ec-regexp (regexp-quote YaTeX-ec)) (defvar YaTeX-struct-begin (concat YaTeX-ec "begin{%1}%2") "Keyword format of begin-environment.") (defvar YaTeX-struct-end (concat YaTeX-ec "end{%1}") "Keyword format of end-environment.") (defvar YaTeX-struct-name-regexp "[^}]*" "Environment name regexp.") (defvar YaTeX-TeX-token-regexp (cond (YaTeX-japan "[A-Za-z*ぁ-ん亜-龠]+") (t "[A-Za-z*]+")) "Regexp of characters which can be a member of TeX command's name.") (defvar YaTeX-kanji-regexp "[ぁ-ん亜-龠]" "Generic regexp of Japanese Kanji (and symbol) characters.") (defvar YaTeX-command-token-regexp YaTeX-TeX-token-regexp "Regexp of characters which can be a member of current mark up language's command name.") ;;(defvar YaTeX-struct-section ;; (concat YaTeX-ec "%1{%2}") ;; "Keyword to make section.") ;;; ;; autoload section ;;; ;;autoload from yatexprc.el (autoload 'YaTeX-visit-main "yatexprc" "Visit main LaTeX file." t) (autoload 'YaTeX-visit-main-other-window "yatexprc" "Visit main other window." t) (autoload 'YaTeX-main-file-p "yatexprc" "Check if the file is main." t) (autoload 'YaTeX-get-builtin "yatexprc" "Get %# built-in." t) (autoload 'YaTeX-system "yatexprc" "Call system command" t) (autoload 'YaTeX-save-buffers "yatexprc" "Save buffers of same major mode" t) (autoload 'YaTeX-goto-corresponding-viewer "yatexprc" "Viewer jump line" t) ;;autoload from yatexmth.el (autoload 'YaTeX-math-insert-sequence "yatexmth" "Image input." t) (autoload 'YaTeX-in-math-mode-p "yatexmth" "Check if in math-env." t) (autoload 'YaTeX-toggle-math-mode "yatexmth" "YaTeX math-mode interfaces." t) (autoload 'YaTeX-math-member-p "yatexmth" "Check if a word is math command." t) (autoload 'YaTeX-insert-amsparens-region "yatexmth" "AMS parens region" t) (autoload 'YaTeX-insert-amsbraces-region "yatexmth" "AMS braces region" t) (autoload 'YaTeX-insert-amsbrackets-region "yatexmth" "AMS brackets region" t) (autoload 'YaTeX-on-parenthesis-p "yatexmth" "Check if on math-parens" t) (autoload 'YaTeX-goto-open-paren "yatexmth" "Goto opening paren" t) (autoload 'YaTeX-change-parentheses "yatexmth" "Change corresponding parens" t) (autoload 'YaTeX-goto-corresponding-paren "yatexmth" "\bigl\bigr jumps" t) (autoload 'YaTeX-typeset-math-region "yatexmth" "Typeset math-region" t) ;;autoload from yatexhlp.el (autoload 'YaTeX-help "yatexhlp" "YaTeX helper with LaTeX commands." t) (autoload 'YaTeX-apropos "yatexhlp" "Apropos for (La)TeX commands." t) ;;autoload from yatexgen.el (autoload 'YaTeX-generate "yatexgen" "YaTeX add-in function generator." t) (autoload 'YaTeX-generate-simple "yatexgen" "YaTeX add-in support." t) ;;autoload from yatexsec.el (autoload 'YaTeX-section-overview "yatexsec" "YaTeX sectioning(view)" t) (autoload 'YaTeX-read-section-in-minibuffer "yatexsec" "YaTeX sectioning" t) (autoload 'YaTeX-make-section-with-overview "yatexsec" "YaTeX sectioning" t) ;;autoload from yatexenv.el (autoload 'YaTeX-what-column "yatexenv" "YaTeX env. specific funcs" t) (autoload 'YaTeX-intelligent-newline "yatexenv" "YaTeX env. specific funcs" t) (autoload 'YaTeX-indent-line-equation "yatexenv" "Indent equation lines." t) (autoload 'YaTeX-goto-corresponding-leftright "yatexenv" "\left\right jumps" t) ;;autoload from yatexhie.el (autoload 'YaTeX-display-hierarchy "yatexhie" "YaTeX document hierarchy browser" t) (autoload 'YaTeX-display-hierarchy-directly "yatexhie" "Same as YaTeX-display-hierarchy. Call from mouse." t) ;;autoload from yatexpkg.el (autoload 'YaTeX-package-auto-usepackage "yatexpkg" "Auto \\usepackage" t) ;;autoload from yatexflt.el (autoload 'YaTeX-filter-goto-source "yatexflt" "Go to graphic source file" t) ;;; ;; YaTeX-mode functions ;;; (defun YaTeX-insert-begin-end (env region-mode) "Insert \\begin{mode-name} and \\end{mode-name}. This works also for other defined begin/end tokens to define the structure." (setq YaTeX-current-completion-type 'begin) (let*((ccol (current-column)) beg beg2 exchange (arg region-mode) ;for old compatibility (indent-column (+ ccol YaTeX-environment-indent))(i 1) func) (if (and region-mode (> (point) (mark))) (progn (exchange-point-and-mark) (setq exchange t ccol (current-column) indent-column (+ ccol YaTeX-environment-indent)))) ;;VER2 (insert "\\begin{" env "}" (YaTeX-addin env)) (setq beg (point)) (YaTeX-insert-struc 'begin env) (setq beg2 (point)) (insert "\n") (indent-to indent-column) (save-excursion ;;indent optional argument of \begin{env}, if any (while (> (point-beginning-of-line) beg) (skip-chars-forward "\\s " (point-end-of-line)) (indent-to indent-column) (forward-line -1))) (require 'yatexenv) (if region-mode ;;if region-mode, indent all text in the region (save-excursion (if (fboundp (intern-soft (concat "YaTeX-enclose-" env))) (funcall (intern-soft (concat "YaTeX-enclose-" env)) (point) (mark)) (while (< (progn (forward-line 1) (point)) (mark)) (if (eolp) nil (skip-chars-forward " \t\n") (indent-to indent-column)))))) (if region-mode (exchange-point-and-mark)) (indent-to ccol) ;;VER2 (insert "\\end{" env "}\n") (YaTeX-insert-struc 'end env) (YaTeX-reindent ccol) (if region-mode (progn (insert "\n") (or exchange (exchange-point-and-mark))) (goto-char beg2) (YaTeX-intelligent-newline nil) (if (fboundp (intern-soft (concat "YaTeX-intelligent-newline-" env))) (progn (message (cond (YaTeX-japan "%s で次の行の入力に進みます。") (t "`%s' produces the next line's template.")) (key-description (car (where-is-internal 'YaTeX-intelligent-newline)))))) (YaTeX-indent-line)) (YaTeX-package-auto-usepackage env 'env) (if YaTeX-current-position-register (point-to-register YaTeX-current-position-register)))) (defun YaTeX-make-begin-end (arg) "Make LaTeX environment command of \\begin{env.} ... \\end{env.} by completing read. If you invoke this command with universal argument, \(key binding for universal-argument is \\[universal-argument]\) you can put REGION into that environment between \\begin and \\end. If the environment name begins with `.'(dot), that environment will be treated as `special environment', which enables special feature such as text conversion." (interactive "P") (let* ((region-p (or arg (YaTeX-region-active-p))) (mode (if region-p " region" "")) (env (save-excursion ;for Emacs24 work-around to avoid point warp (YaTeX-read-environment (format "Begin environment%s(default %s): " mode YaTeX-env-name)))) special) (if (string= env "") (setq env YaTeX-env-name)) (setq special (assoc env YaTeX-filter-special-env-alist) YaTeX-env-name env) (YaTeX-update-table (list YaTeX-env-name) 'env-table 'user-env-table 'tmp-env-table) (if special (YaTeX-insert-filter-special YaTeX-env-name (cdr special) region-p) (YaTeX-insert-begin-end YaTeX-env-name region-p)))) (defun YaTeX-make-begin-end-region () "Call YaTeX-make-begin-end with ARG to specify region mode." (interactive) (YaTeX-make-begin-end t)) (defun YaTeX-guess-section-type () (if (eq major-mode 'yatex-mode) (save-excursion (cond ((save-excursion (not (search-backward YaTeX-ec nil t))) (if YaTeX-use-LaTeX2e "documentclass" "documentstyle")) ((progn (if (= (char-after (1- (point))) ?~) (forward-char -1)) (forward-char -1) (looking-at "表\\|図\\|式\\|第")) "ref") ((and (looking-at "[a-z \t]") (progn (skip-chars-backward "a-z \t") (looking-at "table\\|figure\\|formula\\|eq\\(\\.\\|uation\\)"))) "ref") ((save-excursion (skip-chars-backward "[^ア-ン]") (looking-at "プログラム\\|リスト")) "ref") ((YaTeX-re-search-active-backward (concat YaTeX-ec-regexp "begin{\\([^}]+\\)}") (regexp-quote YaTeX-comment-prefix) (save-excursion (forward-line -1) (point)) t) (let ((env (YaTeX-match-string 1))) (cdr (assoc env '(("table" . "caption")))))) )))) (defun YaTeX-make-section (arg &optional beg end cmd) "Make LaTeX \\section{} type command with completing read. With numeric ARG, you can specify the number of arguments of LaTeX command. For example, if you want to produce LaTeX command \\addtolength{\\topmargin}{8mm} which has two arguments. You can produce that sequence by typing... ESC 2 C-c s add SPC RET \\topm SPC RET 8mm RET \(by default\) Then yatex will automatically complete `addtolength' with two arguments next time. You can complete symbol at LaTeX command and the 1st argument. If the optional 2nd and 3rd argument BEG END are specified, enclose the region from BEG to END into the first argument of the LaTeX sequence. Optional 4th arg CMD is LaTeX command name, for non-interactive use." (interactive "P") (setq YaTeX-current-completion-type 'section) (if (or (equal arg '(4)) (YaTeX-region-active-p)) (setq beg (region-beginning) end (region-end))) (unwind-protect (let* ((source-window (selected-window)) guess (section (or cmd (progn (setq guess (or (YaTeX-guess-section-type) YaTeX-section-name)) (YaTeX-read-section (if YaTeX-simple-messages (format "Section-type (default %s): " guess) (if (> (minibuffer-depth) 0) (format "%s???{} (default %s)%s: " YaTeX-ec guess (format "[level:%d]" (minibuffer-depth))) (format "(C-v for view-section) %s???{%s} (default %s): " YaTeX-ec (if beg "region" "") guess))) nil)))) (section (if (string= section "") guess section)) (numarg ;; The number of section-type command's argument (or (and (numberp arg) arg) (nth 1 (YaTeX-lookup-table section 'section)) 1)) (arg-reader (intern-soft (concat "YaTeX::" section))) (addin-args (and arg-reader (fboundp arg-reader))) (title "") (j 1) (after-change-functions nil) ;inhibit font-locking temporarily (enable-recursive-minibuffers t) (mkarg-func (function (lambda (n) (while (<= j n) (unwind-protect (setq title (cond (addin-args (funcall arg-reader j)) (YaTeX-skip-default-reader "") (t (read-string-with-history (format "Argument %d of %s: " j section))))) (insert (concat ;to allow nil return value "{" title "}"))) (setq j (1+ j)))))) );;let (setq YaTeX-section-name section) (if beg (let*((e (make-marker)) (ar2 (intern-soft (concat "YaTeX::" section "-region"))) (arp (and ar2 (fboundp ar2)))) (goto-char end) (insert "}") (set-marker e (point)) (goto-char beg) (unwind-protect (progn (insert YaTeX-ec YaTeX-section-name (YaTeX-addin YaTeX-section-name)) (if (> numarg 1) (funcall mkarg-func (1- numarg)))) (insert "{")) (if arp (funcall ar2 (point) e)) (goto-char e) (set-marker e nil)) (use-global-map YaTeX-recursive-map) (if (= numarg 0) (YaTeX-make-singlecmd YaTeX-section-name) (progn (insert YaTeX-ec YaTeX-section-name) (insert (YaTeX-addin YaTeX-section-name)))) ;;read arguments with add-in (funcall mkarg-func numarg)) (YaTeX-update-table (if (/= numarg 1) (list section numarg) (list section)) 'section-table 'user-section-table 'tmp-section-table) (if YaTeX-current-position-register (point-to-register YaTeX-current-position-register)) (if (string= (YaTeX-buffer-substring (- (point) 2) (point)) "{}") (forward-char -1)) (while (string= (YaTeX-buffer-substring (- (point) 3) (1- (point))) "{}") (forward-char -2)) (YaTeX-package-auto-usepackage section 'section)) (if (<= (minibuffer-depth) 0) (use-global-map global-map)) (insert ""))) ;insert dummy string to fontify(Emacs20) (defun YaTeX-make-section-region (args beg end) "Call YaTeX-make-section with arguments to specify region mode." (interactive "P\nr") (YaTeX-make-section args beg end)) (defun YaTeX-make-fontsize (arg &optional fontsize) "Make completion like {\\large ...} or {\\slant ...} in minibuffer. If you invoke this command with universal argument, you can put region into {\\xxx } braces. \(key binding for universal-argument is \\[universal-argument]\)" (interactive "P") (YaTeX-sync-local-table 'tmp-fontsize-table) (let* ((region-p (if (or arg (YaTeX-region-active-p)) (cons (region-beginning) (region-end)))) (mode (if region-p "region" "")) (fontsize (or fontsize (YaTeX-read-fontsize (if YaTeX-simple-messages (format "Font or size (default %s): " YaTeX-fontsize-name) (format "{\\??? %s} (default %s)%s: " mode YaTeX-fontsize-name (if (> (minibuffer-depth) 0) (format "[level:%d]" (minibuffer-depth)) ""))) nil nil)))) (if (string= fontsize "") (setq fontsize YaTeX-fontsize-name)) (setq YaTeX-current-completion-type 'large) (setq YaTeX-fontsize-name fontsize) (YaTeX-update-table (list YaTeX-fontsize-name) 'fontsize-table 'user-fontsize-table 'tmp-fontsize-table) (and YaTeX-use-LaTeX2e (YaTeX-latex2e-p) (setq fontsize (cdr (assoc YaTeX-fontsize-name LaTeX2e-fontstyle-alist))) (setq YaTeX-fontsize-name fontsize)) (if region-p (let ((b (car region-p)) (e (set-marker (make-marker) (cdr region-p)))) (goto-char b) (insert "{\\" YaTeX-fontsize-name " ") (goto-char e) (insert "}") (set-marker e nil)) (insert (concat "{\\" YaTeX-fontsize-name " }")) (forward-char -1) (if YaTeX-current-position-register (point-to-register YaTeX-current-position-register)) (save-excursion (insert (YaTeX-addin YaTeX-fontsize-name))) (YaTeX-package-auto-usepackage YaTeX-fontsize-name 'large)))) (defun YaTeX-make-fontsize-region () "Call function:YaTeX-make-fontsize with ARG to specify region mode." (interactive) (YaTeX-make-fontsize t)) (defvar YaTeX-singlecmd-suffix "" "*Suffix for maketitle-type commands.") (defvar YaTeX-read-singlecmd-history nil "Holds maketitle-type history.") (put 'YaTeX-read-singlecmd-history 'no-default t) (defun YaTeX-make-singlecmd (single) (interactive (list (YaTeX-cplread-with-learning (if YaTeX-simple-messages (format "maketitle-type (default %s): " YaTeX-single-command) (format "%s??? (default %s)%s: " YaTeX-ec YaTeX-single-command (if (> (minibuffer-depth) 0) (format "[level:%d]" (minibuffer-depth)) ""))) 'singlecmd-table 'user-singlecmd-table 'tmp-singlecmd-table nil nil nil 'YaTeX-read-singlecmd-history))) (if (string= single "") (setq single YaTeX-single-command)) (setq YaTeX-single-command single) (setq YaTeX-current-completion-type 'maketitle) (let ((dollar (and (not (YaTeX-in-math-mode-p)) (YaTeX-math-member-p YaTeX-single-command))) p q) (if dollar (insert "$")) (insert YaTeX-ec YaTeX-single-command) (setq p (point)) (insert (YaTeX-addin single) YaTeX-singlecmd-suffix) (if dollar (insert "$")) (setq q (point)) (goto-char p) (forward-char -2) (if (looking-at "\\[\\]") (forward-char 1) (goto-char q))) (YaTeX-package-auto-usepackage YaTeX-single-command 'maketitle) (if YaTeX-current-position-register (point-to-register YaTeX-current-position-register))) (defvar YaTeX-completion-begin-regexp "[{\\]" "Regular expression of limit where LaTeX command's completion begins.") (defun YaTeX-do-completion () "Try completion on LaTeX command preceding point." (interactive) (if (or (eq (preceding-char) ? ) (eq (preceding-char) ?\t) (eq (preceding-char) ?\n) (bobp)) (message "Nothing to complete.") ;Do not complete (let* ((end (point)) (limit (point-beginning-of-line)) (completion-begin (progn (re-search-backward "[ \t\n]" limit 1) (point))) (begin (progn (goto-char end) (if (re-search-backward YaTeX-completion-begin-regexp completion-begin t) (1+ (point)) nil)))) (goto-char end) (cond ((null begin) (message "I think it is not a LaTeX sequence.")) (t (mapcar 'YaTeX-sync-local-table '(tmp-section-table tmp-env-table tmp-singlecmd-table)) (let*((pattern (YaTeX-buffer-substring begin end)) (all-table (append section-table user-section-table tmp-section-table env-table user-env-table tmp-env-table singlecmd-table user-singlecmd-table tmp-singlecmd-table)) ;; First, ;; search completion without backslash. (completion (try-completion pattern all-table))) (if (eq completion nil) ;; Next, ;; search completion with backslash (setq completion (try-completion (YaTeX-buffer-substring (1- begin) end) all-table nil) begin (1- begin))) (cond ((null completion) (message (concat "Can't find completion for '" pattern "'")) (ding)) ((eq completion t) (message "Sole completion.")) ((not (string= completion pattern)) (delete-region begin end) (insert completion) ) (t (message "Making completion list...") (with-output-to-temp-buffer "*Help*" (display-completion-list (all-completions pattern all-table))))))))))) (defun YaTeX-toggle-modify-mode (&optional arg) (interactive "P") (or (memq 'YaTeX-modify-mode mode-line-format) (setq mode-line-format (append (list "" 'YaTeX-modify-mode) mode-line-format))) (if (or arg (null YaTeX-modify-mode)) (progn (setq YaTeX-modify-mode "*m*") (message "Modify mode")) (setq YaTeX-modify-mode nil) (message "Cancel modify mode.")) (set-buffer-modified-p (buffer-modified-p))) ;redraw mode-line (defun YaTeX-switch-mode-menu (arg &optional char) (interactive "P") (message "Toggle: (M)odify-mode ma(T)h-mode") (let ((c (or char (read-char)))) (cond ((= c ?m) (YaTeX-toggle-modify-mode arg)) ((or (= c ?$) (= c ?t)) (if YaTeX-auto-math-mode (message "Makes no sense in YaTeX-auto-math-mode.") (YaTeX-toggle-math-mode arg)))))) (defun YaTeX-insert-quote () (interactive) (insert (cond ((YaTeX-literal-p) ?\") ((= (preceding-char) ?\\ ) ?\") ;((= (preceding-char) ?\( ) ?\") ((save-excursion (beginning-of-line) (skip-chars-forward "\t ") (looking-at "%#")) ?\") ((let ((ovl (overlays-at (point)))) (and ovl (catch 'found (while ovl (if (overlay-get (car ovl) 'filter-input) (throw 'found t)) (setq ovl (cdr ovl)))))) ?\") ((or (= (preceding-char) 32) (= (preceding-char) 9) (= (preceding-char) ?\n) (bobp) (string-match (regexp-quote (char-to-string (preceding-char))) "、。,.?!「」『』【】()")) "``") (t "''")))) (defun YaTeX-closable-p () (and (not YaTeX-modify-mode) (not (eq YaTeX-close-paren-always 'never)) (or YaTeX-close-paren-always (eolp)) (not (input-pending-p)) (not (YaTeX-literal-p))) ;;(or YaTeX-modify-mode ;; (and (not YaTeX-close-paren-always) (not (eolp))) ;; (input-pending-p) ;; (YaTeX-quick-in-environment-p "verbatim")) ) (defun YaTeX-insert-braces-region (beg end &optional open close) (interactive "r") (save-excursion (goto-char end) (YaTeX-insert-inherit (or close "}")) (goto-char beg) (YaTeX-insert-inherit (or open "{")))) (defun YaTeX-get-macro-at-point (&optional p) "Get (La)TeX macro around point P." (interactive "d") (save-excursion (goto-char (setq p (or p (point)))) (let ((token (substring (substring YaTeX-TeX-token-regexp 1) 0 -2)) bsend) (and (not (bobp)) (or (looking-at YaTeX-TeX-token-regexp) (string-match YaTeX-TeX-token-regexp (char-to-string (preceding-char)))) (progn (skip-chars-backward token) (equal (preceding-char) ?\\)) (save-excursion (setq bsend (point)) (skip-chars-backward "\\\\") ;emacs18 doesn't return distance (/= (% (- bsend (point)) 2) 0)) ;consider \\ (looking-at YaTeX-TeX-token-regexp) (YaTeX-match-string 0))))) (defun YaTeX-insert-braces (arg &optional open close) (interactive "p") (let ((begend-guide (function (lambda () (if (equal (get 'YaTeX-insert-braces 'begend-guide) 2) nil ;if triggered thrice, do nothing (momentary-string-display (format (cond (YaTeX-japan "begin/end入力には %s を使いましょう") (t "You don't understand Zen of `%s'!")) (key-description (car (where-is-internal 'YaTeX-make-begin-end)))) (point)) (put 'YaTeX-insert-braces 'begend-guide (+ 1 (YaTeX-str2int ;increment counter of beg-end guidance (prin1-to-string (get 'YaTeX-insert-braces 'begend-guide))))))))) env macro not-literal b e) (cond ((YaTeX-region-active-p) (YaTeX-insert-braces-region (region-beginning) (region-end))) ((YaTeX-jmode) (YaTeX-self-insert arg)) ((not (YaTeX-closable-p)) (YaTeX-self-insert arg)) ((save-excursion (and (> (- (point) (point-min)) 6) (condition-case () (forward-char -6) (error nil))) (looking-at "\\\\left\\\\")) (insert "{\\right\\}") (forward-char -8)) ((save-excursion ;from matsumath.s.chiba-u.ac.jp (and (> (- (point) (point-min)) 6) (forward-char -6)) (looking-at "\\\\[bB]igl\\\\")) (insert (concat "{" (buffer-substring (match-beginning 0) (- (match-end 0) 2)) "r\\}")) (forward-char -7)) ((save-excursion (and (> (- (point) (point-min)) 7) (condition-case () (forward-char -7) (error nil))) (looking-at "\\\\[bB]iggl\\\\")) (insert (concat "{" (buffer-substring (match-beginning 0) (- (match-end 0) 2)) "r\\}")) (forward-char -8)) ((= (preceding-char) ?\\ ) (insert "{\\}") (forward-char -2)) ;matsu's hack ends here ((and (setq not-literal (not (YaTeX-literal-p))) (equal "end" (setq macro (YaTeX-get-macro-at-point))) (setq env (YaTeX-inner-environment))) (funcall begend-guide) (insert "{" env "}")) ((and not-literal (equal "begin" macro)) (insert "{") (save-excursion (indent-to (prog1 (- (current-column) 7) (insert "}\n"))) (insert "\\end{}") (setq e (point))) (setq env (YaTeX-read-environment (format "Begin environment(default %s): " YaTeX-env-name))) (if (string= "" env) (setq env YaTeX-env-name)) (setq YaTeX-env-name env) (funcall begend-guide) (delete-region (- (point) 7) e) (YaTeX-insert-begin-end env nil)) (t (insert (or open "{") (or close "}")) (forward-char -1) (if (and (eq (char-after (point)) ?\}) ;; the case `\\{}' (eq (char-after (- (point) 2)) ?\\ )) (progn (insert "\\") (forward-char -1))) )))) (defun YaTeX-jmode () (or (and (boundp 'canna:*japanese-mode*) canna:*japanese-mode*) (and (boundp 'egg:*mode-on*) egg:*mode-on* egg:*input-mode*) (and (boundp 'skk-mode) skk-mode (not skk-latin-mode)) (and (boundp 'default-input-method) default-input-method current-input-method))) (defun YaTeX-jmode-off () (if (cond ((and (boundp 'canna:*japanese-mode*) canna:*japanese-mode*) (canna-toggle-japanese-mode) t) ((and (boundp 'egg:*mode-on*) egg:*mode-on* egg:*input-mode*) (egg:toggle-egg-mode-on-off) t) ((and (fboundp 'skk-mode) (boundp 'skk-mode) skk-mode) (cond ((fboundp 'skk-latin-mode) (or (and (boundp 'skk-henkan-mode) skk-henkan-mode) (and (boundp 'skk-henkan-on) (or skk-henkan-mode skk-henkan-active)) (and (boundp 'j-henkan-on) (or j-henkan-on j-henkan-active)) ;; Deactivate jmode if henkan-mode is not running. ;; Suggested by tt.tetsuo.tsukamoto. (progn (put 'YaTeX-jmode-on 'skkkata skk-katakana) (skk-latin-mode t)))) ((fboundp 'skk-mode-off) (skk-mode-off)) (t (j-mode-off))) t) ((and (fboundp 'toggle-input-method) current-input-method) (toggle-input-method) t) ((and (fboundp 'fep-force-off) (fep-force-off)))) (put 'YaTeX-jmode 'jmode t))) (defun YaTeX-jmode-on () (cond ((boundp 'canna:*japanese-mode*) (if (not canna:*japanese-mode*) (canna-toggle-japanese-mode))) ((boundp 'egg:*mode-on*) (and (not egg:*mode-on*) (not egg:*input-mode*) (egg:toggle-egg-mode-on-off))) ((and (fboundp 'skk-mode) (boundp 'skk-mode)) (if (get 'YaTeX-jmode-on 'skkkata) (skk-j-mode-on t) (skk-mode 1)) (put 'YaTeX-jmode-on 'skkkata nil)) ((fboundp 'toggle-input-method) (if (not current-input-method) (toggle-input-method))) ((and (fboundp 'fep-force-on) (fep-force-on))))) (defun YaTeX-jmode-back () (if (get 'YaTeX-jmode 'jmode) (YaTeX-jmode-on)) (setplist 'YaTeX-jmode nil)) (defun YaTeX-self-insert (arg) (call-interactively (global-key-binding (char-to-string (YaTeX-last-key))))) (defun YaTeX-insert-inherit (&rest args) (apply (if (fboundp 'insert-and-inherit) 'insert-and-inherit 'insert) args)) (defun YaTeX-insert-brackets (arg) "Insert Kagi-kakko or \\ [ \\] pair or simply \[." (interactive "p") (let ((col (1- (current-column)))) (cond ((YaTeX-region-active-p) (YaTeX-insert-brackets-region (region-beginning) (region-end))) ((YaTeX-jmode) (YaTeX-self-insert arg)) ((not (YaTeX-closable-p)) (YaTeX-self-insert arg)) ((save-excursion (and (> (- (point) (point-min)) 5) (forward-char -5)) (looking-at "\\\\left")) (YaTeX-insert-inherit "[\\right]") (forward-char -7)) ((save-excursion ;from matsumath.s.chiba-u.ac.jp (and (> (- (point) (point-min)) 5) (forward-char -5)) (looking-at "\\\\[bB]igl")) (YaTeX-insert-inherit (concat "[" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r]")) (forward-char -6)) ((save-excursion (and (> (- (point) (point-min)) 6) (forward-char -6)) (looking-at "\\\\[bB]iggl")) (YaTeX-insert-inherit (concat "[" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r]")) (forward-char -7)) ;matsu's hack ends here ((and (= (preceding-char) ?\\ ) (/= (char-after (- (point) 2)) ?\\ ) (not (YaTeX-in-math-mode-p))) (YaTeX-insert-inherit (YaTeX-last-key) "\n") (indent-to (max 0 col)) (YaTeX-insert-inherit "\\]") (beginning-of-line) (open-line 1) (delete-region (point) (progn (beginning-of-line) (point))) (indent-to (+ YaTeX-environment-indent (max 0 col))) (or YaTeX-auto-math-mode YaTeX-math-mode (YaTeX-toggle-math-mode 1))) ((YaTeX-closable-p) (YaTeX-insert-inherit "[]") (backward-char 1)) (t (YaTeX-self-insert arg))))) (defun YaTeX-insert-brackets-region (beg end) (interactive "r") (YaTeX-insert-braces-region beg end "[" "]")) (defun YaTeX-insert-parens (arg) "Insert parenthesis pair." (interactive "p") (cond ((YaTeX-region-active-p) (YaTeX-insert-parens-region (region-beginning) (region-end))) ((YaTeX-jmode) (YaTeX-self-insert arg)) ((not (YaTeX-closable-p)) (YaTeX-self-insert arg)) ((save-excursion (and (> (- (point) (point-min)) 5) (forward-char -5)) (looking-at "\\\\left")) (YaTeX-insert-inherit "(\\right)") (forward-char -7)) ((save-excursion ;from matsumath.s.chiba-u.ac.jp (and (> (- (point) (point-min)) 5) (forward-char -5)) (looking-at "\\\\[bB]igl")) (YaTeX-insert-inherit (concat "(" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r)")) (forward-char -6)) ((save-excursion (and (> (- (point) (point-min)) 6) (forward-char -6)) (looking-at "\\\\[bB]iggl")) (YaTeX-insert-inherit (concat "(" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r)")) (forward-char -7)) ((= (preceding-char) ?\\ ) ;matsu's hack ends here (YaTeX-insert-inherit "(\\)") (backward-char 2)) ((YaTeX-closable-p) (YaTeX-insert-inherit "()") (backward-char 1)) (t (YaTeX-self-insert arg)))) (defun YaTeX-insert-parens-region (beg end) (interactive "r") (YaTeX-insert-braces-region beg end "(" ")")) (defun YaTeX-insert-bar (arg) "Insert bar pair." (interactive "p") (cond ((YaTeX-jmode) (YaTeX-self-insert arg)) ((not (YaTeX-closable-p)) (YaTeX-self-insert arg)) ((save-excursion (and (> (- (point) (point-min)) 5) (forward-char -5)) (looking-at "\\\\left")) (YaTeX-insert-inherit "|\\right|") (forward-char -7)) ((save-excursion ;from matsumath.s.chiba-u.ac.jp (and (> (- (point) (point-min)) 5) (forward-char -5)) (looking-at "\\\\[bB]igl")) (insert (concat "|" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r|")) (forward-char -6)) ((save-excursion (and (> (- (point) (point-min)) 6) (forward-char -6)) (looking-at "\\\\[bB]iggl")) (insert (concat "|" (buffer-substring (match-beginning 0) (- (match-end 0) 1)) "r|")) (forward-char -7)) ((save-excursion ; added by Jin nifty.ne.jp> (and (> (- (point) (point-min)) 6) (forward-char -6)) (looking-at "\\\\left\\\\")) (YaTeX-insert-inherit "|\\right\\|") (forward-char -8)) ((save-excursion (and (> (- (point) (point-min)) 6) (forward-char -6)) (looking-at "\\\\[bB]igl\\\\")) (insert (concat "|" (buffer-substring (match-beginning 0) (- (match-end 0) 2)) "r\\|")) (forward-char -7)) ((save-excursion (and (> (- (point) (point-min)) 7) (forward-char -7)) (looking-at "\\\\[bB]iggl\\\\")) (insert (concat "|" (buffer-substring (match-beginning 0) (- (match-end 0) 2)) "r\\|")) (forward-char -8)) ; added by Jin up to here. ((= (preceding-char) ?\\ ) (YaTeX-insert-inherit "|\\|") (backward-char 2)) ; ((and (YaTeX-closable-p) ; (/= (preceding-char) ?|) ; (/= (following-char) ?|)) ; (YaTeX-insert-inherit "||") ; (backward-char 1)) (t (YaTeX-self-insert arg)))) (defvar YaTeX-use-jmode-hook (and (featurep 'canna) (boundp 'canna:*initialized*) canna:*initialized*) ;; (not (and (fboundp 'skk-mode) (boundp 'skk-mode))) "*Non-nil means activate automatic jmode switcher within/out math mode. Hopefully, change default to t in the next version of 1.75.") (defun YaTeX-jmode-hook (old new) "A hook controling jmode on/off." ;; This function is called via point-entered/leave hook, so that ;; codes in it is evaluated on such emacsen as having text-properties. (let ((inhibit-point-motion-hooks t) (oldp (plist-get (text-properties-at old) 'point-left)) (newp (plist-get (text-properties-at new) 'point-left)) (lnew (plist-get (text-properties-at new) 'last-new)) (mjmode (plist-get (text-properties-at new) 'mjmode)) (bmp (buffer-modified-p)) (jm (YaTeX-jmode)) b e) (unwind-protect (cond ((eq lnew new) nil) ;Do nothing if continuous entry ((and (not (eq newp 'YaTeX-jmode-hook)) (eq oldp 'YaTeX-jmode-hook) (plist-get (text-properties-at old) 'entered)) ;; leave (remove-text-properties (setq b (1+ (or (previous-single-property-change old 'point-left) (1- (point))))) (setq e (1- (or (next-single-property-change old 'point-left) (1+ (point))))) (list 'last-new nil 'entered nil)) (add-text-properties b e (list 'mjmode jm)) (if (boundp 'skk-katakana) (put 'YaTeX-jmode-on 'skkkata skk-katakana)) (if (plist-get (text-properties-at old) 'jmode) (YaTeX-jmode-on))) ((and (not (eq oldp 'YaTeX-jmode-hook)) (eq newp 'YaTeX-jmode-hook) (not (plist-get (text-properties-at new) 'entered))) ;; enter (add-text-properties (1+ (or (previous-single-property-change new 'point-left) (1- (point)))) (1- (or (next-single-property-change new 'point-left) (1+ (point)))) (list 'jmode jm 'last-new new 'entered t)) (if (boundp 'skk-katakana) ;care for skk katakana mode (put 'YaTeX-jmode-on 'skkkata skk-katakana)) (if mjmode (YaTeX-jmode-on) (YaTeX-jmode-off)))) ;;unwind job (set-buffer-modified-p bmp)))) (defun YaTeX-insert-dollar () (interactive) (if (or (not (YaTeX-closable-p)) (= (preceding-char) 92) (and (YaTeX-in-math-mode-p) (or (/= (preceding-char) ?$) (/= (following-char) ?$)))) (insert "$") (insert "$$") (forward-char -1) (and YaTeX-use-jmode-hook (fboundp 'add-text-properties) (add-text-properties (1- (point)) (1+ (point)) (list 'point-left 'YaTeX-jmode-hook 'point-entered 'YaTeX-jmode-hook 'front-sticky t 'rear-nonsticky t 'mjmode nil 'jmode (YaTeX-jmode)))) (YaTeX-jmode-off) (or YaTeX-auto-math-mode YaTeX-math-mode (YaTeX-toggle-math-mode 1)))) (defun YaTeX-insert-dollars-region (beg end) (interactive "r") (YaTeX-insert-braces-region beg end "$" "$")) (defun YaTeX-insert-amper () (interactive) (if (or (string-match YaTeX-array-env-regexp (or (YaTeX-inner-environment t) "document")) (= (preceding-char) 92) (YaTeX-literal-p) (YaTeX-in-math-mode-p)) (insert "&") (insert "\\&"))) (defun YaTeX-version () "Return string of the version of running YaTeX." (interactive) (message (concat "Yet Another tex-mode " (if YaTeX-japan "「野鳥」" "`Wild Bird'") " Revision " YaTeX-revision-number))) (defun YaTeX-typeset-menu (arg &optional char) "Typeset, preview, visit error and miscellaneous convenient menu. Optional second argument CHAR is for non-interactive call from menu." (interactive "P") (message (concat "J)latex R)egion E)nv B)ibtex mk(I)dx " "latex+p(D)f " (if (fboundp 'start-process) "K)ill ") "P)review " (and (boundp 'window-system) window-system "S)earch ") "V)iewErr L)pr")) (let ((sw (selected-window)) (c (or char (read-char)))) (require 'yatexprc) ;for Nemacs's bug (select-window sw) (cond ((memq c '(?j ?\C-j)) (YaTeX-typeset-buffer) ; memq for usability test (put 'dvi2-command 'format 'dvi)) ((= c ?r) (YaTeX-typeset-region)) ((= c ?e) (YaTeX-typeset-environment)) ((= c ?b) (YaTeX-call-builtin-on-file "BIBTEX" bibtex-command arg)) ((= c ?i) (YaTeX-call-builtin-on-file "MAKEINDEX" makeindex-command arg)) ((= c ?k) (YaTeX-kill-typeset-process YaTeX-typeset-process)) ((= c ?p) (call-interactively 'YaTeX-preview)) ((= c ?q) (YaTeX-system "lpq" "Printer queue")) ((= c ?d) (YaTeX-typeset-buffer (or (YaTeX-get-builtin "DVIPDF") YaTeX-dvipdf-command)) (put 'dvi2-command 'format 'pdf)) ((= c ?v) (YaTeX-view-error)) ((= c ?l) (YaTeX-lpr arg)) ((= c ?m) (YaTeX-switch-mode-menu arg)) ((= c ?s) (YaTeX-xdvi-remote-search arg))))) (if (fboundp 'wrap-function-to-control-ime) (wrap-function-to-control-ime 'YaTeX-typeset-menu t "P")) (defun YaTeX-%-menu (&optional beg end char) "Operate %# notation." ;;Do not use interactive"r" for the functions which require no mark (interactive) (message "!)Edit-%%#! D)VIPDF B)EGIN-END P)review pdf(V)iew L)PR M)akeidx b)ibtex dp(I)") (let ((c (or char (read-char))) (string "") key (b (make-marker)) (e (make-marker))) (save-excursion (cond ((rindex "!plmibdv" c) ;Edit %#xxx (setq key (cdr (assq c '((?! . "!") (?p . "PREVIEW") (?l . "LPR") (?m . "MAKEINDEX") (?d . "DVIPDF") (?v . "PDFVIEW") (?i . "IMAGEDPI") (?b . "BIBTEX"))))) (YaTeX-getset-builtin key t)) ((= c ?B) ;%#BEGIN %#END region (or end (setq beg (min (point) (mark)) end (max (point) (mark)))) (set-marker b beg) (set-marker e end) (goto-char (point-min)) (while (re-search-forward "^%#\\(BEGIN\\)\\|\\(END\\)$" nil t) (beginning-of-line) (delete-region (point) (progn (forward-line 1) (point)))) (goto-char b) (open-line 1) (delete-region (point) (progn (beginning-of-line)(point)));for 19 :-< (insert "%#BEGIN") (goto-char e) (insert "%#END\n") (set-marker b nil) (set-marker e nil)))))) (defvar YaTeX-refcommand-def-regexp-default "label\\|bibitem") (defvar YaTeX-refcommand-def-regexp-private nil "*Regexp of defining label commands") (defvar YaTeX-refcommand-def-regexp (concat (if YaTeX-refcommand-def-regexp-private (concat YaTeX-refcommand-def-regexp-private "\\|")) YaTeX-refcommand-def-regexp-default)) (defvar YaTeX-refcommand-ref-regexp-default "\\(page\\|eq\\|fig\\)?ref\\|cite" "Regexp of LaTeX's label-referring macros. Searching for this will be done without `\\\\'. So you need not add patterns if new referring macro ends with \"ref\".") (defvar YaTeX-refcommand-ref-regexp-private nil "*Regexp of referring label commands. See documentation of `YaTeX-refcommand-ref-regexp-default'.") (defvar YaTeX-refcommand-ref-regexp (concat (if YaTeX-refcommand-ref-regexp-private (concat YaTeX-refcommand-ref-regexp-private "\\|")) YaTeX-refcommand-ref-regexp-default)) (defvar YaTeX-refcommand-regexp (concat YaTeX-refcommand-def-regexp "\\|" YaTeX-refcommand-ref-regexp) "Regexp of label defining/referring command name.") (defun YaTeX-goto-corresponding-label (reverse &optional otherwin) "Jump to corresponding \\label{} and \\ref{} or \\cite and \\bibitem. The default search direction depends on the command at the cursor position. When the cursor is on \\ref(\\cite), YaTeX will try to search the corresponding \\label(\\bibitem) backward, and if it fails search forward again. And when the cursor is on \\label(\\bibitem), YaTeX will search the corresponding \\ref(\\cite) forward at first and secondary backward. Argument REVERSE non-nil makes the default direction rule reverse. Since Search string is automatically set in search-last-string, you can repeat search the same label/ref by typing \\[isearch-forward] or \\[isearch-backward]. If optional second argument OTHERWIN is non-nil, move to other window." (let ((scmd "") label direc string blist (p (point)) (cb (current-buffer)) (refcommands YaTeX-refcommand-regexp) (foundmsg (format "Type %s %c to return to original position." (key-description (car (or (where-is-internal 'register-to-point) (where-is-internal 'jump-to-register)))) YaTeX-current-position-register)) (func (function (lambda (string sfunc) (or (funcall sfunc string nil t) (funcall (if (eq sfunc 're-search-forward) 're-search-backward 're-search-forward) string nil t)))))) (cond ((YaTeX-on-section-command-p refcommands) (setq scmd (cdr (assoc (YaTeX-match-string 1) '(("label" . "\\\\\\(page\\|eq\\)?ref{%k}") ("ref" . "\\\\label{%k}") ("eqref" . "\\\\label{%k}") ("pageref" . "\\\\label{%k}") ("cite" . "\\\\bibitem\\(\\[[^]]+\\]\\)?{%k}\\|^\\s *@[a-z]+{%k,") ("bibitem" . "\\\\cite\\(\\[[^]]+\\]\\)?"))))) (goto-char (match-end 0)) (let ((label (YaTeX-buffer-substring (1- (point)) (progn (backward-list 1) (1+ (point))))) (fp (make-marker))fl fn (goother (function (lambda (buffer point) (goto-char point) (if (one-window-p) (split-window-calculate-height YaTeX-default-pop-window-height)) (select-window (get-lru-window)) (switch-to-buffer buffer))))) ;(setq string (concat "\\" scmd "{" label "}")) ;(setq string (concat "\\\\" scmd "{" (regexp-quote label) "}")) (setq string (YaTeX-replace-format scmd "k" (regexp-quote label))) (setq direc (if (string-match "ref\\|cite" scmd) 're-search-forward 're-search-backward)) (if YaTeX-current-position-register (point-to-register YaTeX-current-position-register)) (if reverse (setq direc (if (eq direc 're-search-forward) 're-search-backward 're-search-forward))) (if (funcall func string direc) ;label/ref found! (progn (if otherwin (funcall goother cb p)) (goto-char (match-beginning 0)) (push-mark p)) ;;if label/ref not found, search through all yatex buffers. (goto-char p) ;resume position of current buffer (catch 'found (setq blist (YaTeX-yatex-buffer-list)) (while blist ;; search for corresponding keyword (set-buffer (car blist)) (if (YaTeX-on-section-command-p refcommands) (goto-char (match-beginning 0))) (cond ; cond1 ((funcall func string direc) (cond (otherwin (set-buffer cb) (funcall goother (car blist) p)) ((or (get-buffer-window (car blist)) (and YaTeX-emacs-19 (get-buffer-window (car blist) t))) (goto-buffer-window (car blist))) (t (switch-to-buffer (car blist)) (message foundmsg))) (goto-char (match-beginning 0)) (throw 'found t)) ; cond2 ((and (string-match "bibitem" scmd) (catch 'found2 (save-excursion (goto-char (point-min)) (while (YaTeX-re-search-active-forward "\\\\bibliography{\\([^}]*\\)}" "%" nil t) (setq fl (YaTeX-split-string (YaTeX-match-string 1) ",")) (while fl (if (or (file-exists-p (setq fn (car fl))) (file-exists-p (setq fn (concat fn ".bib")))) (progn (set-buffer (find-file-noselect fn)) (save-excursion (goto-char (point-min)) (if (YaTeX-re-search-active-forward string "%" nil t) (throw 'found2 (set-marker fp (point))))))) (setq fl (cdr fl))))))) (if otherwin (funcall goother (marker-buffer fp) fp) (switch-to-buffer (marker-buffer fp)) (goto-char fp)) (set-marker fp nil) (message foundmsg) (throw 'found t))) (setq blist (cdr blist))) ;; search for bibliography ))) (if YaTeX-emacs-19 (setq regexp-search-ring (cons string (delete string regexp-search-ring))) (setq search-last-regexp string))) (t nil)))) ;;YaTeX-goto-corresponding-environment was moved to yatexlib (defun YaTeX-goto-corresponding-file (&optional other) "Visit or switch buffer of corresponding file, looking at \\input or \\include or \\includeonly or %#SRC{} on current line." (cond ((YaTeX-on-includes-p) (let ((parent buffer-file-name) input-file b) (save-excursion (if (and (re-search-forward "[{%]" (point-end-of-line) t) (= ?{ (char-after (match-beginning 0)))) nil (skip-chars-backward "^,{")) (setq input-file (YaTeX-buffer-substring (point) (progn (skip-chars-forward "^ ,}") (point)))) (if (not (string-match "\\.\\(tex\\|sty\\)$" input-file)) (setq input-file (concat input-file ".tex")))) (cond (other (YaTeX-switch-to-buffer-other-window input-file)) ((setq b (YaTeX-get-file-buffer input-file)) (goto-buffer-window b)) (t (YaTeX-switch-to-buffer input-file))) (or (YaTeX-get-builtin "!") YaTeX-parent-file (setq YaTeX-parent-file parent)))) ;; On %#SRC{somefilters.src} ((YaTeX-on-SRC-p) (let ((src (YaTeX-match-string 1))) (if other (YaTeX-switch-to-buffer-other-window src) (goto-buffer-window (find-file-noselect src))))))) (defun YaTeX-goto-corresponding-BEGIN-END () (if (not (YaTeX-on-BEGIN-END-p)) nil (if (cond ((equal (match-beginning 0) (match-beginning 1)) ;if on %#BEGIN (not (search-forward "%#END" nil t))) (t ; if on %#END (not (search-backward "%#BEGIN" nil t)))) (error "Corresponding %%#BEGIN/END not found.")) (beginning-of-line) t)) (defvar YaTeX-processed-file-regexp-alist nil "Alist of regexp of processed file regexp vs. its file name part; For example, if you include image file with `\\epsfile{file=FILE}' where `FILE' is processed file. You might want to view FILE with other previewer such as ghostview, or want to preview its source which was drawn with other drawing tool, tgif for example. Then you should set entire regexp of including expression and enclose its file name part with \\\\( and \\\\). Ex. (\"\\\\\\\\epsfile{[^}]*file=\\\\([^,} ]+\\\\)\\\\(\\\\.e?ps\\\\)?[^}]*}\" 1) Where the first group surrounded by \\\\( and \\\\) is the file name part of expression. So you should set 1 to second element. And the first matching group is sent to (image) processor defined by the variable YaTeX-file-processor-alist. See also the documentation of YaTeX-file-processor-alist. ↑じゃ良くわかんないすね。例えば tgif hoge.obj して hoge.eps を \\epsfile{file=hoge.eps} でインクルードしているとしよう。その行で \[prefix\] g を押した時に tgif を起動して欲しかったら、まず上のような 正規表現を設定する。\\\\(と\\\\)で囲んだところがファイル名になるように 注意する。でファイル名部分が何番目の\\\\(\\\\)になるかをリストの2番目に書く。 すると、その部分が変数 YaTeX-file-processor-alist で定義された 処理プログラムに渡される。というわけ。 ん〜やっぱりむずかしいね。分からない時は隣の Lisper に聞くか、 fj野鳥の会で聞こう! ") (defvar YaTeX-processed-file-regexp-alist-default '(("\\\\epsfile\\(\\[[^]]+\\]\\)?{[^},]*file=\\(\\([^,} ]*/\\)?[^,}. ]+\\)\\(\\.e?ps\\)?[^}]*}" 2) ("\\\\epsfig{[^},]*fi\\(le\\|gure\\)=\\(\\([^,} ]*/\\)?[^,}. ]+\\)\\(\\.e?ps\\)?[^}]*}" 2) ("\\\\postscriptbox{[^}]*}{[^}]*}{\\(\\([^,} ]*/\\)?[^}. ]+\\)\\(\\.e?ps\\)?}" 1) ("\\\\\\(epsfbox\\|epsfig\\)\\*?{\\(\\([^,} ]*/\\)?[^}. ]+\\)\\(\\.e?ps\\)?}" 2) ;\epsfbox{hoge.ps} ("\\\\includegraphics\\*?\\(.*\\]\\|\\s \\)?{\\(.*\\)\\(\\.ai\\|\\.pdf\\|\\.svg\\|\\.png\\|\\.jpe?g\\|\\.e?ps\\)}" 2) ;\includegraphics[options...]{hoge.eps} ("\\\\\\(psbox\\)\\(\\[[^]]+\\]\\)?{\\(\\([^,} ]*/\\)?[^} ]+\\)\\(\\.e?ps\\)}" 3) ;\psbox[options...]{hoge.eps} (97/1/11) ("\\\\input{\\([^} ]+\\)\\(\\.tps\\)}" 1) ;tgif2tex (1998/9/16) ) "See the documentation of YaTeX-processed-file-regexp-alist.") (defvar YaTeX-file-processor-alist nil "*Alist of files' processor vs. its extension; See also the documentation of YaTeX-processed-file-regexp-alist.") (defvar YaTeX-file-processor-alist-default (list (cons YaTeX-cmd-tgif ".obj") (cons YaTeX-cmd-gimp ".xcf") (cons YaTeX-cmd-gimp ".xcf.gz") (cons YaTeX-cmd-gimp ".xcf.bz2") (cons YaTeX-cmd-edit-svg ".svg") (cons YaTeX-cmd-edit-svg ".svgz") (cons YaTeX-cmd-edit-ai ".ai") '("dia" . ".dia") (cons YaTeX-cmd-ooo ".odg") (cons 'YaTeX-filter-goto-source ".diag") (cons 'YaTeX-filter-goto-source ".dot") ;; List of target file itself below... (cons YaTeX-cmd-edit-images ".jpeg") (cons YaTeX-cmd-edit-images ".jpg") (cons YaTeX-cmd-edit-images ".png") (cons YaTeX-cmd-edit-ps ".ps") (cons YaTeX-cmd-edit-ps ".eps") (cons YaTeX-cmd-edit-pdf ".pdf") '(t . ".tex") '(t . ".sty") '(t . "")) "See the documentation of YaTeX-file-processor-alist.") (defun YaTeX-goto-corresponding-file-processor (&optional other) "Execute corresponding file processor." (save-excursion (or (looking-at YaTeX-ec-regexp) (skip-chars-backward (concat "^" YaTeX-ec) (point-beginning-of-line))) (let ((list (append YaTeX-processed-file-regexp-alist YaTeX-processed-file-regexp-alist-default)) (p (point)) flist file (peol (point-end-of-line)) (basedir (if YaTeX-search-file-from-top-directory (save-excursion (YaTeX-visit-main t) default-directory) "."))) (setq flist (catch 'found (while list (goto-char p) (if (re-search-forward (car (car list)) peol t) (progn (setq file (YaTeX-match-string (car (cdr (car list))))) (throw 'found (cdr (car list))))) (setq list (cdr list))))) (if flist ;if pattern and file name found (let*((plist (append YaTeX-file-processor-alist YaTeX-file-processor-alist-default)) (plist0 plist) ext cmd src buf (alt (car (cdr flist)))) (if (and (re-search-forward (concat YaTeX-comment-prefix "\\s *\\(.*\\)$") peol t) (assoc (setq cmd (YaTeX-match-string 1)) YaTeX-file-processor-alist)) (setq src ;if processor is specified (concat file (cdr (assoc cmd YaTeX-file-processor-alist)))) (while plist ;if processor is not specified (setq ext (cdr (car plist))) (if (and (string< "" (concat file ext)) (file-exists-p (expand-file-name (concat file ext) basedir))) (setq cmd (car (car plist)) src (concat file ext) plist nil)) (setq plist (cdr plist))) (if (and (null src) alt YaTeX-create-file-prefix-g) (setq cmd alt src (concat file (cdr (assoc alt plist0)))))) (if src ;if processor and src file found (let ((default-directory basedir)) (cond ((stringp cmd) (YaTeX-system (concat cmd " " src) cmd) t) ((eq t cmd) (let ((parent buffer-file-name)) (funcall (cond (other 'YaTeX-switch-to-buffer-other-window) ((get-file-buffer src) 'goto-buffer-window) (t 'YaTeX-switch-to-buffer)) src) (or (YaTeX-get-builtin "!") YaTeX-parent-file (setq YaTeX-parent-file parent)) t)) ((symbolp cmd) (cond ((symbol-function cmd) (funcall cmd src other))) t))))))))) (defun YaTeX-on-section-command-p (command) "Check if point is on the LaTeX command: COMMAND(regexp). Return nil if point is not on it. Otherwise return the number of argument position. Section command name is stored in match-data #1. Parsing information is stored to plist. Macros name stored to propname 'command. Macro's argument number stored to propname 'argc." (let ((p (point)) md (parg 0) (argc 1) word (grouping 0) (i 0) (ec+command (concat YaTeX-ec-regexp "\\(" command "\\)"))) (setplist 'YaTeX-on-section-command-p nil) (while (setq i (string-match "\\\\(" command i)) (setq grouping (1+ grouping) i (+ i 2))) (save-excursion (if (looking-at ec+command) nil (catch 'found ;caught value has no meaning ;;(1) looking at current position (and (looking-at command) (save-excursion (while (and (not (bobp)) (looking-at command)) (forward-char -1)) (looking-at ec+command)) (goto-char (match-beginning 0)) (throw 'found t)) ;;If inside of parentheses, try to escape. (unwind-protect (progn (set-syntax-table YaTeX-mode-syntax-table-nonparen) (while (and (not (= (preceding-char) ?\])) ;skip optional arg (condition-case err (progn (up-list -1) t) (error nil))))) (set-syntax-table YaTeX-mode-syntax-table)) (while (equal (preceding-char) ?\]) (backward-list)) ;;(2) search command directly (skip-chars-forward "^{}[]") (and (YaTeX-re-search-active-backward ec+command YaTeX-comment-prefix nil t) (>= p (match-beginning 0)) (throw 'found (goto-char (match-beginning 0)))) ;;(3) search token (goto-char p) (while t (if (bobp) (throw 'found nil)) (cond ((looking-at YaTeX-ec-regexp) (throw 'found t)) ((looking-at "[[{]") nil) ((looking-at "[]}]")(condition-case nil (up-list -1) (error nil))) (t (skip-chars-backward " \t\r\n"))) (skip-chars-backward (concat "^ \t\r\n{}[]" YaTeX-ec-regexp)) (or (bobp) (forward-char -1))))) (if (and (looking-at (concat ec+command "\\(\\(\\[[^]]+\\]\\|([0-9,]+)\\)*\\)" ;optional arg ;"[ \t\n\r]*{[^}]+}")) ;arg braces "[ \t\n\r]*{[^}]*}")) ;arg braces (not (YaTeX-lookup-table (setq word (YaTeX-match-string 1)) 'singlecmd))) (progn (setq md (match-data)) (skip-chars-forward "^{") (if (<= (point) p) (setq parg (1+ parg))) (setq argc (or (car (cdr (YaTeX-lookup-table word 'section))) argc)) (put 'YaTeX-on-section-command-p 'argc argc) (put 'YaTeX-on-section-command-p 'command argc) (while (and (>= (setq argc (1- argc)) 0) (progn (skip-chars-forward " \t\n\r") (looking-at "{"))) (forward-list 1) (if (<= (point) p) (setq parg (1+ parg)))) (store-match-data md) (setq i (+ 2 grouping)) (if (and (match-beginning i) (>= p (match-beginning i)) (< p (match-end i))) -1 ;return -1 if point is on optional arg (if (< p (point)) parg)) ))))) (defun YaTeX-on-maketitle-p () "Check if point is on maketitle type commands. Call this function after YaTeX-on-section-command-p." (let ((p (point))) (save-excursion (or (= (char-after (point)) ?\\ ) (progn (skip-chars-backward (concat "^" YaTeX-ec-regexp) (point-beginning-of-line)) (or (bobp) (bolp) (backward-char 1)))) (and (looking-at (concat YaTeX-ec-regexp YaTeX-TeX-token-regexp)) (<= (match-beginning 0) p) (> (match-end 0) p))))) (defun YaTeX-on-begin-end-p () (save-excursion (if (and (boundp 'in-leftright-p) in-leftright-p) ;; Dirty workaround for YaTeX-goto-corresponding-leftright 2003/3/28 (let ((md (match-data))) ; for safety (if (looking-at YaTeX-ec-regexp) nil ; stay here (cond ((looking-at "\\w") (skip-chars-backward "A-Za-z")) ((looking-at "\\.()\\[\\]|") (forward-char -1))) (if (equal (char-after (1- (point))) (string-to-char YaTeX-ec)) (forward-char -1)))) ;(beginning-of-line) (if (equal (char-after (point)) ?\\) nil ;stay here (skip-chars-backward "^\n\\\\") (or (bolp) (forward-char -1)))) (re-search-forward ;;"\\\\begin{\\([^}]+\\)}\\|\\\\end{\\([^}]+\\)}" (concat (YaTeX-replace-format-args (regexp-quote YaTeX-struct-begin) (concat "\\(" YaTeX-struct-name-regexp "\\)") "" "" "") "\\|" (YaTeX-replace-format-args (regexp-quote YaTeX-struct-end) (concat "\\(" YaTeX-struct-name-regexp "\\)") "" "" "") "\\|\\(" YaTeX-ec-regexp ;;"[][()]\\)" "[\\]\\[]\\)" ) (point-end-of-line) t))) (defun YaTeX-on-includes-p () (save-excursion (beginning-of-line) (re-search-forward "\\(\\(include[^}]*\\)\\|\\(input\\)\\){[^}]*}" (point-end-of-line) t))) (defun YaTeX-on-comment-p (&optional sw) "Return t if current line is commented out. Optional argument SW t to treat all `%' lines as comment, even if on `%#' notation." (save-excursion (beginning-of-line) (skip-chars-forward "\\s ") (looking-at (if sw "%" "%[^#]")))) (defun YaTeX-on-BEGIN-END-p () (save-excursion (let ((case-fold-search nil)) (beginning-of-line) (re-search-forward "\\(%#BEGIN\\)\\|\\(%#END\\)" (point-end-of-line) t)))) (defun YaTeX-on-SRC-p () (save-excursion (let ((case-fold-search nil)) (beginning-of-line) (re-search-forward "%#SRC{\\([^}]+\\)}" (point-end-of-line) t)))) (defun YaTeX-goto-corresponding-* (arg) "Parse current line and call suitable function." (interactive "P") (let (mm) (cond ((YaTeX-goto-corresponding-label arg)) ((YaTeX-goto-corresponding-environment)) ((YaTeX-goto-corresponding-file-processor arg)) ((YaTeX-goto-corresponding-file arg)) ((YaTeX-goto-corresponding-BEGIN-END)) ((and (setq mm (YaTeX-in-math-mode-p)) (YaTeX-goto-corresponding-leftright))) ((and ;;mm YaTeX-use-AMS-LaTeX (YaTeX-goto-corresponding-paren))) ;;((and (string-match ;; YaTeX-equation-env-regexp ;to delay loading ;; (or (YaTeX-inner-environment t) "document")) ;; (YaTeX-goto-corresponding-leftright))) ((YaTeX-goto-corresponding-viewer)) (t (message "I don't know where to go."))))) (defun YaTeX-goto-corresponding-*-other-window (arg) "Parse current line and call suitable function." (interactive "P") (YaTeX-goto-corresponding-* t)) (defun YaTeX-comment-region (alt-prefix) "Comment out region by '%'. If you call this function on the 'begin{}' or 'end{}' line, it comments out whole environment" (interactive "P") (if (not (YaTeX-on-begin-end-p)) (YaTeX-comment-region-sub (if alt-prefix (read-string-with-history "Insert prefix: ") YaTeX-comment-prefix)) (YaTeX-comment-uncomment-env 'YaTeX-comment-region-sub))) (defun YaTeX-uncomment-region (alt-prefix) "Uncomment out region by '%'." (interactive "P") (if (not (YaTeX-on-begin-end-p)) (YaTeX-uncomment-region-sub (if alt-prefix (read-string-with-history "Remove prefix: ") YaTeX-comment-prefix) (region-beginning) (region-end) YaTeX-uncomment-once) (YaTeX-comment-uncomment-env 'YaTeX-uncomment-region-sub))) (defun YaTeX-comment-uncomment-env (func) "Comment or uncomment out one LaTeX environment switching function by FUNC." (let (beg beg2 (p (point))) (save-excursion (beginning-of-line) (setq beg (point)) (save-match-data (while (and (not (eobp)) (not (eolp)) (looking-at YaTeX-comment-prefix)) (goto-char (match-end 0)))) (setq beg2 (point)) (YaTeX-goto-corresponding-environment) (beginning-of-line) (if (> p (point)) (setq beg (1+ beg2)) (forward-char 1)) (funcall func YaTeX-comment-prefix beg (point) YaTeX-uncomment-once))) (message "%sommented out current environment." (if (string-match "uncom" (symbol-name func)) "Un-c" "C"))) (defun YaTeX-comment-paragraph () "Comment out current paragraph." (interactive) (save-excursion (cond ((YaTeX-on-begin-end-p) (beginning-of-line) (insert YaTeX-comment-prefix) (YaTeX-goto-corresponding-environment) (beginning-of-line) (insert YaTeX-comment-prefix)) ((YaTeX-on-comment-p) (message "Already commented out.")) (t (mark-paragraph) (if (looking-at paragraph-separate) (forward-line 1)) (YaTeX-comment-region-sub "%"))))) (defun YaTeX-uncomment-paragraph () "Uncomment current paragraph." (interactive) (save-excursion (if (YaTeX-on-begin-end-p) (let ((p (point-marker))) (YaTeX-goto-corresponding-environment) (YaTeX-remove-prefix YaTeX-comment-prefix YaTeX-uncomment-once) (goto-char p) (YaTeX-remove-prefix YaTeX-comment-prefix YaTeX-uncomment-once) (set-marker p nil)) (if (YaTeX-on-comment-p) (let*((fill-prefix "") ;;append `^%' to head of paragraph delimiter. (paragraph-start (concat "^$\\|^%\\(" YaTeX-paragraph-separate "\\)")) (paragraph-separate paragraph-start)) (mark-paragraph) (if (not (bobp)) (forward-line 1)) (YaTeX-uncomment-region-sub "%" nil nil YaTeX-uncomment-once)) (message "This line is not a comment line."))))) (defun YaTeX-remove-prefix (prefix &optional once) "Remove prefix on current line as far as prefix detected. But optional argument ONCE makes deletion once." (interactive "sPrefix:") (beginning-of-line) (while (re-search-forward (concat "^" prefix) (point-end-of-line) t) (replace-match "") (if once (end-of-line)))) (defun YaTeX-kill-some-pairs (predicate gofunc kill-contents) "Kill some matching pair. This function assumes that pairs occupy whole of each line where they resid." (if (not (funcall predicate)) nil (let ((b1 (match-beginning 0)) (e1 (match-end 0)) b2 e2) (save-excursion (funcall gofunc) (funcall predicate) ;get match data (if (< (point) e1) ;if currently on begin-line (progn (setq b2 b1 e2 e1 b1 (match-beginning 0) e1 (match-end 0)) (goto-char e2)) ;goto end-line's end (setq b2 (match-beginning 0) e2 (match-end 0)) (goto-char e2)) ;now e2 has surely end-line's end (skip-chars-forward " \t") (and (eolp) (not (eobp)) (setq e2 (1+ (point)))) (if (not kill-contents) (kill-region (progn (goto-char b2) (skip-chars-backward " \t%") (if (bolp) (point) b2)) e2)) (goto-char b1) (skip-chars-backward " \t%") (if (not kill-contents) (progn (kill-append (buffer-substring (setq b1 (if (bolp) (point) b1)) (setq e1 (progn (goto-char e1) (while (looking-at "{\\| \t") (forward-list 1)) (skip-chars-forward " \t") (if (and (eolp) (not (eobp))) (1+ (point)) (point))))) t) (delete-region b1 e1)) (kill-region (if (bolp) (point) b1) e2))) t))) (defun YaTeX-kill-section-command (point kill-all) "Kill section-type command at POINT leaving its last argument. Non-nil for the second argument kill its last argument too." (let ((cmd (get 'YaTeX-on-section-command-p 'command)) (argc (get 'YaTeX-on-section-command-p 'argc)) beg (end (make-marker))) (save-excursion (goto-char point) (or (looking-at YaTeX-ec-regexp) (progn (skip-chars-backward (concat "^" YaTeX-ec-regexp)) (forward-char -1))) (setq beg (point)) (skip-chars-forward "^{") (while (> (setq argc (1- argc)) 0) (skip-chars-forward "^{") (forward-list 1)) (kill-region beg (point)) (forward-list 1) (set-marker end (point)) (if kill-all (progn (kill-append (buffer-substring beg end) nil) (delete-region beg end)) (goto-char beg) (kill-append (buffer-substring (point) (progn (skip-chars-forward "^{" end) (1+ (point)))) nil) (delete-region beg (1+ (point))) (goto-char end) (set-marker end nil) (kill-append (buffer-substring (point) (1- (point))) nil) (delete-backward-char 1))))) (defun YaTeX-kill-paren (kill-contents) "Kill parentheses leaving its contents. But kill its contents if the argument KILL-CONTENTS is non-nil." (interactive "P") (let (p bsl (backslash-syntax (char-to-string (char-syntax ?\\))) (md (match-data))) (unwind-protect (save-excursion (modify-syntax-entry ?\\ " ") (if (looking-at "\\s(\\|\\(\\s)\\)") (progn (if (match-beginning 1) (up-list -1)) (if (and (> (point) (point-min)) (= (char-after (1- (point))) ?\\ )) (setq p (1- (point)) bsl t) (setq p (point))) (forward-list 1) ;(YaTeX-goto-open-paren t) (if kill-contents (delete-region p (point)) (backward-delete-char 1) (cond ((save-excursion (forward-char -2) (looking-at (concat YaTeX-ec-regexp "/"))) (backward-delete-char 2)) ((= (char-after (1- (point))) ?\\) (backward-delete-char 1))) (goto-char p) (if (looking-at (concat "{" YaTeX-ec-regexp YaTeX-command-token-regexp "+" "\\s +")) (delete-region (point) (match-end 0)) (delete-char 1) (if bsl (delete-char 1)))) t))) (modify-syntax-entry ?\\ backslash-syntax) (store-match-data md)))) (defvar YaTeX-read-environment-history nil "Holds history of environments.") (put 'YaTeX-read-environment-history 'no-default t) (defun YaTeX-read-environment (prompt &optional predicate must-match initial) "Read a LaTeX environment name with completion." (YaTeX-sync-local-table 'tmp-env-table) (completing-read-with-history prompt (append tmp-env-table user-env-table env-table) predicate must-match initial 'YaTeX-read-environment-history)) (defvar YaTeX-read-section-history nil "Holds history of section-types.") (put 'YaTeX-read-section-history 'no-default t) (defun YaTeX-read-section (prompt &optional predicate initial) "Read a LaTeX section-type command with completion." (YaTeX-sync-local-table 'tmp-section-table) (let ((minibuffer-completion-table (append tmp-section-table user-section-table section-table))) (read-from-minibuffer-with-history prompt initial YaTeX-section-completion-map nil 'YaTeX-read-section-history))) (defun YaTeX-read-section-with-overview () "Read sectioning command with overview. This function refers a local variable `source-window' in YaTeX-make-section, because this function is called with no argument." (interactive) (require 'yatexsec) ;some case needs this (if (> (minibuffer-depth) 1) (error "Too many minibuffer levels for overview.")) (let ((sw (selected-window)) (minibuffer-max-depth nil) ; for XEmacs20 (enable-recursive-minibuffers t) sect) (unwind-protect (progn (select-window source-window) (setq sect (YaTeX-read-section-in-minibuffer "Sectioning(Up=C-p, Down=C-n, Help=?): " YaTeX-sectioning-level (YaTeX-section-overview)))) (select-window sw)) (YaTeX-minibuffer-erase) (insert sect) (exit-minibuffer))) (defvar YaTeX-read-fontsize-history nil "Holds history of font designator.") (put 'YaTeX-read-fontsize-history 'no-default t) (defun YaTeX-read-fontsize (prompt &optional predicate must-match initial) "Read a LaTeX font changing command with completion." (YaTeX-sync-local-table 'tmp-fontsize-table) (completing-read-with-history prompt (append tmp-fontsize-table user-fontsize-table fontsize-table) predicate must-match initial 'YaTeX-read-fontsize-history)) (defun YaTeX-change-environment () "Change the name of environment." (interactive) (if (not (YaTeX-on-begin-end-p)) nil (save-excursion (let (p env newenv (m1 (match-beginning 1)) (m2 (match-beginning 2))) (setq env (if m1 (YaTeX-buffer-substring m1 (match-end 1)) (YaTeX-buffer-substring m2 (match-end 2)))) (goto-char (match-beginning 0)) (set-mark-command nil) (YaTeX-goto-corresponding-environment) (setq newenv (YaTeX-read-environment (format "Change environment `%s' to: " env))) (cond ((string= newenv "") (message "Change environment cancelled.")) ((string= newenv env) (message "No need to change.")) (t (search-forward (concat "{" env) (point-end-of-line) t) (replace-match (concat "{" newenv) t) (exchange-point-and-mark) (search-forward (concat "{" env) (point-end-of-line) t) (replace-match (concat "{" newenv) t))) t)))) (defun YaTeX-change-section () "Change section-type command." (interactive) (let*((where (YaTeX-on-section-command-p YaTeX-command-token-regexp)) (p (point)) (cmd (YaTeX-match-string 1)) (beg (make-marker)) (end (make-marker)) old new) (if (null where) nil (unwind-protect (let ((source-window (selected-window))) (cond ((equal where 0);;if point is on section command (set-marker beg (match-beginning 1)) (set-marker end (match-end 1)) (goto-char beg) ;beginning of the command (setq new (YaTeX-read-section (format "Change `%s' to: " cmd) nil) old cmd)) ((= where -1);;if point is on a optional parameter (set-marker beg (match-beginning 2)) (skip-chars-forward "^{") (set-marker end (point)) (goto-char p) (setq new (if (fboundp (intern-soft (concat YaTeX-addin-prefix cmd))) (YaTeX-addin cmd) (concat "[" (read-string (format "Change `%s' to: " (setq old (YaTeX-buffer-substring (1+ beg) (1- end))))) "]")))) ((> where 0);;if point is in arguments' braces (or (looking-at "{") (progn (skip-chars-backward "^{") (forward-char -1))) (set-marker beg (1+ (point))) (forward-list 1) (forward-char -1) (set-marker end (point)) (setq old (YaTeX-buffer-substring beg end)) (goto-char p) (if (> (length old) 40) (setq old (concat (substring old 0 12) "..." (substring old -12)))) (setq new (if (intern-soft (concat "YaTeX::" cmd)) (funcall (intern-soft (concat "YaTeX::" cmd)) where) (read-string (format "Change `%s' to: " old))))) ) ;cond (if (string= old new) nil ;do not replace (delete-region beg end) (goto-char beg) (insert-before-markers new))) (set-marker beg nil) (set-marker end nil)) ;;(goto-char (marker-position p)) new))) (defun YaTeX-change-fontsize () "Change large-type command." (let ((lt (append tmp-fontsize-table user-fontsize-table fontsize-table)) (p (point)) large old new beg end) ;;(and (looking-at "}") (up-list -1)) ;;(and (looking-at "{") (forward-char 1)) ;;Is above convenient? (save-excursion (or (looking-at YaTeX-ec-regexp) (progn (skip-chars-backward (concat "^" YaTeX-ec-regexp)) (forward-char -1))) (cond ((and (looking-at (concat YaTeX-ec-regexp "\\(" YaTeX-TeX-token-regexp "\\)")) (< p (match-end 0)) (assoc (setq old (YaTeX-match-string 1)) lt)) (goto-char p) (setq beg (match-beginning 1) end (match-end 1) ;save match position new (completing-read (format "Change font/size `%s' to : " old) lt)) (delete-region beg end) (goto-char beg) (insert-before-markers new) new) (t nil) )))) (defun YaTeX-change-math-image () "Change with image completion." (let (maketitle memberp beg end) (if (and (YaTeX-on-maketitle-p) (progn (setq maketitle (substring (YaTeX-match-string 0) 1)) (setq memberp (YaTeX-math-member-p maketitle)))) (let*((last-command-char (string-to-char (car memberp))) (last-command-event last-command-char)) (setq beg (match-beginning 0) end (match-end 0)) (delete-region beg end) (YaTeX-math-insert-sequence t (cdr memberp)))))) (defun YaTeX-kill-* (&optional arg) "Parse current line and call suitable function. Non-nil for ARG kills its contents too." (interactive "P") (cond ((YaTeX-kill-some-pairs 'YaTeX-on-begin-end-p 'YaTeX-goto-corresponding-environment arg)) ((YaTeX-kill-some-pairs 'YaTeX-on-BEGIN-END-p 'YaTeX-goto-corresponding-BEGIN-END arg)) ((YaTeX-on-section-command-p YaTeX-command-token-regexp);on any command (YaTeX-kill-section-command (match-beginning 0) arg)) ((YaTeX-kill-paren arg)) ((and (fboundp 'overlays-at) (member YaTeX-on-the-fly-overlay (overlays-at (point)))) (YaTeX-on-the-fly-cancel)) (t (message "I don't know what to kill.")))) (defun YaTeX-change-* () "Parse current line and call suitable function." (interactive) (cond ((YaTeX-change-parentheses)) ((YaTeX-change-environment)) ((YaTeX-change-section)) ((YaTeX-change-fontsize)) ((YaTeX-change-math-image)) (t (message "I don't know what to change.")))) ;;; ;Check availability of add-in functions ;;; (cond ((featurep 'yatexadd) nil) ;Already provided. ((progn (load "yatexadd" t) (featurep 'yatexadd)) nil) (t (message "YaTeX add-in functions not supplied."))) (defun YaTeX-addin (name) "Check availability of addin function and call it if exists." (if (and (not (get 'YaTeX-generate 'disabled)) (intern-soft (concat YaTeX-addin-prefix name)) (fboundp (intern-soft (concat YaTeX-addin-prefix name)))) (let ((s (funcall (intern (concat YaTeX-addin-prefix name))))) (if (stringp s) s "")) "")) ;Add in function is not bound. (defun YaTeX-on-item-p (&optional point) "Return t if POINT (default is (point)) is on \\item." (let ((p (or point (point)))) (save-excursion (goto-char p) (end-of-line) (setq p (point)) (re-search-backward YaTeX-paragraph-delimiter nil t) (re-search-forward YaTeX-item-regexp p t)))) (defun YaTeX-in-verb-p (&optional point) "Check if POINT is in verb or verb*. Default of POINT is (point)." (setq point (or point (point))) (save-excursion (let ((md (match-data))) (goto-char point) (unwind-protect (if (not (re-search-backward (concat YaTeX-ec-regexp "\\(" YaTeX-verb-regexp "\\)" "\\([^-A-Za-z_*]\\)") (point-beginning-of-line) t)) nil (goto-char (match-end 2)) (skip-chars-forward (concat "^" (YaTeX-buffer-substring (match-beginning 2) (match-end 2)))) (and (< (match-beginning 2) point) (< (1- point) (point)))) (store-match-data md))))) (defun YaTeX-literal-p (&optional point) "Check if POINT is in verb or verb* or verbatime environment family. Default of POINT is (point)." (let ((md (match-data))) (unwind-protect (cond ((equal YaTeX-ec "\\") ;maybe LaTeX (save-excursion (and point (goto-char point)) (or (YaTeX-in-verb-p (point)) (and (not (looking-at "\\\\end{verb")) (YaTeX-quick-in-environment-p YaTeX-verbatim-environments)))))) (store-match-data md)))) ;; Filling \item (defun YaTeX-remove-trailing-comment (start end) "Remove trailing comment from START to end." (save-excursion (let ((trcom (concat YaTeX-comment-prefix "$"))) (goto-char start) (while (re-search-forward trcom end t) (if (/= (char-after (1- (match-beginning 0))) ?\\ ) (replace-match "\\1")))))) (defvar YaTeX-itemize-withlabel-max-indent-depth 8) (defun YaTeX-get-item-info (&optional recent thisenv) "Return the list of the beginning of \\item and column of its item. If it seems to be outside of itemizing environment, just return nil. Non-nil for optional argument RECENT refers recent \\item. Optional second argument THISENV omits calling YaTeX-inner-environment." (save-excursion (let* ((p (point)) env e0 c cc md (bndry (and (setq env (or thisenv (YaTeX-inner-environment t))) (get 'YaTeX-inner-environment 'point)))) (end-of-line) (if (if recent (catch 'found (while (YaTeX-re-search-active-backward YaTeX-item-regexp YaTeX-comment-prefix bndry t) (setq md (match-data)) (YaTeX-inner-environment t) (store-match-data md) (if (= bndry (get 'YaTeX-inner-environment 'point)) (throw 'found t)))) (goto-char bndry) (YaTeX-re-search-active-forward YaTeX-item-regexp YaTeX-comment-prefix p t)) (progn (goto-char (match-end 0)) ;(setq c (current-column)) (if (string-match "desc" env) (setq c 6) (setq cc (current-column)) (if (equal (following-char) ?\[) (forward-list 1)) (if (< (- (current-column) cc) YaTeX-itemize-withlabel-max-indent-depth) (setq c 0) (move-to-column cc) (setq c YaTeX-itemize-withlabel-max-indent-depth))) (skip-chars-forward " \t" (point-end-of-line)) (list (point-beginning-of-line) (+ c (current-column)))))))) (defun YaTeX-fill-item () "Fill item in itemize environment." (interactive) (save-excursion (let* ((p (point)) (item-term (concat "\\(^[ \t]*$\\)\\|" YaTeX-item-regexp "\\|\\(" YaTeX-ec-regexp "\\(begin\\|end\\)\\)")) ;;This value depends on LaTeX. fill-prefix start col (info (YaTeX-get-item-info t))) (if (null info) nil ;not on \item, do nothing (setq start (car info) col (car (cdr info))) (save-excursion (if (re-search-backward "^\\s *$" start t) ;;if separated from \item line, isolate this block (progn (setq start (1+ (match-end 0))) (goto-char start) (skip-chars-forward " \t") (delete-region (point) start) ;is this your favor??? (indent-to col)))) (beginning-of-line) (if (<= (save-excursion (re-search-forward (concat "\\\\end{\\|\\\\begin{\\|^[ \t]*$") nil t) (match-beginning 0)) p) (progn (message "Not on itemize.") nil) (end-of-line) (newline) (indent-to col) (setq fill-prefix (YaTeX-buffer-substring (point-beginning-of-line)(point))) (beginning-of-line) (delete-region (point) (progn (forward-line 1) (point))) (re-search-forward item-term nil 1) (YaTeX-remove-trailing-comment start (point)) (beginning-of-line) (push-mark (point) t) (goto-char start) (forward-line 1) (while (< (point) (mark)) (delete-region (point) (progn (skip-chars-forward " \t") (point))) (forward-line 1)) (fill-region-as-paragraph start (mark)) (if NTT-jTeX (while (progn(forward-line -1)(end-of-line) (> (point) start)) (insert ?%))) (pop-mark)))))) (defun YaTeX-fill-paragraph (arg) "YaTeX adjustment function for fill-paragraph. *Protect \\verb from unexpected broken up." (interactive "P") (cond ((not (eq major-mode 'yatex-mode)) (fill-paragraph arg)) ((YaTeX-quick-in-environment-p YaTeX-fill-inhibit-environments) nil) ((YaTeX-in-math-mode-p) nil) (t (save-excursion (let*((verbrex (concat YaTeX-ec-regexp "\\(" YaTeX-verb-regexp "\\)" ;match#1 "\\(.\\).*\\(\\2\\)")) ;match #2 and #3 (tilderex (concat "\\(" YaTeX-kanji-regexp "~" "\\)" YaTeX-ec-regexp "\\|\\(" "~" YaTeX-kanji-regexp "\\)")) (p (point)) ii end poslist spacelist lenlist b e n (fill-prefix fill-prefix) (inenv (or (YaTeX-inner-environment t) "document")) (border (get 'YaTeX-inner-environment 'point))) (cond ((save-excursion (beginning-of-line) ;if point is on the first (setq end (point)) ;non-whitespace char (skip-chars-forward " \t") (equal (point) p)) (setq fill-prefix (YaTeX-buffer-substring p end))) ((and ;;(not YaTeX-emacs-19) (string-match YaTeX-itemizing-env-regexp inenv) (setq ii (YaTeX-get-item-info))) (save-excursion (beginning-of-line) (indent-to-column (car (cdr ii))) (setq fill-prefix (YaTeX-buffer-substring (point) (point-beginning-of-line))) (delete-region (point) (progn (beginning-of-line) (point)))))) (cond ((string-match "tabular" inenv) (let ((b (point-beginning-of-line)) (e (point-end-of-line))) (if (re-search-backward "&\\|\\\\\\\\\\|\\\\\\(begin\\|end\\){" border t) (setq b (if (match-beginning 1) (progn (forward-line 1) (point)) (point-beginning-of-line)))) (goto-char p) (if (re-search-forward "&\\|\\\\\\\\\\|\\\\\\(end\\|begin\\){" nil t) (setq e (if (match-beginning 1) (progn (forward-line -1) (point-end-of-line)) (match-beginning 0)))) (set-mark e) (goto-char b))) (t (mark-paragraph))) (save-restriction (narrow-to-region (region-beginning) (region-end)) (YaTeX-remove-trailing-comment (point-min) (point-max)) ;; First, replace spaces in verb to _ temporarily. (goto-char (point-min)) (while (YaTeX-re-search-active-forward verbrex YaTeX-comment-prefix (point-max) t) (setq end (match-beginning 3)) (goto-char (match-beginning 2)) (while (re-search-forward "\\s " end t) (setq poslist (cons (make-marker) poslist) spacelist (cons (preceding-char) spacelist) lenlist (cons 1 lenlist)) (replace-match "_") (set-marker (car poslist) (match-beginning 0)))) ;; Second, replace "表~\ref{...}" to "\\\ref{...}" (goto-char (point-min)) (while (YaTeX-re-search-active-forward tilderex YaTeX-comment-prefix (point-max) t) (if (match-beginning 1) (setq b (match-beginning 1) e (match-end 1) n 1) (setq b (match-beginning 2) e (match-end 2) n 2)) (setq poslist (cons (make-marker) poslist) spacelist (cons (YaTeX-match-string n) spacelist) lenlist (cons 2 lenlist)) (goto-char (match-beginning 0)) (delete-region (point) e) (insert YaTeX-ec YaTeX-ec) ;set-marker should be here (set-marker (car poslist) b)) ;;(fill-paragraph arg) (fill-region-as-paragraph (point-min) (point-max) arg) (while spacelist (goto-char (car poslist)) (set-marker (car poslist) nil) (and (eolp) (skip-chars-forward "\n\t ")) (delete-char (car lenlist)) (insert (car spacelist)) (setq spacelist (cdr spacelist) poslist (cdr poslist) lenlist (cdr lenlist))) (goto-char (point-min)) (forward-word 1) (beginning-of-line) (while (re-search-forward "\\\\\\([a-z]*ref\\|cite\\){" nil t) (if (< (point-end-of-line) (save-excursion (forward-char -1) (forward-list 1) (point))) (progn (end-of-line) (if (save-excursion (backward-word 1) (looking-at "[^0-9A-z!-)]")) (insert YaTeX-comment-prefix))))) ;; Nonbreak space `~' (goto-char (point-min)) (while (YaTeX-re-search-active-forward "~\\(\\s *\\)$" YaTeX-comment-prefix (point-max) t) (delete-region (match-beginning 1) (match-end 1)) (insert YaTeX-comment-prefix)) (goto-char (point-min)) (if (and NTT-jTeX (looking-at "[ \t]\\|^$")) (progn (goto-char (point-min)) (while (not (eobp)) (end-of-line) (or (bolp) (save-excursion (backward-word 1) (looking-at "[0-9A-z!-)]")) ;is not japanese string (progn (setq p (point)) (insert YaTeX-comment-prefix))) (forward-line 1)) (goto-char p) (if (looking-at "%") (delete-char 1)) ;remove last inserted `%' )))))))) (if (fboundp 'YaTeX-saved-indent-new-comment-line) nil (fset 'YaTeX-saved-indent-new-comment-line (symbol-function 'indent-new-comment-line)) (fset 'indent-new-comment-line 'YaTeX-indent-new-comment-line)) (defun YaTeX-indent-new-comment-line (&optional soft) "Tuned `indent-new-comment-line' function for yatex. See the documentation of `YaTeX-saved-indent-new-comment-line'." (interactive) (cond ((or (not (memq major-mode '(yatex-mode yahtml-mode))) (string-match "document" (or (and (boundp 'inenv) inenv) (or (YaTeX-inner-environment t) "document")))) (apply 'YaTeX-saved-indent-new-comment-line (if soft (list soft)))) ; ((and (eq major-mode 'yahtml-mode) ; (string-match ; "^[Pp][Rr][Ee]" (yahtml-inner-environment-but "^[Aa]\\b" t))) ; (yahtml-indent-new-commnet-line)) ((and (eq major-mode 'yatex-mode) ;1997/2/4 (YaTeX-in-math-mode-p)) nil) ;1996/12/30 (t (let (fill-prefix) (apply 'YaTeX-saved-indent-new-comment-line (if soft (list soft))))))) (defun YaTeX-fill-* () "Fill paragraph according to its condition." (interactive) (cond ((YaTeX-fill-item)) )) ;; Accent completion (defun YaTeX-read-accent-char (x) "Read char in accent braces." (let ((c (read-char))) (concat (if (and (or (= c ?i) (= c ?j)) (not (string-match (regexp-quote x) "cdb"))) "\\" "") (char-to-string c)))) (defun YaTeX-make-accent () "Make accent usage." (interactive) (message "1:` 2:' 3:^ 4:\" 5:~ 6:= 7:. u v H t c d b") (let ((c (read-char))(case-fold-search nil)) (setq c (cond ((and (> c ?0) (< c ?8)) (substring "`'^\"~=." (1- (- c ?0)) (- c ?0))) ((= c ?h) "H") (t (char-to-string c)))) (if (not (string-match c "`'^\"~=.uvHtcdb")) nil (insert "\\" c "{}") (backward-char 1) (insert (YaTeX-read-accent-char c)) (if (string= c "t") (insert (YaTeX-read-accent-char c))) (forward-char 1)))) ;; Field skip in tabular (defun YaTeX-forward-field (arg) "Move forward to the ARGth next column field of table." (interactive "p") (if (< arg 0) (YaTeX-backward-field (- arg)) (let ((ep (save-excursion (YaTeX-end-of-environment) (point))) (wc (car (YaTeX-array-what-column-internal)))) (while (>= (setq arg (1- arg)) 0) (skip-chars-forward "^&\\\\") (while (and (not (eobp)) (> ep (point)) (looking-at "\\&\\|\\\\") (= wc (car (YaTeX-array-what-column-internal)))) (skip-chars-forward "&" ep) (while (looking-at "[\n\t ]+\\|\\\\\\\\\\|\\\\.line\\>") (goto-char (match-end 0)) )))))) (defun YaTeX-backward-field (arg) "Move backward to the ARGth next column field of table." (interactive "p") (if (< arg 0) (YaTeX-forward-field (- arg)) (let ((bp (save-excursion (YaTeX-beginning-of-environment) (point-end-of-line))) (wc (car (YaTeX-array-what-column-internal)))) (while (>= (setq arg (1- arg)) 0) (skip-chars-backward "^&\\\\" bp) (while (and (not (bobp)) (< bp (point)) (memq (preceding-char) '(?& ?\\)) (= wc (car (YaTeX-array-what-column-internal)))) (skip-chars-backward "&\\\\" bp) (skip-chars-backward "\n\t " bp)) (if (eolp) (skip-chars-forward "^&\\\\")))))) ;; Indentation (defun YaTeX-current-indentation () "Return the indentation of current environment." (save-excursion ;;(beginning-of-line) (if (YaTeX-beginning-of-environment t) (goto-char (get 'YaTeX-inner-environment 'point)) (forward-line -1) (beginning-of-line) (skip-chars-forward " \t")) (current-column))) (defun YaTeX-previous-line-indentation () (save-excursion (forward-line -1) (skip-chars-forward " \t") (current-column))) (defvar YaTeX-noindent-env-regexp "verbatim\\*?\\|alltt" "*Regexp of environment names that should begin with no indentation. All verbatime-like environment name should match with.") (defun YaTeX-indent-line () "Indent corrent line referrin current environment." (interactive) (let ((indent-relative (function (lambda (&optional additional) (YaTeX-reindent (+ (YaTeX-current-indentation) (or additional 0) YaTeX-environment-indent))))) sect depth iteminfo (p (point)) pp (peol (point-end-of-line)) begend ;;inenv below is sometimes defined in YaTeX-indent-new-comment-line (inenv (or (and (boundp 'inenv) inenv) (YaTeX-inner-environment t)))) ;;(if NTT-jTeX ;;Do you need this section? ;; (save-excursion ;; (end-of-line) ;; (let ((p (point))) ;; (forward-line -1) ;; (end-of-line) ;; (or (= p (point)) ;; (progn (backward-char (length YaTeX-comment-prefix)) ;; (not (looking-at (regexp-quote YaTeX-comment-prefix)))) ;; (progn ;; (skip-chars-backward YaTeX-comment-prefix) ;; (kill-line)))))) (or inenv (setq inenv "document")) ;is the default environment (cond ((and (prog1 (YaTeX-on-begin-end-p) (setq begend (match-beginning 0))) (or (match-beginning 2) ;if \end (and (match-beginning 3) ;if \) \] (= (char-syntax (char-after (1+ (match-beginning 3)))) ?\))))) (YaTeX-reindent (save-excursion (YaTeX-goto-corresponding-environment) (current-column)))) ;; on the begining of verbatime line, remove all indentation ((and begend ;; match-beginning 0 of \begin YaTeX-noindent-env-regexp (stringp YaTeX-noindent-env-regexp) (save-excursion (and ;; if the \begin is the first declaration of this line (progn (beginning-of-line) (skip-chars-forward " \t") (= begend (point))) (progn (goto-char begend) (looking-at (concat YaTeX-ec-regexp "begin{\\(" YaTeX-noindent-env-regexp "\\)}")))))) (save-excursion (goto-char begend) (delete-region (point) (point-beginning-of-line)))) ((string-match YaTeX-equation-env-regexp inenv) (YaTeX-indent-line-equation)) ;autoload-ed from yatexenv (;(YaTeX-in-environment-p '("itemize" "enumerate" "description" "list")) (string-match YaTeX-itemizing-env-regexp inenv) ;;(YaTeX-on-item-p) ?? ;;(setq iteminfo (YaTeX-get-item-info t)) (if (save-excursion (beginning-of-line) (re-search-forward YaTeX-item-regexp peol t)) (progn (save-excursion (goto-char (1+ (match-beginning 0))) (setq depth (* YaTeX-environment-indent (cond ((looking-at "subsubsub") 3) ((looking-at "subsub") 2) ((looking-at "sub") 1) (t 0))))) (funcall indent-relative depth)) (YaTeX-reindent (or (car (cdr (YaTeX-get-item-info t inenv))) (+ (save-excursion (beginning-of-line) (YaTeX-current-indentation)) YaTeX-environment-indent)))) ) ((YaTeX-literal-p) ;verbatims (tab-to-tab-stop)) ((string-match "\\(tabular\\|array\\)" inenv) ;1.73 (let ((n 1) (cc (current-column)) (p (point))) (condition-case err (save-excursion (beginning-of-line) (skip-chars-forward "[ \t]") ;;(if (looking-at "&") (forward-char 1)) (require 'yatexenv) (setq n (car (YaTeX-array-what-column-internal)))) (error nil)) (YaTeX-reindent (+ (YaTeX-current-indentation) YaTeX-environment-indent (* (1- n) YaTeX-tabular-indentation))) (and (= cc (current-column)) (= p (point)) (equal last-command 'YaTeX-indent-line) ;; if NO indent action occured, move to the next column (YaTeX-forward-field 1)))) ((and inenv (not (equal "document" inenv))) (funcall indent-relative)) ((YaTeX-on-section-command-p YaTeX-sectioning-regexp) (require 'yatexsec) ;to know YaTeX-sectioning-level (setq sect (YaTeX-match-string 1)) (if (string-match "\\*$" sect) (setq sect (substring sect 0 -1))) (YaTeX-reindent (* (max (1- ;I want chapter to have indentation 0 (or (cdr (assoc sect YaTeX-sectioning-level)) 0)) 0) YaTeX-environment-indent))) ;;Default movement ((and (bolp) fill-prefix) (insert fill-prefix)) (t (save-excursion (beginning-of-line) (if fill-prefix (progn (delete-region (point) (progn (skip-chars-forward " \t") (point))) (insert fill-prefix)) (skip-chars-forward " \t") (if (bobp) nil (indent-relative-maybe)))) (skip-chars-forward " \t"))) ;;if current line is \begin, re-indent \end too (if (and (YaTeX-on-begin-end-p) (match-beginning 1)) (save-excursion ;;(beginning-of-line) ;;(search-forward "\\begin") (goto-char (match-beginning 0)) (setq depth (current-column)) (YaTeX-goto-corresponding-environment) (YaTeX-reindent depth))) (if (or (and NTT-jTeX (save-excursion (beginning-of-line) (looking-at "[ \t]"))) (save-excursion (beginning-of-line) (and (not (bobp)) (progn (backward-char 1) (re-search-backward "\\\\\\(\\(page\\)?ref\\|cite\\){" (point-beginning-of-line) t)) (goto-char (1- (match-end 0))) (> (save-excursion (condition-case () (progn (forward-list 1) (point)) (error (point-max)))) (point-end-of-line))))) (save-excursion (end-of-line) (let ((p (point))) (forward-line -1) (end-of-line) (or (= p (point)) (looking-at (regexp-quote YaTeX-comment-prefix)) (bobp) (bolp) (save-excursion (backward-word 1) (looking-at "\\sw+")) ;is not japanese string (insert YaTeX-comment-prefix))))))) (defun YaTeX-comment-line-break (&optional soft) "Call comment-indent-new-line and YaTeX-indent-line" (comment-indent-new-line soft) (YaTeX-indent-line)) (defun YaTeX-latex2e-p () (let ((b (current-buffer)) (ptn (concat YaTeX-ec "documentclass"))) (unwind-protect (or (save-excursion (search-backward ptn nil t)) (progn (YaTeX-visit-main t) (save-excursion (search-backward ptn nil t)))) (set-buffer b)))) (provide 'yatex) (defvar yatex-mode-load-hook nil "*List of functions to be called when yatex.el is loaded.") (if (and YaTeX-emacs-19 YaTeX-display-color-p (not (featurep 'yatex19))) (load "yatex19")) (load "yatexhks" t) ;;-------------------- Final hook jobs -------------------- (substitute-all-key-definition 'fill-paragraph 'YaTeX-fill-paragraph YaTeX-mode-map) (substitute-all-key-definition 'kill-buffer 'YaTeX-kill-buffer YaTeX-mode-map) (run-hooks 'yatex-mode-load-hook) ;; `History' was moved to ChangeLog ;----------------------------- End of yatex.el ----------------------------- yatex1.81/yatex.new010064400037440000000000000674761341014442300134310ustar yuujiwheel What's new in YaTeX/yahtml 野鳥/yahtml - 各バージョンの変更点について 1.81 emacs-26 の主要関数の仕様変更に対応。 == yatex == タイプセットコマンド定義中の %k を漢字コード名に変換(-kanji=%k) ドット環境で外部フィルタを自動起動する機能を追加。 graphiz, blockdiagの変換結果も on-the-fly 表示。 subfigure, bibliographystyle, includesvg補完。 == yahtml == meta要素で view-port を入れやすく。 1.80 string-to-int除外と同時に emacs-18 をサポート外に。 2-Clause BSDでもOKという風に書いてみた。 RCS管理を外した。 == yatex == ラベル補完バッファで M-e, M-i 等でラベル種の絞り込み可能。 dviからPS変換コマンドを少し丁寧に探すようにした。 mathbb, mathscr, mathrsfs, text, and, onslide, pause YaTeX-math-other-env-alist-private で追加数式環境を足しやすくした。 YaTeX-electric-indent-mode で C-m での自動インデントを制御。 %#キーワードに追加: DVIPDF, PDFVIEW, IMAGEDPI(ワンタッチ更新も可)。 Beamer用の補完アドインを追加(原案谷村さん)。 YaTeX-kanji-code のデフォルトをnil(温存)に変更。 == yahtml == figure, iframe 対応。 a要素の属性補完を修正。 meta要素の属性補完を拡充、 に対応。 yahtml-kanji-code のデフォルトを4(UTF-8)に変更。 1.79 別フレームに同一バッファがあるときのミニバッファ入力で、 ポイント位置がずれるEmacsの問題への対策を入れた。 === yatex === 数式環境など特定環境内の [prefix] t e で On-the-fly preview 発動。 環境に対する On-the-fly preview は編集中持続する。 持続中の On-the-fly preview の無効化は何もない場所で [prefix] k。 YaTeX-help-file のデフォルト位置を site-lisp/yatex/help/ に変更。 領域活性時に呼び出す補完は領域括りになるようにした。 タイプセットでPDF出力がありそうなときは次回previewをPDFヴューアに。 === yahtml === 領域活性時に呼び出す補完は領域括りになるようにした。 audio, video, label要素対応 datalistでidを補完対象に 文字実体参照補完([prefix] a)でタイプした文字を入力できるようにした。 1.78 Drag&Dropサポートを追加。 tabular環境内で2連続以上Tabで、1カラム進む機能を追加。 === yatex === 主な外部コマンド名を変数化。 [prefix] t d の直後のデフォルトヴューアはPDF用のものに。 「%#!コマンド -オプション」のときは親ファイル指定なしと判定。 地の段落での [prefix] t g でヴューアの forward-search を試みる。 [prefix] t e の環境タイプセットの結果を可能なら画像に。 [prefix] t e を環境外で呼んだ場合はパラグラフをタイプセット。 [prefix] t e を領域活性状態で呼んだらその領域をタイプセット。 === yahtml === table, ul, ol, dl 内で2連続以上Tabで、1カラム進む機能を追加。 1.77 last-command-char 廃止対策を追加。 === yatex === %#DVIPDF でdviからpdfへの変換コマンドを指定可能に。 PDFヴューアに xpdf, pdfopen, mupdf, zathura, okular を追加。 1.76 === yatex === タイプセットでラベル未定義があったら自動的にrerunする。 自動rerun無効化は YaTeX-typeset-auto-rerun を nil に。 %#BIBTEX で始まる行に起動すべき bibtex コマンドを記述可能。 %#MAKEINDEX で始まる行に起動すべき makeindex コマンドを記述可能。 [prefix] t % で %#BIBTEX、%#MAKEINDEX 行を更新可能に。 [prefix] t d の platex+dvipdfmx をメニューに追加。 \includegraphicsでPNG/JPG/GIF/BMP指定時、bb= を自動生成する(c)。 数式用環境のお任せ改行を刷新。 === yahtml ===
        , の属性入力を C-j でスキップ可能に。 1.75 === yatex === [prefix] t e でポイント位置を含む環境か数式環境をタイプセット。 M-C-SPC で環境だけでなく数式環境もマークする。 [prefix] t d でタイプセッタ起動成功のあと dvipdfmx を起動。 \label{}でラベル名を入れたときは \ref{NAME} を自動的にkill-ringに追加。 [prefix] c で\label{NAME} の NAME を変えたら \ref のNAMEも変える。 同上のことを \cite/\bibitem にも。 \bibitem{}を入れたときは \cite{TAG} を自動的にkill-ringに追加。 \end 補完のお節介検査の精度を少し上げた。 jsarticle, jsbook をデフォルト補完辞書に入れた。 \begin の直後の { で自動的に \end 込みで環境補完(modify-modeと連動)。 === yahtml === [prefix] t ブラウザメニューに「n:新規ページ作成」を追加(実験)。 [prefix] t j のlintコマンドを 行で指定可。 [prefix] } でリジョンを td 要素で括る(デフォルトは空白区切り)。 [prefix] ] でリジョンを tr, td 要素で括る(1行1レコード)。 閉じ括弧のないCSSファイル解析が終われない問題を修正。 li, dt, dd のインデント計算を環境型的に深さを変えるようにした。 1.74 === yatex === YaTeX-kanji-code が 4 のときは UTF-8 とした。 Previewファイルの拡張子が.dviであるという仮定を弱くした(pdf等)。 pdfopenを呼ぶときの問題への対策追加(by松田さん)。 拡張子 pdf に対するデフォルトヴューアを追加。 === yahtml === yahtml-kanji-code が 4 のときは UTF-8 とした。 [prefix] Return Intelligent-newline をtable対応にした。 cssファイル中に@importがあったときのバグを除去。 cssの *.class 解釈を修正。 yahtml-image-inspection-bytes を50000に増やした。 1.73 === yatex === C-i (YaTeX-indent-line) のtabular/array環境対応。行頭位置の tabular的カラム位置に応じてインデントの深さを4桁ずつ深くする。 深くする桁数を制御する変数 YaTeX-tabular-indentation 新設。 \ref補完で出る一覧で数式は\label文字列も出すようにした。 \ref補完で自動的に生成するラベル名を短くした。カスタマイズも可。 生成するラベル名の書式を変える変数YaTeX-ref-default-label-string新設。 ラベル名生成関数そのものは YaTeX-ref-generate-label-function で変更可。 AMS-LaTeX独自のカウンタつき数式環境も全てref補完でlabel打ち可能 な場所を検出できるようにした。 AMS-LaTeX独自の数式環境でのお任せ改行サポート。 tabularのお任せ改行で *{N}{REP} もカラム数を取れるようにした。 verbatim環境/alltt環境宣言はTABインデントで行頭に来るようにした。 インデントなしの環境宣言を決める変数 YaTeX-noindent-env-regexp 新設。 [prefix] c, [prefix] g などがセクション型マクロの英字のみの引数 で動かないのを修正。 先回りusepackageでパッケージのオプションを確認できるようにした。 [prefix] k でセクション型マクロの引数の数を考慮して消すようにした。 [prefix] k ではマクロの最後の引数の中味のみを残すようにした。 [prefix] S ではリジョンをセクション型マクロの最後の引数に括り入 れるようにしてそれ以前の引数入力にアドイン関数を呼ぶようにした。 数式モード内の _添字 ^上字 を変えるfaceを作成。とりあえず色だけ 変えるようにした(Emacs21.4なら上下にスライドできるだろう)。 変数 YaTeX-dvi2-command-ext-alist 新設。Previewerコマンドと、そ れでPreviewするファイルのデフォルト拡張子を指定できるようにした。 tabular中のカラム内に\begin\endがある場合はfill-paragraph境界を そこまでに絞るようにした。 \cite上での[prefix] g で\bibliography{}で指定したBibファイルの対 応エントリに飛べるようにした。 === yahtml === cssの @import に対応(たぶん)。 class補完でクラス名をSPCで区切った複数指定の補完入力を可能に。 Emacs-21.3 以降のため insert-default-directory をnilに。 single-cmd-tableから p を削除。 変数 yahtml-html4-strict を新設。HTML4Strict準拠をできるだけ補助。 script, noscript要素の補完を追加。script要素のアドインも追加。 [prefix] m に 補完を追加。 [prefix] m でもアドイン補完を呼ぶようにしたので M-C-m の
      1. 挿入 でクラス名補完が起きる。これを回避するために M-C-j にも intelligent newline を割り当ててクラス名補完を飛ばせるようにした。 [prefix] g に universal arg を指定しても隣窓で開かないのを修正。 1.72 === yatex === YaTeX-kanji-code が nil なら coding-system に感知しない 補完したマクロがLaTeX2eの特定のpackageに依存している場合 そのpackageを半自動で \usepackage する(yatexpkg.el新設) {} の末尾がイタリック補正 \/ ならそれを消す === yahtml == yahtml-kanji-code が nil なら coding-system に感知しない 1.71 === yatex === fill-prefix を指定している場合、Emacs21で \item の auto-fill が \item の深さにかかわらず fill-prefix になってしまうのを回避 \refのラベル補完で、既にlabel定義してあるものがカウンタと\label 両方が補完候補に出現していたのを修正。またenumerate環境内では \itemとラベルが重複して候補に現れていたのを修正。 Emacsの背景色の定義がXリソースに全く無いときの不具合修正 [prefix] c で AMS-LaTeX の大括弧対の種類を変えられるようにした [prefix] g で AMS-LaTeX の括弧対間でジャンプできるようにした 1.70 Emacs21でmake-frameがエラーになることがあるのを回避 font-lock での Recenter が効かなくなるのを修正 (他、細かい修正がほとんど) 1.69 font-lock 対応(XEmacs, Emacs-20, Emacs-21 のみ)。 hilit19, font-lockを共存させている場合 YaTeX-use-hilit19 か、 YaTeX-use-font-lock どちらか一方を Non-nil にする。 ~/.emacs で (put 'yatex-mode 'font-lock-defaults ....) や (put 'yahtml-mode 'font-lock-defaults ...)などを入れている人はその 設定を削り、(setq YaTeX-use-font-lock t) を入れてください。 Emacs-21(pretest version)で動くようにした。 kill-bufferしたときに親ファイルが出現するよう努力。 野鳥起動時の段階でEmacsに italic, bold フォントが登録されていれ ば、それを積極的に利用するようにした。 === yatex === section型補完のときに直前の文字列でデフォルト候補を変える機能を 試験的に入れてみた。 (Meadow)Typeset menu での IME OFF。 yatexmth, ;[TAB] 一覧の最初の \| が選択できなかったのを修正。 === yahtml === XEmacsで img src での画像サイズ取得ができなかったのを修正。 [prefix] ESC で yahtml-mode に入る前の major-mode に復帰(メイルの draftバッファでHTMLを書くために一時的にyahtmlを読んで元に戻るとき に有効)。 1.68 === yatex === XEmacsでyatexgenが動かなくなったのに対処。 Windowsでのインストールが少し楽になるように makefile を修正。 ref/cite ラベル補完で全てのカウンタを補完候補にあげてなおかつ labelが設定していないところには自動的にラベルを付加するようにした。 \cite の補完を BibTeX データベースファイルからも探すようにした。 LaTeX2eの多くのコマンドに、本体/アドイン共に対応。 === yahtml === 英語版info、Q&Aの添付(by Jun Ohyaさん) 補完でsrcとなる画像ファイルのピクセルサイズを自前 で調べて width, height 属性の補完のデフォルトとなるようにした。 M-C-a(beginning-of-environment), M-C-e(end-of-environment), M-C-@(mark-environment) が yatex.el 内に定義されていてyahtmlだけ をロードしているときにエラーになったので、これら関数定義を yatexlibに移動。 css定義ファイル中ピリオドで始まるエントリを全てのエレメントに共 通なclass補完候補として出すようにした。 yahtmlを使用するとYaTeXでのインデントがおかしくなるのを直した。 & でchar-entity reference補完。 1.67 [[[ http://www.yatex.org/ が誕生しました ]]] === yahtml === href入力でSPCなどのunsafe-charを%エンコードに置換するかを yahtml-escape-chars で選べるようにした。nilならしない、tなら常に、 'ask なら確認する。デフォルトは 'ask。 初回href入力時に yahtml-urls を補完候補に入れてなかったのを修正。 [prefix] ; でリジョン中の <>'"& をエンティティ参照に変換、 [prefix] : で逆変換する機能を追加。 yahtml-translate-hyphens-when-comment-region が non-nil のときに 領域コメントアウトで - を - に変換。 yahtml-prefer-upcase-attributes が non-nil のとき属性名を大文字に。 カレントまたは上位ディレクトリに .htaccess ファイルがありその中に AddType "text/html; charset=XXXX" .html 宣言があれば編集するHTMLソースの漢字コードもその宣言に合わせる。