From 706211be9ce73b3d17014d6b3fd75af5bf18035a Mon Sep 17 00:00:00 2001 From: Hironori Kitagawa Date: Fri, 4 Nov 2011 11:24:15 +0900 Subject: [PATCH] Updated the draft for post-proceedings. --- doc/ajt-devel-ltja.tex | 395 +++++++++++++++++----- doc/ajt.cls | 872 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1185 insertions(+), 82 deletions(-) create mode 100644 doc/ajt.cls diff --git a/doc/ajt-devel-ltja.tex b/doc/ajt-devel-ltja.tex index 3ed7907..a613b7e 100644 --- a/doc/ajt-devel-ltja.tex +++ b/doc/ajt-devel-ltja.tex @@ -7,13 +7,16 @@ \usepackage{luatexja} \DeclareFontShape{JY3}{mc}{m}{n}{<-> s*[0.92489] file:ipaexm.ttf:jfm=ujis}{} \DeclareFontShape{JY3}{gt}{m}{n}{<-> s*[0.92489] file:ipaexg.ttf:jfm=ujis}{} +% quick hack: monospaced Japanese font by \ttfamily +\DeclareKanjiFamily{JY3}{\ttdefault}{}{} +\DeclareFontShape{JY3}{\ttdefault}{m}{n}{<-> s*[0.92489] file:ipaexg.ttf:jfm=mono}{} %%% for LTXexample environment \usepackage{showexpl,lltjlisting} \lstset{basicstyle=\ttfamily, width=0.3\textwidth} -%%% for logo -\usepackage{mflogo} + +\usepackage{mflogo,booktabs} %%% Verbatim environment \usepackage{fancyvrb} @@ -69,22 +72,29 @@ Here we cite three examples: This package is based on \LaTeXe\ and |fontspec| package. \item |luajp-test| package\cite{luajp-test}, a test package made by Atsuhito Kohda, based on articles on the web page~\cite{joylua}. \end{itemize} -% ltja: hassan boushi + \subsection{Development Policy of \LuaTeX-ja} -\label{ssec-pol} -The first aim of the project is to implement features of p\TeX as macros under \LuaTeX, so \LuaTeX-ja is much affected by p\TeX. -However, as the development proceeds, some technical/conceptual difficulties are arised. Hence we changed the aim of the project: +\label{ssec-pol} +The first aim of the project is to implement features (from the +''primitive'' level) of p\TeX as macros under \LuaTeX, so \LuaTeX-ja is +much affected by p\TeX. However, as the development proceeds, some +technical/conceptual difficulties are arised. Hence we changed the aim +of the project. \begin{itemize} \item\emph{\LuaTeX-ja offers more flexibility of typesetting than that by p\TeX.} - There is JIS~X~4051 Japanese Standard, ... - However, we think that the ability of producing outputs conformed to JIS~X~4051 is not enough for (Japanese) typesetting; - the \TeX\ engine can handle the case even when one wants to produce very incoherent output for some reason. - In this point, we can say p\TeX has some flexibility, hence \LuaTeX-ja should have more. + We think that the ability of producing outputs conformed to + JIS~X~4051~\cite{jisx4051}, the Japanese Industrial Standard for + typesetting, is not enough; if one wants to produce very + incoherent outputs for some reason, it should be possible. +In this point, previous attempts of Japanese typesetting with \LuaTeX\ + which we cited in the previous subsection are inadequate. - For this reason, \LuaTeX-ja has counterparts of additional primitives of p\TeX. +p\TeX has some flexibility of typesetting, by changing internal + parameters such as |\kanjiskip| or |\prebreakpenalty|, and by using + custom JFM (Japanese TFM). ... \item\emph{\LuaTeX-ja isn't mere re-implementation or porting of p\TeX; some (technically and/or conceptually) inconvenient features of @@ -104,25 +114,30 @@ specifications. In Section~3, we show the current status of the \LuaTeX-ja proje For implementing features into \LuaTeX-ja, we had to use some tricks in Lua scripts. In Section~4, we describe several these tricks and internal processing methods. -We hope that the materials in this section, espcially -Subsection~4.3, have good applications. +We hope that the materials in this section have good applications. \section{Major differences with \pTeX} In this section, we breifly look at ** major differences between p\TeX\ and \LuaTeX-ja. +For genral information of Japanese typesetting and the facts about p\TeX, please see Okumara~\cite{ptexjp}. + \subsection{Names of Control Sequences} -Since p\TeX\ is a modification of a \TeX\ engine, some primitives added in it takes a form that cannot be simulated by a macro. -For example, an additional primitive |\prebreakpenalty|$\langle\hbox{\it -char\_code}\rangle$|=|$\langle\hbox{\it penalry}\rangle$ in p\TeX\ sets the -amount of penalty inserted before $\langle\hbox{\it char\_code}\rangle$ -to $\langle\hbox{\it penalry}\rangle$. +\label{ssec-csname} +Since p\TeX\ is a engine modification of Knuth's original \TeX82 engine, +some primitives added in it takes a form that cannot be simulated by a +macro. For example, an additional primitive +|\prebreakpenalty|$\langle\hbox{\it +char\_code}\rangle$|[=]|$\langle\hbox{\it penalty}\rangle$ in p\TeX\ sets +the amount of penalty inserted before $\langle\hbox{\it +char\_code}\rangle$ to $\langle\hbox{\it penalty}\rangle$, and |\prebreakpenalty|$\langle\hbox{\it +char\_code}\rangle$ can be also used for retrieving the value. Moreover, there are some parameters for Japanese typesetting which were mere internal integers, dimensions, or~skips in p\TeX\ that cannot be implemented by same approaches in \LuaTeX-ja. These parameters have a -common feature; the values at the end of a horizontal box or that of a -paragraph are effective in whole box or apragraph. A good example of +common point; the values at the end of a horizontal box or that of a +paragraph are effective in whole box or paragraph. A good example of them is |\kanjiskip|, the default amount of a skip which will be inserted between two consecutive Japanese characters by default. The reason of this is the place of |hpack_filter| in the \LuaTeX's @@ -130,44 +145,48 @@ CWEB-source code, and we will discuss on it in Subsection~\ref{ssec-stack}. From above 2~problems we discussed above, the assignment and retrieval -of most parameters in \LuaTeX-ja are summarize into 3~control sequences: +of most parameters in \LuaTeX-ja are summarized into 3~control sequences: \begin{itemize} \item |\ltjsetparameter{|$\langle\hbox{\it name}\rangle$|=|$\langle\hbox{\it value}\rangle$|,...}|: for local assignment. -\item |\ltjglobalsetparameter|: for global assignment. +\item |\ltjglobalsetparameter|: for global assignment. These two control + sequences obey the value of |\globaldefs| primitive. \item |\ltjgetparameter{|$\langle\hbox{\it name}\rangle$|}[{|$\langle\hbox{\it optional argument}\rangle$|}]|: for retrieval. The returned value is always a string. \end{itemize} -\subsection{Linebreak after Japanese Character} +\subsection{Linebreak after a Japanese Character} \label{ssec-line} + Japanese texts can linebreak almost everywhere, in contrast with -alphabetic texts can linebreak only between on words (or use +alphabetic texts can linebreak only between words (or use hyphenation). Hence, p\TeX's input processor is modified so that a linebreak after a Japanese character doesn't emit a space. However, -there is no way to customize the input processor of \LuaTeX. All we can -do is that modify an input line before when \LuaTeX\ begin to process -it, using |process_input_buffer| callback. +there is no way to customize the input processor of \LuaTeX, other than +hack its CWEB-source. All we can do is to modify an input line before +when \LuaTeX\ begin to process it, inside the |process_input_buffer| +callback. Hence, in \LuaTeX-ja, a comment letter (we reserve U+FFFFF for this purpose) will be appended to an input line, if this ends with a Japanese character\footnote{Strictly speaking, it also requires that the catcode -of the endline character is 5.}. One might jump to a conclusion that the -treatment of linebreaks by p\TeX and that of \LuaTeX-ja is very similar, +of the endline character is 5~(\emph{end-of-line}). This condition is useful under the +verbatim environment.}. One might jump to a conclusion that the +treatment of a linebreak by p\TeX\ and that of \LuaTeX-ja is totally same, but they are different in the respect that \LuaTeX-ja's judgement whether a comment letter will be appended the line is done \emph{before} -the line is processed by \LuaTeX. +the line is actually processed by \LuaTeX. Figure~\ref{fig-linebreak} shows an example; the command at the first line marks most of Japanese characters as ``non-Japanese character''. In -other words, from this command onward, the letter `あ' will not be -received any process of \LuaTeX-ja. Then, it is natural to occur a space -between `あ' and `y' in the output, where the actual output does not so. -This is because `あ' is considered to be a Japanese character by -\LuaTeX-ja, when \LuaTeX-ja look the end of the input line~2. +other words, from this command onward, the letter `あ' will be treated +as an alphabetic character by \LuaTeX-ja. Then, it is natural to occur a +space between `あ' and `y' in the output, where the actual output in the figure does +not so. This is because `あ' is considered to be a Japanese character +by \LuaTeX-ja, when \LuaTeX-ja does a decision whether U+FFFFF will be added to the input line~2. \begin{figure} \begin{LTXexample} \font\x=IPAMincho \x @@ -178,19 +197,26 @@ y \end{figure} \subsection{Separation between ``real'' fonts and Metrics} +\label{ssec-sepmet} + Traditionally, most Japanese fonts used in typesetting are monospaced, -that is, most glyphs have same size and square-shaped. Hence, it is not -rare that the contents of different Japanese TFMs (JFM, for short) are -totally same, and only differ in their names. For example, the +that is, most glyphs have same size (in most cases, +square-shaped). Hence, it is not rare that the contents of different +JFMs are totally same, and only differ in their names. For example, the difference between |min10.tfm| and |goth10.tfm|, which are JFMs shipped -with p\TeX\ for \emph{Mincho} and \emph{Gothic} fonts, are their -|FAMILY| and |FACE| only. Another example is: if one want to use many -fonts which are not installed in his \TeX\ distribution, of course he -needs to prepare TFMs for them. But, as long as he wants to use Japanese -fonts with p\TeX, he has to only copy and rename some JFM (\emph{e.g.,}~copy |jis.tfm| to |hoge.tfm|). +with p\TeX\ for seriffed \emph{mincho} family and sans-seriffed +\emph{gothic} family, are their |FAMILY| and |FACE| only. Moreover, +|jis.tfm| and |jisg.tfm|, which consists a parts of \emph{jis} font +metric which is used in Haruhiko Okumura's +\emph{jsclasses}~\cite{jsclasses}, are totally same as binary files. +Another example is: if one want to use many fonts which are not +installed in his \TeX\ distribution, of course he needs to prepare TFMs +for them. But, as long as he wants to use Japanese fonts with p\TeX, he +has to only copy and rename some JFM (\emph{e.g.},~copy |jis.tfm| to +|hoge.tfm|). Considering this situation, we decided to separate ``real'' fonts and -Metrics in \LuaTeX-ja, as shown in Figure~\ref{fig-jfdef}; +metrics in \LuaTeX-ja, as shown in Figure~\ref{fig-jfdef}; \begin{itemize} \item a control sequence |\jfont| must be used for japanese fonts, instead of |\font|. \item \LuaTeX-ja automatically loads the |luaotfload| package, so @@ -198,7 +224,7 @@ Metrics in \LuaTeX-ja, as shown in Figure~\ref{fig-jfdef}; Figure~\ref{fig-jfdef}. \item The |jfm| key specifies the metric for the font. In Figure~\ref{fig-jfdef}, both fonts will use a metric stored in a Lua script named - |jfm-ujis.lua|. + |jfm-ujis.lua|. This metric is the standard metric in \LuaTeX-ja, and is based on JFMs used in the \emph{otf} package~\cite{otf}. \item The |psft:| prefix can be used to specify name-only, noembedded fonts. \end{itemize} @@ -209,80 +235,271 @@ We note that |-kern| in features is important, since if kerning information from \jfont\foo=file:ipaexm.ttf:jfm=ujis;script=latn;-kern;+jp04 at 12pt \jfont\bar=psft:Ryumin-Light:jfm=ujis at 10pt \end{verbatim} -\caption{Typical declarations of Japanese fonts} +\caption{Typical declarations of Japanese fonts.} \label{fig-jfdef} \end{figure} -\subsection{Insertion of Kerns and/or Glues for Japanese Typesetting: The Timing} +\subsection{Insertion of Kerns and/or Glues for Japanese Typesetting: the Timing} As described in \cite{luatexref}, \LuaTeX's kerning and ligaturing -process is totally different from that of Knuth's original \TeX82. -\TeX82's process is done just when a (sequence of) character node is -appended to current list, hence we can cancel this process by writing -|f{}irm| (this gives `f\hbox{}irm' in \TeX82). However, \LuaTeX's process is +process is totally different from that of \TeX82. +\TeX82's process is done just when a (sequence of) character is appended +to current list. Thus we can interrupt this process by writing |f{}irm| +(this gives `f\hbox{}irm' in \TeX82). However, \LuaTeX's process is \emph{node-based}, that is, the process will be done when a horizontal box of a paragraph is ended, so |f{}irm| and |firm| yield the same output under \LuaTeX. -The situation for Japanese characters is basically same, but not entirely. -Glues (and kerns) those will be needed for Japanese typesetting will be divided into the following three categories: +The situation for Japanese characters is basically same, but not +entirely. Glues (and kerns) those will be needed for Japanese +typesetting will be divided into the following three categories: \begin{description} -\item[Glues (and Kerns) from the Metric of Japanese Fonts] -\item[Default Skip Between a Japanese Character and an Alphabetic Character] -Usually 1/4 of fullwidth with some stretch and shrink. -\item[Default Skip Between Two Consecutive Japanese Characters] +\item[Glue (or Kern) from the Metric of Japanese Fonts] +\item[Default Glue Between a Japanese Character and an Alphabetic Character] +Usually 1/4 of fullwidth with some stretch and shrink for justifying each line. +\item[Default Glue Between Two Consecutive Japanese Characters] +The main reason of this glue is to enable line-breaking almost everywhere in Japanese texts. In most cases, its natural width is zero, and +some stretch/shrink for justifying each line. \end{description} In p\TeX, these three kinds of glues are treated differently. The first - category (\emph{JFM glue}, for short) is inserted when a Japanese - character node is appended to current list, same as alphabetic - characters in \TeX82. The second category (\emph{xkanjiskip}, for + category (\emph{JFM glue}, for short) is inserted when a (sequence of) + Japanese character is appended to current list, same as alphabetic + characters in \TeX82. This means that one can interrupt the insertion + process by saying |{}|. The second category (\emph{xkanjiskip}, for short) is inserted just before `hpack' or line-breaking of a paragraph; this timing is somewhat similar to that of \LuaTeX's kerning process. The third category (\emph{kanjiskip}, for short) is not - appeared as a node anywhere; only appears implicitly in calculation of - width of a horizontal box of line-breaking. These specifications made + appeared as a node anywhere; only appears implicitly in calculation of the + width of a horizontal box or that of linebreaking. These specifications made p\TeX's behavior very hard to understand. -\LuaTeX-ja does the insertion process of glues in all three categories -simultaneously, inside |hpack_filter| and |pre_linebreak_filter| -callbacks. The reasons of this specification are to behave like -alphabetic characters in \LuaTeX\ (as described in the first paragraph), -and to clarify the specification for \LuaTeX-ja's process. +\LuaTeX-ja inserts glues in all three categories simultaneously inside +|hpack_filter| and |pre_linebreak_filter| callbacks. The reasons of +this specification are to behave like alphabetic characters in \LuaTeX\ +(as described in the first paragraph), and to clarify the specification +for \LuaTeX-ja's process. + +\subsection{Insertion of Kerns and/or Glues for Japanese Typesetting: the Spec} +\begin{figure} +\begin{center} +\begin{tabular}{llllllll} +\toprule +&\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}&\multicolumn{1}{c}{(3)}&\multicolumn{1}{c}{(4)}\\ +Input &|あ】{}【〙\/〘| &|い』\/a| &|う)\hbox{}(| &|え]\special{}[|\\\midrule +p\TeX &あ】\hbox{}【〙\hbox{}〘&い』\/a &う)\hbox{}( &え]\hbox{}[\\ +\LuaTeX-ja &あ】{}【〙\/〘 &い』\/a &う)\hbox{}( &え]\special{}[\\ +\bottomrule +\end{tabular} +\end{center} +\caption{Examples of differences between p\TeX\ and \LuaTeX-ja,} +\label{fig-jfmglue} +\end{figure} + +\begin{figure} +\begin{center} +\fontsize{40}{40}\selectfont\fboxsep=0mm +\fbox{\vrule width0pt height\cht depth\cdp あ}% +\fbox{\vrule width0pt height\cht depth\cdp 】\inhibitglue}% +\fbox{\vrule width0pt height\cht depth\cdp\kern.5\zw}% +\fbox{\vrule width0pt height\cht depth\cdp\kern.5\zw}% +\fbox{\vrule width0pt height\cht depth\cdp\hbox{}\inhibitglue【}% +\fbox{\vrule width0pt height\cht depth\cdp 〙\inhibitglue}% +\fbox{\vrule width0pt height\cht depth\cdp\kern.5\zw}% +\fbox{\vrule width0pt height\cht depth\cdp\kern.5\zw}% +\fbox{\vrule width0pt height\cht depth\cdp \hbox{}\inhibitglue〘}% +\end{center} +\caption{Detail of (1) in Figure~\ref{fig-jfmglue}.} +\label{fig-ptexjfm} +\end{figure} +Now we will take a look inside the insertion process itself. -\subsection{Insertion of Kerns and/or Glues for Japanese Typesetting: The Behavior} +\begin{description} +\item[Ignored Nodes] +As noted in the previous subsection, the insertion process in p\TeX\ is + interrupted by saying |{}| or anything else. This leads the + second row in Figure~\ref{fig-jfmglue}, or + Figure~\ref{fig-ptexjfm}. ``The process is interrupted'' means that p\TeX\ + does not think the letter `】\inhibitglue' is followed by `\inhibitglue【', hence two + half-width glues are inserted between between `】\inhibitglue' and `\inhibitglue【', + where one is from `】\inhibitglue' and another is from `\inhibitglue【'. + + + On the other hand, in \LuaTeX-ja, the process is done inside + |hpack_filter| and |pre_linebreak_filter| callbacks. Hence, + \emph{anything that does not make any nodes will be + ignored,}\ in \LuaTeX-ja, as shown in (1) in + Figure~\ref{fig-jfmglue}. \LuaTeX-ja also ignores any nodes + which does not make any contribution to current horizontal + list---\emph{ins\_node}, \emph{adjust\_node}, + \emph{mark\_node}, \emph{whatsit\_node} and + \emph{penalty\_node}---, as shown in (4). + +By the way, around a \emph{glyph\_node} $p$ there may be some nodes + attached to $p$. These are an accent and kerns for + positioning it, and kerns from italic correction for $p$, and + it is natural that these attachments should be ignored in the + process. Hence \LuaTeX-ja takes this approach, as the latest + version of p\TeX\ (p3.2). This explains (2) in the figure. + +Summerizing, to + +\item[Fonts with the Same Metric] +Recall that \LuaTeX-ja separated ``real'' fonts and metrics, as in Subsection~\ref{ssec-sepmet}. +Consider the following input, where we assume that all Japanese fonts + use same metric, and |\gt| selects \emph{gothic} family: +\begin{quote} +\begin{verbatim} +明朝)\gt (ゴシック +\end{verbatim} +\end{quote} +If the above input is processed by p\TeX, since the insertion process is + interrupt by |\gt|, the result looks like +\begin{quote} +\mc 明朝)\hbox{}\gt (ゴシック +\end{quote} +But this is unnatural, since two Japanese fonts in the output uses the +same metric, \emph{i.e.}, the same typesetting rule. Hence, we decided +that Japanese fonts with the same metric are treated as one font in the +insertion process of \LuaTeX-ja. Thus, the output from the above input +in \LuaTeX-ja is: +\begin{quote} +\mc 明朝)\gt (ゴシック +\end{quote} +\end{description} \section{Current Status of the Development} -\LuaTeX-ja +At the moment, \LuaTeX-ja can be used under plain \TeX, and under +\LaTeXe. Generally speaking, one has to read |luatexja.sty|, by +|\input| command or |\usepackage|~(\LaTeXe) if you merely want to typeset Japanese character. +We look more detail by parts. + +\subsection{``Engine Extension''} +The lowest part of \LuaTeX-ja corresponds the p\TeX\ extension as +\emph{\TeX\ engine}. The development of \LuaTeX-ja is started from this +part. We, the project menbers, think that this part is almost +done. Other features of \LuaTeX-ja which we have not described are the +followings: +\begin{description} +\item[Adjusting the baseline of alphabetic characters and/or Japanese characters] + +\item[Setting the range of ``Japanese characters''] This feature is + inspired by up\TeX. up\TeX\ has an additional primitive named + |\kcatcode| for setting a character is treated as alphabetic + charaacter, \emph{kana}, \emph{kanji}, \emph{Hangul}, + or~\emph{other CJK character}, and the assignment of + |\kcatcode| can be done by a block of Unicode\footnote{There + are some exceptions. For example, U+FF00--FFEF (Halfwidth and + Fullwidth Forms) are divided into three blocks in up\TeX.}. + +\LuaTeX-ja uses a slightly different approach. Because there are many Unicode + blocks in Basic Multilingual Plane which are not included in + most Japanese fonts, ... +Furthermore, the basic Japanese character set JIS~X~0208 are not just + union of Unicode blocks. For example, the intersection of + JIS~X~0208 and Latin-1 Supplement consists of the following + characters: +Considering these two points, ... + +\end{description} +Note that \LuaTeX-ja doesn't support for vertical typesetting, \emph{tategaki}, for now. + +\subsection{Patches for plain \TeX\ and \LaTeXe} +p\TeX\ has patches for plain \TeX, namely |ptex.tex|, that for \LaTeXe\ +macro (this patch and \LaTeXe\ consist \emph{p\LaTeXe}), and +|kinsoku.tex| which includes the default setting of \emph{kinsoku +shori}, the Japanese hyphenation. We ported them to \LuaTeX-ja, except +the codes related to vertical typesetting. We remark two points related to the porting: +\begin{description} +\item[The Default Ranges of Japanese Characters] + + +\item[The behavior of\/ {\tt\char92fontfamily\/} command] +The |\fontfamily| command in p\LaTeXe\ changes the current alphabetic + font family and/or the current Japanese font family, + depending the argument. More concretely, + |\fontfamily{|$\langle\hbox{\it arg\/}\rangle$|}| changes the + current alphabetic font family to $\langle\hbox{\it + arg\/}\rangle$, if and only if one of the following + conditions are satisfied: +\begin{itemize} +\item Alphabetic font family named $\langle\hbox{\it arg\/}\rangle$ in + \emph{some} alphabetic encoding already defined in the document. +\item There exists an alphabetic encoding $\langle\hbox{\it + enc\/}\rangle$ already defined in the document such that a font + definition file $\langle\hbox{\it enc\/}\rangle\langle\hbox{\it + arg\/}\rangle$|.fd| exists. +\end{itemize} +The same criterion is used for changing Japanese font family. + +To make possible this behavior, one has to create a list of already + defined alphabetic encodings. Hence it works in p\LaTeXe, ... +However, since \LuaTeX-ja is loaded as a package, it will not + work. Hence \LuaTeX-ja adopted different approach, namely + |\fontfamily{|$\langle\hbox{\it arg\/}\rangle$|}| changes the + current alphabetic font family to $\langle\hbox{\it + arg\/}\rangle$, if and only if: +\begin{itemize} +\item Alphabetic font family named $\langle\hbox{\it arg\/}\rangle$ in the current alphabetic encoding $\langle\hbox{\it enc\/}\rangle$. +\item A font definition file $\langle\hbox{\it enc\/}\rangle\langle\hbox{\it + arg\/}\rangle$|.fd| exists. +\end{itemize} + + +\end{description} + + + +\subsection{Classes for Japanese Documents} +To produce ``high-quality'' Japanese documents, we need not only that +Japanese characters are correctly placed, but also class files for +Japanese documents. In p\TeX, there are two major families of classes: +\emph{jclasses} which is distributed with the official p\LaTeXe\ macros, +and \emph{jsclasses}~\cite{jsclasses} which has developed by Haruhiko +Okumura and now widely used in Japanese \TeX\ users. At the present, +\LuaTeX-ja simply contains their counterparts: \emph{ltjclasses} and +\emph{ltjsclasses}. However, the policy on classess is not determined +now, and we hope to have another family of classes which are useful in +commercial printing. In the author's opinion, \emph{ltjclasses} is +better to stay as an example of porting of class files for \pTeX\ to +\LuaTeX-ja. + \section{Implementation} \subsection{Handling of Japanese Fonts} In p\TeX, there are three slots for maintaining current fonts, namely |\font| for alphabetic fonts, |\jfont| for Japanese font (in horizontal -direction) and |\tfont| for Japanese font (in vertical direction). With these slots, we can select -current font for alphabetic characters and that for Japanese characters separately in p\TeX. -However, \LuaTeX\ has only one slot for maintaining current font, as \TeX82. -This situation leads a problem: how can we maintain ``current Japanese font''? +direction) and |\tfont| for Japanese font (in vertical direction). With +these slots, we can select the current font for alphabetic characters +and that for Japanese characters separately in p\TeX. However, \LuaTeX\ +has only one slot for maintaining the current font, as \TeX82. This +situation leads a problem: how can we maintain the ``current Japanese +font''? There are three approaches for this problem. One approach is to make a mapping table from alphabetic fonts to corresponding Japanese fonts (here we don't assume that NFSS2 is available), and when current -alphabetic font is changed, current Japanese font also changes according -to the table. Another approach is that we always use composite fonts -with alphabetic fonts and Japanese fonts. The third approach is that the -information of current Japanese font is stored in an attribute. We -adopted the third approach, since \LuaTeX-ja is much affected by p\TeX\ -as we noted in Subsection~\ref{ssec-pol}. - +alphabetic font is changed, the current Japanese font also changes +according to the table. Another approach is that we always use +composite fonts with alphabetic fonts and Japanese fonts. The third +approach is that the information of the current Japanese font is stored +in an attribute. We adopted the third approach, since \LuaTeX-ja is much +affected by p\TeX\ as we noted in Subsection~\ref{ssec-pol}. +As in Figure~\ref{fig-jfdef}, \LuaTeX-ja uses |\jfont| for defining +Japanese font, as p\TeX. However, since the information of the current +Japanese font is stored into an attribute, control sequences defined by +|\jfont| (\emph{e.g.},~|\foo| and |\bar| in Figure~\ref{fig-jfdef}) is +not representing a font by the means of original \TeX. In other words, +these control sequence cannot be an argument of |\the| or |\textfont|, and they are just an assignments to an attribute, in fact. \subsection{Overview of the Processes} Now we describe an outline of the \LuaTeX-ja's process briefly. \begin{description} \item[Treatment of Linebreaks after Japanese Characters] We described - this already at Subsection~\ref{ssec-line}. Registered in the + this already at Subsection~\ref{ssec-line}. Done in the |process_input_buffer| callback. \item[Font Replacement] In the |hyphenate| callback, we looks into for each \textit{glyph\_node}~$p$. If its character is considered @@ -319,11 +536,18 @@ Under \LuaTeX-ja, the size of the virtual body of a Japanese character To adjust size/places of Japanese characters, \LuaTeX-ja encapsules a \textit{glyph\_node} which containing a Japanese character into a horizontal box which size is specified in the metric. +As the case of `\inhibitglue {', a half-widthed horizontal box \end{description} \subsection{Stack Management} \label{ssec-stack} -\LuaTeX-ja has a lot of parameters for Japanese typesetting. + +As we noted on Subsection~\ref{ssec-csname}, parameters that the values +at the end of a horizontal box or that of a paragraph are effective in +whole box or paragraph cannot be implemented by internal integers or +other types. We explain it in this section. + + \subsection*{About the Project} \subsection*{Acknowledgements} @@ -359,6 +583,13 @@ Yannis Haralambous. \textbf{The Joy of LuaTeX}. \url{http://luatex.bluwiki.com/} \bibitem{luatexref} \textbf{The \LuaTeX reference} +\bibitem{jsclasses} +Haruhiko Okumura\ (奥村晴彦), \textbf{pLaTeX2e 新ドキュメントクラス}\ (in Japanese). \url{http://oku.edu.mie-u.ac.jp/~okumura/jsclasses/} + +\bibitem{ptexjp} +Haruhiko Okumura\ (奥村晴彦), \textbf{p\TeX\ and Japanese Typesetting}, The Asian Journal of \TeX\ \textbf{2}~(2008), 43--51. + + \end{thebibliography} \end{document} diff --git a/doc/ajt.cls b/doc/ajt.cls new file mode 100644 index 0000000..7f18501 --- /dev/null +++ b/doc/ajt.cls @@ -0,0 +1,872 @@ +%% +%% Copyright (C) 2010 The Korean TeX Society. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation; either version 2 of the License, or +%% (at your option) any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program; if not, write to the Free Software +%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesClass{ajt} + [2010/12/31 v0.73 The Asian Journal of TeX Class] +\let\ExecuteOptions@ltx\ExecuteOptions +\def\ExecuteOptions#1{% + \ExecuteOptions@ltx{a4paper,10pt,twoside,onecolumn,final}% +}% +\LoadClassWithOptions{article} +\let\ExecuteOptions\ExecuteOptions@ltx +\def\normal@body@spread{1.069} +\def\normal@info@spread{1.0} +\def\normalbodyspread{\linespread{\normal@body@spread}\selectfont} +\linespread{\normal@body@spread} +%%% +%%% korean option: use ko.TeX for Korean typesetting (default: english) +%%% ptexjs option: use pTeX (jsclasses appearance) for Japanese typesetting (default: english) +%%% dvips option: use dvips instead of dvipdfmx, xetex or pdftex +%%% print option: final version (default: preprint) +%%% reprint option: print option without crop (default: preprint) +%%% koreanabstract option: abstract is korean not english (default: english) +%%% ptexjsabstract option: abstract is japanese (jsclasses appearance) not english (default: english) +%%% +\newif\if@korean\@koreanfalse +\newif\if@ptexjs\@ptexjsfalse +\newif\if@print\@printfalse +\newif\if@reprint\@reprintfalse +\newif\if@korabstract\@korabstractfalse +\newif\if@ptexjsabstract\@ptexjsabstractfalse +\def\tpd@driver{pdftex} +\def\dps@driver{dvips} +\def\dpx@driver{dvipdfmx} +\def\xtx@driver{xetex} +%%% +\RequirePackage{ifpdf} +\ifpdf + \let\@dvi@driver\tpd@driver +\else + \expandafter\ifx\csname XeTeXrevision\endcsname\relax + \let\@dvi@driver\dpx@driver + \else + \let\@dvi@driver\xtx@driver + \fi +\fi +%%% +\DeclareOption{korean}{\@koreantrue\@ptexjsfalse} +\DeclareOption{ptexjs}{\@ptexjstrue\@koreanfalse} +\DeclareOption{dvips}{\let\@dvi@driver\dps@driver} +\DeclareOption{print}{\@printtrue\@reprintfalse} +\DeclareOption{reprint}{\@printtrue\@reprinttrue} +\DeclareOption{koreanabstract}{\@korabstracttrue\@ptexjsabstractfalse} +\DeclareOption{ptexjsabstract}{\@ptexjsabstracttrue\@korabstractfalse} +\ProcessOptions +%%% +\setlength\paperwidth{170mm} +\setlength\paperheight{254mm} +\setlength\textwidth{132mm} +\setlength\oddsidemargin{-6.4mm} +\setlength\evensidemargin\oddsidemargin +\if@print\if@reprint\else% for final printing only + \addtolength\oddsidemargin{1.5mm} + \addtolength\evensidemargin{-1.5mm} +\fi\fi +\setlength\textheight{210mm} +\setlength\headheight{12pt} +\setlength\headsep{14pt} +\setlength\topmargin{-10mm} +\setlength\footskip{24pt} +%%% +%%% AJT use CM math fonts, not mathpazo.sty +%%% +\ifx\@dvi@driver\xtx@driver % XeTeX + \if@print + \RequirePackage{fontspec,xunicode} + \RequirePackage[no-sscript]{xltxtra} + \setmainfont[Mapping=tex-text]{Palatino LT Std} + \setsansfont[Mapping=tex-text]{Optima LT Std} + \else + \RequirePackage{fontspec,xunicode,xltxtra} + \fi +\else % pdfTeX, DVIPDFMx, DVIPS + \renewcommand\rmdefault{ppl} % URW Palatino + \if@print + \renewcommand\sfdefault{pop} % Adobe Optima + %\renewcommand\sfdefault{uop} % URW Classico (Optima clone) + \fi + \if@korean + \renewcommand\bfdefault{b} + \fi +\fi +%%% +\ifx\@dvi@driver\dpx@driver + \RequirePackage[dvipdfmx]{color,graphicx} + \RequirePackage[unicode,dvipdfmx]{hyperref} +\else + \RequirePackage{color,graphicx} + \ifx\@dvi@driver\xtx@driver + \RequirePackage{hyperref} + \else + \RequirePackage[unicode]{hyperref} + \fi +\fi +\if@print\setkeys{Hyp}{nolinks=true}\fi +%%% +\RequirePackage{calc} +\RequirePackage{amsmath} +\RequirePackage{textcomp} +%%% +\if@print\if@reprint\else + \IfFileExists{crop.sty} + {\ifx\@dvi@driver\tpd@driver% pdftex + \RequirePackage[a4,center,cam,pdftex!]{crop}% + \else% dvips or dvipdfmx or xetex + \RequirePackage[a4,center,cam,dvips!]{crop}% + \fi + }{} +\fi\fi +\if@korean + \ifx\@dvi@driver\xtx@driver % XeTeX + \RequirePackage{xetexko} + \if@print + \setmainhangulfont[ + BoldFont={YoonMyungjo Medium}, + Mapping=tex-text, Renderer=ICU, + preperiodkern={-.3ex}, precommakern={-.3ex} + ]{YoonMyungjo Light} + \setsanshangulfont[ + BoldFont={YoonGothic Medium}, + Mapping=tex-text, Renderer=ICU, + preperiodkern={-.1ex}, precommakern={-.1ex} + ]{YoonGothic Light} + \setmonohangulfont[ + BoldFont={YoonGothic Medium}, + Mapping=tex-text, Renderer=ICU + ]{YoonGothic Light} + \fi + \linespread{\normal@body@spread} + \hangulquotes + \else + \RequirePackage[utf,finemath]{kotex} + \RequirePackage[default]{dhucs-interword} + \if@print + \RequirePackage[gremphhangul=yngt,gremphhanja=yngt]{dhucs-gremph} + \usehangulfontspec{yn} + \SetHangulFonts{ynmj}{yngt}{yngt} + \SetHanjaFonts{ynmj}{yngt}{yngt} + \DeclareFontFamily{LUC}{grem}{\hyphenchar \font\m@ne} + \DeclareFontShape{LUC}{grem}{m}{n}{<-> LUC * o\GrEmphFont l}{} + \DeclareFontShape{LUC}{grem}{m}{it}{<-> LUC * o\GrEmphFont l}{} + \DeclareFontShape{LUC}{grem}{m}{sl}{<-> LUC * o\GrEmphFont l}{} + \DeclareFontFamily{LUC}{gremhj}{\hyphenchar \font\m@ne} + \DeclareFontShape{LUC}{gremhj}{m}{n}{<-> LUC * o\GrEmphHanjaFont l}{} + \DeclareFontShape{LUC}{gremhj}{m}{it}{<-> LUC * o\GrEmphHanjaFont l}{} + \DeclareFontShape{LUC}{gremhj}{m}{sl}{<-> LUC * o\GrEmphHanjaFont l}{} + \else + \RequirePackage{dhucs-gremph} + \usehangulfontspec{ut} + \SetHangulFonts{utmj}{utgt}{utgt} + \SetHanjaFonts{utmj}{utgt}{utgt} + \fi + \fi + \def\korean@body@spread{1.35} + \def\korean@info@spread{1.15} + \def\koreanbodyspread{\linespread{\korean@body@spread}\selectfont} + \def\koreaninfospread{\linespread{\korean@info@spread}\selectfont} + \renewcommand{\figurename}{그림} + \renewcommand{\tablename}{표} + \newcommand\hcntdot{\nobreak\mbox{$\cdot$}} + \newcommand\cntrdot{\kern.2em\hcntdot\nobreak\hskip.2em} + \newcommand\cntrdots{\kern.2em\hcntdot\nobreak\hskip.2em\hcntdot\nobreak\hskip.2em\hcntdot\nobreak\hskip.4em} + \ifx\@dvi@driver\xtx@driver % XeTeX + \newcommand\cnm[1]{〈#1〉} + \newcommand\ccnm[1]{《#1》} + \newcommand\snm[1]{「#1」} + \newcommand\bnm[1]{『#1』} + \else + \newcommand\cnm[1]{\kern-.10em〈#1〉\kern-.10em} + \newcommand\ccnm[1]{\kern-.198em《#1》\kern-.198em} + \newcommand\snm[1]{\kern-.10em「#1」\kern-.10em} + \newcommand\bnm[1]{\kern-.20em『#1』\kern-.20em} + \fi +\else\if@ptexjs + \DeclareFontShape{JY1}{mc}{m}{n}{<-> s * [0.961] jis}{} + \DeclareFontShape{JY1}{gt}{m}{n}{<-> s * [0.961] jisg}{} + \DeclareFontShape{JT1}{mc}{m}{n}{<-> s * [0.961] tmin10}{} + \DeclareFontShape{JT1}{gt}{m}{n}{<-> s * [0.961] tgoth10}{} + % + \DeclareFontShape{JY1}{mc}{m}{it}{<->ssub*mc/m/n}{} + \DeclareFontShape{JY1}{mc}{m}{sl}{<->ssub*mc/m/n}{} + \DeclareFontShape{JY1}{mc}{m}{sc}{<->ssub*mc/m/n}{} + \DeclareFontShape{JY1}{gt}{m}{it}{<->ssub*gt/m/n}{} + \DeclareFontShape{JY1}{gt}{m}{sl}{<->ssub*gt/m/n}{} + \DeclareFontShape{JY1}{mc}{bx}{it}{<->ssub*gt/m/n}{} + \DeclareFontShape{JY1}{mc}{bx}{sl}{<->ssub*gt/m/n}{} + \DeclareFontShape{JT1}{mc}{m}{it}{<->ssub*mc/m/n}{} + \DeclareFontShape{JT1}{mc}{m}{sl}{<->ssub*mc/m/n}{} + \DeclareFontShape{JT1}{mc}{m}{sc}{<->ssub*mc/m/n}{} + \DeclareFontShape{JT1}{gt}{m}{it}{<->ssub*gt/m/n}{} + \DeclareFontShape{JT1}{gt}{m}{sl}{<->ssub*gt/m/n}{} + \DeclareFontShape{JT1}{mc}{bx}{it}{<->ssub*gt/m/n}{} + \DeclareFontShape{JT1}{mc}{bx}{sl}{<->ssub*gt/m/n}{} + \DeclareRobustCommand\rmfamily + {\not@math@alphabet\rmfamily\mathrm + \romanfamily\rmdefault\kanjifamily\mcdefault\selectfont} + \DeclareRobustCommand\sffamily + {\not@math@alphabet\sffamily\mathsf + \romanfamily\sfdefault\kanjifamily\gtdefault\selectfont} + \DeclareRobustCommand\ttfamily + {\not@math@alphabet\ttfamily\mathtt + \romanfamily\ttdefault\kanjifamily\gtdefault\selectfont} + \def\textmc#1{\relax\ifmmode\hbox\fi{\mcfamily #1}} + \def\textgt#1{\relax\ifmmode\hbox\fi{\gtfamily #1}} + \def\ptexjs@body@spread{1.333} + \def\ptexjs@info@spread{1.15} + \def\ptexjsbodyspread{\linespread{\ptexjs@body@spread}\selectfont} + \def\ptexjsinfospread{\linespread{\ptexjs@info@spread}\selectfont} + \renewcommand{\figurename}{図} + \renewcommand{\tablename}{表} + \renewcommand{\appendixname}{付録} + \prebreakpenalty\jis"2147=10000 % 5000 ’ + \postbreakpenalty\jis"2148=10000 % 5000 “ + \prebreakpenalty\jis"2149=10000 % 5000 ” + \inhibitxspcode`〒=2 + \xspcode`+=3 + \xspcode`\%=3 + \xspcode`^^80=3 + \xspcode`^^81=3 + \xspcode`^^82=3 + \xspcode`^^83=3 + \xspcode`^^84=3 + \xspcode`^^85=3 + \xspcode`^^86=3 + \xspcode`^^87=3 + \xspcode`^^88=3 + \xspcode`^^89=3 + \xspcode`^^8a=3 + \xspcode`^^8b=3 + \xspcode`^^8c=3 + \xspcode`^^8d=3 + \xspcode`^^8e=3 + \xspcode`^^8f=3 + \xspcode`^^90=3 + \xspcode`^^91=3 + \xspcode`^^92=3 + \xspcode`^^93=3 + \xspcode`^^94=3 + \xspcode`^^95=3 + \xspcode`^^96=3 + \xspcode`^^97=3 + \xspcode`^^98=3 + \xspcode`^^99=3 + \xspcode`^^9a=3 + \xspcode`^^9b=3 + \xspcode`^^9c=3 + \xspcode`^^9d=3 + \xspcode`^^9e=3 + \xspcode`^^9f=3 + \xspcode`^^a0=3 + \xspcode`^^a1=3 + \xspcode`^^a2=3 + \xspcode`^^a3=3 + \xspcode`^^a4=3 + \xspcode`^^a5=3 + \xspcode`^^a6=3 + \xspcode`^^a7=3 + \xspcode`^^a8=3 + \xspcode`^^a9=3 + \xspcode`^^aa=3 + \xspcode`^^ab=3 + \xspcode`^^ac=3 + \xspcode`^^ad=3 + \xspcode`^^ae=3 + \xspcode`^^af=3 + \xspcode`^^b0=3 + \xspcode`^^b1=3 + \xspcode`^^b2=3 + \xspcode`^^b3=3 + \xspcode`^^b4=3 + \xspcode`^^b5=3 + \xspcode`^^b6=3 + \xspcode`^^b7=3 + \xspcode`^^b8=3 + \xspcode`^^b9=3 + \xspcode`^^ba=3 + \xspcode`^^bb=3 + \xspcode`^^bc=3 + \xspcode`^^bd=3 + \xspcode`^^be=3 + \xspcode`^^bf=3 + \xspcode`^^c0=3 + \xspcode`^^c1=3 + \xspcode`^^c2=3 + \xspcode`^^c3=3 + \xspcode`^^c4=3 + \xspcode`^^c5=3 + \xspcode`^^c6=3 + \xspcode`^^c7=3 + \xspcode`^^c8=3 + \xspcode`^^c9=3 + \xspcode`^^ca=3 + \xspcode`^^cb=3 + \xspcode`^^cc=3 + \xspcode`^^cd=3 + \xspcode`^^ce=3 + \xspcode`^^cf=3 + \xspcode`^^d0=3 + \xspcode`^^d1=3 + \xspcode`^^d2=3 + \xspcode`^^d3=3 + \xspcode`^^d4=3 + \xspcode`^^d5=3 + \xspcode`^^d6=3 + \xspcode`^^d7=3 + \xspcode`^^d8=3 + \xspcode`^^d9=3 + \xspcode`^^da=3 + \xspcode`^^db=3 + \xspcode`^^dc=3 + \xspcode`^^dd=3 + \xspcode`^^de=3 + \xspcode`^^df=3 + \xspcode`^^e0=3 + \xspcode`^^e1=3 + \xspcode`^^e2=3 + \xspcode`^^e3=3 + \xspcode`^^e4=3 + \xspcode`^^e5=3 + \xspcode`^^e6=3 + \xspcode`^^e7=3 + \xspcode`^^e8=3 + \xspcode`^^e9=3 + \xspcode`^^ea=3 + \xspcode`^^eb=3 + \xspcode`^^ec=3 + \xspcode`^^ed=3 + \xspcode`^^ee=3 + \xspcode`^^ef=3 + \xspcode`^^f0=3 + \xspcode`^^f1=3 + \xspcode`^^f2=3 + \xspcode`^^f3=3 + \xspcode`^^f4=3 + \xspcode`^^f5=3 + \xspcode`^^f6=3 + \xspcode`^^f7=3 + \xspcode`^^f8=3 + \xspcode`^^f9=3 + \xspcode`^^fa=3 + \xspcode`^^fb=3 + \xspcode`^^fc=3 + \xspcode`^^fd=3 + \xspcode`^^fe=3 + \xspcode`^^ff=3 + \def\@{\spacefactor3000\space} + \let\footnotes@ve=\footnote + \def\footnote{\inhibitglue\footnotes@ve} + \let\footnotemarks@ve=\footnotemark + \def\footnotemark{\inhibitglue\footnotemarks@ve} + \def\@inhibitglue{% + \futurelet\@let@token\@@inhibitglue} + \def\@@inhibitglue{% + \ifx\@let@token「 + \inhibitglue + \else + \ifx\@let@token( + \inhibitglue + \else + \ifx\@let@token『 + \inhibitglue + \else + \ifx\@let@token[ + \inhibitglue + \fi + \fi + \fi + \fi} + \let\everyparhook=\@inhibitglue + \setlength\parskip{0\p@} + \setlength\parindent{1zw} + \let\@startsection@orig\@startsection + \def\@startsection{\@afterindenttrue\@startsection@orig} + \AtBeginDocument{\everypar{\everyparhook}} +\else + \IfFileExists{microtype.sty}{\RequirePackage[protrusion=true,expansion=false]{microtype}}{} +\fi\fi +%%% +\definecolor{linkcolour}{rgb}{0,0.2,0.6} +\hypersetup{colorlinks,breaklinks, + linkcolor=linkcolour,citecolor=linkcolour, + filecolor=linkcolour, urlcolor=linkcolour} +\IfFileExists{switcheml.sty} + {\RequirePackage{switcheml} + \AtBeginDocument{\@ifx@undefined{\typesetemail}{\obfuscateemail}{}}} + {\AtBeginDocument{\@ifx@undefined{\typesetemail}{\hyperlinkemail}{}}} +\renewcommand\maketitle{\par + \ifajt@noabstract\else + \@ifx@undefined{\ajt@info@Abstract} + {\ClassError{ajt} + {Please specify an \string\abstract\space before \string\maketitle} + {It is a Asian Journal of TeX requirement to include an abstract. \MessageBreak + \MessageBreak + If you have exceptional reasons for not having one in this \MessageBreak + article, write \string\noabstract\space somewhere before \string\maketitle.}}{} + \fi + \begingroup + \renewcommand\thefootnote{\@fnsymbol\c@footnote}% + \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}% + \long\def\@makefntext##1{\parindent 1em\noindent + \hb@xt@1.8em{% + \hss\@textsuperscript{\normalfont\@thefnmark}}##1}% + \newpage + \global\@topnum\z@ % Prevents figures from going at top of page. + \@maketitle + \thispagestyle{titlepage}\@thanks + \endgroup + \setcounter{footnote}{0}% + \global\let\thanks\relax + \global\let\maketitle\relax + \global\let\@maketitle\relax + \global\let\title\relax + \global\let\author\relax + \global\let\date\relax + \global\let\and\relax + \if@korean\koreanbodyspread\fi + \if@ptexjs\ptexjsbodyspread\fi +}% +\def\@maketitle{% + \newpage + \null + \write@ID@aux\read@issue + \begin{flushleft} + \let\footnote\thanks + \begingroup + \LARGE\@title + \ifx\@empty\@etitle\else + \settowidth\@tempdima{\@title}% + \settowidth\@tempdimb{\@etitle}% + \advance\@tempdima\@tempdimb + \ifdim\@tempdima>\textwidth\\[-0.1\baselineskip]\noindent\thinspace + \vtop{% + \setlength\hsize{\textwidth-2em}% + \normalbodyspread\large\@etitle} + \else\enspace + {\normalbodyspread\large\@etitle} + \fi + \fi\par + \endgroup + \vspace{24pt}% + \@tempcnta\z@\loop\ifnum\@tempcnta<\value{num@author}\@makeauthors\repeat + \end{flushleft} + \ajt@optional@author@info + \vspace{12pt} + \ajt@info@container{Keywords} + \ifajt@noabstract\else + \vspace{12pt}% + \ajt@info@container{Abstract} + \fi + \vspace{24pt}} +\def\@makeauthors{% + \advance\@tempcnta\@ne + \def\@author{{\large\csname @author\the\@tempcnta\endcsname}}% + \def\@eauthor{{\normalsize\csname @eauthor\the\@tempcnta\endcsname}}% + \def\@address{\csname @address\the\@tempcnta\endcsname}% + \def\@email{\csname @email\the\@tempcnta\endcsname}% + \begin{minipage}[t]{\ifnum\value{num@author}>1 0.5\fi\textwidth} + \small + \@author + \ifx\@empty\@eauthor\else\enspace\@eauthor\fi + \\[0.3\baselineskip] + \ifx\@empty\@address\else + \settowidth\@tempdima{\@address}% + \@address + \ifdim\@tempdima>0.5\textwidth\\\else\enspace\fi + \fi + \ifx\@empty\@email\else\typesetemail\@email\fi + \end{minipage}\hfill + \ifodd\@tempcnta\else\par\vspace{\baselineskip}\fi +} +\newcounter{num@author}\setcounter{num@author}{0} +\renewcommand*{\title}[2][]{\gdef\@etitle{#1}\gdef\@title{#2}} +\renewcommand*{\author}[2][]{% + \stepcounter{num@author}% + \expandafter\gdef\csname @eauthor\thenum@author\endcsname{#1}% + \expandafter\gdef\csname @author\thenum@author\endcsname{#2}% +} +\newcommand*{\address}[1]{% + \expandafter\gdef\csname @address\thenum@author\endcsname{#1}% +} +\newcommand*{\email}[1]{% + \expandafter\gdef\csname @email\thenum@author\endcsname{#1}% +} +\if@ptexjs +\renewcommand\section{\@startsection {section}{1}{\z@}% + {3.5ex \@plus 1ex \@minus .2ex}% + {2.5ex \@plus.2ex}% + {\normalfont\sffamily\bfseries\large\raggedright}} +\renewcommand\subsection{\@startsection{subsection}{2}{\z@}% + {2.5ex \@plus 1ex \@minus .2ex}% + {1.5ex \@plus .2ex}% + {\normalfont\sffamily\bfseries\raggedright}} +\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}% + {2ex \@plus .5ex \@minus .2ex}% + {1ex \@plus .2ex}% + {\normalfont\normalsize\raggedright}} +\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}% + {2.5ex \@plus1ex \@minus.2ex}% + {-1em}% + {\normalfont\normalsize\sffamily\itshape}} +\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\z@}% + {2.5ex \@plus1ex \@minus .2ex}% + {-1em}% + {\normalfont\normalsize\sffamily\itshape}} +\else +\renewcommand\section{\@startsection {section}{1}{\z@}% + {-3.5ex \@plus -1ex \@minus -.2ex}% + {2.5ex \@plus.2ex}% + {\normalfont\bfseries\large\raggedright}} +\renewcommand\subsection{\@startsection{subsection}{2}{\z@}% + {-2.5ex\@plus -1ex \@minus -.2ex}% + {1.5ex \@plus .2ex}% + {\normalfont\bfseries\raggedright}} +\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}% + {-2ex\@plus -.5ex \@minus -.2ex}% + {1ex \@plus .2ex}% + {\normalfont\normalsize\raggedright}} +\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}% + {2.5ex \@plus1ex \@minus.2ex}% + {-1em}% + {\normalfont\normalsize\itshape}} +\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}% + {2.5ex \@plus1ex \@minus .2ex}% + {-1em}% + {\normalfont\normalsize\itshape}} +\fi +\let\ajt@itemize\itemize +\let\ajt@enditemize\enditemize +\let\ajt@enum\enumerate +\let\ajt@endenum\endenumerate +\let\ajt@desc\description +\let\ajt@enddesc\enddescription +\renewenvironment{itemize} + {\ajt@itemize\parskip0pt}{\ajt@enditemize} +\renewenvironment{enumerate} + {\ajt@enum\parskip0pt}{\ajt@endenum} +\renewenvironment{description} + {\ajt@desc\parskip0pt\parindent1.8em}{\ajt@enddesc} +\let\itemise\itemize +\let\enditemise\enditemize +\renewcommand\labelitemi{\normalfont\bfseries\textendash} +\renewcommand\labelitemii{\normalfont\bfseries\textperiodcentered} +\if@ptexjs + \renewcommand*\descriptionlabel[1]{\hspace\labelsep\normalfont\gtfamily\itshape #1} +\else + \renewcommand*\descriptionlabel[1]{\hspace\labelsep\normalfont\itshape #1} +\fi +\newlength\captionindent +\if@ptexjs + \setlength\captionindent{1pc} + \setlength\abovecaptionskip{5\p@} + \setlength\belowcaptionskip{5\p@} + \newcommand*\@captionheadfont{\ptexjsinfospread\small\scshape} + \newcommand*\@captionfont{\ptexjsinfospread\normalfont\small} +\else + \setlength\captionindent{3pc} + \setlength\abovecaptionskip{10\p@} + \setlength\belowcaptionskip{0\p@} + \newcommand*\@captionheadfont{\scshape} + \newcommand*\@captionfont{\normalfont} +\fi +\long\def\@makecaption#1#2{% + \setbox\@tempboxa\vbox{\color@setgroup + \advance\hsize-2\captionindent\noindent + \@captionfont\@captionheadfont#1\@xp\@ifnotempty\@xp + {\@cdr#2\@nil}{.\@captionfont\upshape\enspace#2}% + \unskip\kern-2\captionindent\par + \global\setbox\@ne\lastbox\color@endgroup}% + \ifhbox\@ne % the normal case + \setbox\@ne\hbox{\unhbox\@ne\unskip\unskip\unpenalty\unkern}% + \fi + \ifdim\wd\@tempboxa=\z@ % this means caption will fit on one line + \setbox\@ne\hbox to\columnwidth{\hss\kern-2\captionindent\box\@ne\hss}% + \else % tempboxa contained more than one line + \setbox\@ne\vbox{\unvbox\@tempboxa\parskip\z@skip + \noindent\unhbox\@ne\advance\hsize-2\captionindent\par}% + \fi + \ifnum\@tempcnta<64 % if the float IS a figure... + \addvspace\abovecaptionskip + \hbox to\hsize{\kern\captionindent\box\@ne\hss}% + \else % if the float IS NOT a figure... + \hbox to\hsize{\kern\captionindent\box\@ne\hss}% + \nobreak + \vskip\belowcaptionskip + \fi +\relax +} +\renewcommand\@footnotetext[1]{\insert\footins{% + \if@korean\linespread{\korean@info@spread}\fi% + \if@ptexjs\linespread{\ptexjs@info@spread}\fi% + \reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark + }% + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}% + \color@endgroup}}% +\renewcommand\@makefntext[1]{% + \parindent 1.8em% + \noindent + \hb@xt@1.8em{\hbox{\strut\normalfont\footnotesize\@thefnmark.}\hss}#1} +\def\@ifx@empty#1{% Implicit #2#3 + \ifx#1\@empty + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi}% +\def\@ifx@undefined#1{% Implicit #2#3 + \ifx#1\@undefined + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi}% +\def\@ifeof#1{% Implicit #2#3 + \ifeof#1 + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi}% +\def\boolean@true#1{\let#1\@firstoftwo}% +\def\boolean@false#1{\let#1\@secondoftwo}% +\def\ps@titlepage{% + \def\@oddhead{\titlepage@head\hfil}% + \let\@evenhead\@oddhead + \def\@oddfoot{\hfil\titlepage@foot}% + \let\@evenfoot\@oddfoot}% +\def\titlepage@head{\footnotesize + \parbox{\linewidth}{% + \normalbodyspread + \@ifx@empty\@AJTissue{For submission to \AJT}{\AJT, \@AJTissue\hfill\raisebox{-\height+.6\baselineskip}[0pt][0pt]{\@KTSlogo}}\par + \@ifx@empty\@AJTissue + {\@ifx@empty\@AJTrevision{Draft of \today}{Article revision \@AJTrevision}}% + {\@ifx@empty\@AJTrevision + {\ClassError{ajt} + {\string\AJTrevision\space must be defined if + \string\AJTissue\space is also} + {It is a requirement for PracTeX Journal articles to contain\MessageBreak + revision information for version tracking. Please input this\MessageBreak + information, or omit \protect\AJTissue.}} + {Article revision \@AJTrevision}}}}% +\def\titlepage@foot{% + \vtop{\raggedleft\footnotesize\@AJTcopyright}}% +\def\odd@heading@rule{\makebox[0pt][l]{\rule[-3.5pt]{\textwidth}{0.3pt}}}% +\let\even@heading@rule\odd@heading@rule +\def\ps@headings{% + \def\@oddhead{\odd@heading@rule\small\scshape\@AJTissue\hfil\thepage}% + \def\@evenhead{\even@heading@rule\small\scshape\thepage\hfil\AJT}% + \let\@oddfoot\@empty + \let\@evenfoot\@oddfoot}% +\renewcommand{\topfraction}{.85} +\renewcommand{\bottomfraction}{.7} +\renewcommand{\textfraction}{.15} +\renewcommand{\floatpagefraction}{.66} +\renewcommand{\dbltopfraction}{.66} +\renewcommand{\dblfloatpagefraction}{.66} +\setcounter{topnumber}{9} +\setcounter{bottomnumber}{9} +\setcounter{totalnumber}{20} +\setcounter{dbltopnumber}{9} +\newcommand\addinfo[2][]{% + \ajt@define@info@block[#1]{#2}% + \g@addto@macro\ajt@optional@author@info{\ajt@info@container[#1]{#2}}} +\newcommand\addinfospace[1]{\g@addto@macro\ajt@optional@author@info{\vspace{#1}}} +\newcommand\ajt@define@info@block[2][]{% + \lowercase{\expandafter\long\expandafter\def\csname#2\endcsname}% + ##1{\expandafter\def\csname ajt@info@#2\endcsname{##1}}} +\newcommand\clearinfo{\let\ajt@optional@author@info\@empty} +\clearinfo +%\addinfo[\typesetemail]{Email} +%\addinfo[\url]{Website} +%\addinfo[\linespread{0.9}\selectfont]{Address} +\ajt@define@info@block{Keywords} +\ajt@define@info@block{Abstract} +\newif\ifajt@noabstract +\newcommand\noabstract{\ajt@noabstracttrue} +\def\endabstract{% + \ClassError{ajt} + {Please input the abstract with \string\abstract{...}, before \string\begin{document}} + {Instead of the \string\begin{abstract}...\string\end{abstract} \MessageBreak + environment, use \string\abstract{...}. Paragraphs are allowed!\MessageBreak + \MessageBreak + Because the abstract is typeset with the title block, \MessageBreak + it must be input before the \string\begin{document}\space command.}} +\newcommand{\AJTissue}[3]{\gdef\@AJTissue{Volume #1, No.\thinspace #2, #3}}% +\newcommand{\AJTpage}[1]{\setcounter{page}{#1}}% +\newcommand{\AJTlang}[1]{\gdef\@AJTlang{#1}}% +\newcommand{\AJTrevision}[3]{\gdef\@AJTrevision{#1/#2/#3}}% +\newcommand{\AJTcopyright}[1]{\gdef\@AJTcopyright{#1}}% +\def\logo@setup#1{% + \IfFileExists{#1} + {\def\@KTSlogo{\includegraphics[height=12mm]{#1}}} + {\let\@KTSlogo\@empty}}% +\ifx\@dvi@driver\dps@driver + \logo@setup{KTS-logo.eps} +\else + \logo@setup{KTS-logo.pdf} +\fi +\let\@AJTissue\@empty +\let\@AJTrevision\@empty +\let\@AJTcopyright\@empty +\let\license\AJTcopyright +\newcommand\ajt@info@container[2][]{% + \lowercase{\expandafter\gdef\csname#2\endcsname}% + {\ClassError{ajt}{#2 must be defined BEFORE \string\maketitle}{}} + \expandafter\ifx\csname ajt@info@#2\endcsname\relax\else + \noindent\small + \begin{minipage}[t]{0.12\textwidth} + \noindent\rmfamily\scshape#2\hfill + \end{minipage}\hfill + \begin{minipage}[t]{0.85\textwidth} + \if@korean\if@korabstract\koreanbodyspread\else\koreaninfospread\fi\fi + \if@ptexjs\if@ptexjsabstract\ptexjsbodyspread\else\ptexjsinfospread\fi\fi + \setlength\parindent{1.8em}% + \noindent\ignorespaces + \expandafter#1\expandafter{\csname ajt@info@#2\endcsname} + \end{minipage}\par + \fi} +\newcommand\obfuscateemail{% + \def\typesetemail##1{\ttfamily\switchemail{##1}}} +\newcommand\hyperlinkemail{% + \def\typesetemail##1{\ttfamily\ajt@compose@mailto{##1}{Re: AJT article}{##1}}} +\newcommand\ajt@compose@mailto[3]{% + \edef\@tempa{mailto:#1?subject=#2 }% + \edef\@tempb{\expandafter\html@spaces\@tempa\@empty}% + \href{\@tempb}{#3}} + +\catcode`\%=11 +\def\html@spaces#1 #2{#1%20\ifx#2\@empty\else\expandafter\html@spaces\fi#2} +\catcode`\%=14 +\newcommand\note[1]{\unskip\footnote{#1}} +\DeclareRobustCommand\dash{% + \unskip\nobreak\thinspace\textemdash\thinspace\ignorespaces} +%\pdfstringdefDisableCommands{\renewcommand{\dash}{ - }} +\newcommand\ctanfile[1]{% + \href{http://www.ctan.org/get?fn=/#1} + {\path{CTAN:#1}}} +\newcommand\ctanloc[1]{% + \href{http://www.ctan.org/tex-archive/#1} + {\path{CTAN:#1}}} +\ifx\@dvi@driver\xtx@driver\else % not XeTeX + \DeclareTextSymbol{\textbackslash}{OT1}{`\\} + \DeclareTextSymbol{\textbraceleft}{OT1}{`\{} + \DeclareTextSymbol{\textbraceright}{OT1}{`\}} +\fi +\newcommand\cs[1]{% + \texttt{\textbackslash#1}} +\DeclareRobustCommand\TeX{T\kern-.15em\lower.5ex\hbox{E}\kern-.07em X\spacefactor1000\relax} +\DeclareRobustCommand\eTeX{\ensuremath{\varepsilon}-\kern-.125em\TeX} +\DeclareRobustCommand\LaTeX{L\kern-.32em\raise.37ex\hbox{\scalebox{0.76}{A}}\kern-.15em\TeX} +\DeclareRobustCommand\LaTeXe{\LaTeX2$_{\textstyle\varepsilon}$} +\DeclareRobustCommand\LuaTeX{Lua\TeX} +\DeclareRobustCommand\LuaLaTeX{Lua\LaTeX} +\DeclareRobustCommand\kotex{\textsf{k}\textit{o}\kern-1pt\lower.15ex\hbox{.}\kern-1pt\TeX} +\DeclareRobustCommand\xetexko{\XeTeX-\textsf{k}\textit{o}} +\DeclareRobustCommand\luatexko{\LuaTeX-\textsf{k}\textit{o}} +\DeclareRobustCommand\BibTeX{B{\textsc i\kern-.025em\textsc b}\kern-.08em\TeX} +\DeclareRobustCommand\logofamily{% + \not@math@alphabet\logofamily\relax + \fontencoding{U}\fontfamily{logo}\selectfont} +\DeclareTextFontCommand{\textlogo}{\logofamily} +\DeclareRobustCommand\MF{\textlogo{META}\@dischyph\textlogo{FONT}\@} +\DeclareRobustCommand\MP{\textlogo{META}\@dischyph\textlogo{POST}\@} +\DeclareRobustCommand\ConTeXt{C\kern-.03em on\-\kern-.10em\TeX\kern-0.04em t}% +\DeclareRobustCommand\pdfTeX{pdf\/\TeX} +\DeclareRobustCommand\pdfeTeX{pdf\/\eTeX} +\DeclareRobustCommand\pdfLaTeX{pdf\/\LaTeX} +\DeclareRobustCommand\PS{PostScript} +\DeclareRobustCommand\PracTeX{Prac\kern-0.07em\TeX} +\DeclareRobustCommand\pTeX{p\kern-0.05em\TeX} +\DeclareRobustCommand\AJT{The Asian Journal of \TeX} +\DeclareRobustCommand\XeTeX{% + X\lower.5ex\hbox{\kern-.07em\reflectbox{E}}% + \kern-.15em\TeX} +\DeclareRobustCommand\ExTeX{\textrm{\relax + \ensuremath{\textstyle\varepsilon_{\kern-0.15em\mathcal{X}}}\relax + \kern-.15em\TeX}} +\def\write@ID@aux{% + \@ifx@empty\@AJTrevision{}{% + \begingroup + \let\thanks\@gobble + \immediate\openout\ID@aux _rev.tex + \immediate\write\ID@aux{\@AJTrevision}% + \immediate\closeout\ID@aux + \endgroup + }% +}% +\newwrite\ID@aux +\def\read@issue{% + \openin\@inputcheck _iss.tex + \@ifeof\@inputcheck{} + {\ifx\@AJTissue\@empty\else + \typeout{---------^^J + ajt: \protect\AJTissue\space info overwritten due to _iss.tex file^^J + ---------} + \fi + \read\@inputcheck to\@AJTissue + \closein\@inputcheck + \expandafter\parse@iss\@AJTissue\@nil}} +\def\parse@iss AJT #1 No #2, #3-#4-#5\@nil{% + \@tempcnta#2\relax + \protected@xdef\@AJTissue{\AJT, #1, No.\thinspace\the\@tempcnta}} +\def\set@pdfpage{% + \ifx\@dvi@driver\tpd@driver + \@ifx@undefined\pdfoutput{}{% + \pdfpagewidth =\paperwidth + \pdfpageheight=\paperheight + \relax}% + \else + \special{papersize=\the\paperwidth,\the\paperheight}% + \fi} +\AtBeginDocument{\if@print\else\set@pdfpage\fi} +\let\thebibliography@ltx\thebibliography +\let\endthebibliography@ltx\endthebibliography +\renewenvironment{thebibliography}[1] + {\if@korean\normalbodyspread\renewcommand{\refname}{참고 문헌}\fi% + \if@ptexjs\ptexjsinfospread\renewcommand{\refname}{参考文献}\fi% + \thebibliography@ltx{#1}\setlength{\itemsep}{0pt}\small} + {\endthebibliography@ltx} +\renewcommand\@biblabel[1]{#1.} +\def\head@setup#1{% + \IfFileExists{#1} + {\def\@AJThead{\includegraphics[width=.25\textwidth]{#1}}} + {\let\@AJThead\@empty}}% +\ifx\@dvi@driver\dps@driver + \head@setup{AJT-head.eps} +\else + \head@setup{AJT-head.pdf} +\fi +\newcommand*\putAJThead[1]{% + \raisebox{-\textheight-3em}[0pt][0pt]{% + \makebox[0pt][l]{\hspace*{-3em}\@AJThead}% + }% +} +\if@reprint + \let\cleardoublepage\relax +\else + \renewcommand\cleardoublepage{\clearpage\if@twoside\ifodd\c@page\else + \pagestyle{empty}\noindent\putAJThead\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi} +\fi +\pagestyle{headings} +\endinput +%% +%% End of file `ajt.cls'. -- 2.11.0