From 0a318aead011f1429fd44b4071dd04dbd27a9a86 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 19 Oct 2019 21:15:30 +0000 Subject: ptex-manual (19oct19) git-svn-id: svn://tug.org/texlive/trunk@52444 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/ptex/ptex-manual/README.md | 4 +- .../texmf-dist/doc/ptex/ptex-manual/eptexdoc.pdf | Bin 382228 -> 381070 bytes .../texmf-dist/doc/ptex/ptex-manual/eptexdoc.tex | 431 +++++++------- Master/texmf-dist/doc/ptex/ptex-manual/fam256d.tex | 4 +- Master/texmf-dist/doc/ptex/ptex-manual/fam256p.tex | 11 + Master/texmf-dist/doc/ptex/ptex-manual/jfm.pdf | Bin 132440 -> 157050 bytes Master/texmf-dist/doc/ptex/ptex-manual/jfm.tex | 484 +++++++++------- .../doc/ptex/ptex-manual/jtex_asciimw.tex | 1 + .../doc/ptex/ptex-manual/jtexdoc_asciimw.tex | 1 + .../doc/ptex/ptex-manual/ptex-guide-en.pdf | Bin 0 -> 69161 bytes .../doc/ptex/ptex-manual/ptex-guide-en.tex | 623 +++++++++++++++++++++ .../doc/ptex/ptex-manual/ptex-manual.pdf | Bin 356044 -> 381437 bytes .../doc/ptex/ptex-manual/ptex-manual.tex | 608 ++++++++++++-------- .../doc/ptex/ptex-manual/ptexdoc_asciimw.tex | 1 + 14 files changed, 1515 insertions(+), 653 deletions(-) create mode 100644 Master/texmf-dist/doc/ptex/ptex-manual/ptex-guide-en.pdf create mode 100644 Master/texmf-dist/doc/ptex/ptex-manual/ptex-guide-en.tex (limited to 'Master/texmf-dist/doc/ptex') diff --git a/Master/texmf-dist/doc/ptex/ptex-manual/README.md b/Master/texmf-dist/doc/ptex/ptex-manual/README.md index 6fb6c332039..2fb6a003af2 100644 --- a/Master/texmf-dist/doc/ptex/ptex-manual/README.md +++ b/Master/texmf-dist/doc/ptex/ptex-manual/README.md @@ -1,13 +1,13 @@ # ptex-manual This is a project of preparing a manual of Japanese pTeX and e-pTeX. -Currently only Japanese version available. ## Contents The following documents are maintained by Japanese TeX Development Community: + * ptex-guide-en.pdf: Guide of pTeX and friends (in English) * ptex-manual.pdf: The manual of pTeX. * eptexdoc.pdf: The manual of e-pTeX. * jfm.pdf: Specification of JFM (Japanese Font Metric) format. @@ -36,6 +36,6 @@ the 3-clause BSD license (see [LICENSE](./LICENSE)). ## Release Date -2019-04-03 +2019-10-19 Japanese TeX Development Community diff --git a/Master/texmf-dist/doc/ptex/ptex-manual/eptexdoc.pdf b/Master/texmf-dist/doc/ptex/ptex-manual/eptexdoc.pdf index dc6b3e12103..30ef9193c9e 100644 Binary files a/Master/texmf-dist/doc/ptex/ptex-manual/eptexdoc.pdf and b/Master/texmf-dist/doc/ptex/ptex-manual/eptexdoc.pdf differ diff --git a/Master/texmf-dist/doc/ptex/ptex-manual/eptexdoc.tex b/Master/texmf-dist/doc/ptex/ptex-manual/eptexdoc.tex index ab4b9cfe169..62d11cc730a 100644 --- a/Master/texmf-dist/doc/ptex/ptex-manual/eptexdoc.tex +++ b/Master/texmf-dist/doc/ptex/ptex-manual/eptexdoc.tex @@ -1,181 +1,43 @@ %#!make eptexdoc.pdf -\documentclass[a4paper,11pt]{jsarticle} +\documentclass[a4paper,11pt,nomag]{jsarticle} +\usepackage[bold,deluxe]{otf} \input fam256p.tex \usepackage[textwidth=42zw,lines=40,truedimen,centering]{geometry} -\usepackage{amsmath,mathtools,amssymb,multicol,comment} + +%%%%%%%%%%%%%%%% +% additional packages +\usepackage{amsmath} +\usepackage{mathtools,amssymb,comment} \usepackage[dvipdfmx]{graphicx} \usepackage[T1]{fontenc} -\usepackage{booktabs,enumitem} +\usepackage{booktabs,enumitem,multicol} \usepackage{lmodern} \usepackage[dvipdfmx,hyperfootnotes=false]{hyperref} \usepackage{pxjahyper} -\usepackage[bold,deluxe]{otf} \usepackage{hologo} \usepackage{makeidx}\makeindex +% common +\usepackage{ptex-manual} + %%%%%%%%%%%%%%%% -\makeatletter +\def\delbit#1#2{\underbracket[0.4pt]{#1}_{\text{#2}}} + +\usepackage{shortvrb} +\MakeShortVerb*{|} +%%%%%%%%%%%%%%%% + +% logos \newcommand{\OMEGA}{$\Omega$} \protected\def\epTeX{$\varepsilon$\nobreakdash-\pTeX} +\protected\def\eupTeX{$\varepsilon$\nobreakdash-\upTeX} \protected\def\eTeX{$\varepsilon$\nobreakdash-\TeX} \def\upTeX{u\pTeX}\def\pTeX{p\kern-.15em\TeX} \def\NTS{\leavevmode\hbox{$\cal N\kern-0.35em\lower0.5ex\hbox{$\cal T$}% \kern-0.2emS$}\,} -\def\headfont{\normalfont\mathversion{bold}\gtfamily\bfseries} -\def\node#1{\textit{#1}} -\def\.#1{\texorpdfstring{% - \leavevmode\hbox{\texttt{\textbackslash#1}}\ifmmode\else\textcompwordmark\fi}{\textbackslash #1}} -\let\orig@cs=\. -\def\ind@cs#1{\orig@cs{#1}\indcs{#1}} -\def\indcs#1{\index{{\texttt{\textbackslash #1}}}} -\newlist{cslist}{description}1 -\setlist[cslist]{% - style=nextline,itemsep=\medskipamount,listparindent=1zw, - font=\normalfont\mdseries} -\def\csitem[#1]{\item[\llap{$\blacktriangleright$~}\let\.=\ind@cs#1]} -\def\emph#1{{\bfseries\gtfamily\mathversion{bold}#1}} -\def\listx{\def\makelabel{\hbox to 1em{\hfil\textbullet\hfil}}\def\@{\hfill} -\labelwidth=13zw\leftmargin15zw\itemindent=0zw} -\def\paragraph#1{\par\medskip\par\noindent\emph{■#1}\par\nobreak} -\def\Pkg#1{\textsf{#1}} -\catcode`\<=13 -\xspcode`\\=3 -\xspcode`\*=3 -\xspcode`\-=3 -\xspcode23=3 % \textcompwordmark -\def<#1>{\ensuremath{\langle\hbox{\normalfont\itshape #1\/}\rangle}} - -\font\man=manfnt at 10pt -\def\dbend{\raise0pt\hbox{\man\char'177}} -\AtBeginDvi{\special{pdf:mapfile otf-ipaex.map}} -\def\delbit#1#2{\underbracket[0.4pt]{#1}_{\text{#2}}} - \def\TeXXeT{\TeX-\reflectbox{\bfseries\TeX-}} -\newenvironment{multilist}[2]% - {$$\setbox\z@=\hbox\bgroup % catch some funny things -> \mathord - \let\a=\empty - \let\b=\empty - \count@=\z@ - \toks@={#2}% - \def\item##1\cr - {\ifnum \count@=\z@ - \count@=#1% - \expandafter\def\expandafter\b\expandafter{\b\y{}}% - \fi - \advance\count@ by\m@ne - \expandafter\def\expandafter\a\expandafter{\a\x{##1}}}% - \ignorespaces}% - {\loop - \ifnum \count@>\z@ - \expandafter\def\expandafter\a\expandafter{\a\expandafter\z\b\relax}% - \advance\count@ by\m@ne - \repeat - \def\x##1{\expandafter\y\b\relax{##1}}% - \def\y\y##1##2\relax##3% - {\ifx @##1@% - \def\b{##2\y{##3}}% - \else - \def\b{##2\y{##1&##3}}% - \fi}% - \def\z\y##1##2\relax{\def\b{##2\y{##1}}}% - \a - \def\x - {\expandafter\egroup\expandafter\halign\expandafter\bgroup - \expandafter&\the\toks@\cr}% - \def\y##1{\expandafter\def\expandafter\x\expandafter{\x##1\cr}}% - \b - \x\egroup $$} - \makeatletter -\def\hex#1{% -{\count@=#1\@tempcnta=#1\@tempcntb=\@tempcnta\relax -\divide\@tempcntb by 16% -\ifnum\count@=0\else - \multiply\@tempcntb by16% - \advance\@tempcnta-\@tempcntb - \divide\@tempcntb by16% - \hex{\the\@tempcntb}% - \ifcase\@tempcnta\relax 0\or1\or2\or3\or4\or5\or6\or - 7\or8\or9\or A\or B\or C\or D\or E\pr F\fi -\fi}} -\clubpenalty=8000\widowpenalty=8000 - -\normalsize -\bigskipamount=\baselineskip -\medskipamount=.5\baselineskip -\smallskipamount=.25\baselineskip - -\usepackage{etoolbox} -\newenvironment{curve}{% - \par\medskip - \bgroup\small\leftskip=\dimexpr\textwidth-44zw\relax\@totalleftmargin=\leftskip - \parindent1zw\noindent\kern-\leftskip\hbox to\leftskip{\dbend\hss}% - \bigskipamount=\baselineskip - \medskipamount=.5\baselineskip - \smallskipamount=.25\baselineskip - \everypar{\everypar{}}\ignorespaces -}{\par\egroup\medskip} - -\renewenvironment{theindex}{% - \def\presectionname{}\def\postsectionname{}% - \section*{\indexname} - \@mkboth{\indexname}{\indexname}% - \plainifnotempty % \thispagestyle{plain} - \parindent\z@ - \parskip\z@ \@plus .3\p@\relax - \let\item\@idxitem - \raggedright - \begin{multicols}{2} - }{ - \end{multicols} - \clearpage - } - -\patchcmd\@verbatim\@totalleftmargin{\dimexpr\@totalleftmargin+2zw\relax}{}{} -\patchcmd\quote{\list{}}{\par\list{\topsep\medskipamount}}{}{} -\patchcmd\@verbatim{\trivlist}{\trivlist\addvspace\medskipamount\noautoxspacing}{}{} -\patchcmd\endverbatim{\endtrivlist}{\endtrivlist\addvspace\medskipamount}{}{} -\expandafter\let\csname endverbatim*\endcsname =\endverbatim -\patchcmd\verb{\ifmmode\hbox\else\leavevmode\vadjust{}\fi\bgroup} - {\ifmmode\else\leavevmode\vadjust{}\fi\hbox - \bgroup\textcompwordmark\noautoxspacing\noautospacing}{}{} -\patchcmd\verb@egroup{\egroup}{\egroup\textcompwordmark}{}{} - -\usepackage{shortvrb} -\MakeShortVerb*{|} -%%%%%%%% macros for index (simplified from doc.sty) -\newif\ifscan@allowed -\def\dotfill{\leaders\hbox to.6em{\hss .\hss}\hskip\z@ plus1fill}% -\def\pfill{\unskip~\dotfill\nobreak} - -\long\def\@footnotetext{% - \insert\footins\bgroup - \normalfont\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}% - \futurelet\next\fo@t} -\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t - \else \let\next\f@t\fi \next} -\def\f@@t{\bgroup\aftergroup\@foot\let\next} -\def\f@t#1{#1\@foot} -\def\@foot{\@finalstrut\strutbox\color@endgroup\egroup - \ifx\pltx@foot@penalty\@undefined\else - \ifhmode\null\fi - \ifnum\pltx@foot@penalty=\z@\else - \penalty\pltx@foot@penalty - \pltx@foot@penalty\z@ - \fi - \fi} - {\lccode`\!=`\_ \lowercase{% \protected\gdef\_{\ifdefstrequal{\f@family}{\ttdefault}{!}% @@ -183,14 +45,15 @@ }} } \makeatother -%%%%%%%%%%%%%%%% + +\clubpenalty=8000 \widowpenalty=8000 \frenchspacing \begin{document} \title{\emph{\epTeX について}} \author{北川 弘典\null \thanks{\url{http://osdn.jp/projects/eptex/wiki/},\ e-mail: \texttt{h\_kitagawa2001(at)yahoo.co.jp}}} -\date{version 190131,\today} +\date{version \the\epTeXversion,\today} \maketitle \tableofcontents @@ -352,47 +215,126 @@ tracing機能や条件判断文の強化などあるが,そこら辺はパッ の位置がずれたり空白がおかしかったりするけれども,そこの修正は大変に思え るし,苦労して実装する意味があるのか疑問なので放置している. -\medskip - -\pTeX 拡張では,\TeX と比較して\node{dir\_node}と\node{disp\_node}という2種類のノードが -追加された.前者は,現在のリストの中に違う組方向のboxを挿入する際に寸法を補正するために作られ, -\.{hbox}や\.{vbox}のコンテナとなっている. -また後者は,欧文文字のベースライン補正のために使われる. - -\epTeX~110102 まではこれらのノードも\.{lastnodetype}の値として出力させるようにした. -しかし,両者ともに\epTeX が自動的に挿入する(ユーザーが意識する必要はない)ノードであることから, -\epTeX~110227以降では\node{dir\_node}と\node{disp\_node}は -\.{lastnodetype}\indcs{lastnodetype}の対象とする「最後のノード」とはならないようにしている -\footnote{% - 最後のノードが\node{dir\_node}であった場合,\.{lastnodetype}はそのノードが格納している - \node{hlist\_node}か\node{vlist\_node}の種類を返す. -}. -\begin{multilist}{3}{\hfil\hskip1.5zw#:&\quad#\qquad\hfil} -\item $-1$&none (empty list)\cr\item 0&char node\cr\item 1&hlist node\cr -\item 2&vlist node\cr\item 3&rule node\cr\item 4&ins node\cr -\item 5&mark node\cr\item 6&adjust node\cr\item 7&ligature node\cr -\item 8&disc node\cr\item 9&whatsit node\cr\item 10&math node\cr -\item 11&glue node\cr\item 12&kern node\cr\item 13&penalty node\cr -\item 14&unset node\cr\item 15&math mode nodes\cr -\end{multilist} +以下,\eTeX 拡張を\pTeX 拡張とマージするにあたって調整した箇所を述べる. +\begin{cslist} + \csitem[\.{lastnodetype}] + \pTeX 拡張では,\TeX と比較して\node{dir\_node}と\node{disp\_node}という2種類のノードが + 追加された.前者は,現在のリストの中に違う組方向のboxを挿入する際に寸法を補正するために作られ, + \.{hbox}や\.{vbox}のコンテナとなっている. + また後者は,欧文文字のベースライン補正のために使われる. + + \epTeX~110102まではこれらのノードも\.{lastnodetype}の値として出力させるようにした. + しかし,両者ともに\epTeX が自動的に挿入する(ユーザーが意識する必要はない)ノードであることから, + \epTeX~110227以降では\node{dir\_node}と\node{disp\_node}は + \.{lastnodetype}の対象とする「最後のノード」とはならないようにしている + \footnote{% + 最後のノードが\node{dir\_node}であった場合,\.{lastnodetype}はそのノードが格納している + \node{hlist\_node}か\node{vlist\_node}の種類を返す. + }.\\ + \parbox{.9\linewidth}{% + \begin{multilist}{3}{\hfil\hskip1.5zw#:&\quad#\qquad\hfil} + \item $-1$&none (empty list)\cr\item 0&char node\cr\item 1&hlist node\cr + \item 2&vlist node\cr\item 3&rule node\cr\item 4&ins node\cr + \item 5&mark node\cr\item 6&adjust node\cr\item 7&ligature node\cr + \item 8&disc node\cr\item 9&whatsit node\cr\item 10&math node\cr + \item 11&glue node\cr\item 12&kern node\cr\item 13&penalty node\cr + \item 14&unset node\cr\item 15&math mode nodes\cr + \end{multilist}} + + \csitem[\.{currentiftype}] +\ifnum\epTeXversion>190131 %%%%% TL2019-hack + 条件判断文とそれを表す数字との対応は以下のようになっている + (\epTeX~190709以降). + 21,~22は\hologo{pdfTeX}由来の条件判断文(後述), + 23--30が,\pTeX 拡張で追加された条件判断文に対応する.\\ + \parbox{.9\linewidth}{% + \begin{multilist}{3}{\hfil\hskip1.5zw#:&\quad#\qquad\hfil} + \item 1&\.{if}\cr\item 2&\.{ifcat}\cr\item 3&\.{ifnum}\cr\item 4&\.{ifdim}\cr + \item 5&\.{ifodd}\cr\item 6&\.{ifvmode}\cr\item 7&\.{ifhmode}\cr + \item 8&\.{ifmmode}\cr\item 9&\.{ifinner}\cr\item 10&\.{ifvoid}\cr + \item 11&\.{ifhbox}\cr\item 12&\.{ifvbox}\cr\item 13&\.{ifx}\cr + \item 14&\.{ifeof}\cr\item 15&\.{iftrue}\cr\item 16&\.{iffalse}\cr + \item 17&\.{ifcase}\cr\item 18&\.{ifdefined}\cr\item 19&\.{ifcsname}\cr + \item 20&\.{iffontchar}\cr\item \bf 21&\.{ifincsname}\cr\item \bf 22&\.{ifpdfprimtive}\cr + \item \bf 23&\.{iftdir}\cr\item \bf 24&\.{ifydir}\cr + \item \bf 25&\.{ifddir}\cr\item \bf 26&\.{ifmdir}\cr\item \bf 27&\.{iftbox}\cr + \item \bf 28&\.{ifybox}\cr\item \bf 29&\.{ifdbox}\cr\item \bf 30&\.{ifmbox}\cr + \end{multilist}} +\else %%%%% TL2019-hack + 条件判断文とそれを表す数字との対応は以下のようになっている + (\epTeX~190131まで;\epTeX~190709以降は\.{ifincsname}プリミティブ追加により変化するので注意). + 21--28が,\pTeX 拡張で追加された条件判断文に対応する. + 29の\.{ifpdfprimitive}は\hologo{pdfTeX}由来のプリミティブ(後述)である.\\ + \parbox{.9\linewidth}{% + \begin{multilist}{3}{\hfil\hskip1.5zw#:&\quad#\qquad\hfil} + \item 1&\.{if}\cr\item 2&\.{ifcat}\cr\item 3&\.{ifnum}\cr\item 4&\.{ifdim}\cr + \item 5&\.{ifodd}\cr\item 6&\.{ifvmode}\cr\item 7&\.{ifhmode}\cr + \item 8&\.{ifmmode}\cr\item 9&\.{ifinner}\cr\item 10&\.{ifvoid}\cr + \item 11&\.{ifhbox}\cr\item 12&\.{ifvbox}\cr\item 13&\.{ifx}\cr + \item 14&\.{ifeof}\cr\item 15&\.{iftrue}\cr\item 16&\.{iffalse}\cr + \item 17&\.{ifcase}\cr\item 18&\.{ifdefined}\cr\item 19&\.{ifcsname}\cr + \item 20&\.{iffontchar}\cr\item \bf 21&\.{iftdir}\cr\item \bf 22&\.{ifydir}\cr + \item \bf 23&\.{ifddir}\cr\item \bf 24&\.{ifmdir}\cr\item \bf 25&\.{iftbox}\cr + \item \bf 26&\.{ifybox}\cr\item \bf 27&\.{ifdbox}\cr\item \bf 28&\.{ifmbox}\cr + \item \bf 29&\.{ifpdfprimtive}\cr + \end{multilist}} +\fi %%%%% TL2019-hack + +\ifnum\epTeXversion>190131 %%%%% TL2019-hack + \csitem[\.{fontcharwd}, \.{fontcharht}, \.{fontchardp}, \.{fontcharic}] + 欧文フォントと和文フォントを判別し,それに応じて処理が分かれる. + それに伴い,許容される引数範囲と意味が異なることに注意 + (\epTeX~190709以降). + 以下,|??|は|wd|, |ht|, |dp|, |ic|のいずれかを表す. + \begin{itemize} + \item 和文フォントの場合: \.{fontchar??} \\ + を$f$,を$c$とおくと, + \begin{itemize} + \item $c \geq 0$の場合は,$c$を\emph{文字コード}とみなす. + $c$が和文文字コードとして有効であれば, + 和文フォント$f$における文字コード$c$の和文文字の寸法値を返す. + 和文文字コードとして無効であれば|0pt|を返す. + \item $c < 0$の場合は,$-(c+1)$を\emph{文字タイプ}とみなす. + 和文フォント$f$に文字タイプ$-(c+1)$が定義されていればその寸法値を返し, + 未定義であれば|0pt|を返す. + \end{itemize} + \item 欧文フォントの場合: \.{fontchar??} <8-bit number>\\ + オリジナルの\eTeX と同じ挙動である.すなわち, + 引数に$c \geq 256$や$c < 0$を与えると + \verb+! Bad character code (256).+ + のようにエラーが出る. + \end{itemize} -\vskip-\baselineskip + \csitem[\.{iffontchar}] + \begin{itemize} + \item 和文フォントの場合: \.{iffontchar} \\ + を$f$,を$c$とおくと, + \begin{itemize} + \item $c \geq 0$の場合は$c$を\emph{文字コード}とみなし, + $c$が和文文字コードとして有効かどうかを判定する + \footnote{\pTeX では「任意の和文フォントには,和文文字コードとして有効な + 全ての文字が存在する」という扱いであるため,和文フォント$f$によらない.}. + \item $c < 0$の場合は$-(c+1)$を\emph{文字タイプ}とみなし, + 和文フォント$f$に文字タイプ$-(c+1)$が定義されているかどうかを判定する. + \end{itemize} + \item 欧文フォントの場合: \.{iffontchar} <8-bit number>\\ + オリジナルの\eTeX と同じ挙動である.すなわち, + 引数に$c \geq 256$や$c < 0$を与えると + \verb+! Bad character code (256).+ + のようにエラーが出る. + \end{itemize} +\fi %%%%% TL2019-hack +\end{cslist} -\.{currentiftype}\indcs{currentiftype}における条件判断文とそれを表す数字との対応は,以 -下のようになっている.21--28が,\pTeX 拡張で追加された条件判断文に対応する. -29の\.{ifpdfprimitive}は\hologo{pdfTeX}由来のプリミティブ(後述)である. -\begin{multilist}{3}{\hfil\hskip1.5zw#:&\quad#\qquad\hfil} -\item 1&\.{if}\cr\item 2&\.{ifcat}\cr\item 3&\.{ifnum}\cr\item 4&\.{ifdim}\cr -\item 5&\.{ifodd}\cr\item 6&\.{ifvmode}\cr\item 7&\.{ifhmode}\cr -\item 8&\.{ifmmode}\cr\item 9&\.{ifinner}\cr\item 10&\.{ifvoid}\cr -\item 11&\.{ifhbox}\cr\item 12&\.{ifvbox}\cr\item 13&\.{ifx}\cr -\item 14&\.{ifeof}\cr\item 15&\.{iftrue}\cr\item 16&\.{iffalse}\cr -\item 17&\.{ifcase}\cr\item 18&\.{ifdefined}\cr\item 19&\.{ifcsname}\cr -\item 20&\.{iffontchar}\cr\item \bf 21&\.{iftdir}\cr\item \bf 22&\.{ifydir}\cr -\item \bf 23&\.{ifddir}\cr\item \bf 24&\.{ifmdir}\cr\item \bf 25&\.{iftbox}\cr -\item \bf 26&\.{ifybox}\cr\item \bf 27&\.{ifdbox}\cr\item \bf 28&\.{ifmbox}\cr -\item \bf 29&\.{ifpdfprimtive}\cr -\end{multilist} +\ifnum\epTeXversion>190131 %%%%% TL2019-hack +\begin{dangerous} + 上記で「和文文字コードとして有効かどうか」は,関数|is_char_kanji|を参照. + この関数は内部コードによって異なるため,マクロで実装するのは面倒であるが, + \epTeX~190709以降では\.{iffontchar}で容易に実現できる. + なお,\upTeX では任意の非負の値が和文文字コードとして有効なため, + |is_char_kanji|は非負かどうかの判定になっている. +\end{dangerous} +\fi %%%%% TL2019-hack \section{\OMEGA 由来の機能(旧名称:\texttt{FAM256}パッチ)} \epTeX には,掲示板\TeX\ Q\ \&\ Aの山本氏の書き込み @@ -494,8 +436,8 @@ delimiter codeを取得しようとしても,現時点のパッチでは,う \paragraph{無限のレベル} \TeX では,glueの伸縮量に\texttt{fil}, \texttt{fill}, \texttt{filll} という3つの無限大のレベルが存在し,\texttt{l}が多いほど無限大のオーダーが高くなっていた. -\OMEGA では,「inter-letter spacingのために」\texttt{fi}という,有限と -\texttt{fil}の中間にあたる無限大のレベルが付け加えられた.そこで,この無限大レベル +\OMEGA では,「inter-letter spacingのために」\texttt{fi}\index{fi=\texttt{fi}}という, +有限と\texttt{fil}の中間にあたる無限大のレベルが付け加えられた.そこで,この無限大レベル \texttt{fi}も採用することにした. \medskip @@ -503,13 +445,15 @@ delimiter codeを取得しようとしても,現時点のパッチでは,う 実装方法は,大まかには\OMEGA で\texttt{fi}の実装を行っているchange file\ \texttt{omfi.ch}の通りであるのだが,これに\pTeX や\eTeX に伴う少々の修正を行っている. \begin{itemize} -\item プリミティブ|\pagefistretch|, |\hfi|, |\vfi|を新たに定義している -\footnote{% + \item プリミティブ|\pagefistretch|\indcs{pagefistretch}, + |\hfi|\indcs{hfi}, |\vfi|\indcs{vfi}を新たに定義している + \footnote{% |\hfi|, |\vfi|については\cite{omegaman}に記述があるが, \TeX~Liveに収録されている$\aleph$(\OMEGA は\TeX~Liveに収録されていない)では 実装されていない.|\pagefistretch|を実装したのは北川の完全な勘違いである. -}. -\item |\gluestretchorder|, |\glueshrinkorder|の動作を\eTeX のそれと合わせた. + }. + \item |\gluestretchorder|\indcs{gluestretchorder}, + |\glueshrinkorder|\indcs{glueshrinkorder}の動作を\eTeX のそれと合わせた. 具体的には,ある適当なglue~|\someglue|の伸び量をとおくとき, \[ \hbox{|\gluestretchorder\someglue|}= @@ -520,8 +464,8 @@ delimiter codeを取得しようとしても,現時点のパッチでは,う 3&\text{がちょうど\texttt{filll}レベルの無限量} \end{cases} \] -となっている.内部では\texttt{fi}レベルが1,\texttt{fil}レベルが2,……として処 - 理している. + となっている.内部では\texttt{fi}レベルが1,\texttt{fil}レベルが2,……として + 処理している. \end{itemize} \paragraph{レジスタについて} @@ -606,26 +550,32 @@ delimiter codeを取得しようとしても,現時点のパッチでは,う 原点はページの(物理的な意味の)左下隅であり,$y$軸は(物理的な)上方向に向かって増加する. \begin{itemize} \item ページの物理的な幅と高さはすぐ上の\.{pdfpagewidth}, \.{pdfpageheight}で設定する. - これらの内部長さが0であった場合は,\.{shipout}されたボックスの寸法と - \.{hoffset}(または\.{voffset})の値から自動的に計算される. + これらの内部長さが0であった場合は,\.{shipout}されたボックスの寸法と + \.{hoffset}(または\.{voffset})の値から自動的に計算される. \item \pTeX では横組・縦組と組方向が複数あるので,\.{pdflastxpos}, \.{pdflastypos}の値の座標系を - 「物理的な」向きとすべきか,それとも「組方向に応じた」向きとすべきかは悩みどころである. - \epTeX~110227以降,現在までのバージョンでは上記のように物理的な向きとしている. + 「物理的な」向きとすべきか,それとも「組方向に応じた」向きとすべきかは悩みどころである. + \epTeX~110227以降,現在までのバージョンでは上記のように物理的な向きとしている. \item \.{mag}を用いてページの拡大縮小を行い,かつ - dvipsやdvipdfmxを用いてPostScript,~pdfを生成した場合,\.{pdflast\{x,y\}pos}の原点は - ページの左下隅から左・上方向にそれぞれ$1\,\mathrm{in}-1\,\mathrm{truein}$% - 移動したところになる - \footnote{これは\hologo{pdfTeX}のdviモードや\hologo{XeTeX}と同じ挙動である.}. + dvipsやdvipdfmxを用いてPostScript,~pdfを生成した場合,\.{pdflast\{x,y\}pos}の原点は + ページの左下隅から左・上方向にそれぞれ$1\,\mathrm{in}-1\,\mathrm{truein}$% + 移動したところになる + \footnote{これは\hologo{pdfTeX}のdviモードや\hologo{XeTeX}と同じ挙動である.}. \end{itemize} \csitem[\.{pdfcreationdate}] エンジン起動時の時刻を,\texttt{\pdfcreationdate}の形式で表した文字列に展開する. - これは\Pkg{standalone}パッケージを\epTeX で扱うために2013/06/05に実装されたプリミティブであるが, - 現在時刻の「秒」まで得るためにも使用できる(\TeX 82では分単位でしか取得できない). - + 末尾に|+09'00'|などと表示されるのはローカルのタイムゾーンであるが, + 例えば|SOURCE_DATE_EPOCH=1000000000|のように環境変数を設定すると + |D:20010909014640Z|のようにタイムゾーンは|Z|と表示される. + % [TODO] |FORCE_SOURCE_DATE|が0か1かは関係する? + % https://tug.org/pipermail/tex-live/2018-November/042575.html + \epTeX においてプリミティブを実装した当初は「最初にこのプリミティブが実行された時刻を…」と していたが,\epTeX~161030から\hologo{pdfTeX}と同じ挙動に修正した. + これは\Pkg{standalone}パッケージを\epTeX で扱うために2013/06/05に実装されたプリミティブであるが, + 現在時刻の「秒」まで得るためにも使用できる(\TeX 82では分単位でしか取得できない). + \csitem[\.{pdffilemoddate} , \.{pdffilesize} ] それぞれの更新時刻(\.{pdfcreationdate}と同じ形式)と ファイルサイズを表す文字列に展開する. @@ -696,6 +646,13 @@ delimiter codeを取得しようとしても,現時点のパッチでは,う しかし\cite{expanded1}をきっかけに, \hologo{pdfTeX}, \epTeX, \hologo{XeTeX}で一斉に実装された. \epTeX~180518以降で利用可能である. + +\ifnum\epTeXversion>190131 %%%%% TL2019-hack + \csitem[\.{ifincsname}] + \texttt{\.{csname}~...~\.{endcsname}}内で評価されたちょうどその時に真となる. + \LaTeX~2019-10-01で行われる変更(\cite{latex95,tjb83})で必要になったために + \epTeX~190709で導入された. +\fi %%%%% TL2019 \end{cslist} \section{バージョン番号} @@ -790,7 +747,7 @@ abcfi\the\lastnodechar, abc\char"1C \the\lastnodechar となり,見た目では同じ「fi」が\.{lastnodechar}実行時の「最後のノード」であるかのように見えても, それが合字の場合(左側)では\.{lastnodechar}の実行結果は最後の構成要素「i」のコード番号105となる. -\begin{curve} +\begin{dangerous} 「|これは,|」とソース中に入力したときの ノードの状態を\.{showlists}で調べてみると次のようになっており, 本当に一番最後のノードはJFMによって挿入される二分空きの空白 @@ -807,7 +764,7 @@ abcfi\the\lastnodechar, abc\char"1C \the\lastnodechar \end{verbatim} しかし,数段落上の説明の通り,\.{lastnodechar}は\pTeX の和文処理によって自動的に挿入された これらJFM由来の空白を無視する. -\end{curve} +\end{dangerous} 「最後のノード」を見ているので, \begin{verbatim} @@ -919,6 +876,8 @@ abcfi\the\lastnodechar, abc\char"1C \the\lastnodechar 現在読み込んでいるファイルの文字コードをに変更する. 実際に変更されるのは「次の行」であり,また現在のファイルからさらに\.{input}等で 読まれたファイルには効力を及ぼさない. + の末尾は,空白トークンや展開不能トークンによって区切られる. + % [TODO] これで合っていますか? -- aminophen の値は,基本的には\pTeX の\texttt{-kanji}オプションで指定できる値 (\texttt{euc}, \texttt{sjis}, \texttt{jis}, \texttt{utf8})である. @@ -1033,25 +992,33 @@ $3$\,sp)だが,どこか気になるところである. documentation for the $\it\Omega$ system}, 1999.\\ |$TEXMFDIST/doc/omega/base/doc-1.8.tex| \bibitem{pdftexman} H\`an Th\'{\^e} Th\`anh et al. \textit{The - \hologo{pdfTeX}\ user manual}, 2015.\\ - |$TEXMFDIST/doc/pdftex/manual/pdftex-a.pdf| -\bibitem{l2e26} - The \LaTeX3 Project Team, \textit{\LaTeX\ News Issue 26}, 2017.\\ - |$TEXMFDIST/source/latex/base/ltnews26.tex|, \\ - \url{https://www.latex-project.org/news/latex2e-news/ltnews26.pdf}. -\bibitem{tjb28} 北川 弘典, - 「[ptex] |\inhibitglue|の効力」,2017/09/20.\\ - \url{https://github.com/texjporg/tex-jp-build/issues/28}. -\bibitem{plt63} Dora TeX, - 「p 指定の tabular でのセル冒頭の |\relax\par|」,2018/02/19.\\ - \url{https://github.com/texjporg/platex/issues/63}. + \hologo{pdfTeX}\ user manual}, 2015.\\ + |$TEXMFDIST/doc/pdftex/manual/pdftex-a.pdf| + \bibitem{l2e26} + The \LaTeX3 Project Team, \textit{\LaTeX\ News Issue 26}, 2017.\\ + |$TEXMFDIST/source/latex/base/ltnews26.tex|, \\ + \url{https://www.latex-project.org/news/latex2e-news/ltnews26.pdf}. + \bibitem{tjb28} 北川 弘典, + 「[ptex] |\inhibitglue|の効力」,2017/09/20.\\ + \url{https://github.com/texjporg/tex-jp-build/issues/28}. + \bibitem{plt63} Dora TeX, + 「p 指定の tabular でのセル冒頭の |\relax\par|」,2018/02/19.\\ + \url{https://github.com/texjporg/platex/issues/63}. \bibitem{expanded1} Joseph Wright, ``[tex-live] Primitive parity, |\expanded| and |\Ucharcat|'', 2018/05/04,\\ \url{http://tug.org/pipermail/tex-live/2018-May/041599.html} -\bibitem{expanded} + \bibitem{expanded} Joseph Wright, ``A `new' primitive: |\expanded|'', 2018/12/06.\\ \url{https://www.texdev.net/2018/12/06/a-new-primitive-expanded} + \bibitem{latex95} + Volker-Weissmann, ``Feature Request: Better error messages for non-ASCII symbols in labels.'', + 2018/12/03.\\ + \url{https://github.com/latex3/latex2e/issues/95} +\ifnum\epTeXversion>190131 %%%%% TL2019-hack + \bibitem{tjb83} aminophen,「[e-pTeX] |\ifincsname|」,2019/07/09.\\ + \url{https://github.com/texjporg/tex-jp-build/issues/83}. +\fi %%%%% TL2019 \end{thebibliography} \newpage diff --git a/Master/texmf-dist/doc/ptex/ptex-manual/fam256d.tex b/Master/texmf-dist/doc/ptex/ptex-manual/fam256d.tex index 65f820d8ab2..9efd20fb180 100644 --- a/Master/texmf-dist/doc/ptex/ptex-manual/fam256d.tex +++ b/Master/texmf-dist/doc/ptex/ptex-manual/fam256d.tex @@ -112,8 +112,8 @@ ${\tt \verb|\lx|:\ }\lx,\ {\tt \verb|\Bigl\lx|:\ } \Bigl\lx$ -{\tt \verb+\the\mathcode`\f+:\ \hex{\the\mathcode`\f}}, -{\tt \verb+\the\omathcode`\f+:\ \hex{\the\omathcode`\f}}(どちらも16進に +{\tt \verb+\the\mathcode`\f+:\ \cnttohex{\the\mathcode`\f}}, +{\tt \verb+\the\omathcode`\f+:\ \cnttohex{\the\omathcode`\f}}(どちらも16進に 変換した) $\left[\right.\bigl[\Bigl[\Bigr)\bigr)) <>$ diff --git a/Master/texmf-dist/doc/ptex/ptex-manual/fam256p.tex b/Master/texmf-dist/doc/ptex/ptex-manual/fam256p.tex index 56808f63d4c..d05847ab6d9 100644 --- a/Master/texmf-dist/doc/ptex/ptex-manual/fam256p.tex +++ b/Master/texmf-dist/doc/ptex/ptex-manual/fam256p.tex @@ -1,5 +1,16 @@ \makeatletter \mathchardef\e@mathgroup@top=256 +\def\cnttohex#1{% +{\count@=#1\@tempcnta=#1\@tempcntb=\@tempcnta\relax +\divide\@tempcntb by 16% +\ifnum\count@=0\else + \multiply\@tempcntb by16% + \advance\@tempcnta-\@tempcntb + \divide\@tempcntb by16% + \cnttohex{\the\@tempcntb}% + \ifcase\@tempcnta\relax 0\or1\or2\or3\or4\or5\or6\or + 7\or8\or9\or A\or B\or C\or D\or E\or F\fi +\fi}} \makeatother diff --git a/Master/texmf-dist/doc/ptex/ptex-manual/jfm.pdf b/Master/texmf-dist/doc/ptex/ptex-manual/jfm.pdf index 2a499781a45..440180a3f33 100644 Binary files a/Master/texmf-dist/doc/ptex/ptex-manual/jfm.pdf and b/Master/texmf-dist/doc/ptex/ptex-manual/jfm.pdf differ diff --git a/Master/texmf-dist/doc/ptex/ptex-manual/jfm.tex b/Master/texmf-dist/doc/ptex/ptex-manual/jfm.tex index 1f23731cc38..128ba4399ac 100644 --- a/Master/texmf-dist/doc/ptex/ptex-manual/jfm.tex +++ b/Master/texmf-dist/doc/ptex/ptex-manual/jfm.tex @@ -1,239 +1,337 @@ -\documentclass[twoside]{jarticle} -\addtolength{\textwidth}{0.9in} -\setlength{\oddsidemargin}{.4in} -\setlength{\evensidemargin}{.4in} -\pagestyle{headings} -\title{JFMファイルフォーマット} +\documentclass[a4paper,11pt,nomag]{jsarticle} +\usepackage[textwidth=42zw,lines=40,truedimen,centering]{geometry} +\usepackage{amsmath} +\usepackage[defaultsups]{newpxtext} +\usepackage[zerostyle=c,straightquotes]{newtxtt} +\usepackage{newpxmath} + +% common +\usepackage{ptex-manual} + +\usepackage{shortvrb} +\MakeShortVerb*{|} + +\def\size#1{\mathit{#1}} +\def\code#1{\texttt{#1}} + +% logos +\def\pTeX{p\kern-.10em\TeX}\def\upTeX{u\pTeX} + +\title{\emph{JFMファイルフォーマット}} \author{ASCII Corporation \& Japanese \TeX\ Development Community} \begin{document} \maketitle -\section{JFM file format} -JFMファイルのフォーマットは、 -基本的にはTFMファイルのフォーマットに準拠しており、 -TFMを拡張した形になっている。 -ここでは、主にその拡張部分について説明を行い、 -その他の部分に関しては、 -\TeX\ the program等のTFMの説明を参照してもらいたい。 - -この文書はもともと株式会社アスキーが開発したp\TeX{}に付属していた -ものである。2018年に日本語\TeX{}開発コミュニティはJFMフォーマットを -拡張したため、その内容について追記してある。 - -\subsection{JFMファイルの構成} -JFMファイル全体の構成は、 -Table~\ref{構成}(\pageref{構成}ページ)に示すとおりである。 \\ -ここでTFMと異なるのは次の点である。 +\emph{JFM (Japanese Font Metric)}は, +\pTeX で和文フォントを扱うためのフォントメトリックであり, +オリジナルの\TeX のTFM (\TeX\ Font Metric)に相当する. +\pTeX と同じく株式会社アスキーによって開発され, +この文書も\pTeX に付属していたものであるが,ここでは2018年に +日本語\TeX 開発コミュニティによって拡張されたJFMフォーマットに +基づいて説明する. + +なお,\pTeX の内部コードをUnicode化した\upTeX でも, +JFMフォーマットの仕様は全く同じであり,ただ +\node{char\_type}テーブルに文字コードを格納するときに +JISコードを用いる(\pTeX の場合)か, +UCS-4の下位3バイトを用いる(\upTeX の場合)かだけが異なる. + +\section{JFMファイルの構成} + +JFMファイルのフォーマットは, +基本的にはTFMファイルのフォーマットに準拠しており, +TFMを拡張した形になっている. +ここでは,主にその拡張部分について説明を行い, +その他の部分に関しては, +\TeX\ the program等のTFMの説明を参照してもらいたい. + +JFMファイル全体の構成は, +表\ref{構成}(\pageref{構成}ページ)に示すとおりである. +ここでTFMと異なるのは次の点である. \begin{enumerate} -\item {\it char\_type}のテーブルが付け加えられたこと。 -\item {\it exten}の換わりに{\it glue}のテーブルが設けられたこと。 -\item 2に関連して、{\it lig\_kern}から{\it glue\_kern}テーブルへ変更されたこと。 -\item これらに伴い、先頭のファイル内の各部分を規定する - パラメータ表が変更されている。 - また、オリジナルのTFMとの区別のためにidを付加している。 +\item \node{char\_type}のテーブルが付け加えられたこと. +\item \node{exten}の換わりに\node{glue}のテーブルが設けられたこと. +\item 2に関連して,\node{lig\_kern}から\node{glue\_kern}テーブルへ変更されたこと. +\item これらに伴い,先頭のファイル内の各部分を規定するパラメータ表が変更されている. + また,オリジナルのTFMとの区別のために$\size{id}$を付加しており, + 先頭の半ワード(2バイト)が横組用は11,縦組用は9である + \footnote{欧文TFMの半ワードは$\size{lf}$すなわちファイルサイズであり, + 11や9になることはない.}. \end{enumerate} -最初の7ワードは半ワード(=2バイト)ずつに区切られ、 -JFMファイルを構成する14個の要素のサイズが収められている。 -これらの値は、すべて$2^{15}$よりも小さい非負の値で、 +最初の7ワードは半ワード(=2バイト)ずつに区切られ, +JFMファイルを構成する14個の要素のサイズが収められている +\footnote{欧文TFMでは12個だが,JFMでは$\size{id}$と$\size{nt}$が増え, +$\size{ne}$が$\size{ng}$に置き換わったため14個である.}. +これらの値は,すべて$2^{15}$よりも小さい非負の値で, 次の条件を満たしていなければならない: -\begin{eqnarray*} -bc &=& 0 \\ -lf &=& 7 + lh + (ec - bc + 1) + nw + nh + nd + ni + nl + nk + ng + np -\end{eqnarray*} - -\subsection{char\_type} -今回の\TeX の日本語化においては、同一の文字幅、 -高さ前後に挿入されるグルー等、その文字が持つ属性全てが -同じものを、1つの{\it `char\_type'}として英字フォントの1キャラクタと -同様にして扱うようにしている。 -そこで、漢字の文字コードとこの{\it char\_type}との対応付けを -このテーブルを使って行う。 - -このテーブルの各エントリーは1ワード(=4バイト)で構成され、 -上位3バイトに漢字コード、下位1バイトにキャラクタタイプを持つ +\begin{align*} +\size{bc} &= 0 \\ +0 &\leq \size{ec} \leq 255 \\ +\size{lf} &= 7+\size{nt}+\size{lh}+(\size{ec}-\size{bc}+1)+\size{nw}+\size{nh} + +\size{nd}+\size{ni}+\size{nl}+\size{nk}+\size{ng}+\size{np} +\end{align*} +ここで,$\size{bc}$と$\size{ec}$は最小・最大の文字タイプ番号, +$\size{nt}$は\node{char\_type}テーブルに登録された文字の数(文字タイプ0も含む), +$\size{nl}$と$\size{ng}$はそれぞれは\node{glue\_kern}テーブルと +\node{glue}テーブルのサイズであり,その他の値はTFMを踏襲する. + +JFMファイルでもTFMファイルと同じく,拡張子は\code{.tfm}が用いられる. + +\subsection{\node{char\_type}テーブル} +\pTeX では欧文\TeX よりはるかに多くの文字を扱う必要があるが, +そのほとんどは漢字であり,それらは全て同一の寸法(全角幅)を持つ. +また,括弧や句読点などの約物も種類が増えるが,こちらも +幾つかのパターンに分類すれば済む(例えば ``「'' と ``('' は同様に扱える). + +そこで,JFMフォーマットでは, +同一の文字幅,高さ,前後に挿入されるグルー等,「その文字が持つ属性全てが +同じもの」を1つの\emph{文字タイプ} (\node{char\_type})として, +欧文フォントの1文字と同様にして扱うようにしている. +そして,文字コードと文字タイプとの対応付けを, +この\node{char\_type}テーブルを使って行う. + +このテーブルの各エントリーは1ワード(=4バイト)で構成され, +上位3バイトに文字コード(符合位置),下位1バイトに文字タイプを持つ \footnote{これが日本語\TeX{}開発コミュニティによって2018年1月に導入された -新仕様である;オリジナルのアスキーによる仕様では、「上位半ワードに -漢字コード、下位半ワードにキャラクタタイプを持つ」というものであった。 -p\TeX{}では内部処理にJISが用いられ、JFMで扱う漢字コードは2バイトが -上限だったため十分であったが、up\TeX{}でBMP超えの3バイトの文字を -JFMで扱うことを目的に仕様拡張した。}。 -漢字コードは、それが16進数24bit(3バイト)で0xABcdefと表されるとき、 -{\it char\_type}テーブルには{\tt cd ef AB}として格納される -\footnote{オリジナルの仕様では、下位半ワードにキャラクタタイプを -格納していたが、キャラクタタイプの上限は255なので、実はその上位バイトは -常に{\tt 00}であった。このことを利用し、日本語\TeX{}開発コミュニティの -新仕様では「この{\tt 00}が実は漢字コードの上位だった」ということに -して、3バイト(U+10000以上)の漢字コードで不足する1バイトを確保した。 -これにより、新仕様はオリジナルの仕様の上位互換であることが保証されている。}。 -テーブル内にはコードの値の順番に収められていなければならない。 -またこのテーブルの先頭には、デフォルトのインデックスとして -漢字コード及びキャラクタタイプの項が0のものが、 -必ず1つ存在しなければならず、このテーブルに登録されていない文字は、 -キャラクタタイプが0として扱う。 -つまり、このデフォルト以外の文字幅、カーン等の属性を持つキャラクタ -のコードとタイプが2番目以降のエントリーとして存在しなければならない。 - -\subsection{char\_info} -{\it char\_type}をインデックスとしてこのテーブルを -参照することにより、各{\it char\_type}の属性を検索する。 +新仕様である;オリジナルのアスキーによる仕様では,「上位半ワードに +文字コード,下位半ワードに文字タイプを持つ」というものであった. +\pTeX{}では内部処理にJISが用いられ,JFMで扱う文字コードは2バイトが +上限だったため十分であったが,\upTeX{}でBMP超えの3バイトの文字を +JFMで扱うことを目的に仕様拡張した.}. +文字コードは,それが16進数24bit(3バイト)で\code{0xABcdef}と表されるとき, +\node{char\_type}テーブルには\code{cd ef AB}として格納される +\footnote{オリジナルの仕様では,下位半ワードに文字タイプを +格納していたが,文字タイプの上限は255なので,実はその上位バイトは +常に\code{00}であった.このことを利用し,日本語\TeX{}開発コミュニティの +新仕様では「この\code{00}が実は文字コードの上位だった」ということに +して,3バイト(U+10000以上)の文字コードで不足する1バイトを確保した. +これにより,新仕様はオリジナルの仕様の上位互換であることが保証されている.}. +テーブル内にはコードの値の順番に収められていなければならない. +またこのテーブルの先頭には,デフォルトのインデックスとして +文字コード及び文字タイプの項が0のものが, +必ず1つ存在しなければならず,このテーブルに登録されていない文字は, +文字タイプが0として扱う. +つまり,このデフォルト以外の文字幅,カーン等の属性を持つキャラクタ +のコードとタイプが2番目以降のエントリーとして存在しなければならない. + +\subsection{\node{char\_info}テーブル} +\node{char\_type}をインデックスとしてこのテーブルを +参照することにより,各\node{char\_type}の属性を検索する. 各テーブルへのインデックス等の情報を次の順番でパッキング -して1ワードに収めてある。 -\begin{description} -\item{{\it width\_index} (8bits)} width\_tableへのインデックス -\item{{\it height\_index} (4bits)} height\_tableへのインデックス -\item{{\it depth\_index} (4bits)} depth\_tableへのインデックス -\item{{\it italic\_index} (6bits)} italic\_tableへのインデックス -\item{{\it tag} (2bits)} - \begin{description} - \item{${\it tag}=0$} {\it remainder}の項は無効であり - 使用しないことを示す。 - \item{${\it tag}=1$} {\it remainder}の項が{\it glue\_kern}への有効な - インデックスであることを示す。 - \item{${\it tag}=2, 3$} JFMでは使用していない。 - \end{description} -\item{remainder (8bits)} +して1ワードに収めてある. +\begin{description}\itemindent=2zw + \item[\node{width\_index} (8bits)] + \node{width\_table}へのインデックス + \item[\node{height\_index} (4bits)] + \node{height\_table}へのインデックス + \item[\node{depth\_index} (4bits)] + \node{depth\_table}へのインデックス + \item[\node{italic\_index} (6bits)] + \node{italic\_table}へのインデックス + \item[\node{tag} (2bits)] + \node{remainder}をどのような目的で使うかを示す. + \begin{description}\itemindent=1zw + \item[$\size{tag}=0$] + \node{remainder}の項は無効であり使用しないことを示す. + \item[$\size{tag}=1$] + \node{remainder}の項が\node{glue\_kern}への有効なインデックスであることを示す. + \item[$\size{tag}=2, 3$] + JFMでは使用していない. + \end{description} + \item[\node{remainder} (8bits)] \end{description} -JFMでは$bc$は必ずゼロ\footnote{前節にある通り、漢字コード及び -キャラクタタイプの項が0のものが必ず1つ存在するため。}なので、 -1つのJFMに含まれる{\it char\_info}は全部で$ec+1$ワードになる。 - -\subsection{glue\_kern} -特定のキャラクタタイプの組み合せ時に挿入すべき{\it glue}又は{\it kern}を -簡単なプログラム言語によって指定する。 -各命令は、以下の4バイトで構成される。 -\begin{description} -\item{第1バイト({\it skip\_byte})} - \begin{itemize} - \item 128より大きいとき\\ - 現在のワードが{\it char\_info}から示された最初のワード - である場合は、実際の{\it glue\_kern}プログラムが - {\it glue\_kern}[$256*{\it op\_byte}+{\it remainder}$]から - 収められている(すなわち、再配置されている)ことを示す - \footnote{「再配置」は、サイズが256を超える大きな - {\it glue\_kern}テーブルを格納するための方策であり、 - 欧文TFMの{\it lig\_kern}テーブルにおけるそれと同様である。 - 2018年2月に日本語\TeX{}開発コミュニティによって、 - p\TeX{}及びpPLtoTFで新たにサポートされた。}。 - 最初のワードでない場合(すなわち、既に再配置先あるいは - プログラムのステップを開始した後のワードである場合)は、 - その場でプログラムを終了する。 - \item 128のとき\\ - このワードを実行してプログラムを終了する。 - \item 128より小さいとき\\ - このワードを実行した後、次のステップまでスキップする - ワード数を示す - \footnote{「スキップ」(SKIP)は、元々アスキーの公式ページ - {\tt http://ascii.asciimw.jp/pb/ptex/tfm/jfm.html}に文書化 - されてはいたが、実際には(p)PLtoTFの{\it glue\_kern}テーブル内で - SKIP命令を使用することができず、p\TeX{}もやはりSKIP命令を - サポートしていなかった。 - 2018年2月の日本語\TeX{}開発コミュニティの改修により、 - 新たにサポートが開始された。}。 - \end{itemize} -\item{第2バイト({\it char\_type})} - \begin{itemize} - \item 次の文字のキャラクタタイプが、 - このバイトで示すキャラクタタイプ - \footnote{ここにキャラクタタイプが格納されるため、 - キャラクタタイプの上限は255なのである。}と同じ場合、 - 第3バイトの処理を実行し、プログラム終了。 - \item そうでなければ次のステップへ。 - \end{itemize} -\item{第3バイト({\it op\_byte})}\\ - この値によってグルーを扱うかカーンを扱うかを規定する。 - \begin{itemize} - \item 127以下の場合{\it glue[remainder$\times$3]}のグルーを挿入。 - \item 128以上の場合{\it kern[remainder]}のカーンを挿入。 - \end{itemize} -\item{第4バイト({\it remainder})}\\ - 第3バイトにより規定される - {\it glue}または{\it kern}へのインデックスを示す。 + +JFMでは$\size{bc}$は必ずゼロ\footnote{前節にある通り,文字コード及び +文字タイプの項が0のものが必ず1つ存在するため.}なので, +1つのJFMに含まれる\node{char\_info}は全部で$\size{ec}+1$ワードになる. + +% [TODO] char_info のサイズが ec+1 ということは, +% 文字タイプは 0 から ec まで連続しなければならないのか? +% (char_type テーブル内の文字コードの順序については説明があるが, +% 文字タイプの連続性についてはどこにも明記されていない気がする…) + +\subsection{\node{glue\_kern}テーブル} +特定の文字タイプの組み合せ時に挿入すべき\node{glue}又は\node{kern}を +簡単なプログラム言語によって指定する. +各命令は,以下の4バイトで構成される. +\begin{description}\itemindent=2zw +\item[第1バイト] (\node{skip\_byte}) + \begin{itemize} + \item 128より大きいとき\\ + 現在のワードが\node{char\_info}から示された最初のワード + である場合は,実際の\node{glue\_kern}プログラムが + \node{glue\_kern}[$256\times\size{op\_byte}+\size{remainder}$]から + 収められている(すなわち,再配置されている)ことを示す + \footnote{「再配置」は,サイズが256を超える大きな + \node{glue\_kern}テーブルを格納するための方策であり, + 欧文TFMの\node{lig\_kern}テーブルにおけるそれと同様である. + 2018年2月に日本語\TeX{}開発コミュニティによって, + \pTeX{}及びpPLtoTFで新たにサポートされた.}. + 最初のワードでない場合(すなわち,既に再配置先あるいは + プログラムのステップを開始した後のワードである場合)は, + その場でプログラムを終了する. + \item 128のとき\\ + このワードを実行してプログラムを終了する. + \item 128より小さいとき\\ + このワードを実行した後,次のステップまでスキップする + ワード数を示す + \footnote{「スキップ」(SKIP)は,元々アスキーの公式ページ + \texttt{http://ascii.asciimw.jp/pb/ptex/tfm/jfm.html}に文書化 + されてはいたが,実際には(p)PLtoTFの\node{glue\_kern}テーブル内で + SKIP命令を使用することができず,\pTeX{}もやはりSKIP命令を + サポートしていなかった. + 2018年2月の日本語\TeX{}開発コミュニティの改修により, + 新たにサポートが開始された.}. + \end{itemize} +\item[第2バイト] (\node{char\_type}) + \begin{itemize} + \item 次の文字の文字タイプが, + このバイトで示す文字タイプ + \footnote{ここに文字タイプが格納されるため, + 文字タイプの上限は255なのである.}と同じ場合, + 第3バイトの処理を実行し,プログラム終了. + \item そうでなければ次のステップへ. + \end{itemize} +\item[第3バイト] (\node{op\_byte})\\ + この値によってグルーを扱うかカーンを扱うかを規定する. + \begin{itemize} + \item 127以下の場合\node{glue}[$\size{remainder}\times 3$]のグルーを挿入. + \item 128以上の場合\node{kern}[$\size{remainder}$]のカーンを挿入. + \end{itemize} +\item[第4バイト] (\node{remainder})\\ + 第3バイトにより規定される + \node{glue}または\node{kern}へのインデックスを示す. \end{description} -% -\subsection{glueテーブル} -自然長、伸び長、縮み長の3ワードで1つのグルーを構成する -(したがって、$ng$は必ず3の倍数となる)。 -各値は、$design size\times2^{-20}$を単位として表す。 -\begin{description} -\item{第1ワード} width -\item{第2ワード} stretch -\item{第3ワード} shrink + +\subsection{\node{glue}テーブル} +自然長,伸び長,縮み長の3ワードで1つのグルーを構成する +(したがって,$ng$は必ず3の倍数となる). +各値は,$\mathrm{design size}\times2^{-20}$を単位として表す. +\begin{description}\itemindent=2zw + \item[第1ワード] width + \item[第2ワード] stretch + \item[第3ワード] shrink \end{description} -% -\subsection{paramテーブル} -\begin{description} -\item{param[1]} 文字の傾き (italic slant)。 -\item{param[2][3][4]} 漢字間に挿入するグルーのデフォルト値。 -\item{param[5]} p\TeX{}でzhで参照される寸法。 -\item{param[6]} p\TeX{}でzwで参照される寸法。 -\item{param[7][8][9]} 漢字と英字間に挿入するグルーのデフォルト値。 + +\subsection{\node{param}テーブル} +一応,以下のように定義されている. +\begin{description}\itemindent=2zw + \item[\mbox{param[1]}] + 文字の傾き (italic slant). + \item[\mbox{param[2][3][4]}] + 和文文字間に挿入するグルー(|\kanjiskip|)のデフォルト値. + \item[\mbox{param[5]}] + \pTeX{}でzhで参照される寸法. + \item[\mbox{param[6]}] + \pTeX{}でzwで参照される寸法. + \item[\mbox{param[7][8][9]}] + 和文文字と欧文文字間に挿入するグルー(|\xkanjiskip|)のデフォルト値. \end{description} -% -\newpage -\begin{table}[h] +\begin{dangerous} +このように書かれているが,実際には +\pTeX のzwは「文字タイプ0の文字の幅」, +\pTeX のzhは「文字タイプ0の文字の高さと深さの和」である. +明示的に|\fontdimen|で取得する場合を除くと,JFMの\node{param}テーブルの +値が用いられる状況は限られている. +% [TODO] 例えばいつ? +% ptex-manual によると,\accent で和文文字をアクセントにした場合の +% 上下位置補正に \fontdimen5 の値が用いられるらしい.他には? +\end{dangerous} + +\DeleteShortVerb{|} +\begin{table}[tbp]\small +\caption{JFMファイルの構成\label{構成}} \begin{minipage}[b]{2in} \begin{tabular}{|c|c|} \hline -\hbox to.8in{\hfil$id$\hfil} & \hbox to.8in{\hfil$nt$\hfil} \\ \hline -$lf$ & $lh$ \\ \hline -$bc$ & $ec$ \\ \hline -$nw$ & $nh$ \\ \hline -$nd$ & $ni$ \\ \hline -$nl$ & $nk$ \\ \hline -$ng$ & $np$ \\ \hline +\hbox to.8in{\hfil$\size{id}$\hfil} & +\hbox to.8in{\hfil$\size{nt}$\hfil} \\ \hline +$\size{lf}$ & $\size{lh}$ \\ \hline +$\size{bc}$ & $\size{ec}$ \\ \hline +$\size{nw}$ & $\size{nh}$ \\ \hline +$\size{nd}$ & $\size{ni}$ \\ \hline +$\size{nl}$ & $\size{nk}$ \\ \hline +$\size{ng}$ & $\size{np}$ \\ \hline \multicolumn{2}{|c|}{} \\ -\multicolumn{2}{|c|}{header} \\ +\multicolumn{2}{|c|}{\node{header}} \\ \multicolumn{2}{|c|}{}\\ \hline \multicolumn{2}{|c|}{} \\ -\multicolumn{2}{|c|}{char\_type} \\ +\multicolumn{2}{|c|}{\node{char\_type}} \\ \multicolumn{2}{|c|}{}\\ \hline \multicolumn{2}{|c|}{}\\ -\multicolumn{2}{|c|}{char\_info} \\ +\multicolumn{2}{|c|}{\node{char\_info}} \\ \multicolumn{2}{|c|}{}\\ \hline \multicolumn{2}{|c|}{}\\ -\multicolumn{2}{|c|}{width} \\ +\multicolumn{2}{|c|}{\node{width}} \\ \multicolumn{2}{|c|}{}\\ \hline \multicolumn{2}{|c|}{}\\ -\multicolumn{2}{|c|}{height} \\ +\multicolumn{2}{|c|}{\node{height}} \\ \multicolumn{2}{|c|}{}\\ \hline \multicolumn{2}{|c|}{}\\ -\multicolumn{2}{|c|}{depth} \\ +\multicolumn{2}{|c|}{\node{depth}} \\ \multicolumn{2}{|c|}{}\\ \hline \multicolumn{2}{|c|}{}\\ -\multicolumn{2}{|c|}{italic} \\ +\multicolumn{2}{|c|}{\node{italic}} \\ \multicolumn{2}{|c|}{}\\ \hline \multicolumn{2}{|c|}{}\\ -\multicolumn{2}{|c|}{glue\_kern} \\ +\multicolumn{2}{|c|}{\node{glue\_kern}} \\ \multicolumn{2}{|c|}{}\\ \hline \multicolumn{2}{|c|}{}\\ -\multicolumn{2}{|c|}{kern} \\ +\multicolumn{2}{|c|}{\node{kern}} \\ \multicolumn{2}{|c|}{}\\ \hline \multicolumn{2}{|c|}{}\\ -\multicolumn{2}{|c|}{glue} \\ +\multicolumn{2}{|c|}{\node{glue}} \\ \multicolumn{2}{|c|}{}\\ \hline \multicolumn{2}{|c|}{}\\ -\multicolumn{2}{|c|}{param} \\ +\multicolumn{2}{|c|}{\node{param}} \\ \multicolumn{2}{|c|}{}\\ \hline \end{tabular} \end{minipage} \begin{minipage}[b]{3.3in} \noindent \begin{tabular}{l} -$id=$ JFM\_ID number. ($=11$ for yoko, $9$ for tate) \\ -$nt=$ number of words in the character type table. \\ -$lf=$ length of the entire file, in words. \\ -$lh=$ length of the header data, in words. \\ -$bc=$ smallest character type in the font. ($=0$ for JFM) \\ -$ec=$ largest character type in the font. \\ -$nw=$ number of words in the width table. \\ -$nh=$ number of words in the height table. \\ -$nd=$ number of words in the depth table. \\ -$ni=$ number of words in the italic correction table. \\ -$nl=$ number of words in the glue/kern table. \\ -$nk=$ number of words in the kern table. \\ -$ng=$ number of words in the glue table. \\ -$np=$ number of font parameter words. \\ + $\size{id}=$ JFM\_ID number. ($=11$ for yoko, $9$ for tate) \\ + $\size{nt}=$ number of words in the character type table. \\ + $\size{lf}=$ length of the entire file, in words. \\ + $\size{lh}=$ length of the header data, in words. \\ + $\size{bc}=$ smallest character type in the font. ($=0$ for JFM) \\ + $\size{ec}=$ largest character type in the font. \\ + $\size{nw}=$ number of words in the width table. \\ + $\size{nh}=$ number of words in the height table. \\ + $\size{nd}=$ number of words in the depth table. \\ + $\size{ni}=$ number of words in the italic correction table. \\ + $\size{nl}=$ number of words in the glue/kern table. \\ + $\size{nk}=$ number of words in the kern table. \\ + $\size{ng}=$ number of words in the glue table. \\ + $\size{np}=$ number of font parameter words. \\ \end{tabular} \end{minipage} -\caption{JFMファイルの構成\label{構成}} \end{table} +\MakeShortVerb*{|} + + +\section{JPLファイル} + +TFMはバイナリ形式であるが,これをプロパティ(特性)という概念を使って +テキスト形式で視覚化したものがPL (Property List)ファイルである. +同様に,JFMをテキスト形式で視覚化したものが +\emph{JPL (Japanese Property List)}ファイルである. +JPLファイルでもPLファイルと同じく,拡張子は\code{.pl}が用いられる. + + +\section{JFMを扱うプログラム} + +\pTeX と\upTeX ,あるいはそれらが生成したDVIを扱うプログラムが +JFMを扱うのは当然であるが,ここではJFMおよび関連するフォントフォーマットを +扱うことに特化したプログラムの主なものを挙げる. + +%\subsection{pPLtoTF, upPLtoTF} + +%\subsection{pTFtoPL, upTFtoPL} + +%\subsection{chkdvifont} + +%\subsection{jfmutil} + +%\subsection{makejvf} + \end{document} diff --git a/Master/texmf-dist/doc/ptex/ptex-manual/jtex_asciimw.tex b/Master/texmf-dist/doc/ptex/ptex-manual/jtex_asciimw.tex index d2baa874fe6..884a21b53c4 100644 --- a/Master/texmf-dist/doc/ptex/ptex-manual/jtex_asciimw.tex +++ b/Master/texmf-dist/doc/ptex/ptex-manual/jtex_asciimw.tex @@ -650,4 +650,5 @@ charノード内のフォントを調べ、それが漢字フォントである \cs{prebreakpenalty}\cs{jis}"2576=150 \\ \end{tabular}} +%% texjporg: タイポだけ修正 (2017/04/12, 2017/07/16) \end{document} diff --git a/Master/texmf-dist/doc/ptex/ptex-manual/jtexdoc_asciimw.tex b/Master/texmf-dist/doc/ptex/ptex-manual/jtexdoc_asciimw.tex index 203a1aa6882..8373afc12ee 100644 --- a/Master/texmf-dist/doc/ptex/ptex-manual/jtexdoc_asciimw.tex +++ b/Master/texmf-dist/doc/ptex/ptex-manual/jtexdoc_asciimw.tex @@ -400,4 +400,5 @@ boxの前後の文字に連続する文字列として解釈され、 グルーの自動挿入を行うことは不可能です。 \end{itemize} %% cmsy の \{ は 0x6E でなく 0x66 (2001/08/24) +%% texjporg: タイポだけ修正 (2017/03/13, 2017/04/12, 2017/04/16) \end{document} diff --git a/Master/texmf-dist/doc/ptex/ptex-manual/ptex-guide-en.pdf b/Master/texmf-dist/doc/ptex/ptex-manual/ptex-guide-en.pdf new file mode 100644 index 00000000000..f33abf4c401 Binary files /dev/null and b/Master/texmf-dist/doc/ptex/ptex-manual/ptex-guide-en.pdf differ diff --git a/Master/texmf-dist/doc/ptex/ptex-manual/ptex-guide-en.tex b/Master/texmf-dist/doc/ptex/ptex-manual/ptex-guide-en.tex new file mode 100644 index 00000000000..bbf6918839f --- /dev/null +++ b/Master/texmf-dist/doc/ptex/ptex-manual/ptex-guide-en.tex @@ -0,0 +1,623 @@ +%#!make ptex-guide-en.pdf +\documentclass[a4paper,11pt]{article} +\usepackage[textwidth=42zw,lines=40,truedimen,centering]{geometry} + +%%%%%%%%%%%%%%%% +% additional packages +\usepackage{amsmath} +\usepackage{array}\usepackage[all]{xy} +\SelectTips{cm}{} +%\usepackage[dvipdfmx]{graphicx} +\usepackage[T1]{fontenc} +\usepackage{booktabs,enumitem,multicol} +\usepackage[defaultsups]{newpxtext} +\usepackage[zerostyle=c,straightquotes]{newtxtt} +\usepackage{newpxmath} +\usepackage[dvipdfmx,hyperfootnotes=false]{hyperref} +\usepackage{pxjahyper} +\usepackage{hologo} +\usepackage{makeidx}\makeindex + +% common +\usepackage{ptex-manual} + +\makeatletter +\newlist{simplelist}{description}1 +\setlist[simplelist]{% + itemsep=0pt, listparindent=1zw, itemindent=10pt, + font=\normalfont\mdseries, leftmargin=2zw, + before=\advance\@listdepth\@ne, + after=\advance\@listdepth\m@ne +} +\makeatother + +\def\code#1{\texttt{#1}} + +%%%%%%%%%%%%%%%% +\makeatletter +\setlist{leftmargin=2zw} +\setlist[description]{labelwidth=2zw,labelindent=1zw,topsep=\medskipamount} + +\def\>{\ifhmode\hskip\xkanjiskip\fi} + +\def\tsp{_{\mbox{\fontsize\sf@size\z@\ttfamily \char32}}} +\def\tpar{_{\mbox{\fontsize\sf@size\z@\ttfamily \string\par}}} +\def\tign{_{\mbox{\fontsize\sf@size\z@\selectfont --}}} + +\usepackage{shortvrb} +\MakeShortVerb*{|} +%%%%%%%%%%%%%%%% + +% logos +\def\epTeX{$\varepsilon$-\pTeX}\def\eTeX{$\varepsilon$-\TeX} +\def\eupTeX{$\varepsilon$-\upTeX}\def\upTeX{u\pTeX} +\def\pTeX{p\kern-.10em\TeX} +\def\pLaTeX{p\LaTeX}\def\upLaTeX{u\pLaTeX} +\def\pdfTeX{pdf\TeX} +\def\OMEGA{$\Omega$} +\def\TL{\TeX\ Live\ } + +\def\_{\leavevmode\vrule width .45em height -.2ex depth .3ex\relax} + +\frenchspacing +\begin{document} +\catcode`\<=13 +\title{\emph{Guide of \pTeX\ for developers not interested in Japanese}} +\author{Japanese \TeX\ Development Community\null +\thanks{\url{https://texjp.org},\ e-mail: \texttt{issue(at)texjp.org}}} +\date{version p\the\ptexversion.\the\ptexminorversion\ptexrevision, \today} +\maketitle + +\pTeX\ and its variants, \upTeX, \epTeX\ and \eupTeX, are all \TeX\ engines +with native Japanese support. +Its output is always a DVI file, which can be processed by several +DVI drivers with Japanese support including {\em dvips} and {\em dvipdfmx}. +Formats based on \LaTeX\ is called \pLaTeX\ when running on \pTeX/\epTeX, +and called \upLaTeX\ when running on \upTeX/\eupTeX. + +%%% Target readers of this document: 日本語機能でないパッケージ作者に絞る +\section*{Purpose of this document} + +This document is written for developers of \TeX/\LaTeX, who aim to +support \pTeX/\pLaTeX\ and its variants \upTeX/\upLaTeX. +Knowledge of the followings are assumed: +\begin{itemize} + \item Basic knowledge of Western \TeX\ (Knuthian \TeX, \eTeX\ and \pdfTeX), + \item ... and its programming conventions. +\end{itemize} + +%%% 日本語(の組版・文字コード)の知識は要らない。その話はできる限り避ける +Any knowledge of Japanese (characters, encodings, typesetting conventions etc.) +is not assumed; some explanations are provided in this document when needed. +We hope that this document helps authors of packages or classes +to proceed with supporting \pTeX\ family smoothly. + +\begin{quotation} +Note: This English edition (\jobname.pdf) is {\em not} meant +to be a complete translation of Japanese edition (ptex-manual.pdf). +For example, this document does not cover the following aspects of \pTeX: +\begin{itemize} + \item Typesetting conventions of Japanese characters + \item Details of vertical writing +\end{itemize} +For beginners of writing Japanese texts, +please refer to the Japanese edition. +\end{quotation} + +\tableofcontents + + +\newpage + + +%%%%% +\part{Brief introduction}% 概論 + +%%% pTeX とその仲間 +\section{\pTeX\ and its variants} + +% [TODO] \pTeX, \upTeX, \epTeX, \eupTeX を簡単に紹介 + +%%% e-(u)pTeX の話がメイン +There is no advantage to choose \pTeX/\upTeX\ over \epTeX/\eupTeX, +so we focus mainly on \epTeX/\eupTeX. + +% [TODO] pLaTeX/upLaTeX も e- で走っていて,これで十分であると付け加える +% [TODO] 既に pTeX/upTeX が暗に e-pTeX/e-upTeX を指す文献もあることに言及 + +%%% 欧文 TeX との互換性 +\section{Compatibility with Western \TeX} + +%%% pTeX/upTeX は Knuthian TeX に対してほぼ上位互換 +\pTeX/\upTeX\ are almost uppercompatible with Knuthian \TeX, +however, they do not pass TRIP test. +%%% 入力の8bitの扱いが異なる。フォントの8bitはそのまま +In \pTeX/\upTeX, input handling is different from Knuthian \TeX; +if a pair of two or more 8-bit codes matches Japanese character code, +it is regarded as one Japanese character. +There is no difference in handling 8-bit TFM font. + +%%% e-pTeX/e-upTeX は e-TeX に対してほぼ上位互換 +\epTeX/\eupTeX\ are almost uppercompatible with \eTeX, +however, input handling is similar to \pTeX/\upTeX. +It does not pass e-TRIP test. +%%% だけど e-TeX はもうなく,pdfTeX の DVI モードがあるだけ +That said, please note that ``raw \eTeX'' is unavailable anymore +in \TeX\ Live and derived distributions; +they provide a command |etex| only as ``DVI mode of \pdfTeX.'' +%%% e-pTeX/e-upTeX は pdfTeX の DVI モードに対して上位互換ではない +We should note that +\epTeX/\eupTeX\ are {\em not} uppercompatible with DVI mode of \pdfTeX, +which will be discussed later in section \ref{dvi-pdftex}. + +%%% LaTeX ムニャムニャ +\section{\LaTeX\ on \pTeX/\upTeX\ --- \pLaTeX/\upLaTeX} + +%%% pLaTeX と upLaTeX ムニャムニャ +Formats based on \LaTeX\ is called \pLaTeX\ when running on \pTeX/\epTeX, +and called \upLaTeX\ when running on \upTeX/\eupTeX. +In recent versions (around 2011) of \TeX\ Live and its derivatives, +the default engines of \pLaTeX\ and \upLaTeX\ are \epTeX\ and \eupTeX. +That is, the command |platex| starts \epTeX\ (not \pTeX) with +preloaded format |platex.fmt|. + +%%% カーネルが拡張されている +In the kernel level (|platex.ltx| and |uplatex.ltx|), +\pLaTeX\ and \upLaTeX\ adds some additional commands +related to the followings: +\begin{itemize} + \item Selection of Japanese fonts + \item Crop marks (called ``tombow'') for printings + \item Adjustment for mixing horizontal and vertical texts +\end{itemize} +%%% author レベルでは LaTeX とほぼ互換,ただし例外あり +For authors, \pLaTeX/\upLaTeX\ is almost uppercompatible with +original \LaTeX, except for the followings: +\begin{itemize} + \item Order of float objects; in \pLaTeX/\upLaTeX, + is placed above . + That is, the complete order is + $\rightarrow$ $\rightarrow$ + $\rightarrow$ . + % [TODO] 他にもあるか? +\end{itemize} +%%% developer レベルでは pdfTeX 拡張や pLaTeX カーネルでムニャムニャ +For developers, additional cares may be needed, +for changes in the kernel macros and/or absence of \pdfTeX\ features. + +%%% 際立った pTeX 系列の特徴 +\section{Eminent characteristics of \pTeX/\upTeX} + +The most important characteristics of \pTeX/\upTeX\ can be +summarized as follows: +%%% 欧文と和文が別個に存在する・縦組がある +\begin{itemize} + \item Japanese characters are interpret and handled completely apart from + Western characters. + \item Texts can be aligned vertically, called ``tate-gumi'' (縦組). + The horizontal alignment of texts is called ``yoko-gumi'' (横組), + and both ``tate-gumi'' and ``yoko-gumi'' can be mixed + even within a single document. +\end{itemize} + + +\newpage + + +%%%%% +\part{Details}% 各論 + +%%% 出力フォーマット +\section{Output format --- DVI} + +%%% DVI だけ +The output of \pTeX/\upTeX\ is always a DVI file. +%%% pTeX の DVI は欧文の横組みだけなら普通。和文が入ると特殊,縦組ならIDも変化 +Its DVI format is completely compatible with Knuthian \TeX, +as long as the following conditions are met: +\begin{itemize} + \item No Japanese characters are typeset. + \item There is no portion of vertical text alignment. +\end{itemize} + +\subsection{Extensions of DVI format} + +In \pTeX/\upTeX, +some additional DVI commands, which are defined in the +standard \cite{dvistd0} but never used in \TeX82, are used. +\begin{itemize} + \item |set2| (129), |put2| (134): + Appears in both \pTeX\ and \upTeX\ DVI. + Used to typeset a Japanese character with 2-byte code. + \item |set3| (130), |put3| (135): + Appears in only \upTeX\ DVI. + Used to typeset a Japanese character with 3-byte code. +\end{itemize} +When \pTeX\ is going to typeset a Japanese character into DVI, +it is encoded in JIS, which is always a 2-byte code. +For this purpose, |set2| or |put2| are used. +When \upTeX\ is going to output a Japanese character into DVI, +it is encoded in UTF-32. +If the code is equal to or less than |U+FFFF|, +the lower 16-bit is used with |set2| or |put2|. +If the code is equal to or greater than |U+10000|, +the lower 24-bit is used with |set3| or |put3|. + +In addition, \pTeX/\upTeX\ defines one additional DVI command. +\begin{itemize} + \item |dir| (255): + Used to change directions of text alignment. +\end{itemize} +The DVI format in the preamble is always set to 2, as with \TeX82. +On the other hand, the DVI ID in the postamble can be special. +Normally it is set to 2, as with \TeX82; however, +when |dir| (255) appears at least once in a single \pTeX/\upTeX\ DVI, +the |post_post| table of postamble contains $\mathrm{ID} = 3$. + +%%% 日本の DVI ドライバの状況 +\subsection{DVI drivers with Japanese support} + +There is some DVI drivers with Japanese support. +The most eminent drivers are {\em dvips} and {\em dvipdfmx}. +Nowadays most of casual Japanese users are using {\em dvipdfmx} as a DVI driver. +On the other hand, users of {\em dvips} are unignorable, especially those +working in publishing industry. + +\subsubsection{Using {\em dvipdfmx}} + +A DVI file which is output by \pTeX\ can be converted directly to a PDF file +using dvipdfmx. +% [TODO] Mention kanji-config-updmap for font setup + +{\em Note for casual \LaTeX\ users} --- +when you choose to process the resulting DVI file with dvipdfmx +after running \LaTeX\ (command |platex| or |uplatex|), +you need to pass a proper driver option |[dvipdfmx]| for +all driver-dependent packages, such as |graphicx| and |color|. +This is because the default for such packages is set to |dvips| mode +as with the original \LaTeX\ in DVI mode (command |latex|). +For simplicity, we recommend a global driver option |[dvipdfmx]| +as in the following example: +\begin{verbatim} + \documentclass[dvipdfmx,...]{article} + \usepackage{graphicx} + \usepackage{color} +\end{verbatim} + +\subsubsection{Using {\em dvips}} + +A DVI file which is output by \pTeX\ can be converted to a PostScript file +using dvips. +% [TODO] Mention kanji-config-updmap again + +The resulting PostScript file can then be converted to +a PDF file using Ghostscript (ps2pdf) or Adobe Distiller. +When using Ghostscript, a proper setup of Japanese font must be done +before converting PostScript into PDF. +An easy solution for the setup is a script |cjk-gs-integrate| +developed by Japanese \TeX\ Development Community. + +\section{Programming on \pTeX\ family} + +We focus on programming aspects of \pTeX\ and its variants. + +%%% レジスタの数 +\subsection{Number of registers} + +\pTeX\ and \upTeX\ have exactly the same number ($=256$) of registers +as Knuthian \TeX. +\epTeX\ and \eupTeX\ in extended mode have more registers; +there are 65536, which is twice as many as 32768 of \eTeX. + +% [TODO] まとめて 65536 個と書いて良い? レジスタの種類毎に書くべき? + +%%% 拡張プリミティブ +\subsection{Additional primitives} +% tex -ini: 322 multiletter control sequences +% ptex -ini: 366 multiletter control sequences +% uptex -ini: 374 multiletter control sequences +% eptex -ini: 379 multiletter control sequences +% eptex -ini -etex: 469 multiletter control sequences +% euptex -ini: 387 multiletter control sequences +% euptex -ini -etex: 477 multiletter control sequences +% etex (pdftex) -ini: 470 multiletter control sequences +% etex (pdftex) -ini -etex: 539 multiletter control sequences + +Here we provide only complete lists of additional primitives +of \pTeX\ family in alphabetical order. +Feature of each primitive can be found in Japanese edition. + +% [TODO] 抜けがないか? +% [TODO] アルファベット順に正しく並んでいるか? +% [TODO] 追加されたバージョン情報は正しいか? + +\def\New#1{--- New primitive since #1} + +\subsubsection{Sync\TeX\ additions (available in \pTeX, \upTeX, \epTeX, \eupTeX)} +In the standard build of \TL, Sync\TeX\ extension is unavailable in +Knuthian \TeX; however, it is enabled in \pTeX\ family. +\begin{simplelist} + \csitem[\.{synctex}] +\end{simplelist} + +%%% pTeX のやつ +\subsubsection{\pTeX\ additions (available in \pTeX, \upTeX, \epTeX, \eupTeX)} +\begin{simplelist} + \csitem[\.{autospacing}] + \csitem[\.{autoxspacing}] + \csitem[\.{disinhibitglue} \New{p3.8.2 (\TL2019)}] + \csitem[\.{dtou}] + \csitem[\.{euc}] + \csitem[\.{ifdbox} \New{p3.2 (\TL2011)}] + \csitem[\.{ifddir} \New{p3.2 (\TL2011)}] + \csitem[\.{ifmbox} \New{p3.7.1 (\TL2017)}] + \csitem[\.{ifmdir}] + \csitem[\.{iftbox}] + \csitem[\.{iftdir}] + \csitem[\.{ifybox}] + \csitem[\.{ifydir}] + \csitem[\.{inhibitglue}] + \csitem[\.{inhibitxspcode}] + \csitem[\.{jcharwidowpenalty}] + \csitem[\.{jfam}] + \csitem[\.{jfont}] + \csitem[\.{jis}] + \csitem[\.{kanjiskip}] + \csitem[\.{kansuji}] + \csitem[\.{kansujichar}] + \csitem[\.{kcatcode}] + \csitem[\.{kuten}] + \csitem[\.{noautospacing}] + \csitem[\.{noautoxspacing}] + \csitem[\.{postbreakpenalty}] + \csitem[\.{prebreakpenalty}] + \csitem[\.{ptexminorversion} \New{p3.8.0 (\TL2018)}] + \csitem[\.{ptexrevision} \New{p3.8.0 (\TL2018)}] + \csitem[\.{ptexversion} \New{p3.8.0 (\TL2018)}] + \csitem[\.{scriptbaselineshiftfactor} \New{p3.7 (\TL2016)}] + \csitem[\.{scriptscriptbaselineshiftfactor} \New{p3.7 (\TL2016)}] + \csitem[\.{showmode}] + \csitem[\.{sjis}] + \csitem[\.{tate}] + \csitem[\.{tbaselineshift}] + \csitem[\.{textbaselineshiftfactor} \New{p3.7 (\TL2016)}] + \csitem[\.{tfont}] + \csitem[\.{xkanjiskip}] + \csitem[\.{xspcode}] + \csitem[\.{ybaselineshift}] + \csitem[\.{yoko}] + \csitem[\texttt{H}\index{H=\texttt{H}}] + \csitem[\texttt{Q}\index{Q=\texttt{Q}}] + \csitem[\texttt{zh}\index{zh=\texttt{zh}}] + \csitem[\texttt{zw}\index{zw=\texttt{zw}}] +\end{simplelist} + +%%% upTeX のやつ +\subsubsection{\upTeX\ additions (available in \upTeX, \eupTeX)} +\begin{simplelist} + \csitem[\.{disablecjktoken}] + \csitem[\.{enablecjktoken}] + \csitem[\.{forcecjktoken}] + \csitem[\.{kchar}] + \csitem[\.{kchardef}] + \csitem[\.{ucs}] + \csitem[\.{uptexrevision} \New{u1.23 (\TL2018)}] + \csitem[\.{uptexversion} \New{u1.23 (\TL2018)}] +\end{simplelist} + +%%% e-pTeX/e-upTeX の pdfTeX 由来 +%%% e-pTeX/e-upTeX の Omega 由来 +%%% その他の独自拡張 +\subsubsection{\epTeX\ additions (available in \epTeX, \eupTeX)} +\begin{simplelist} + \csitem[\.{epTeXinputencoding} \New{160201 (\TL2016)}] + \csitem[\.{epTeXversion} \New{180121 (\TL2018)}] + \csitem[\.{expanded} \New{180518 (\TL2019)}] + \csitem[\.{hfi}] + \csitem[\.{ifincsname} \New{190709 (\TL2020)}] + \csitem[\.{ifpdfprimitive} \New{150805 (\TL2016)}] + \csitem[\.{lastnodechar} \New{141108 (\TL2015)}] + \csitem[\.{lastnodesubtype} \New{180226 (\TL2018)}] + \csitem[\.{odelcode}] + \csitem[\.{odelimiter}] + \csitem[\.{omathaccent}] + \csitem[\.{omathchar}] + \csitem[\.{omathchardef}] + \csitem[\.{omathcode}] + \csitem[\.{oradical}] + \csitem[\.{pagefistretch}] + \csitem[\.{pdfcreationdate} \New{130605 (\TL2014)}] + \csitem[\.{pdfelapsedtime} \New{161114 (\TL2017)}] + \csitem[\.{pdffiledump} \New{140506 (\TL2015)}] + \csitem[\.{pdffilemoddate} \New{130605 (\TL2014)}] + \csitem[\.{pdffilesize} \New{130605 (\TL2014)}] + \csitem[\.{pdflastxpos}] + \csitem[\.{pdflastypos}] + \csitem[\.{pdfmdfivesum} \New{150702 (\TL2016)}] + \csitem[\.{pdfnormaldeviate} \New{161114 (\TL2017)}] + \csitem[\.{pdfpageheight}] + \csitem[\.{pdfpagewidth}] + \csitem[\.{pdfprimitive} \New{150805 (\TL2016)}] + \csitem[\.{pdfrandomseed} \New{161114 (\TL2017)}] + \csitem[\.{pdfresettimer} \New{161114 (\TL2017)}] + \csitem[\.{pdfsavepos}] + \csitem[\.{pdfsetrandomseed} \New{161114 (\TL2017)}] + \csitem[\.{pdfshellescape} \New{141108 (\TL2015)}] + \csitem[\.{pdfstrcmp}] + \csitem[\.{pdfuniformdeviate} \New{161114 (\TL2017)}] + \csitem[\.{readpapersizespecial} \New{180901 (\TL2019)}] + \csitem[\.{vfi}] + \csitem[\texttt{fi}\index{fi=\texttt{fi}}] +\end{simplelist} + +% [TODO] 引数は何で返り値は何か,expandable? + +%%% (e-)TeX にあるが (e-)upTeX にないもの +\subsection{Omitted primitives and unsupported features} + +Compared to Knuthian \TeX\ and \eTeX, +some primitives are omitted due to conflict with Japanese handling. +%%% encTeX 拡張など +One is enc\TeX\ extension, such as |\mubyte|. +The ML\TeX\ extension, such as |\charsubdef|, is included but not well-tested. +%%% コマンドラインオプションの話 + +% [TODO] ptex.man1.pdf も参照 + +\subsection{Behavior of Western \TeX\ primitives} + +Here we provide some notes on behavior of Knuthian \TeX\ and \eTeX\ primitives +when used within \pTeX\ family. + +\subsubsection{Primitives with limitations in handling Japanese} + +Each of the following primitives allows only character codes 0--255; +other codes will give an error ``! Bad character code.'' +\begin{quote} + |\catcode|, + |\sfcode|, + |\mathcode|, + |\delcode|, + |\mathchardef|, + |\lccode|, + |\uccode|. +\end{quote} + +Each of the following primivies has |\...char| in its name, +however, the effective values are restricted to 0--255. +\begin{quote} + |\endlinechar|, + |\newlinechar|, + |\escapechar|, + |\defaulthyphenchar|, + |\defaultskewchar|. +\end{quote} + +\subsubsection{Primitives capable of handling Japanese} + +The following primitives are extended to support Japanese characters: +\begin{cslist} + \csitem[\.{char} , + \.{chardef} =] + In addition to 0--255, internal codes of Japanese characters are allowed. + For putting Japanese characters, a Japanese font is chosen. + + \csitem[\.{font}, \.{fontname}, \.{fontdimen}] + % [TODO] + + \csitem[\.{accent} =] + % [TODO] + + \csitem[\.{if} , \.{ifcat} ] + Japanese character token is also allowed. + In that case, + \begin{itemize} + \item |\if| tests the internal character code of the Japanese character. + \item |\ifcat| tests the |\kcatcode| of the Japanese character. + \end{itemize} +\end{cslist} + +\begin{dangerous} +\TeX book describes the behavior of |\if| and |\ifcat| as follows; +\begin{quote} +If either token is a control sequence, +\TeX\ considers it to have character code 256 and category code 16, +unless the current equivalent of that control sequence +has been |\let| equal to a non-active character token. +\end{quote} +However, this includes a lie; in the real implementation of tex.web, +a control sequence is considered to have a category code 0. +\end{dangerous} + +\subsection{Case study} + +Based on the above knowledge, we provide some code examples +which may be useful for package developers. + +%%% pTeX かどうかの判定 +\subsubsection{Detecting \pTeX} + +Since the primitive |\ptexversion| is rather new (added in 2018), +the safer solution for detecting \pTeX\ is +to test if a primitive |\kanjiskip| is defined. +\begin{verbatim} + \ifx\kanjiskip\undefined + % not pTeX, upTeX, e-pTeX and e-upTeX + \else + % pTeX, upTeX, e-pTeX and e-upTeX + \fi +\end{verbatim} + +% [TODO] upTeX 系列は \enablecjktoken か \ucs か? +% [TODO] \forcecjktoken は比較的新しい? +% [TODO] 内部コードが uptex かどうかの判定 + +%%% pTeX のバージョン判定 + +%%% pdfTeX と違うところ +\subsection{Difference from \pdfTeX\ in DVI mode}\label{dvi-pdftex} + +As stated above, +\epTeX/\eupTeX\ are {\em not} uppercompatible with DVI mode of \pdfTeX. + +%%% pdfTeX の DVI モードにあって e-(u)pTeX にないプリミティブ +%%% その他ムニャムニャ + +%%% ファイルの文字コードはどうするか +\subsection{Recommendation for file encoding} + +%%% 全部アスキーにしてしまえ +%%% UTF-8 にしたい場合はムニャムニャ +%%% \epTeXinputencoding を使う話 + +%%% e-upTeX の入力解析:euc/sjis を語りたくないので utf8.uptex 前提 +\subsection{Input handling} + +For simplicity, first we introduce of input handling of \eupTeX. + +%%% 文字の和文扱い・欧文扱い +%%% 和文カテゴリーコード +%%% \...cjktoken +%%% ちなみに e-pTeX では:euc/sjis があることにだけ触れる + +%%% e-upTeX の和文トークンの話:和文トークンが混ざっているので注意 +\subsection{Japanese tokens} + +%%% 和文組版の厳選トピック +\section{Basic introduction to Japanese typesetting} + +%%% 和文をやり過ごすために注意すべきこと +This section does not aim to explain Japanese typesetting completely; +here we provide a minimum requirement for ``getting away'' with Japanese. + +%%% 空白・ペナルティ挿入:勝手に入ってくる! +\subsection{Automatic insertion of glues and penalties} + +Sometimes \pTeX\ family automatically inserts glues and penalties +between characters. +% [TODO] もう少しだけ詳しく + +%%% 和文フォント +\subsection{Japanese fonts} + +For typesetting Japanese characters, a JFM (Japanese \TeX\ font metric) +format is used. It is a modified version of \TeX\ TFM. + +%%% 欧文とは別個 +%%% \nullfont しても全部消えない + +%%% 縦組は諦めよう + +\newpage + +\begin{thebibliography}{99} + \bibitem{dvistd0} TUG DVI Standards Working Group, + \textit{The DVI Driver Standard, Level 0}.\\ + \url{https://ctan.org/pkg/dvistd} +\end{thebibliography} + +\newpage +\printindex + + +\end{document} diff --git a/Master/texmf-dist/doc/ptex/ptex-manual/ptex-manual.pdf b/Master/texmf-dist/doc/ptex/ptex-manual/ptex-manual.pdf index b07f8a175b6..219af34588c 100644 Binary files a/Master/texmf-dist/doc/ptex/ptex-manual/ptex-manual.pdf and b/Master/texmf-dist/doc/ptex/ptex-manual/ptex-manual.pdf differ diff --git a/Master/texmf-dist/doc/ptex/ptex-manual/ptex-manual.tex b/Master/texmf-dist/doc/ptex/ptex-manual/ptex-manual.tex index f48e8bc8252..176624be85c 100644 --- a/Master/texmf-dist/doc/ptex/ptex-manual/ptex-manual.tex +++ b/Master/texmf-dist/doc/ptex/ptex-manual/ptex-manual.tex @@ -1,6 +1,9 @@ %#!make ptex-manual.pdf \documentclass[a4paper,11pt,nomag]{jsarticle} \usepackage[textwidth=42zw,lines=40,truedimen,centering]{geometry} + +%%%%%%%%%%%%%%%% +% additional packages \usepackage{amsmath} \usepackage{array}\usepackage[all]{xy} \SelectTips{cm}{} @@ -15,89 +18,21 @@ \usepackage{hologo} \usepackage{makeidx}\makeindex +% common +\usepackage{ptex-manual} + +\def\code#1{\texttt{#1}} + %%%%%%%%%%%%%%%% -% preamble copied from eptexdoc.tex \makeatletter -\def\epTeX{$\varepsilon$-\pTeX}\def\eTeX{$\varepsilon$-\TeX} -\def\eupTeX{$\varepsilon$-\upTeX}\def\upTeX{u\pTeX} -\def\pTeX{p\kern-.10em\TeX} -\def\headfont{\normalfont\mathversion{bold}\sffamily} -\def\.#1{\texorpdfstring{% - \leavevmode\hbox{\texttt{\textbackslash#1}}\ifmmode\else\textcompwordmark\fi}{\textbackslash #1}} -\let\orig@cs=\. -\def\ind@cs#1{\orig@cs{#1}\indcs{#1}} -\def\indcs#1{\index{{\texttt{\textbackslash #1}}}} -\newlist{cslist}{description}1 -\setlist[cslist]{% - itemsep=\medskipamount,listparindent=1zw, - font=\normalfont\mdseries, leftmargin=2zw, - before=\advance\@listdepth\@ne, - after=\advance\@listdepth\m@ne -} -\def\csitem[#1]{\item[\llap{$\blacktriangleright$~}\let\.=\ind@cs#1] - \leavevmode\par\nopagebreak} -\def\emph#1{{\bfseries\sffamily\gtfamily\mathversion{bold}#1}} \setlist{leftmargin=2zw} -\setlist[description]{labelwidth=2zw,labelindent=1zw} +\setlist[description]{labelwidth=2zw,labelindent=1zw,topsep=\medskipamount} -\catcode`\<=13 -\xspcode`\\=3 -\xspcode`\*=3 -\xspcode`\-=3 -\xspcode23=3 % \textcompwordmark -\def<#1>{\ensuremath{\langle\hbox{\normalfont\textit{#1}}\rangle}} -\def\hex#1{\ifmmode\mbox\fi{\texttt{"#1}}}%" - -\font\man=manfnt at 10pt -\def\dbend{\raise0pt\hbox{\man\char'177}} -\AtBeginDvi{\special{pdf:mapfile otf-ipaex.map}} \def\>{\ifhmode\hskip\xkanjiskip\fi} -\normalsize -\bigskipamount=\baselineskip -\medskipamount=.5\baselineskip -\smallskipamount=.25\baselineskip - -\usepackage{etoolbox} -\patchcmd\@verbatim\@totalleftmargin{\dimexpr\@totalleftmargin+2zw\relax}{}{} -\patchcmd\quote{\list{}}{\par\list{\topsep\medskipamount}}{}{} -\patchcmd\@verbatim{\trivlist}{\trivlist\addvspace\medskipamount\noautoxspacing}{}{} -\patchcmd\endverbatim{\endtrivlist}{\endtrivlist\addvspace\medskipamount}{}{} -\expandafter\let\csname endverbatim*\endcsname =\endverbatim -\patchcmd\verb{\ifmmode\hbox\else\leavevmode\vadjust{}\fi\bgroup} - {\ifmmode\else\leavevmode\vadjust{}\fi\hbox - \bgroup\textcompwordmark\noautoxspacing\noautospacing}{}{} -\patchcmd\verb@egroup{\egroup}{\egroup\textcompwordmark}{}{} -\newenvironment{dangerous}{% - \ifnum\@listdepth>\z@ - \GenericError{}{Do not use `dangerous' environment inside any list}{}{} - \fi - \par\addvspace\medskipamount - \@tempdima=\dimexpr\textwidth-2zw\relax\small - \bigskipamount=\baselineskip - \medskipamount=.5\baselineskip - \smallskipamount=.25\baselineskip - \divide\@tempdima by\dimexpr1zw\relax\@tempcnta=\@tempdima - \leftskip=\dimexpr\textwidth-\@tempcnta zw\relax - \@totalleftmargin\dimexpr\leftskip+0zw - \linewidth=\dimexpr\@tempcnta zw-0zw - \parindent1zw\noindent\kern-\leftskip\hbox to\leftskip{\dbend\hss}% - \everypar{\everypar{}}\ignorespaces -}{\par\addvspace\medskipamount} - -\renewenvironment{theindex}{% - \def\presectionname{}\def\postsectionname{}% - \section*{\indexname} - \@mkboth{\indexname}{\indexname}% - \plainifnotempty % \thispagestyle{plain} - \parindent\z@ - \parskip\z@ \@plus .3\p@\relax - \let\item\@idxitem - \raggedright - \begin{multicols}{2} - }{ - \end{multicols} - \clearpage - } + +\def\tsp{_{\mbox{\fontsize\sf@size\z@\ttfamily \char32}}} +\def\tpar{_{\mbox{\fontsize\sf@size\z@\ttfamily \string\par}}} +\def\tign{_{\mbox{\fontsize\sf@size\z@\selectfont --}}} \def\tableautorefname{表} \def\figureautorefname{図} @@ -107,59 +42,35 @@ \expandafter\HyRef@autosetref\csname r@#2\endcsname{#2}{#1}% \endgroup\textcompwordmark %欧文ゴースト } - -\long\def\@footnotetext{% - \insert\footins\bgroup - \normalfont\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}% - \futurelet\next\fo@t} -\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t - \else \let\next\f@t\fi \next} -\def\f@@t{\bgroup\aftergroup\@foot\let\next} -\def\f@t#1{#1\@foot} -\def\@foot{\@finalstrut\strutbox\color@endgroup\egroup - \ifx\pltx@foot@penalty\@undefined\else - \ifhmode\null\fi - \ifnum\pltx@foot@penalty=\z@\else - \penalty\pltx@foot@penalty - \pltx@foot@penalty\z@ - \fi - \fi} - -\def\tsp{_{\mbox{\fontsize\sf@size\z@\ttfamily \char32}}} -\def\tpar{_{\mbox{\fontsize\sf@size\z@\ttfamily \string\par}}} -\def\tign{_{\mbox{\fontsize\sf@size\z@\selectfont --}}} - +\makeatother \usepackage{shortvrb} \MakeShortVerb*{|} -%%%%%%%% macros for index (simplified from doc.sty) -\newif\ifscan@allowed -\def\dotfill{\leaders\hbox to.6em{\hss .\hss}\hskip\z@ plus1fill}% -\def\pfill{\unskip~\dotfill\nobreak} -\makeatother %%%%%%%%%%%%%%%% +% logos +\def\epTeX{$\varepsilon$-\pTeX}\def\eTeX{$\varepsilon$-\TeX} +\def\eupTeX{$\varepsilon$-\upTeX}\def\upTeX{u\pTeX} +\def\pTeX{p\kern-.10em\TeX} + \def\_{\leavevmode\vrule width .45em height -.2ex depth .3ex\relax} + \frenchspacing \begin{document} \catcode`\<=13 \title{\emph{\pTeX マニュアル}} \author{日本語\TeX 開発コミュニティ\null -\thanks{\url{https://texjp.org},\ -e-mail: \texttt{issue(at)texjp.org}}} +\thanks{\url{https://texjp.org},\ e-mail: \texttt{issue(at)texjp.org}}} \date{version p\the\ptexversion.\the\ptexminorversion\ptexrevision,\today} \maketitle +本ドキュメントは,日本語\TeX 開発コミュニティ版の\pTeX% +~p\the\ptexversion.\the\ptexminorversion\ptexrevision +についてまとめたものである. +オリジナルのASCII~\pTeX\footnote{最新版はp3.1.11 (2009/08/17). + \url{https://asciidwango.github.io/ptex/}}とは +動作が異なる点もあるので注意されたい. + \emph{\large 本ドキュメントはまだまだ未完成です.} \tableofcontents @@ -173,6 +84,7 @@ e-mail: \texttt{issue(at)texjp.org}}} プリミティブを説明する. \section{\pTeX で利用可能な文字} +\label{sec:ptexchar} \TeX82で扱える文字コードの範囲は0--255であった. \pTeX ではこれに加えてJIS X 0208の文字も利用可能であり, @@ -197,18 +109,18 @@ e-mail: \texttt{issue(at)texjp.org}}} $C_1=\{\hex{81},\dots,\hex{9f}\}\cup\{\hex{e0},\dots,\hex{fc}\}$,\\ $C_2=\{\hex{40},\dots,\hex{7e}\}\cup\{\hex{80},\dots,\hex{fc}\}$. \end{description} -である. +である.この内部コードのパターンに合えば和文文字として扱われ, +合わなければ欧文文字として扱われる. +% 参考:kanji.c の |is_char_kanji| の実装 -% この内部コードのパターンに合えば和文文字として扱われ, -% 合わなければ欧文文字として扱われる,でよい? +入力ファイルの文字コードがUTF-8の場合,JIS X 0208にない文字は +UTF-8のバイト列として読み込まれる. +% このマニュアルを英語化する際は以下も参照. % http://tutimura.ath.cx/ptexlive/?ptexenc%2FDetails % http://ajt.ktug.org/assets/2008/5/1/0201tsuchimura_kuroki.pdf % https://oku.edu.mie-u.ac.jp/tex/mod/forum/discuss.php?d=460 -入力ファイルの文字コードがUTF-8の場合,JIS X 0208にない文字は -UTF-8のバイト列として読み込まれる. - \pTeX の入力ファイルの文字コードは,起動時のオプション|-kanji|によって 変更できる(可能な値は|utf8|,|euc|,|sjis|,|jis|). 同様に,内部コードは|-kanji-internal|オプションによって変更できる @@ -252,6 +164,28 @@ virtual modeでは,起動直後にバナーを表示してから,フォー [TODO] \pTeX の内部コードはEUC-JPかShift-JISのいずれかであるが, DVIファイル内の和文文字コードとしてはJISコードを出力する. +ただし,|\special|命令の文字列は内部コードで符号化されたバイト列として書き出される. + +\begin{dangerous} + 以上で述べた「内部コードの範囲」はJIS~X~0213の漢字集合1面(Shift-JISの場合は2面も)を + まるまる含んでいるが,\emph{\pTeX はJIS~X~0213には対応していない.} + + JIS~X~0213で規定された「85区1点」の位置の文字を入力ファイル中に書いた場合, + \begin{description} + \item[文字コードがEUC,~Shift-JISの場合] DVIには29985~(\texttt{"7521})%" + 番の文字として出力される. + \item[文字コードがJISの場合] 「\verb+! Missing $ inserted.+」というエラーが発生する. + これは,\pTeX がJIS~X~0213の1面を指示するエスケープシーケンス + \texttt{1B 24 28 4F} (JIS2000), \texttt{1B 24 28 51} (JIS2004)を認識せず, + \texttt{24}~(\texttt{\$})を数式モード区切りと解釈してしまうためである. + \item[文字コードがUTF-8の場合] UTF-8のバイト列\texttt{E6 93 84}として読み込まれる. + \end{description} + なお,\.{char}により「\verb+\char\kuten"5521+」%" + のようにして区点コードを指定した場合は,DVIには29985~(\texttt{"7521})%" + 番の文字として出力される. + また,DVIに文字として出力されたからといって,それをPostScriptやPDFに変換したときに + 意図通りに出力されるかは全くの別問題である. +\end{dangerous} \section{文字コードの取得と指定} @@ -294,7 +228,6 @@ DVIファイル内の和文文字コードとしてはJISコードを出力す \emph{和文文字直後の改行は何も発生しない}.和文文字の直後にグループ開始・終了が来て 行が終わった場合も同様である. - \begin{figure}[b] \small \[ @@ -325,11 +258,14 @@ DVIファイル内の和文文字コードとしてはJISコードを出力す \ar@(d,r)[]_{1,2,9\tign,J} \ar[d]_-{5,14} &*\txt{}\\ - *\txt{}&*\txt{}&*\txt{}&*\txt{} -% + *\txt{}&*\txt{}&*\txt{}&*\txt{} +% } \] \begin{itemize} + \item 状態\textit{N} (new line),状態\textit{M} (middle of line), + 状態\textit{S} (skipping spaces)は\TeX82と同じであるが, + 新たに状態\textit{K} (middle of kanji)が追加されている. \item 矢印の上下に書いた数字はカテゴリーコードを表す. \item ``E''はカテゴリーコード3, 4, 6, 8, 11, 12の文字達を, ``J''は和文文字を表す. @@ -338,10 +274,10 @@ DVIファイル内の和文文字コードとしてはJISコードを出力す \item 図中央の「制御綴読み取り」の後で$S$,~$M$どちらの状態になるかは, 次のように決まっている: \begin{itemize} - \item 制御綴が「|\ |」のようなカテゴリーコード10の文字 - からなるコントロールシンボルのときは状態$S$に遷移する. - \item 制御綴が「|\#|」「|\】|」のようなその他のコントロールシンボルのときは状態$M$に遷移する. - \item 制御綴がコントロールワードのときは状態$S$に遷移する. + \item 制御綴が「|\ |」のようなカテゴリーコード10の文字 + からなるコントロールシンボルのときは状態$S$に遷移する. + \item 制御綴が「|\#|」「|\】|」のようなその他のコントロールシンボルのときは状態$M$に遷移する. + \item 制御綴がコントロールワードのときは状態$S$に遷移する. \end{itemize} \end{itemize} \caption{\pTeX の入力プロセッサの状態遷移図} @@ -352,19 +288,13 @@ DVIファイル内の和文文字コードとしてはJISコードを出力す \begin{itemize} \item \TeX82では,「複数文字からなる命令」(コントロールワード)には カテゴリーコードが11~($\mathit{letter}$)の文字しか使用できないことになっていたが, - \pTeX では16,~17の和文文字も合わせて使用することができる. + \pTeX ではカテゴリーコードが16,~17の和文文字も合わせて使用することができる. \item 一方,カテゴリーコードが18の和文文字はコントロールワード中には使用できない. 「|\】|」のように一文字命令(コントロールシンボル)に使用することはできる - \footnote{「|\】|」のように和文文字からなるコントロールシンボルを文字列化する際に, - バージョンp3.7.2以前の\pTeX では「|\】 |」と後ろに余計な空白文字を補ってしまうという問題があった. - \TeX~Live 2018の\pTeX~p3.8.1でこの問題は修正された(\cite{build37}). - - また,バージョンp3.8.1以前では - 「|\】|」のような和文のコントロールシンボルで行が終わった場合,「|\!|」のような - 欧文コントロールシンボルと同様に改行由来の空白が追加されてしまい, - 和文文字直後の改行は何も発生しないという原則に反していたが, - こちらは\TeX~Live 2019の\pTeX~p3.8.2で修正された(\cite{build37}). - }. + \footnote{「|\】|」のような和文のコントロールシンボルで行が終わった場合, + 「|\!|」のような欧文コントロールシンボルと同様に改行由来の空白が追加されてしまい, + 和文文字直後の改行は何も発生しないという原則に反していたが, + これは\TeX~Live 2019の\pTeX~p3.8.2で修正された(\cite{build37}).}. \item 後で説明する|\jcharwidowpenalty|は,カテゴリーコードが16,~17の和文文字の前にのみ 挿入されうるもので,カテゴリーコードが18の和文文字の前には挿入されない. \item 欧文文字は\TeX82と同様に1つの文字トークンはカテゴリーコード$c$と文字コード$s$の組 @@ -376,20 +306,68 @@ DVIファイル内の和文文字コードとしてはJISコードを出力す \begin{cslist} \csitem[\.{kcatcode} =<16--18>] - |\kcatcode|はDVI中の上位バイト(すなわち,JISコードでいう区ごと)に値が設定可能である. - 初期状態では1,~2, 7--15, 85--94区の文字が18,3--6区の文字が17,16--84区の文字が16である. + 日本語\TeX 開発コミュニティ版の\pTeX では,和文文字のカテゴリーコード(|\kcatcode|)は + DVI中の上位バイトごと(すなわち,JISコードでいう区ごと)に値が設定可能である + \footnote{% + オリジナルのASCII~\pTeX では,内部コードの上位バイトごとに値が設定可能であった. + すなわち,内部コードがEUC-JPのときは区ごとに設定可能であったが, + 内部コードがShift-JISのときは + $2n-1$区・$2n$区($1\leq n\leq 47$)は同一のカテゴリーコードを持つことになる. + }.初期状態では, + 1,~2, 7--15, 85--94区の文字の|\kcatcode|は18,3--6区の文字は17, + 16--84区の文字は16に設定されている. + + \pTeX においては,|\kcatcode|を上記の初期状態から変更することは想定されていない. + また,変更したとしても,(先に述べた通り)和文文字トークンにカテゴリーコードの情報は + 保存されず,和文文字が処理対象となるたびにその度に値が取得される. + + なお,\upTeX においては,|\kcatcode|は大きく仕様変更されている. \end{cslist} \begin{dangerous} - |\kcatcode|では欧文文字の文字コード(0--255)も指定することができるが, - その場合「0区扱い」として扱われる - \footnote{\pTeX の処理でこの「0区」の|\kcatcode|が使われることはないので, - 事実上は「16--18のどれかを格納可能な追加レジスタ」程度の使い方しかない.}. + 例えば,以下のコードで定義される|\X|, |\Y|で引数終端をしめす「あ」には + カテゴリーコードの情報は格納されない.そのため,|\X|,~|\Y|は全く同じ動作となる. + \begin{verbatim} + \kcatcode`あ=16 + \def\X#1あ{\message{X: #1}} + \kcatcode`あ=17 + \def\Y#1あ{\message{X: #1}} + \end{verbatim} +\end{dangerous} - なお,\upTeX においては,|\kcatcode|は大きく仕様変更されている. +\begin{dangerous} + |\kcatcode|では欧文文字の文字コード(0--255)も指定することができるが, + その場合「0区扱い」として扱われる. + \pTeX の処理でこの「0区」の|\kcatcode|が使われることはないので, + 事実上は「16--18のどれかを格納可能な追加レジスタ」程度の使い方しかない. \end{dangerous} +% [TODO] 和文文字を含む文字列化の挙動 +% "kanji character " になることも明文化したい +% どの \section に含めるかわからないのでとりあえずここに置く +|\string|や|\meaning|などの文字トークン列生成については以下の通り: +\begin{itemize} + \item 欧文文字は\TeX82と同様で,(文字コード32の空白を除き) + すべてカテゴリーコード12の文字トークンになるが, + 和文文字は16--18のいずれかのカテゴリーコードを持つ. + \item 「コントロールワードの文字列化では後ろに空白文字を補い, + コントロールシンボルの文字列化では空白文字を補わない」という点は, + 和文文字を含む場合も同様である + \footnote{「|\】|」のように和文文字からなるコントロールシンボルを文字列化する際に, + バージョンp3.7.2以前の\pTeX では「|\】 |」と後ろに余計な空白文字を補ってしまう + という問題があった. + \TeX~Live 2018の\pTeX~p3.8.1でこの問題は修正された(\cite{build37}).}. + \item 和文文字はそのカテゴリーコードによらず,|\meaning|すると + \begin{itemize} + \item \the\kcatcode`漢:\quad \texttt{\meaning 漢} + \item \the\kcatcode`あ:\quad \texttt{\meaning あ} + \item \the\kcatcode`):\quad \texttt{\meaning )} + \end{itemize} + となる. +\end{itemize} + % jtex.tex の「ラインブレーク」を簡略化 \section{禁則} +\label{sec:kinsoku} 欧文と和文の処理で見かけ上最も大きな違いは,行分割処理であろう. \begin{itemize} \item 欧文中での行分割は,ハイフネーション処理等の @@ -437,17 +415,68 @@ DVIファイル内の和文文字コードとしてはJISコードを出力す \end{cslist} |\prebreakpenalty|, |\postbreakpenalty|は -和文文字,欧文文字の区別無しに指定できるが,同一の文字に対して -両方のペナルティを同時に与えるような指定はできない +和文文字,欧文文字の区別無しに指定できる. +ただし,欧文文字に設定されたこれらのペナルティが実際に挿入されるのは +以下の場合に限られる(つまり,欧文組版だけの範囲では挿入されない). +\begin{itemize} + \item 当該の欧文文字の直後が和文文字(前方に禁則ペナルティを伴っても構わない)の + 場合に限り,その欧文文字に設定された|\postbreakpenalty|を挿入する. + \item 当該の欧文文字の直前が和文文字(後方に禁則ペナルティを伴っても構わない)の + 場合に限り,その欧文文字に設定された|\prebreakpenalty|を挿入する. +\end{itemize} +\iffalse %%%%% TL2019-hack +\begin{dangerous} +上記の「欧文文字に設定された禁則ペナルティが挿入される状況」は +欧文文字と和文文字の境界であり, +ベースライン補正(\ref{sec:baselineshift}節を参照)を実現する +|disp_node|の挿入箇所でもある. +ベースライン補正がゼロでないとき,|penalty_node|と|disp_node|の +挿入順序は以下のようにしている. % tex-jp-build@2c83eb0 +\begin{itemize} + \item 欧文→和文文字間: |disp_node| → |penalty_node| (\.{postbreakpenalty}) の順 + \item 和文→欧文文字間: |penalty_node| (\.{prebreakpenalty}) → |disp_node| の順 +\end{itemize} +\end{dangerous} +\fi %%%%% TL2019-hack + +\begin{dangerous} +禁則ペナルティはリスト構築中に自動的に挿入されるので,\.{showlists}で +\begin{verbatim} +\penalty 10000(for kinsoku) +\end{verbatim} +のように表示される. + +また,和文文字の後方に挿入された\.{postbreakpenalty}は +\.{lastpenalty}で取得できるし,\.{unpenalty}で取り除くこともできる +\footnote{以前の\pTeX では,\.{unpenalty}したはずの +和文文字の後方の\.{postbreakpenalty}が復活してしまう場合があったが, +2017-04-06のコミット(r43707)で修正された\cite{build11}.}. +% ただ,JFMグルーが後方に挿入される和文文字では上手くいかない. +% https://github.com/texjporg/tex-jp-build/issues/67 +しかし,上述のとおり,欧文文字に設定された\.{postbreakpenalty}は +後に和文文字が連続して初めて挿入されるため, +\.{lastpenalty}で取得できないし,\.{unpenalty}で取り除くこともできない. + +\.{prebreakpenalty}は和文・欧文によらず,その直後に文字ノードを伴うため, +原理的に\.{lastpenalty}で取得できないし,\.{unpenalty}で取り除くこともできない. +\end{dangerous} + +同一の文字に対して|\prebreakpenalty|と|\postbreakpenalty|の両方を +同時に与えるような指定はできない (もし両方指定された場合,後から指定されたものに置き換えられる). 禁則テーブルには256文字分の領域しかないので, 禁則ペナルティを指定できる文字数は最大で256文字までである. -禁則テーブルからの登録の削除はペナルティ値0をグローバルに(つまり,|\global|を用いて) -設定することによって行われる\footnote{0をローカルに設定した場合でも,その設定が最も外側のグループ -(\eTeX 拡張でいう|\currentgrouplevel|が0のとき)には削除される. -「ローカルで削除された場所に別の禁則ペナルティ設定がグローバルで行われる」ことが -おこらないようにするため,最外グループ以外での0設定ではテーブルから削除されない.}. +禁則テーブルからの登録の削除は以下の時に行われる\cite{build26,build57}: +\begin{itemize} + \item ペナルティ値0をグローバルに(つまり,|\global|を用いて) + 設定した場合. + \item ペナルティ値0をローカルに設定した場合でも,その設定が + 最も外側のグループ(\eTeX 拡張でいう|\currentgrouplevel|が0)の場合 + \footnote{禁則テーブルのある場所がローカルで0に設定されても,その場所に + 別の禁則ペナルティ設定がグローバルで行われることのないように, + 最外グループ以外での0設定ではテーブルから削除されない.}. +\end{itemize} \begin{cslist} \csitem[\.{jcharwidowpenalty}=] @@ -484,7 +513,7 @@ DVIファイル内の和文文字コードとしてはJISコードを出力す \begin{enumerate} \item 連続する和文文字間に自動的にグルー(伸縮する空白)を挿入\label{kanjiskip} \item 和欧文間に(ソース中に空白文字を含めずとも)自動的にグルーを挿入\label{xkanjiskip} -\item 和文の約物類にグルーを設定\label{jfmglue} +\item 和文の約物類にグルーもしくはカーンを設定\label{jfmglue} \end{enumerate} 上記のうち,\ref{kanjiskip}と\ref{xkanjiskip}についてはそれぞれ \.{kanjiskip}, \.{xkanjiskip}というパラメータを設けている. @@ -495,6 +524,25 @@ DVIファイル内の和文文字コードとしてはJISコードを出力す \begin{itemize} \item メトリック由来空白の挿入処理は展開不能トークンが来たら中断 \item 展開不能トークンや欧文文字は「文字クラス0」扱い.「\verb+)\relax(+」の例 + \item 禁則ペナルティ(\.{prebreakpenalty}や\.{postbreakpenalty})と + が同じ箇所に発行される場合は + 「禁則ペナルティ→JFM由来空白」の順に発行される. +\iffalse %%%%% TL2019-hack + \item より一般に,禁則ペナルティ,JFM由来空白,ベースライン補正, + 欧文TFM由来カーンが同じ箇所に発行される場合は + 次の順になる(\ref{sec:kinsoku}節の注意の一般化).% tex-jp-build/f6f500d or 9e7e21aa + \begin{itemize} + \item 和文→欧文:禁則ペナルティ→JFM由来空白→ベースライン補正→% + 欧文TFM由来カーン + \item 欧文→和文:ベースライン補正→禁則ペナルティ→JFM由来空白 + \footnote{[TODO] \TeX~Live~2019の\pTeX~3.8.2では,欧文TFM由来カーンは欧文→和文の + 切替時には挿入されない.}% tex-jp-build/78c8605 で解決 + \end{itemize} +\fi %%%%% TL2019-hack + \item もし水平ボックス(\.{hbox})や\.{noindent}で開始された段落がJFM由来グルーで始まった + 場合は,そのグルーは取り除かれる(カーンは除かれない). + また水平ボックスがJFM由来グルーで終了した場合は,そのグルーは自然長・伸び量・縮み量の + すべてが0となる. \end{itemize} \begin{cslist} @@ -552,7 +600,7 @@ DVIファイル内の和文文字コードとしてはJISコードを出力す \csitem[\.{xkanjiskip}=] 和文文字と欧文文字の間に標準で入るグルーを設定する. 段落途中でこの値を変えても影響はなく, - 段落終了時の値が段落全体にわたって用いられる. + 段落終了時の値が段落全体にわたって用いられる. \end{cslist} \begin{dangerous} |\kanjiskip|と異なり,|\xkanjiskip|はノードの形で挿入される. @@ -585,10 +633,11 @@ DVIファイル内の和文文字コードとしてはJISコードを出力す \end{description} この|\inhibitxspcode|の設定値の情報は256文字分のテーブルに格納されている, 未登録時は3(両側許可)であるとみなされ,またグローバルに3を代入するか,あるいは - 最も外側のグループで3を代入するとテーブルからの削除が行われる. + 最も外側のグループで3を代入するとテーブルからの削除が行われる + (禁則テーブルからの削除と同様の規則). \end{cslist} \begin{dangerous} - |\xspmode|と|\inhibitxspmode|では,一見すると + |\xspcode|と|\inhibitxspcode|では,一見すると 設定値1と2の意味が反対のように感じるかもしれない.しかし,実は両者とも \begin{quote} 1: 「和文文字→欧文文字」の場合のみ許可.「欧文文字→和文文字」の場合は禁止.\\ @@ -644,10 +693,10 @@ DVIファイル内の和文文字コードとしてはJISコードを出力す \TeX~Live 2019の\pTeX~p3.8.2以降では,明確に\emph{新たなノードが追加されない限り},と 定めた(\cite{build28,forum_2566}).すなわち, \begin{enumerate} - \item |\inhibitglue|は,ノード挿入処理を行う命令 - (|\null|,~|\hskip|, |\kern|, |\vrule|,~\dots)が後ろに来た場合は無効化される. - \item 一方,|\relax|やレジスタへの代入などのノードを作らない処理では無効化されない. - \item |\inhibitglue|の効果は別レベルのリストには波及しない. + \item |\inhibitglue|は,ノード挿入処理を行う命令 + (|\null|,~|\hskip|, |\kern|, |\vrule|,~\dots)が後ろに来た場合は無効化される. + \item 一方,|\relax|やレジスタへの代入などのノードを作らない処理では無効化されない. + \item |\inhibitglue|の効果は別レベルのリストには波及しない. \end{enumerate} \end{cslist} \begin{dangerous} @@ -769,15 +818,15 @@ DtoU方向での数式ディレクションはそれぞれ非数式の場合と での実行は禁止. \item 外部垂直モードの場合は,次の2点が同時に満たされる場合のみ実行可能である - \footnote{% - \TeX は,外部垂直モードでボックスその他のノードを追加する際に,まず - そのノードをrecent contributionsというリストの末尾に追加し, - その後recent contributionsの中身が徐々にcurrent pageという別のリストに移される - という処理を行っている. - - そのため,単純にcurrent pageまたはrecent contributionsという1つのリストを - 調べるだけでは「ページが空」か正しく判断できない. - }. + \footnote{% + \TeX は,外部垂直モードでボックスその他のノードを追加する際に,まず + そのノードをrecent contributionsというリストの末尾に追加し, + その後recent contributionsの中身が徐々にcurrent pageという別のリストに移される + という処理を行っている. + + そのため,単純にcurrent pageまたはrecent contributionsという1つのリストを + 調べるだけでは「ページが空」か正しく判断できない. + }. \begin{itemize} \item current pageの中身にはボックス,罫線(|\hrule|), insertion~(|\insert|)はない. @@ -830,7 +879,7 @@ DtoU方向での数式ディレクションはそれぞれ非数式の場合と (DtoU方向) \fi \end{verbatim} - + \csitem[\.{iftbox} , \.{ifybox} , \.{ifdbox} , \.{ifmbox} ] 番のボックスの組方向を判定する.は有効なboxレジスタでなければならない. @@ -842,6 +891,7 @@ DtoU方向での数式ディレクションはそれぞれ非数式の場合と \end{cslist} \section{ベースライン補正} +\label{sec:baselineshift} 和文文字のベースラインと欧文文字のベースラインが一致した状態で組むと, 行がずれて見えてしまう場合がある.特に縦組の状況が典型的である @@ -854,11 +904,11 @@ DtoU方向での数式ディレクションはそれぞれ非数式の場合と \csitem[\.{tbaselineshift}=, \.{ybaselineshift}=] 指定した箇所以降の欧文文字のベースラインシフト量を格納する.両者の使い分けは \begin{description} - \item[\texttt{\string\tbaselineshift}] - 縦組用和文フォントが使われるとき(つまり組方向が縦組のとき), - \item[\texttt{\string\ybaselineshift}] - 横組用和文フォントが使われるとき(横組,DtoU方向,縦数式ディレクション) - \end{description} + \item[\texttt{\string\tbaselineshift}] + 縦組用和文フォントが使われるとき(つまり組方向が縦組のとき), + \item[\texttt{\string\ybaselineshift}] + 横組用和文フォントが使われるとき(横組,DtoU方向,縦数式ディレクション) + \end{description} となっている. どちらの命令においても, 正の値を指定すると行送り方向(横組ならば下,縦組ならば左)にずらすことになる. @@ -879,18 +929,17 @@ DtoU方向での数式ディレクションはそれぞれ非数式の場合と \pTeX~p3.7\footnote{\TeX~Live 2016,厳密には2016-03-05のコミット(r39938).}で追加された. \begin{cslist} \csitem[\.{textbaselineshiftfactor}=, - \.{scriptbaselineshiftfactor}=] -\vspace{-\itemsep} + \.{scriptbaselineshiftfactor}=]\vspace{-\itemsep} \csitem[\.{scriptscriptbaselineshiftfactor}=] - 文中数式全体にかかるベースライン補正量に対し, - 文中数式内の明示的なボックスを逆方向に移動させる割合を指定する. - 1000が1倍(ベースライン補正をちょうど打ち消す)に相当する. - - プリミティブが3つあるのは,数式のスタイルが - |\textstyle|以上(|\displaystyle|含む),|\scriptstyle|, - |\scriptscriptstyle|のときにそれぞれ - 適用される値を変えられるようにするためである. - 既定値はそれぞれ1000(1倍),700(0.7倍),500(0.5倍)である. + 文中数式全体にかかるベースライン補正量に対し, + 文中数式内の明示的なボックスを逆方向に移動させる割合を指定する. + 1000が1倍(ベースライン補正をちょうど打ち消す)に相当する. + + プリミティブが3つあるのは,数式のスタイルが + |\textstyle|以上(|\displaystyle|含む),|\scriptstyle|, + |\scriptscriptstyle|のときにそれぞれ + 適用される値を変えられるようにするためである. + 既定値はそれぞれ1000(1倍),700(0.7倍),500(0.5倍)である. \end{cslist} \TeX~Live 2015以前の動作に戻すには,上記の3プリミティブに全て0を指定すれば良い. @@ -907,7 +956,6 @@ DtoU方向での数式ディレクションはそれぞれ非数式の場合と }$か%$ \end{verbatim} 組版結果は以下のようになる: -\medskip \begin{quote} \ybaselineshift=10pt\scriptbaselineshiftfactor=700 漢字pqr$a\hbox{xあ}^{% @@ -915,7 +963,6 @@ DtoU方向での数式ディレクションはそれぞれ非数式の場合と \hbox{\scriptsize\ybaselineshift=7pt zえ} }$か%$ \end{quote} -\medskip この例で,ボックス|\hbox{\scriptsize yう}|内ではベースライン補正量は10\,ptのままである \footnote{|\scriptsize|などのフォントサイズ変更命令では,標準では|\ybaselineshift|の値は @@ -933,6 +980,67 @@ $10\,\mathrm{pt}-7\,\mathrm{pt}=3\,\mathrm{pt}$だけ上に配置されてしま \end{dangerous} \section{和文フォント} +\label{sec:ptexfont} + +\TeX は組版を行うとき,文字の情報をTFMファイルから参照する. +\pTeX も同様で,欧文文字についてはTFMファイルを参照するが, +和文文字についてはJFMファイルを参照する. +ファイル名はどちらも\code{フォント名.tfm}である. + +TFMファイルには,大別すると +\begin{itemize} + \item それぞれの文字に関する事柄 + (各文字の幅,高さ,深さなど) + \item そのTFMファイルに収められている文字に共通する事柄 + (文字の傾き,デザインサイズ,そのフォントの基準値(em, ex)など) + \item 特定の文字の組み合わせのときの事柄 + (合字やカーニングなど) +\end{itemize} +の3種類の情報が設定されている. +JFMファイルもTFMファイルと同様の情報を持つが, +\begin{itemize} + \item 日本語の文字は数が多いので, + 文字を単位とするのではなく,共通する性質を持つ文字を + 一つにまとめてタイプ別の設定を行う + \item 横組み用と縦組み用の区別がある +\end{itemize} +という点が異なる.JFMフォーマットの詳細は, +この文書と同じディレクトリにある\cite{jfm}を参照されたい. + +% [TODO] 一つの文書で用いることができるフォント数の上限は? + +\begin{cslist} +\csitem[\.{jfont}, \.{tfont}] + 欧文フォントを定義したり,現在の欧文フォントを取得したりする|\font|の和文版である. + 一応|\jfont|が「和文の横組用フォント」の,|\tfont|が「和文の縦組用フォント」のために + 用いる命令である. +\begin{itemize} + \item フォントを定義する際は,欧文フォント・和文の横組用フォント・ + 和文の縦組用のフォントのいずれも + |\font|, |\jfont|, |\tfont|のどれを用いても定義できる. + \item |\the|等で「現在のフォント」を取得する際には, + |\jfont|で「和文の横組用フォント」を, + |\tfont|で「和文の縦組用フォント」を返す. + \item |\nullfont|は全ての文字が未定義な「空フォント」を指すが, + これは欧文フォントであり,和文版|\nullfont|という概念は存在しない. + これは,\pTeX では「全ての和文フォントには,和文文字コードとして有効な + 全ての文字が存在する」という扱いになっているためである. +\end{itemize} +\end{cslist} + +\begin{dangerous} + 細かい話をすれば,\pTeX のフォーマット作成時に和文フォントを + 何も選択しなければ,|\fontname\jfont|が|\nullfont|となり, + また和文文字を入力してもノードは作られないので, + 「和文版|\nullfont|が選択されている」と言えなくもない. + ただ,いったん実際の和文フォントを選択した後に + 「和文版|\nullfont|を選択する」という制御綴は作れないと思われる. + % つまり,tikzpicture 環境のように|\selectfont|を|\nullfont|に + % 再定義した状態では,和文文字だけ消えずに残る. + % https://tex.stackexchange.com/questions/18602/ + % https://twitter.com/doraTeX/status/1098584763277824000 + % https://twitter.com/zr_tex8r/status/1098594165573722112 +\end{dangerous} \begin{cslist} \csitem[\.{jfam}=] @@ -954,19 +1062,6 @@ $10\,\mathrm{pt}-7\,\mathrm{pt}=3\,\mathrm{pt}$だけ上に配置されてしま ! Not one-byte family. \end{verbatim} というエラーが発生する. - -\csitem[\.{jfont}, \.{tfont}] - 欧文フォントを定義したり,現在の欧文フォントを取得する|\font|の和文版である. - 一応|\jfont|が「和文の横組用フォント」の,|\tfont|が「和文の縦組用フォント」のために - 用いる命令である. -\begin{itemize} - \item フォントを定義する際は,欧文フォント・和文の横組用フォント・ - 和文の縦組用のフォントのいずれも - |\font|, |\jfont|, |\tfont|のどれを用いても定義できる. - \item |\the|等で「現在のフォント」を取得する際には, - |\jfont|で「和文の横組用フォント」を, - |\tfont|で「和文の縦組用フォント」を返す. -\end{itemize} \end{cslist} \section{文字コード変換,漢数字} @@ -985,10 +1080,19 @@ p3.1.2で復活したという経緯がある.}. たとえば,|\char\kuten"253C|は,「\char\kuten"253C」(37区60点)である. \csitem[\.{jis} <16-bit number>, \.{euc} <16-bit number>, \.{sjis} <16-bit number>] - それぞれJISコード,EUCコード,Shift\_JISコードから内部コードへの変換を行う. + それぞれJISコード,EUCコード,Shift-JISコードから内部コードへの変換を行う. たとえば,|\char\jis"346E|,|\char\euc"B0A5|,|\char\sjis"8A79|は, それぞれ「\char\jis"346E」,「\char\euc"B0A5」,「\char\sjis"8A79」である. +\end{cslist} + +\begin{dangerous} + \ref{sec:ptexchar}節でも述べたように, + \emph{\pTeX はJIS X 0213には対応せず,JIS X 0208の範囲のみ扱える}. + [TODO] \.{kuten}, \.{jis}, \.{sjis}, \.{euc}が$-1$とならない範囲はどこ? +\end{dangerous} + +\begin{cslist} \csitem[\.{kansuji} , \.{kansujichar} <0--9>=] |\kansuji|は,続く数値を漢数字の文字列で出力する. 出力される文字は|\kansujichar|で指定できる(デフォルトは「〇一二三四五六七八九」). @@ -1020,13 +1124,23 @@ p3.1.2で復活したという経緯がある.}. 基本的にこのエラーは発生しない.}. \end{cslist} +\begin{dangerous} + |\kansujichar|は整数値パラメータであるが,p3.8.2までは + 「代入できるが取得はできない」という挙動であった + (例えば|\count255=\kansujichar1|はエラー). +\iffalse %%%%% TL2019-hack + \pTeX~p3.8.3で取得もできるように修正された(\cite{build93})が, + 以前の\pTeX も考慮すると,値の取得は以下のようにするのが安全である: + |\count255=\expandafter`\kansuji1| +\fi %%%%% TL2019-hack +\end{dangerous} + % luatexja.dtx より pTeX 用に移植 \begin{dangerous} 以上に挙げたプリミティブ(|\kuten|, |\jis|, |\euc|, |\sjis|, |\kansuji|)は 展開可能(expandable)であり, 内部整数を引数にとるが,実行結果は\emph{文字列}であることに注意 (\TeX82の|\number|, |\romannumeral|と同様). - また,\pTeX はJIS X 0213には対応せず,JIS X 0208の範囲のみ扱える. \medskip\noindent \begin{minipage}{.6\linewidth} @@ -1040,7 +1154,7 @@ p3.1.2で復活したという経緯がある.}. \end{minipage} \begin{minipage}{.3\linewidth} \newcount\hoge - \hoge="2423 + \hoge="2423 \the\hoge, \kansuji\hoge\\ \jis\hoge, \char\jis\hoge\\ \kansuji1701 @@ -1138,9 +1252,13 @@ p3.1.2で復活したという経緯がある.}. |\lccode|, |\uccode| \end{quote} - +違反すると +\begin{verbatim} +! Bad character code (42146). +\end{verbatim} +というエラーが発生する. \begin{dangerous} -以前の\pTeX では, +以前の\pTeX では, これらの命令の文字コード部分に和文文字の内部コードを指定することもでき, その場合は「引数の上位バイトの値に対する操作」として扱われていた: \begin{verbatim} @@ -1149,34 +1267,52 @@ p3.1.2で復活したという経緯がある.}. しかしこの挙動は2016-09-06のコミット(r41998)により禁止され, \TeX~Live 2017の\pTeX~(p3.7.1)で反映されている. \end{dangerous} + +また,下記のプリミティブは名称が|\...char|であるが,値は0--255の範囲のみ +有効であり,256以上あるいは負の値を指定すると無効である +(オリジナルの\TeX 同様,エラーにはならない). +\begin{quote} + |\endlinechar|, + |\newlinechar|, + |\escapechar|,\\ + |\defaulthyphenchar|, + |\defaultskewchar| +\end{quote} + % 他にもあるか? \section{和文に対応したプリミティブ} \begin{cslist} - \csitem[\.{char} , + \csitem[\.{char} , \.{chardef} =] 引数として0--255に加えて和文文字の内部コードも指定できる. 和文文字の内部コードを指定した場合は和文文字を出力する. + + \csitem[\.{font}, \.{fontname}, \.{fontdimen}] + |\font|については\ref{sec:ptexfont}節を参照. + |\fontname|は和文フォントからもフォント名を取得でき, + |\fontdimen|は和文フォントのパラメータ表(JFMで定義される\node{param}テーブル)からも + 値を取得できる. + % [TODO] pTeX が内部処理で param テーブルを使うことはある? + % 少なくとも,zw と zh は使われていないんですよね? + \csitem[\.{accent} =] |\accent|プリミティブにおいても,アクセントの部分に和文文字の内部コードを指定できるほか, アクセントのつく親文字を和文文字にすることもできる. -\end{cslist} - \begin{itemize} \item 和文文字をアクセントにした場合,その上下位置が期待されない結果になる - 可能性が大きい. - これは,アクセントの上下位置補正で用いる|\fontdimen5|の値が和文フォントでは - 特に意味を持たない\footnote{欧文フォントではx-heightである.}ためである. + 可能性が大きい. + これは,アクセントの上下位置補正で用いる|\fontdimen5|の値が和文フォントでは + 特に意味を持たない\footnote{欧文フォントではx-heightである.}ためである. \item 和文文字にアクセントをつけた場合, - \begin{itemize} - \item 前側にはJFMグルーや|\kanjiskip|は挿入されない - (ただし|\xkanjiskip|は挿入されうる). - \item 後側にはJFMグルーは挿入されない - (ただし|\kanjiskip|, |\xkanjiskip|は挿入されうる). - \end{itemize} + \begin{itemize} + \item 前側にはJFMグルーや|\kanjiskip|は挿入されない + (ただし|\xkanjiskip|は挿入されうる). + \item 後側にはJFMグルーは挿入されない + (ただし|\kanjiskip|, |\xkanjiskip|は挿入されうる). + \end{itemize} \end{itemize} -\begin{cslist} \csitem[\.{if} , \.{ifcat} ] 文字トークンを指定する場合,その文字コードは\TeX82では0--255のみが許されるが, \pTeX では和文文字トークンも指定することができる. @@ -1211,30 +1347,54 @@ has been |\let| equal to a non-active character token. コントロールシークエンスをカテゴリーコード0とみなしている. そのため,\pTeX 系列において和文文字トークンの|\kcatcode|の値が 16である場合も,|\ifcat|判定でコントロールシークエンスと混同されることはない. + +一方,文字コードについては,確かにtex.webは|\if|判定において +コントロールシークエンスを256とみなしている.しかし,\upTeX では +文字コード256の和文文字と衝突するので,2019-05-06のコミット(r51021)で +「原理的に文字コードが取り得ない値」に変更した(\cite{build68}). \end{dangerous} \begin{thebibliography}{99} \bibitem{topic} Victor Eijkhout, \textit{\TeX\ by Topic, A \TeX nician's Reference}, Addison-Wesley, 1992.\\ \url{https://www.eijkhout.net/texbytopic/texbytopic.html} + \bibitem{jfm} ASCII Corporation \& Japanese \TeX\ Development Community, 「JFMファイルフォーマット」, + \texttt{./jfm.pdf} \bibitem{tatemath} aminophen, 「縦数式ディレクションとベースライン補正」, 2016/09/05,\\ \url{https://github.com/texjporg/platex/issues/22} + \bibitem{build26} h-kitagawa, 「禁則テーブル,|\inhibitxspcode| 情報テーブルからのエントリ削除」, + 2017/09/10,\\ + \url{https://github.com/texjporg/tex-jp-build/pull/26} + \bibitem{build57} Man-Ting-Fang, \textit{[upTeX] Unexpected behaviour in kinsoku processing}, + 2018/04/13,\\ + \url{https://github.com/texjporg/tex-jp-build/issues/57} + \bibitem{build11} aminophen, 「pTeX の後禁則ペナルティ」, + 2017/04/05,\\ + \url{https://github.com/texjporg/tex-jp-build/issues/11} \bibitem{build28} h-kitagawa, 「[ptex] |\inhibitglue|の効力」, 2017/09/20,\\ \url{https://github.com/texjporg/tex-jp-build/issues/28} \bibitem{build36} aminophen, 「欧文文字の|\kansujichar|,|\inhibitxspcode|」, 2017/11/26,\\ \url{https://github.com/texjporg/tex-jp-build/issues/36} - \bibitem{build37} aminophen,「和文のコントロールシンボル」, +\iffalse %%%%% TL2019-hack + \bibitem{build93} aminophen, 「[ptex] reading |\kansujichar|」, + 2019/10/14,\\ + \url{https://github.com/texjporg/tex-jp-build/issues/93} +\fi %%%%% TL2019-hack + \bibitem{build37} aminophen, 「和文のコントロールシンボル」, 2017/11/29,\\ \url{https://github.com/texjporg/tex-jp-build/issues/37} - \bibitem{build55} aminophen,「[(u)pTeX] 内部コードの -kanji-internal オプション」, + \bibitem{build55} aminophen, 「[(u)pTeX] 内部コードの -kanji-internal オプション」, 2018/04/03,\\ \url{https://github.com/texjporg/tex-jp-build/issues/55} \bibitem{forum_2566} aminophen, 「\TeX~Live 2019 での |\inhibitglue| の挙動変更【予定】」, 2019/02/06,\\ \url{https://oku.edu.mie-u.ac.jp/tex/mod/forum/discuss.php?d=2566} + \bibitem{build68} aminophen, 「upTeX の |\if| と |\ifcat|」, + 2019/01/17,\\ + \url{https://github.com/texjporg/tex-jp-build/issues/68} \end{thebibliography} \newpage diff --git a/Master/texmf-dist/doc/ptex/ptex-manual/ptexdoc_asciimw.tex b/Master/texmf-dist/doc/ptex/ptex-manual/ptexdoc_asciimw.tex index 05a7cbdd558..edb8e305fd2 100644 --- a/Master/texmf-dist/doc/ptex/ptex-manual/ptexdoc_asciimw.tex +++ b/Master/texmf-dist/doc/ptex/ptex-manual/ptexdoc_asciimw.tex @@ -921,4 +921,5 @@ cshのtimeコマンドでCPU時間を比較してみた. {\em TUGboat Volume~8 No.~1}, pp.~14--25 (1987) \end{thebibliography} +%% texjporg: タイポだけ修正 (2017/03/13) \end{document} -- cgit v1.2.3