OSDN Git Service

Small (grammatical and apparant) improvements.
[luatex-ja/luatexja.git] / doc / manual.dtx
index d304cae..73fda11 100644 (file)
-%#! lualatex -shell-escape manual.ins && lualatex man-en && lualatex man-ja
+%#! lualatex -shell-escape manual.ins
 
-%<*Eng>
+%<*en>
 \documentclass[a4paper,titlepage]{article}
 \usepackage[margin=20mm]{geometry}
-%</Eng>
-%<*Jpn>
+%</en>
+%<*ja>
 \documentclass[a4paper,titlepage]{bxjsarticle}
 \setpagelayout*{margin=20mm}
 \def\headfont{\normalfont\bfseries}
 % \def\headfont{\sffamily\gtfamily} is needed in ordinal documents
-%</Jpn>
+%</ja>
 
 \usepackage{amsmath,amssymb,xcolor,pict2e}
-\usepackage{booktabs,listings,lltjlisting,showexpl}
+\usepackage{booktabs,listings,lltjlisting,showexpl,multicol}
 \usepackage{luatexja}
 \usepackage[unicode=true]{hyperref}
+\usepackage[all]{xy}
+\SelectTips{cm}{}
 
-%<*Eng>
-\title{The Lua\TeX-ja package}
-\author{The Lua\TeX-ja project team}
-%</Eng>
-%<*Jpn>
-\title{Lua\TeX-jaパッケージ}
-\author{Lua\TeX-jaプロジェクトチーム}
-%</Jpn>
+\DeclareRobustCommand\eTeX{\ensuremath{\varepsilon}-\kern-.125em\TeX}
+\DeclareRobustCommand\LuaTeX{Lua\TeX}
+\DeclareRobustCommand\pTeX{p\kern-.05em\TeX}
+\DeclareRobustCommand\upTeX{p\kern-.05em\TeX}
+\DeclareRobustCommand\pLaTeX{p\kern-.05em\LaTeX}
+\DeclareRobustCommand\pLaTeXe{p\kern-.05em\LaTeXe}
+
+
+\makeatletter
+\long\def\@makecaption#1#2{%
+  \vskip\abovecaptionskip
+  \sbox\@tempboxa{{\small #1. #2}}%
+  \ifdim \wd\@tempboxa >\hsize
+    {\small #1. #2}\par
+  \else
+    \global \@minipagefalse
+    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+  \fi
+  \vskip\belowcaptionskip}
+\makeatother
+
+%<*en>
+\title{The \LuaTeX-ja package}
+\author{The \LuaTeX-ja project team}
+%</en>
+%<*ja>
+\title{\LuaTeX-jaパッケージ}
+\author{\LuaTeX-jaプロジェクトチーム}
+%</ja>
 
 \lstset{
   basicstyle=\ttfamily\small, pos=o, breaklines=true,
   numbers=none, rframe={}
 }
 
-\catcode`\<=13
-\def<#1>{{\normalfont\itshape$\langle$#1$\rangle$}}
 \parskip=\smallskipamount
 \begin{document}
+\catcode`\<=13
+\def<#1>{{\normalfont\rm\itshape$\langle$#1$\rangle$}}
 \maketitle
 
 \tableofcontents
 \bigskip
 
-%<*Eng>
+%<*en>
 {\Large\bf This documentation is far from complete. It may have many
 grammatical (and contextual) errors.}
-%</Eng>
-%<*Jpn>
+%</en>
+%<*ja>
 \textbf{\large 本ドキュメントはまだまだ未完成です.
 また,英語版と日本語版をdocstripプログラムを用いることで一緒に生成している都合上,
 見出しが英語のままになっています.}
-%</Jpn>
+%</ja>
 
-\newpage
+\clearpage
 \part{User's manual}
 
 \section{Introduction}
 
-%<*Eng>
-The Lua\TeX-ja package is a macro package for typesetting high-quality
-Japanese documents in Lua\TeX.
-%</Eng>
-%<*Jpn>
-Lua\TeX-jaパッケージは,次世代標準\TeX であるLua\TeX の上で,p\TeX と同等
+%<*en>
+The \LuaTeX-ja package is a macro package for typesetting high-quality
+Japanese documents when using \LuaTeX.
+%</en>
+%<*ja>
+\LuaTeX-jaパッケージは,次世代標準\TeX である\LuaTeX の上で,\pTeX と同等
 /それ以上の品質の日本語組版を実現させようとするマクロパッケージである.
-%</Jpn>
+%</ja>
 
 \subsection{Backgrounds}
-Traditionally, ASCII p\TeX, an extension of \TeX, and its derivatives
-are used to typeset Japanese documents in \TeX. p\TeX\ is an engine
+Traditionally, ASCII \pTeX, an extension of \TeX, and its derivatives
+are used to typeset Japanese documents in \TeX. \pTeX\ is an engine
 extension of \TeX: so it can produce high-quality Japanese documents
 without using very complicated macros. But this point is a mixed
-blessing: p\TeX\ is left behind from other extensions of \TeX,
-especially $\varepsilon$-\TeX\ and pdf\TeX, and from changes about
+blessing: \pTeX\ is left behind from other extensions of \TeX,
+especially \eTeX\ and pdf\TeX, and from changes about
 Japanese processing in computers (\textit{e.g.}, the UTF-8 encoding).
 
-Recently extensions of p\TeX, namely up\TeX\ (Unicode-implementation
-of p\TeX) and $\varepsilon$-p\TeX\ (merging of p\TeX and
-$\varepsilon$-\TeX\ extension), have developed to fill those gaps to some
-extent, but gaps are still exist.
+Recently extensions of \pTeX, namely \upTeX\ (Unicode-implementation
+of \pTeX) and \epTeX\ (merging of \pTeX\ and
+\eTeX\ extension), have developed to fill those gaps to some
+extent, but gaps still exist.
 
-However, the appearance of Lua\TeX\ changed the whole situation. With
+However, the appearance of \LuaTeX\ changed the whole situation. With
 using Lua `callbacks', users can customize the internal processing of
-Lua\TeX. So there is no need to modify sources of engines to
+\LuaTeX. So there is no need to modify sources of engines to
 support Japanese typesetting: to do this, we only have to write Lua
 scripts for appropriate callbacks.
 
 
-\subsection{Major Changes from p\TeX}
-The Lua\TeX-ja package is under much influence of p\TeX\ engine. The initial
-target of development was to implement features of p\TeX. However,
-\emph{Lua\TeX-ja is not a just porting of p\TeX; unnatural
-specifications/behaviors of p\TeX\ were not adopted}.
+\subsection{Major Changes from \pTeX}
+The \LuaTeX-ja package is under much influence of \pTeX\ engine. The initial
+target of development was to implement features of \pTeX. However,
+\emph{\LuaTeX-ja is not a just porting of \pTeX; unnatural
+specifications/behaviors of \pTeX\ were not adopted}.
 
-The followings are major changes from p\TeX:
+The followings are major changes from \pTeX:
 \begin{itemize}
 \item A Japanese font is a tuple of a `real' font, a Japanese font
       metric (\textbf{JFM}, for short), and an optional string called
       `variation'.
 
-\item In p\TeX, a linebreak after Japanese character is ignored (and
+\item In \pTeX, a linebreak after Japanese character is ignored (and
       doesn't yield a space), since linebreaks (in source files) are
-      permitted almost everywhere in Japanese texts. However, Lua\TeX-ja
+      permitted almost everywhere in Japanese texts. However, \LuaTeX-ja
       doesn't have this function completely, because of a specification
-      of Lua\TeX.
+      of \LuaTeX.
 \item The insertion process of glues/kerns between two Japanese
       characters and between a Japanese character and other characters
       (we refer these glues/kerns as \textbf{JAglue}) is rewritten from
       scratch.
 
 \begin{itemize}
-\item As Lua\TeX's internal character handling is `node-based'
+\item As \LuaTeX's internal character handling is `node-based'
       (\textit{e.g.}, \verb+of{}fice+ doesn't prevent ligatures), the
       insertion process of \textbf{JAglue} is now `node-based'.
 \item Furthermore, nodes between two characters which have no effects in
@@ -117,7 +140,7 @@ The followings are major changes from p\TeX:
       fonts only are identified.
 \end{itemize}
 \item At the present, vertical typesetting (\emph{tategaki}), is not
-      supported in Lua\TeX-ja.
+      supported in \LuaTeX-ja.
 
 \end{itemize} 
 For detailed information, see Part~\ref{part-imp}.
@@ -129,7 +152,7 @@ In this document, the following terms and notations are used:
 \begin{itemize}
 \item \textbf{JAchar}: standing for Japanese characters such as
       Hiragana, Katakana, Kanji and other punctuation marks for
-      Japanese.'
+      Japanese.
 \item \textbf{ALchar}: standing for all other characters like alphabets. 
 \end{itemize}
 We say `alphabetic fonts' for fonts used in \textbf{ALchar}, and `Japanese fonts' for fonts used in \textbf{JAchar}.
@@ -137,41 +160,52 @@ We say `alphabetic fonts' for fonts used in \textbf{ALchar}, and `Japanese fonts
 \item A word in a sans-serif font (like \textsf{prebreakpenalty})
       represents an internal parameter for Japanese typesetting, and it
       is used as a key in \verb+\ltjsetparameter+ command.
-\item The word `primitive' is used not only for primitives in Lua\TeX,
+\item The word `primitive' is used not only for primitives in \LuaTeX,
       but also for control sequences that defined in the core module of
-      Lua\TeX-ja.
+      \LuaTeX-ja.
 \item In this document, natural numbers start from~0.
 \end{itemize}
 
 \subsection{About the project}
-\paragraph{Project Wiki} \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage%28en%29}
+\paragraph{Project Wiki} Project Wiki is under construction.
+\begin{itemize}
+\item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage%28en%29} (English)
+\item \url{http://sourceforge.jp/projects/luatex-ja/wiki/FrontPage} (Japanese)
+\end{itemize}
 
 This project is hosted by SourceForge.JP.
-\paragraph{Members}
-
-%h7k
-%kmaeda
-%abenori
-%kuroky
-%munepi
-%thonda
-%zrbabbler
 
-\newpage
+\paragraph{Members}\ 
+% \begin{multicols}{2}
+% \begin{itemize}
+% \item Hironori KITAGAWA
+% \item Kazuki MAEDA
+% \item Takayuki YATO
+% \item Yusuke KUROKI
+% \item Noriyuki ABE
+% \item Munehiro YAMAMOTO
+% \item Tomoaki HONDA
+% \par\ 
+% \end{itemize}
+% \end{multicols}
+
+% \paragraph{Acknowledgments} -- 挿入するならここ
+
+\clearpage
 \section{Getting Started}
 \subsection{Installation}
-To install the Lua\TeX-ja\ package, you will need:
+To install the \LuaTeX-ja\ package, you will need:
 \begin{itemize}
-\item Lua\TeX\ (version 0.65.0-beta or later) and its supporting packages.\\
-If you are using \TeX~Live\ 2011 or W32\TeX, you don't have to worry.
-\item The source archive of Lua\TeX-ja, of course{\tt:)}
+\item \LuaTeX\ (version 0.65.0-beta or later) and its supporting packages.\\
+If you are using \TeX~Live\ 2011 or current W32\TeX, you don't have to worry.
+\item The source archive of \LuaTeX-ja, of course{\tt:)}
 \end{itemize}
 
 The installation methods are as follows:
 \begin{enumerate}
 \item Download the source archive.
 
-At the present, Lua\TeX-ja has no official release, so you have to retrieve
+At the present, \LuaTeX-ja has no official release, so you have to retrieve
 the archive from the repository.
 You can retrieve the Git repository via
 \begin{verbatim}
@@ -195,7 +229,7 @@ or download the archive of HEAD in \texttt{master} branch from
 \end{itemize}
 
 \subsection{Using in plain \TeX}\label{ssec-plain}
-To use Lua\TeX-ja in plain \TeX, simply put the following  at the beginning of the document:
+To use \LuaTeX-ja in plain \TeX, simply put the following  at the beginning of the document:
 \begin{verbatim}
 \input luatexja.sty
 \end{verbatim}
@@ -220,7 +254,7 @@ This does minimal settings (like {\tt ptex.tex}) for typesetting Japanese docume
 \item It is widely accepted that the font `Ryumin-Light' and
       `GothicBBB-Medium' aren't embedded into PDF files, and PDF reader
       substitute them by some external Japanese fonts (\textit{e.g.},
-      Kozuka Mincho is used in Adobe Reader). We adopt this custom to
+      Kozuka Mincho is used for Ryumin-Light in Adobe Reader). We adopt this custom to
       the default setting.
 \item You may notice that size of above fonts is slightly smaller than
       their alphabetic counterparts: for example, the size
@@ -236,19 +270,19 @@ This does minimal settings (like {\tt ptex.tex}) for typesetting Japanese docume
 Here \verb+\zw+ is the counterpart of \texttt{em} for Japanese fonts, that is, the length of `full-width' in current Japanese font.
 \end{itemize}
 
-\subsection{Using in \LaTeX}
+\subsection{Using in \LaTeX}\label{ssec-ltx}
 \paragraph{\LaTeXe}
 Using in \LaTeXe\ is basically same. To set up the minimal environment
 for Japanese, you only have to load {\tt luatexja.sty}:
 \begin{verbatim}
 \usepackage{luatexja}
 \end{verbatim}
-It also does minimal settings (counterparts in p\LaTeX\ are {\tt
+It also does minimal settings (counterparts in \pLaTeX\ are {\tt
 plfonts.dtx} and {\tt pldefs.ltx}):
 
 \begin{itemize}
 \item {\tt JY3} is the font encoding for Japanese fonts (in horizontal direction).\\
-When vertical typesetting is supported by Lua\TeX-ja in the future, {\tt JT3} will be used for vertical fonts.
+When vertical typesetting is supported by \LuaTeX-ja in the future, {\tt JT3} will be used for vertical fonts.
 \item Two font families {\tt mc} and {\tt gt} are defined: 
 \begin{center}
 \begin{tabular}{ccccc}
@@ -266,15 +300,15 @@ When vertical typesetting is supported by Lua\TeX-ja in the future, {\tt JT3} wi
 
 However, above settings are not sufficient for Japanese-based
 documents. To typeset Japanese-based documents, You are better to use
-class files other than {\tt article.cls}, {\tt book.cls}, ...  At the
+class files other than {\tt article.cls}, {\tt book.cls}, \ldots.  At the
 present, BXjscls (\texttt{bxjsarticle.cls} and \texttt{bxjsbook.cls}, by
 Takayuki Yato) are better alternative. It is not determined whether
-Lua\TeX-ja will develop and contain counterparts of major classes used
-in p\TeX\ (including jsclasses by Haruhiko Okumura).
+\LuaTeX-ja will develop and contain counterparts of major classes used
+in \pTeX\ (including jsclasses by Haruhiko Okumura).
 
 \subsection{Changing Fonts}
 \paragraph{Remark: Japanese Characters in Math Mode}
-Since p\TeX\ supports Japanese characters in math mode, there are
+Since \pTeX\ supports Japanese characters in math mode, there are
 sources like the following:
 
 \begin{LTXexample}
@@ -283,7 +317,7 @@ $f_{高温}$~($f_{\text{high temperature}}$).
 $5\in{}素:=\{\,p\in\mathbb N:\text{$p$ is a prime}\,\}$.
 \end{LTXexample}
 
-We (the project members of Lua\TeX-ja) think that using
+We (the project members of \LuaTeX-ja) think that using
 Japanese characters in math mode are allowed if and only if these are used as identifiers.
 In this point of view, 
 \begin{itemize}
@@ -311,8 +345,8 @@ To change Japanese fonts in plain \TeX, you must use the primitive
 
 
 \paragraph{NFSS2}
-For \LaTeXe, Lua\TeX-ja simply adopted the font selection system from that
-of p\LaTeXe\ (in {\tt plfonts.dtx}).
+For \LaTeXe, \LuaTeX-ja simply adopted the font selection system from that
+of \pLaTeXe\ (in {\tt plfonts.dtx}).
 \begin{itemize}
 \item Two control sequences \verb+\mcdefault+ and \verb+\gtdefault+ are
       used to specify the default font families for \emph{mincho} and
@@ -369,13 +403,13 @@ popular for Japanese fonts that nearly all Japanese glyphs have same widths.
 
 
 \section{Changing Parameters}
-There are many parameters in Lua\TeX-ja. And due to the behavior of Lua\TeX,
+There are many parameters in \LuaTeX-ja. And due to the behavior of \LuaTeX,
 most of them are not stored as internal register of \TeX, but as an
-original storage system in Lua\TeX-ja. Hence, to assign or acquire those
+original storage system in \LuaTeX-ja. Hence, to assign or acquire those
 parameters, you have to use commands \verb+\ltjsetparameter+ and
 \verb+\ltjgetparameter+.
 
-\subsection{Editing the range of \textbf{JAchar}}
+\subsection{Editing the range of \textbf{JAchar}s}
 As noted before, the default setting is:
 \begin{center}
 A character in Unicode is treated as \textbf{JAchar},\\
@@ -385,8 +419,18 @@ A character in Unicode is treated as \textbf{JAchar},\\
 $\uparrow$ TODO: CHANGE THIS!
 
 
+To edit the range of \textbf{JAchar}s, You have to assign a non-zero
+natural number which is less than 217 to the character range first. This
+can be done by using \verb+\ltjdefcharrange+ primitive. For example, the
+next line assigns whole characters in Supplementary Multilingual Plane
+and the character `漢' to the range number~4.
+\begin{lstlisting}
+\ltjdefcharrange{4}{"10000-"1FFFF,`漢}
+\end{lstlisting}
+This assignment of numbers to ranges are always global, so you should
+not do this in the middle of a document. 上書き
 
-
+After assigning numbers to ranges, ...
 
 \subsection{\textsf{kanjiskip} and \textsf{xkanjiskip}}\label{subs-kskip}
 \textbf{JAglue} is divided into the following three categories:
@@ -417,7 +461,7 @@ boundary between \textbf{JAchar}s and \textbf{ALchar}s. For example,
 \textsf{xkanjiskip} should not be inserted after opening parenthesis
 (\textit{e.g.}, compare `(あ' and `(\hskip\ltjgetparameter{xkanjiskip}あ').
 
-Lua\TeX-ja can control whether \textsf{xkanjiskip} can be inserted
+\LuaTeX-ja can control whether \textsf{xkanjiskip} can be inserted
 before/after a character, by changing \textsf{jaxspmode} for \textbf{JAchar}s and
 \textsf{alxspmode} parameters \textbf{ALchar}s respectively. 
 \begin{LTXexample}
@@ -428,7 +472,7 @@ pあq い!う
 The second argument {\tt preonly} means `the insertion of
 \textsf{xkanjiskip} is allowed before this character, but not after'.
 the other possible values are {\tt postonly}, {\tt allow} and {\tt
-inhibit}. For the compatibility with p\TeX, natural numbers between
+inhibit}. For the compatibility with \pTeX, natural numbers between
 0~and~3 are also allowed as the second argument\footnote{But we don't
 recommend this: since numbers 1~and~2 have opposite meanings in
 \textsf{jaxspmode} and \textsf{alxspmode}.}.
@@ -440,12 +484,12 @@ parameters to {\tt false}, respectively.
 
 \subsection{Shifting Baseline}
 To make a match between a Japanese font and an alphabetic font, sometimes
-shifting of the baseline of one of the pair is needed. In p\TeX, this is achieved
+shifting of the baseline of one of the pair is needed. In \pTeX, this is achieved
 by setting \verb+\ybaselineshift+ to a non-zero length (the
 baseline of alphabetic fonts is shifted below). However, for documents
 whose main language is not Japanese, it is good to shift the baseline of
 Japanese fonts, but not that of alphabetic fonts.
-Because of this, Lua\TeX-ja can independently set the shifting amount
+Because of this, \LuaTeX-ja can independently set the shifting amount
 of the baseline of alphabetic fonts (\textsf{yalbaselineshift}
 parameter) and that of Japanese fonts (\textsf{yjabaselineshift}
 parameter). 
@@ -470,10 +514,11 @@ xyz漢字
 \end{LTXexample}
 
 
-\subsection{`tombow'}
-`tombow' is a mark for indicating 4~corners and horizontal/vertical
-center of the paper. p\LaTeX and this Lua\TeX-ja support `tombow' by
-their kernel. The following steps are needed to typeset tombow:
+\subsection{Cropmark}
+Cropmark is a mark for indicating 4~corners and horizontal/vertical
+center of the paper. In Japanese, we call cropmark as tombo(w).
+\pLaTeX\ and this \LuaTeX-ja support `tombow' by their kernel.
+The following steps are needed to typeset cropmark:
 
 \begin{enumerate}
 \item First, define the banner which will be printed at the upper left
@@ -501,7 +546,7 @@ For example, the following sets banner as `{\tt filename (2012-01-01 17:01)}':
 To load a font as a Japanese font, you must use the
 \verb+\jfont+ primitive instead of~\verb+\font+, while
 \verb+\jfont+ admits the same syntax used in~\verb+\font+. 
-Lua\TeX-ja automatically loads \texttt{luaotfload} package,
+\LuaTeX-ja automatically loads \texttt{luaotfload} package,
 so TrueType/OpenType fonts with features can be used for Japanese fonts:
 \begin{LTXexample}
 \jfont\tradgt={file:ipaexg.ttf:script=latn;%
@@ -675,7 +720,7 @@ the `real' glyph is centered horizontally (the green rectangle).
       glyph is indicated by the red rectangle.
 \end{itemize}
 \end{minipage}
-\caption{The position of the `real' glyph}
+\caption{The position of the `real' glyph.}
 \label{fig-pos}
 \end{figure}
 
@@ -686,28 +731,42 @@ the `real' glyph is centered horizontally (the green rectangle).
 \end{list}
 
 \subsection{Math Font Family}
-
+\TeX\ handles fonts in math formulas by 16~font families\footnote{Omega,
+Aleph, \LuaTeX~and $\varepsilon$-\kern-.125em(u)\pTeX can handles 256~families, but
+an external package is needed to support this in plain \TeX\ and
+\LaTeX.}, and each family has three fonts:
+\verb+\textfont+, \verb+\scriptfont+ and \verb+\scriptscriptfont+.
+
+\LuaTeX-ja's handling of Japanese fonts in math formulas is similar;
+Table~\ref{tab-math} shows counterparts to \TeX's primitives for math
+font families.
+
+\begin{table}[tb]
+\label{tab-math}
+\caption{Primitives for Japanese math fonts.}
 \begin{center}\def\{{\char`\{}\def\}{\char`\}}
 \begin{tabular}{lll}
 \toprule
 &Japanese fonts&alphabetic fonts\\
-font family&\verb+\jfam+&\verb+\fam+\\
+\midrule
+font family&\verb+\jfam+${}\in [0,256)$&\verb+\fam+\\
 text size&\tt\textsf{jatextfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\textfont+<fam>=<font\_cs>\\
 script size&\tt\textsf{jascriptfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\scriptfont+<fam>=<font\_cs>\\
 scriptscript size&\tt\textsf{jascriptscriptfont}\,=\{<jfam>,<jfont\_cs>\}&\tt\verb+\scriptscriptfont+<fam>=<font\_cs>\\
 \bottomrule
 \end{tabular}
 \end{center}
+\end{table}
 
 
 \section{Parameters}
 \subsection{{\tt\char92 ltjsetparameter} primitive}
 As noted before, \verb+\ltjsetparameter+ and \verb+\ltjgetparameter+ are
-primitives for accessing most parameters of Lua\TeX-ja. One of the main
-reason that Lua\TeX-ja didn't adopted the syntax similar to that of p\TeX\ 
+primitives for accessing most parameters of \LuaTeX-ja. One of the main
+reason that \LuaTeX-ja didn't adopted the syntax similar to that of \pTeX\ 
 (\textit{e.g.},~\verb+\prebreakpenalty`)=10000+) 
 is the position of \verb+hpack_filter+ callback in the source
-of Lua\TeX, see Section~\ref{sec-para}.
+of \LuaTeX, see Section~\ref{sec-para}.
 
 \verb+\ltjsetparameter+ and \verb+\ltjglobalsetparameter+ are primitives
 for assigning parameters. These take one argument which is a
@@ -731,15 +790,16 @@ additional argument---a character code, for example---in some cases.
 \end{LTXexample}
 \emph{The return value of\/ {\normalfont\tt\char92ltjgetparameter} is
 always a string}. This is outputted by \texttt{tex.write()}, so any
-character other than space~` '~(U+0020) has the category code
+character other than space~`{\tt\char32}'~(U+0020) has the category code
 12~(other), while the space has 10~(space).
 
 \subsection{List of Parameters}
-In the following list of parameters, [\verb+\cs+] indicates the counterpart in p\TeX, and each symbol has the following meaning:
+In the following list of parameters, [\verb+\cs+] indicates the counterpart in \pTeX, and each symbol has the following meaning:
 \begin{itemize}
-\item `\ast' : local
-\item `\dagger' always global
-\item No mark: the last of paragraph
+\item No mark: values at the end of the paragraph or the hbox are
+      adopted in the whole paragraph/hbox.
+\item `\ast' : local parameters, which can change everywhere inside a paragraph/hbox.
+\item `\dagger': assignments are always global.
 \end{itemize}
 
 \begin{list}{}{\def\makelabel{\ttfamily}\def\{{\char`\{}\def\}{\char`\}}}
@@ -794,14 +854,25 @@ Note that parameters \textsf{jaxspmode} and \textsf{alxspmode} use a common tabl
 \item[\textsf{autoxspacing}\,=<bool>$^\ast$] [\verb+\autoxspacing+]
 \item[\textsf{kanjiskip}\,=<skip>] [\verb+\kanjiskip+]
 \item[\textsf{xkanjiskip}\,=<skip>] [\verb+\xkanjiskip+]
+
 \item[\textsf{differentjfm}\,=<mode>$^\dagger$]
+
+Specify how glues/kerns between two \textbf{JAchar}s whose JFM (or size) are different. 
+The allowed arguments are the followings:
+\begin{description}
+\item[\texttt{average}]
+\item[\texttt{both}]
+\item[\texttt{large}]
+\item[\texttt{small}]
+\end{description}
+
 \item[\textsf{jacharrange}\,=<ranges>$^\ast$]
 \item[\textsf{kansujichar}\,=\{<digit>, <chr\_code>\}] [\verb+\kansujichar+]
 \end{list}
 
 
 \section{Other Primitives}
-\subsection{Compatibility with p\TeX}
+\subsection{Compatibility with \pTeX}
 \begin{list}{}{\def\makelabel{\ttfamily\char92 }}
 \item[kuten]
 \item[jis]
@@ -810,11 +881,17 @@ Note that parameters \textsf{jaxspmode} and \textsf{alxspmode} use a common tabl
 \item[ucs]
 \item[kansuji]
 \end{list}
+
 \section{Control Sequences for \LaTeXe}
+\subsection{Patch for NFSS2}
+As described in Subsection~\ref{ssec-ltx}, \LuaTeX-ja simply adopted \texttt{plfonts.dtx} in \pLaTeXe\ for the Japanese patch for NFSS2. 
+
+\subsection{Cropmark/`tombow'}
+
 \part{Implementations}\label{part-imp}
 \section{Storing Parameters}\label{sec-para}
 \subsection{Used Dimensions and Attributes}
-Here the following is the list of dimension and attributes which are used in Lua\TeX-ja.
+Here the following is the list of dimension and attributes which are used in \LuaTeX-ja.
 \begin{list}{}{%
 \def\makelabel{\ttfamily}
 \def\dim#1{\item[\char92 #1\ \textrm{(dimension)}]}
@@ -831,7 +908,7 @@ There is also a unit called `歯' which equals to $0.25\,\textrm{mm}$ and
                        \verb+\jH+ stores this length, similar to \verb+\jQ+. 
 \dim{ltj@zw} A temporal register for the `full-width' of current Japanese font.
 \dim{ltj@zh} A temporal register for the `full-height' (usually the sum of height of imaginary body and its depth) of current Japanese font.
-\attr{jfam} 
+\attr{jfam} Current number of Japanese font family for math formulas.
 \attr{ltj@curjfnt} The font index of current Japanese font.
 \attr{ltj@charclass} The character class of Japanese \textit{glyph\_node}.
 \attr{ltj@yablshift} The amount of shifting the baseline of alphabetic
@@ -845,25 +922,26 @@ There is also a unit called `歯' which equals to $0.25\,\textrm{mm}$ and
                        assigned:
 \begin{description}
 \item[ITALIC (1)] Glues from an itaric correction
-          (\verb+\/+). This distinction of origins of glues (from explicit \verb+\kern+, or from \verb+\/+)
+          (\verb+\/+). This distinction of origins of glues 
+          (from explicit \verb+\kern+, or from \verb+\/+)
           is needed in the insertion process of \textsf{xkanjiskip}.
 \item[PACKED (2)] 
 \item[KINSOKU (3)] Penalties inserted for the word-wrapping  process of Japanese characters (\emph{kinsoku}).
 \item[FROM\_JFM (4)] Glues/kerns from JFM.
-\item[LINE\_END (5)] Kerns
+\item[LINE\_END (5)] Kerns for ...
 \item[KANJI\_SKIP (6)] Glues for \textsf{kanjiskip}.
 \item[XKANJI\_SKIP (7)] Glues for \textsf{xkanjiskip}.
 \item[PROCESSED (8)] Nodes which is already processed by ...
-\item[IC\_PROCESSED (9)] Glues from an itaric correction
+\item[IC\_PROCESSED (9)] Glues from an itaric correction, but also already processed.
 \item[BOXBDD (15)] Glues/kerns that inserted just the beginning or the ending of an hbox or a paragraph.
 \end{description}
 \attr{ltj@kcat$i$} Where $i$~is a natural number which is less than~7.
 These 7~attributes store bit~vectors indicating which character block is regarded as a block of \textbf{JAchar}s.
 \end{list}
 
-\subsection{Stack System of Lua\TeX-ja}
+\subsection{Stack System of \LuaTeX-ja}
 \paragraph{Background}
-Lua\TeX-ja has its own stack system, and most parameters of Lua\TeX-ja
+\LuaTeX-ja has its own stack system, and most parameters of \LuaTeX-ja
 are stored in it.  To clarify the reason, imagine the parameter
 \textsf{kanjiskip} is stored by a skip, and consider the following
 source:
@@ -876,9 +954,9 @@ source:
 As described in Part~\ref{part-ref}, the only effective value of
 \textsf{kanjiskip} in an hbox is the latest value, so the value of
 \textsf{kanjiskip} which applied in the entire hbox should be 5\,pt.
-However, by the implementation method of Lua\TeX, this `5\,pt' cannot be
+However, by the implementation method of \LuaTeX, this `5\,pt' cannot be
 known from any callbacks.  In the \texttt{tex/packaging.w} (which is a
-file in the source of Lua\TeX), there are the following codes:
+file in the source of \LuaTeX), there are the following codes:
 \begin{lstlisting}
 void package(int c)
 {
@@ -914,7 +992,7 @@ are stored in one big table named \texttt{charprop\_stack\_table}, where
 a new stack level is created by \verb+\ltjsetparameter+, all data of the
 previous level is copied.
 
-To resolve the problem mentioned in `Background' above, Lua\TeX-ja uses
+To resolve the problem mentioned in `Background' above, \LuaTeX-ja uses
 another thing: When a new stack level is about to be created, a whatsit
 node whose type, subtype and value are 44~(\textit{user\_defined}),
 30112, and current group level respectively is appended to the current
@@ -943,4 +1021,91 @@ Note that to work this trick correctly, assignments to
 regardless the value of \verb+\globaldefs+.
 This problem is resolved by using
 \hbox{\verb+\directlua{tex.globaldefs=0}+} (this assignment is local).
-\end{document}
\ No newline at end of file
+
+
+\section{Linebreak after Japanese Character}\label{sec-lbreak}
+\subsection{Reference: Behavior in \pTeX}
+(NOT COMPLETED)
+
+In~\pTeX, a linebreak after a Japanese character doesn't emit a space,
+since words are not separated by spaces in Japanese writings. However,
+this feature isn't fully implemented in \LuaTeX-ja due to the
+specification of callbacks in~\LuaTeX. To clarify the difference between
+\pTeX~and~\LuaTeX, We briefly describe the handling of a linebreak in~\pTeX, in
+this subsection. 
+
+\pTeX's input processor can be described in terms of a finite state
+automaton, as that of~\TeX\ in~Section~2.5 of~\cite{texbytopic}. The
+internal states are as follows:
+\begin{itemize}
+\item State~$N$: new line
+\item State~$S$: skipping spaces
+\item State~$M$: middle of line
+\item State~$K$: after a Japanese character
+\end{itemize}
+The first three states---$N$, $S$~and~$M$---are as same as \TeX's input
+processor.  State~$K$ is similar to state~$M$, and is entered after
+Japanese characters.  The diagram of state transitions are indicated in
+Figure~\ref{fig-ptexipro}.  Note that \pTeX\ doesn't leave state~$K$
+after `beginning/ending of a group' characters.
+\begin{figure}[tb]
+\label{fig-ptexipro}
+\begin{gather*}
+ \def\sp{\text{\tt\char32}}
+ \xymatrix{&&
+   {\text{scan a cs}}\ar@(r,ul)[dr]&\\
+\ar[r]&
+   *++[o][F-]{N}\ar[ur]^0\ar[dd]_{d,\ g}\ar[u]^{5\ (\text{\tt\char92par})}
+     \ar@{->}@(d,l)[ddrr]_(0.45){j}&&
+   *++[o][F-]{S}\ar@(l,dr)[ul]^0\ar@(l,ur)[ddll]_{d,\ g}\ar[u]_{5}
+     \ar@{->}@(r,r)[dd]^{j}\\&\\&
+   *++[o][F-]{M}\ar[uuur]^0\ar@(r,dl)[uurr]_(0.55){10\ (\sp)}
+     \ar[d]_{5\ ({\sp})}\ar@{->}@(dr,dl)[rr]_{j}&&
+   *++[o][F-]{K}\ar@{->}@(ul,d)[uuul]^0\ar@{->}[ll]^{d}
+     \ar@{->}@(ur,dr)[uu]^{10\ (\sp)}\ar@{->}[d]_5\\
+   &&&
+ }\\
+ d:=\{3,4,6,7,8,11,12,13\},\quad g:=\{1,2\},\quad j:=(\text{Japanese characters})
+\end{gather*}
+\begin{itemize}
+\item Numbers represent category codes.
+\item Category codes 9~(ignored), 14~(comment)~and~15~(invalid) are omitted in above diagram.
+\end{itemize}
+\caption{State transitions of \pTeX's input processor.}
+\end{figure}
+
+
+\subsection{Behavior in \LuaTeX-ja}
+States in the input processoe of \LuaTeX\ is the same as that of \TeX,
+and they can't be customized by any callbacks. Hence, we can only use
+\verb+process_input_buffer+ and \verb+token_filter+ callbacks for to
+suppress a space by a linebreak which is after Japanese characters.
+
+However, \verb+token_filter+ callback cannot be used either, since a
+character in category code 5~(end-of-line) is converted into an space
+token \emph{in the input processor}.  So we can use only the
+\verb+process_input_buffer+ callback.  This means that suppressing a
+space must be done \emph{just before} an input line is read.
+
+Considering these situations, handling of a end-of-line in \LuaTeX-ja are as follows:
+\begin{quote}
+A character U+FFFFF (its category code is set to 14~(comment) by
+\LuaTeX-ja) is appended to an input line, before \LuaTeX\ actually
+process it, if and only if the following two conditions are satisfied:
+\begin{enumerate}
+\item The category code of the character $\langle${return}$\rangle$
+      (whose character code is 13) is 5~(end-of-line).
+\item The input line matches the following `regular expression':
+\[
+  (\text{any char})^*(\textbf{JAchar})
+  \bigl(\{\text{catcode}=1\}\cup\{\text{catcode}=2\}\bigr)^*
+\]
+\end{enumerate}
+
+\end{quote}
+
+\section{Insertion of JFM glues, \textsf{kanjiskip} and \textsf{xkanjiskip}}
+This is the longest section of the document.
+
+jfmglue.tex の内容をここに入れる
+\end{document}