next up previous contents index
: 構成 : Asir 用のライブラリの書き方 : モジュール機能   目次   索引

マニュアルの書き方 その 1 : texinfo で直接書く

``野呂, 下山, 竹島 : Asir User's Manual'' は texinfo というスタイルで書かれている (cf. 25.3 節). これは LATEXのような マクロパッケージの一つで, GNU tool のマニュアルの記述用に 伝統的に用いられている. 一つのソースファイルから, 次の 3 つの マニュアルが生成できるので便利である.

本節では, Risa/Asir 関連のマニュアルを書く際の標準的なスタイルに ついて説明する. もちろん, そのスタイルに従う必要はないが, 従えばスタイル を考える必要がないぶん楽ができるのでおすすめである.

まず, 例を示す. この例は OpenXM 版 Asir のソース配布 (付録 25 章) の OpenXM/src/asir-docman-sample.texi としておいてあるのでこれを適当に改変することで, 穴埋 め的にマニュアルが書ける.

@comment --- おまじない ---
\input jtexinfo
@iftex
@catcode`@#=6
@def@fref#1{@xrefX[#1,,@code{#1},,,]}
@def@b#1{{@bf@gt #1}}
@catcode`@#=@other
@end iftex
@overfullrule=0pt
@c -*-texinfo-*-
@comment %**start of header
@comment --- おまじない終り ---

@comment --- GNU info ファイルの名前 ---
@setfilename xyzman

@comment --- タイトル ---
@settitle XYZ

@comment %**end of header
@comment %@setchapternewpage odd

@comment --- おまじない ---
@ifinfo
@macro fref{name}
@ref{\name\,,@code{\name\}}
@end macro
@end ifinfo

@iftex
@comment @finalout
@end iftex

@titlepage
@comment --- おまじない終り ---

@comment --- タイトル, バージョン, 著者名, 著作権表示 ---
@title XYZ
@subtitle XYZ User's Manual
@subtitle Edition 1.0
@subtitle March 2001

@author  by Risa/Asir comitters
@page
@vskip 0pt plus 1filll
Copyright @copyright{} Risa/Asir committers
2001. All rights reserved.
@end titlepage

@comment --- おまじない ---
@synindex vr fn
@comment --- おまじない終り ---

@comment --- @node は GNU info, HTML 用 ---
@comment --- @node  の引数は node-name,  next,  previous,  up --- 
@node Top,, (dir), (dir)

@comment --- @menu は GNU info, HTML 用 ---
@comment --- chapter 名を正確に並べる ---
@menu
* XYZ::
* Index::
@end menu

@comment --- chapter の開始 ---
@comment --- 親 chapter 名を正確に ---
@node XYZ,,, Top
@chapter XYZ

@comment --- section 名を正確に並べる ---
@menu
* XYZについて::
* XYZに関する関数::
@end menu

@comment --- section の開始 ---
@node XYZについて,,, XYZ
@section XYZについて

@comment --- 書体指定について ---
@comment --- @code{} はタイプライタ体表示 ---
@comment --- @var{} は斜字体表示 ---
@comment --- @b{} はボールド表示 ---
@comment --- @samp{} はファイル名などの表示 ---

@b{Asir} は, xyz に関する計算をサポートしている.
xyz は @samp{xxx/xyz} で定義されている.
xyz の abc は次の通りである.

@comment --- @enumerate〜@end enumerate は番号付き箇条書き ---
@enumerate
@item abc は efg である.
@item abc の hij が klm することがある.
@end enumerate

xyz を abc した場合, 結果およびその意味を示す.

@comment --- @table〜@end table は表形式箇条書き ---
@comment --- @table の後に, 最初の column に対する書体指定をする ---
@table @code
@item 0

失敗

@item 0 以外の整数
成功
@end table

@node XYZに関する関数,,, XYZ
@section XYZに関する関数

@comment --- 関数名を正確に ---
@comment --- 複数の関数をまとめて説明できる ---
@menu
* xyz_abc::
* xyz_pqr xyz_stu::
@end menu

@comment --- 個々の関数の説明の開始 ---
@comment --- section 名を正確に ---
@node xyz_abc,,, XYZに関する関数
@subsection @code{xyz_abc}
@comment --- 索引用キーワード
@findex xyz_abc

@comment --- 関数の簡単な説明 ---
@table @t
@item xyz_abc(@var{number}) 
:: @var{number} の xyz を abc する.
@end table

@comment --- 引数の簡単な説明 ---
@table @var
@item return
整数
@item number
整数
@end table

@comment --- ここで関数の詳しい説明 ---
@comment --- @itemize〜@end itemize は箇条書き ---
@comment --- @bullet は黒点付き ---
@itemize @bullet
@item
@var{number} の xyz を abc する.
@item
@var{number} は整数でなければならない.
@end itemize

@comment --- @example〜@end example は実行例の表示 ---
@example
[3] xyz_abc(123);
456
[4] xyz_abc(1.2);
xyz_abc : input must be an integer
@end example

@comment --- 参照(リンク)を書く ---
@table @t
@item 参照
@fref{xyz_pqr xyz_stu}
@end table

@comment --- 複数の関数をまとめて説明する例 ---
@node xyz_pqr xyz_stu,,, XYZに関する関数
@subsection @code{xyz_pqr}, @code{xyz_stu}
@findex xyz_pqr
@findex xyz_stu

@comment --- 関数の簡単な説明 ---
@comment --- @itemx は複数に対して説明を一つつける場合に使う ---
@table @t
@item xyz_pqr(@var{arg1},@var{arg2}[,@var{flag}])
@itemx xyz_stu(@var{arg1},@var{arg2})
:: xyz に関する操作.
@end table

@table @var
@item return
整数
@item arg1, arg2
整数
@item flag
0 または 1
@end table

@itemize @bullet
@item
@code{xyz_pqr()} は, @var{arg1}, @var{arg2} を pqr する.
@item
@var{flag} が 0 でないとき, モジュラ計算を行う.
@item
@code{xyz_stu()} は stu アルゴリズムを用いる.
@end itemize

@example
[219] xyz_pqr(1,2);
3
[220] xyz_pqr(1,2,1);
3
0
[221] xyz_stu(1,2);
3
@end example

@table @t
@item 参照
@fref{xyz_abc}
@end table

@comment --- おまじない ---
@node Index,,, Top
@unnumbered Index
@printindex fn
@printindex cp
@iftex
@vfill @eject
@end iftex
@summarycontents
@contents
@bye
@comment --- おまじない終り ---
書くべき場所に @comment -- コメント -- を入れてあるので, それに従えば書けると思うが, 一応要点をまとめておく.





Nobuki Takayama 平成15年9月12日