diff options
author | Karl Berry <karl@freefriends.org> | 2020-12-06 22:14:43 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-12-06 22:14:43 +0000 |
commit | 3fdb50c0c03b81f4a73e2aded83a4cd2e8b35e86 (patch) | |
tree | 2b080f7cd1e18365b8f43618100fa98eef3c487e /Master/texmf-dist | |
parent | 75af44304d05db1d785c7a1acc8d58e100036a1d (diff) |
babel-japanese (6dec20)
git-svn-id: svn://tug.org/texlive/trunk@57078 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
11 files changed, 1196 insertions, 457 deletions
diff --git a/Master/texmf-dist/doc/generic/babel-japanese/README.md b/Master/texmf-dist/doc/generic/babel-japanese/README.md index 7e52f31134f..e0f60b35779 100644 --- a/Master/texmf-dist/doc/generic/babel-japanese/README.md +++ b/Master/texmf-dist/doc/generic/babel-japanese/README.md @@ -4,8 +4,6 @@ The package "babel-japanese" (or shortly, "japanese" package) provides `japanese` option for Babel package. It defines all the language definition macros in Japanese. -Currently this package works on pLaTeX, upLaTeX, XeLaTeX and LuaLaTeX. - ## Limitations @@ -22,41 +20,44 @@ jsclasses, ltj(s)classes in LuaTeX-ja are well-supported. ## Installation -1) Process japanese.ins with some tex engine. For example, using lualatex: +1) Process babel-japanese.ins with some tex engine. + For example, using lualatex: - lualatex japanese.ins + lualatex babel-japanese.ins -When you use platex, give -kanji=utf8 option. + When you use platex, give -kanji=utf8 option. - platex -kanji=utf8 japanese.ins + platex -kanji=utf8 babel-japanese.ins -You will get japanese.ldf (the main code) and japanese-sample.tex (sample -document for pLaTeX). + You will get japanese.ldf (the main code) and + babel-japanese-sample.tex (sample document for pLaTeX). -2) Process documentation, japanese.dtx and japanese-sample.tex, as you wish. -japanese.dtx can be processed with pLaTeX, upLaTeX or LuaLaTeX. -japanese-sample.tex is written for pLaTeX or LuaLaTeX. +2) Process documentation, babel-japanese.dtx and + babel-japanese-sample.tex, as you wish. + babel-japanese.dtx can be processed with pLaTeX, upLaTeX or LuaLaTeX. + babel-japanese-sample.tex is written for pLaTeX or LuaLaTeX. -If you use lualatex: + If you use lualatex: - lualatex japanese.dtx - lualatex japanese-sample.tex + lualatex babel-japanese.dtx + lualatex babel-japanese-sample.tex -If you use platex: + If you use platex: - platex -kanji=utf8 japanese.dtx - dvipdfmx japanese.dvi - platex -kanji=utf8 japanese-sample.tex - dvipdfmx japanese-sample.dvi + platex -kanji=utf8 babel-japanese.dtx + dvipdfmx babel-japanese.dvi + platex -kanji=utf8 babel-japanese-sample.tex + dvipdfmx babel-japanese-sample.dvi -3) Deploy the directory or files in an appropriate place under the TEXMF tree. +3) Deploy the directory or files in an appropriate place under + the TEXMF tree. * japanese.ldf - => $TEXMF/tex/latex/japanese - * japanese.dtx - => $TEXMF/source/latex/japanese - * japanese.pdf, japanese-sample.tex, japanese-sample.pdf - => $TEXMF/doc/latex/japanese + => $TEXMF/tex/generic/babel-japanese/ + * babel-japanese.dtx + => $TEXMF/source/generic/babel-japanese/ + * babel-japanese-sample.tex, japanese.tex and PDF files + => $TEXMF/doc/generic/babel-japanese/ 4) Execute mktexlsr. @@ -71,8 +72,8 @@ If you have issues, please let us know from the above page. ## License -Copyright (C) 1999-2007 by ING (Toru Inagaki) -Copyright (C) 2016- by Japanese TeX Development Community +Copyright (C) 1999-2007 by ING (Toru Inagaki) +Copyright (C) 2016- by Japanese TeX Development Community This package is free software that can be redistributed and/or modified under the terms of the LaTeX Project Public License 1.3. @@ -80,6 +81,6 @@ modified under the terms of the LaTeX Project Public License 1.3. ## Release Date -2019-04-03 +2020-12-06 Japanese TeX Development Community diff --git a/Master/texmf-dist/doc/generic/babel-japanese/babel-japanese-sample.pdf b/Master/texmf-dist/doc/generic/babel-japanese/babel-japanese-sample.pdf Binary files differnew file mode 100644 index 00000000000..cc8f1928c87 --- /dev/null +++ b/Master/texmf-dist/doc/generic/babel-japanese/babel-japanese-sample.pdf diff --git a/Master/texmf-dist/doc/generic/babel-japanese/japanese-sample.tex b/Master/texmf-dist/doc/generic/babel-japanese/babel-japanese-sample.tex index 13816c84bef..31b37923d9a 100644 --- a/Master/texmf-dist/doc/generic/babel-japanese/japanese-sample.tex +++ b/Master/texmf-dist/doc/generic/babel-japanese/babel-japanese-sample.tex @@ -1,18 +1,39 @@ %% -%% This is file `japanese-sample.tex', +%% This is file `babel-japanese-sample.tex', %% generated with the docstrip utility. %% %% The original source files were: %% -%% japanese.dtx (with options: `sample') +%% babel-japanese.dtx (with options: `sample') %% \ifx\epTeXinputencoding\undefined\else \epTeXinputencoding utf8 \fi \ifx\directlua\undefined - \documentclass{jbook} + \ifx\kanjiskip\undefined + \ifx\XeTeXversion\undefined + % pdfLaTeX: not beautiful + \documentclass{book} + \usepackage[whole]{bxcjkjatype} + \else + % XeLaTeX: not beautiful + \documentclass{book} + \usepackage{zxjatype} + \setCJKmainfont{ipaexm.ttf} + \fi + \else + \ifx\ucs\undefined + % pLaTeX: OK + \documentclass{jbook} + \usepackage{minijs} + \else + % upLaTeX: OK + \documentclass{ujbook} + \fi + \fi \else - \documentclass{ltjbook} + % LuaLaTeX: OK + \documentclass{ltjbook} \fi \usepackage[german,english,japanese]{babel} \makeatletter @@ -41,7 +62,8 @@ japaneseパッケージは日本語による見出し語と日付を出力する \begin{itemize} \se -\item ここで英語(\texttt{english})に変更します。(languageの値は\the\language) +\item ここで英語(\texttt{english})に変更します。 +(languageの値は\the\language) \TEXT @@ -49,10 +71,12 @@ japaneseパッケージは日本語による見出し語と日付を出力する ここはドイツ語? \iflanguage{german}{\yes}{\no}\par ここは日本語? \iflanguage{japanese}{\yes}{\no} -※ \verb:\adddialect\l@japanese0: と設定しているため,日本語?も「はい」となります。 +※ \verb:\adddialect\l@japanese0: と設定しているため, +日本語?も「はい」となります。 \sg -\item ここでドイツ語(\texttt{german})に変更します。(languageの値は\the\language) +\item ここでドイツ語(\texttt{german})に変更します。 +(languageの値は\the\language) \TEXT @@ -61,14 +85,17 @@ japaneseパッケージは日本語による見出し語と日付を出力する ここは日本語? \iflanguage{japanese}{\yes}{\no} ※ ハイフネーションがドイツ語―旧正書法―に切り替わっている点に注目。 -なお,新正書法(\texttt{ngerman})では\texttt{Leis-tungs-f\"a-hig-keit}のように分綴します。 +なお,新正書法(\texttt{ngerman})では +\texttt{Leis-tungs-f\"a-hig-keit}のように分綴します。 \sj -\item ここで日本語(\texttt{japanese})に変更します。(languageの値は\the\language) +\item ここで日本語(\texttt{japanese})に変更します。 +(languageの値は\the\language) \tbcaption -\item \verb:\和暦: は日付の表示をデフォルトの西暦「\today 」から和暦「\和暦\today 」に変更します。 +\item \verb:\和暦: は日付の表示をデフォルトの西暦「\today 」から +和暦「\和暦\today 」に変更します。 \end{itemize} \end{document} \endinput %% -%% End of file `japanese-sample.tex'. +%% End of file `babel-japanese-sample.tex'. diff --git a/Master/texmf-dist/doc/generic/babel-japanese/babel-japanese.pdf b/Master/texmf-dist/doc/generic/babel-japanese/babel-japanese.pdf Binary files differnew file mode 100644 index 00000000000..cf4a1ba89a9 --- /dev/null +++ b/Master/texmf-dist/doc/generic/babel-japanese/babel-japanese.pdf diff --git a/Master/texmf-dist/doc/generic/babel-japanese/japanese-sample.pdf b/Master/texmf-dist/doc/generic/babel-japanese/japanese-sample.pdf Binary files differdeleted file mode 100644 index 622d69cb8de..00000000000 --- a/Master/texmf-dist/doc/generic/babel-japanese/japanese-sample.pdf +++ /dev/null diff --git a/Master/texmf-dist/doc/generic/babel-japanese/japanese.pdf b/Master/texmf-dist/doc/generic/babel-japanese/japanese.pdf Binary files differindex 65f89c53968..7d64e49e0b5 100644 --- a/Master/texmf-dist/doc/generic/babel-japanese/japanese.pdf +++ b/Master/texmf-dist/doc/generic/babel-japanese/japanese.pdf diff --git a/Master/texmf-dist/doc/generic/babel-japanese/japanese.tex b/Master/texmf-dist/doc/generic/babel-japanese/japanese.tex new file mode 100644 index 00000000000..1ef7514b2f0 --- /dev/null +++ b/Master/texmf-dist/doc/generic/babel-japanese/japanese.tex @@ -0,0 +1,847 @@ +%#!lualatex +\documentclass[lualatex,a4paper,11pt]{jlreq} +\usepackage{luatexja-fontspec} +\newjfontfamily{\HaraMC}[ + FontFace = {l}{n}{*-Light}, + FontFace = {m}{n}{*-Regular}, + FontFace = {b}{n}{*-Bold}, + BoldFont = {*-Bold}, + ]{HaranoAjiMincho} +\newjfontfamily{\HaraGT}[ + FontFace = {m}{n}{*-Regular}, + FontFace = {b}{n}{*-Bold}, + FontFace = {eb}{n}{*-Heavy}, + BoldFont = {*-Bold}, + ]{HaranoAjiGothic} +\newjfontfamily{\HaraMG}[ + FontFace = {m}{n}{*-Medium}, + ]{HaranoAjiGothic} + +%\usepackage{luatexja-ruby}% for kenten +% [TODO] https://ja.osdn.net/projects/luatex-ja/ticket/41023 +% => based on okumacro.sty +\makeatletter +\def\kenten#1{% + \setbox1=\hbox to\z@{\hbox to 1\zw{\hss ・\hss}\hss}% + \ht1=.63\zw + \@kenten#1\end\relax} +\def\@kenten#1#2{% + \ifx#1\end \let\next=\relax \else + \raise.75\zw\copy1\nobreak #1\ifx#2\end\else + \hskip\ltjgetparameter{kanjiskip}\relax\fi + \let\next=\@kenten + \fi\next#2} +\makeatother + +%%%%%%%%%%%%%%%% +% additional packages +\usepackage{amsmath} +\usepackage{array} +\usepackage[defaultsups]{newpxtext} +\usepackage[zerostyle=c,straightquotes]{newtxtt} +\usepackage{newpxmath} +\usepackage[svgnames]{xcolor} +\usepackage[hyperfootnotes=false]{hyperref} +\usepackage{hologo} +\usepackage{xspace} + +\def\Pkg#1{\textsf{#1}} +\def\Opt#1{\texttt{#1}} +\def\ClsY#1{\Pkg{\textcolor{Black}{#1}}} +\def\ClsT#1{\Pkg{\textcolor{Green}{#1}}} +\def\ClsYT#1{\Pkg{\textcolor{Blue}{#1}}} +\def\file#1{\textsf{#1}} +\def\code#1{\texttt{#1}} + +\usepackage[japanese,english]{babel}% References in English + +\usepackage{listings} +\lstset{% + language=[LaTeX]{TeX}, + basicstyle={\small\ttfamily}, + texcsstyle={*\color{blue}}, + commentstyle={\color{Green}}, + columns=[l]{fullflexible}, + numbers=left, + xrightmargin=0\zw, + xleftmargin=3\zw, + aboveskip=3pt, + belowskip=3pt, + moretexcs={setlength,setmainfont,maketitle,RequirePackage} +} + +\usepackage{shortvrb} +\MakeShortVerb*{|} +%%%%%%%%%%%%%%%% + +% foreign text -> italic +\def\Foreign#1{\textit{#1}} + +% logos +\def\eTeX{$\varepsilon$-\TeX} +\def\pTeX{p\kern-.10em\TeX} +\def\upTeX{u\pTeX} +\def\epTeX{$\varepsilon$-\pTeX} +\def\eupTeX{$\varepsilon$-\upTeX} +\def\pLaTeX{p\LaTeX}\def\pLaTeXe{p\LaTeXe} +\def\upLaTeX{u\pLaTeX}\def\upLaTeXe{u\pLaTeXe} +\def\pdfTeX{\hologo{pdfTeX}} +\def\pdfLaTeX{\hologo{pdfLaTeX}} +\def\XeTeX{\hologo{XeTeX}} +\def\XeLaTeX{\hologo{XeLaTeX}} +\def\LuaTeX{\hologo{LuaTeX}} +\def\LuaLaTeX{\hologo{LuaLaTeX}} + +\def\TL{\TeX\ Live\xspace} +\def\JTDC{Japanese \TeX\ Development Community} + +\def\_{\leavevmode\vrule width .45em height -.2ex depth .3ex\relax} + +\frenchspacing +\begin{document} + +\title{\textsf{\textbf{Guide to Japanese typesetting with \LaTeX}}} +\author{\JTDC\null +\thanks{\url{https://texjp.org},\ e-mail: \texttt{issue(at)texjp.org}}} +\maketitle + +% 日本語組版は西欧言語とは全然違う +Typesetting requirements of Japanese are completely different from +those of Western languages, so setting parameter values and additional +hyphenation patterns are not enough. + +% babel-japanese (japanese.ldf) は訳語を登録するだけ +% 日本語組版に必要な設定は行わない +The package \Pkg{babel-japanese} provides ``\Opt{japanese}'' +option for Babel package. +However, it only defines translated replacement texts for +keywords and dates (e.g. ``\contentsname'' $\rightarrow$ +``{\selectlanguage{japanese}\contentsname}'', +\verb+\today+ $\rightarrow$ ``{\selectlanguage{japanese}\和暦\today}'') +and it does not care about any Japanese typesetting requirements. + +% この文書の目的:ちゃんと日本語する簡単な方法の紹介 +%-- 日本語を「ちゃんと」組むことが西欧言語とは全く異なることを伝える。 +%-- ほんの数文字・数行の行組版だけでも組版規則が全く異なる。 +%-- ページレイアウトに関わる設定値(段落字下げ,行長,行送りなど)が +%-- 異なるのは,想像の範囲内と思われる。 +This document describes how to get an ``acceptable'' Japanese +typesetting result and the eminent differences between Western +and Japanese typesetting requirements. + + +% とりあえず LuaLaTeX + \usepackage{luatexja} オススメ +\section{Short introduction: using \LuaLaTeX} + +To obtain a properly formatted Japanese document, the easiest way +is to use \LuaLaTeX\ with Lua\TeX-ja package. + +\begin{itemize} + \item Using the \Pkg{jlreq} class: +\begin{lstlisting} + \documentclass[book]{jlreq} + \begin{document} + \chapter{日本語の文書}% Japanese document + こんにちは,日本。% Hello, Japan. + \end{document} +\end{lstlisting} + Save the above as \file{jp1.tex} and run the following command. +\begin{verbatim} + $ lualatex jp1 +\end{verbatim} + You will get \file{jp1.pdf} which is properly formatted and + a Japanese font family ``HaranoAji Mincho/Gothic'' is embedded. + \item If you prefer classes not for Japanese, + you can load \Pkg{luatexja} directly: +\begin{lstlisting} + \documentclass{book} + \usepackage{luatexja} + \begin{document} + ... +\end{lstlisting} + * Note that using non-Japanese classes will lead to unnatural + page layouts for Japanese books, especially regarding line gaps + and line lengths. +\end{itemize} + + +% 他の選択肢:upLaTeX が先 +\section{Relatively stable alternative: \upLaTeX} + +\LuaLaTeX\ is relatively new, +and Lua\TeX-ja is under active development. +As a more stable alternative, you can use \upLaTeX. +It is a somewhat legacy implementation, which requires TFM files +for typesetting Japanese characters (called JFM). + +The \Pkg{jlreq} class also supports \upLaTeX, but here +we provide an example using an relatively old class \Pkg{jsclasses}, +which has been widely used for over a decade: +\begin{lstlisting} + \documentclass[uplatex]{jsbook}% or, \documentclass{ujbook} + \begin{document} + ... +\end{lstlisting} +Save the above as \file{jp2.tex} and run the following command. +\begin{verbatim} + $ uplatex jp2 +\end{verbatim} +You will get \file{jp2.dvi}.\bigskip + +\upLaTeX\ and \pLaTeX\ (explained later) are often referred to +as (u)\pLaTeX. They always output DVI files. +To convert DVI containing Japanese characters into PDF, +the easiest way is to use dvipdfmx. +If you have \file{jp2.dvi}, running the following command +\begin{verbatim} + $ dvipdfmx jp2 +\end{verbatim} +will generate \file{jp2.pdf}.\bigskip + +Since the default DVI driver in \TL is set to +\Opt{dvips},\footnote{Though dvips supports DVI with Japanese fonts, +additional settings for Ghostscript are required to convert +the resulting PostScript file into PDF.} +it is recommended to add a global driver option +to be passed to all driver-dependent packages +(e.g. \Pkg{graphicx}, \Pkg{color}, \Pkg{hyperref}): +\begin{lstlisting} + \documentclass[uplatex,dvipdfmx]{jsbook} + \usepackage{graphicx} + \begin{document} + ... +\end{lstlisting} + + +% レガシーな pLaTeX は最後 +\section{Using legacy \pLaTeX} + +Some old Japanese journal classes may require \pLaTeX. +It is a legacy implementation which was born in 1980s, +before the release of Unicode 1.0. +\pLaTeX\ only supports a limited character set, JIS~X~0208 +(6879 characters). +\begin{lstlisting} + \documentclass{jsbook}% or, \documentclass{jbook} + \begin{document} + ... +\end{lstlisting} +Save the above as \file{jp3.tex} and run the following command. +\begin{verbatim} + $ platex jp3 +\end{verbatim} +You will get \file{jp3.dvi}. +Again, the DVI file can be converted into PDF using dvipdfmx. + + +% CJK package はサポート外 +\newenvironment{NOTE}{\StartNOTE\small}{\EndNOTE} +\newcommand*{\NOTEline}[1]{% + \par\noindent\makebox[0pt][l]{\rule[.5ex]{\linewidth}{.4pt}}% + \makebox{\hspace{.05\linewidth}\rule[#1ex]{.9\linewidth}{.2pt}}\par} +\newcommand*{\StartNOTE}{\NOTEline{.1}\nobreak} +\newcommand*{\EndNOTE}{\nobreak\NOTEline{.9}} + +\begin{NOTE} +Note for users who know the \Pkg{CJK} package: +(u)\pLaTeX\ does \emph{not} support the \Pkg{CJK} package! +The reasons are the followings: +\begin{itemize} + \item Both the (u)\pLaTeX\ kernel and \file{CJK.sty} redefine + the command \verb+\selectfont+, and those definitions are + incompatible. + \item The input handling of (u)\pTeX\ engine is different + from that of Western \TeX\ engines, and Japanese tokens + are no longer treated as active characters. +\end{itemize} +Anyway, you will not need the \Pkg{CJK} package at all +when using (u)\pLaTeX. +\end{NOTE} + + +%% ちゃんと日本語を組むには? +%-- 禁則文字を除く任意箇所での行分割が可能 +%-- 和文文字直後の改行文字は空白にならない +%-- 約物どうしの字間調整 +%-- 和欧文間空白の挿入 +\section{Differences between Western and Japanese typesetting} + +The sections above described some practical ways to achieve +``acceptable'' Japanese typesetting results. +So, what are the minimum requirements for ``acceptable'' results +for native Japanese readers? + +The W3C Working Group Note ``Requirements for Japanese Text Layout'' +\cite{w3c-jlreq} is one of the comprehensive documentation which +describes issues of text composition in the Japanese writing system. +However, they are too complicated to explain here thoroughly,\footnote{They +include specification of basic page layout (\Foreign{kihon-hanmen}; 基本版面), +vertical alignment of Japanese text (\Foreign{tate-gumi}; 縦組), +small-sized supplementary text (\Foreign{ruby}; ルビ), inline cutting note +(\Foreign{warichu}; 割注) etc.} so we focus on the main issues regarding +simple and short horizontal writing within a few lines. + +\newbox\JEXBOX % stores example output +\newbox\JJgridbox +\def\JJsq{% + \hbox to 1\zw{\hss\fboxsep=-.5\fboxrule\fbox{% + \hskip\dimexpr-.5\zw-.2pt\vrule width.4pt height.08\zw depth.12\zw% + \hskip\dimexpr.5\zw-.2pt\relax}\hss}} +\def\JJsb{\hbox to 1\zw{\hss\fboxsep=-.5\fboxrule\fbox{% + ■\hskip\dimexpr-.5\zw-.2pt\vrule width.4pt height.08\zw depth.12\zw% + \hskip\dimexpr.5\zw-.2pt\relax}\hss}} +\setbox\JJgridbox=\hbox to 12\zw{% + \JJsq\JJsq\JJsq\JJsq\JJsb\JJsq\JJsq\JJsq\JJsq\JJsb\JJsq\JJsq} +\def\JJoutbox#1{{% + \ltjsetparameter{kanjiskip=0pt plus .2\zw minus .2\zw}% + \hbox{\textcolor{cyan}{\copy\JJgridbox}\hskip-12\zw% + \vbox{\hsize=12\zw\noindent\leftskip0pt\rightskip0pt\parfillskip0pt#1\hss}\vrule}% +}} + +Consider the following input, Listing \ref{list:src1}. Using \LuaLaTeX, +it is allowed to include any Unicode character out-of-the-box, +though a suitable Japanese font should be declared. + +\begingroup +\begin{figure}[tbp] +\ltjsetparameter{kanjiskip=0pt,xkanjiskip=0pt} +\begin{lstlisting}[caption={Example input using \LuaLaTeX},label={list:src1}] + %#!lualatex + \documentclass{article} + \usepackage{fontspec} + \setmainfont{HaranoAjiMincho-Regular} + \setlength{\textwidth}{250pt} + \setlength{\overfullrule}{5pt} + \begin{document} + \noindent + % first line = exactly 250pt (= 10pt x 25) + ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆\\ + 改行後 + 空白が入る。日本語が連続すると改行できず、はみ出す。\\ + 句読点と、(括弧)の間隔が広い。% + 日本語とLatinの間が空かない。 + \end{document} +\end{lstlisting} +\end{figure} +\endgroup + +However, the result (Figure \ref{fig:src1}) is not acceptable, +especially for the following reasons: + +\begin{itemize} + \item Japanese text has no interword spaces, but + line break is allowed between any Japanese characters + except before some punctuation marks (\Foreign{kinsoku}; 禁則). + The overfull rules that appeared in Figure \ref{fig:src1} come + from not knowing such line breaking rules. + \item Similarly, it is common to insert a new line character after + arbitrary Japanese characters in the input source. + Such a new line character should not be treated as a blank space.\\ + Wrong: \JJoutbox{改行後 空白が入る。…\hfill}\quad + Correct: \JJoutbox{改行後空白が入る。…\hfill} + \item Ordinary Japanese characters are designed to have virtual + full-width (\Foreign{zenkaku}) bounding box. However, spacing + between adjacent punctuation marks must be truncated.\\ + Wrong: \JJoutbox{句読点と、\null (括弧)の間…\hfill}\quad + Correct: \JJoutbox{句読点と、(括弧)の間…\hfill} + \item It is preferred to insert a quarter em space (\Foreign{shibu aki}) + between Japanese and Latin characters.\footnote{Such a space + is often called ``xkanjiskip'' glue in Japanese \TeX\ world.}\\ + Wrong: \JJoutbox{日本語と\null Latin\null の間…\hfill}\quad + Correct: \JJoutbox{日本語とLatinの間…\hfill} +\end{itemize} +Figure \ref{fig:src1-mod} shows an acceptable output of the same text. +You will see that choosing a Japanese font on Unicode-enabled engine +is not enough for obtaining properly formatted result. + +All of the methods explained in the previous sections, namely +\begin{enumerate} + \item \LuaLaTeX\ with Lua\TeX-ja package, + \item \upLaTeX, + \item \pLaTeX, +\end{enumerate} +are developed to support (most of) the requirements mentioned above, +and their output is most likely to be acceptable. +Therefore, we recommend to use one of those platforms. + +\begingroup +\ltjsetparameter{jacharrange={-1,-2,-3,-4,-5,-6,-7,-8,-9}} +\setmainfont{HaranoAjiMincho-Regular} +\global\setbox\JEXBOX=\vbox{\hsize=250pt\fontsize{10pt}{12pt}\selectfont +\setlength{\overfullrule}{5pt}\noindent + ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆\\ + 改行後 + 空白が入る。日本語が連続すると改行できず、はみ出す。\\ + 句読点と、(括弧)の間隔が広い。% + 日本語とLatinの間が空かない。} +\endgroup + +\begin{figure}[tbp] +\centering\leavevmode\fbox{\box\JEXBOX} +\caption{Output from Listing \ref{list:src1} (not acceptable)} +\label{fig:src1} +\end{figure} + +\begingroup +\setmainfont{HaranoAjiMincho-Regular} +\global\setbox\JEXBOX=\vbox{\hsize=250pt\fontsize{10pt}{12pt}\selectfont +\setlength{\overfullrule}{5pt}\noindent + ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆\\ + 改行後 + 空白が入る。日本語が連続すると改行できず、はみ出す。\\ + 句読点と、(括弧)の間隔が広い。% + 日本語とLatinの間が空かない。} +\endgroup + +\begin{figure}[tbp] +\centering\leavevmode\fbox{\box\JEXBOX} +\caption{Acceptable output of the above text} +\label{fig:src1-mod} +\end{figure} + + +%% 日本語組版における多書体化の必要性 +%-- 欧文組版で「セリフ体からのイタリック化」に相当するのは +%-- 和文組版では「明朝体(セリフ)からのゴシック(サンセリフ)化」 +\section{Using multi-weight typefaces for Japanese typesetting} + +Latin font families used in Western typesetting consist of +many typefaces: +\begin{itemize} + \def\FACES{Upright, \textit{Italic}, + \textbf{Bold}, \textbf{\textit{BoldItalic}}} + \item {\rmfamily Serif: \FACES} + \item {\sffamily Sans Serif: \FACES} + \item {\ttfamily Typewriter: \FACES} +\end{itemize} + +In contrast, Japanese font families provide limited typefaces. +Most Japanese font families do not provide italic or slanted shapes. +Rather, these shapes look strange and have rarely been used in +traditional typesetting. +Also, there is no typewriter font; ordinary Japanese typefaces are +inherently designed to have a fixed width. +\begin{itemize} + \item {\mcfamily 明朝 (\Foreign{Mincho}; Japanese Serif)} + \item {\gtfamily ゴシック (\Foreign{Gothic}; Japanese Sans Serif)} +\end{itemize} + +Therefore, the typeface used to emphasize in Japanese text is +different from those often used in Western text: +\begin{itemize} + \item Normal text (in upright shape) and + \emph{Emphasized text (in italic shape)} + \item 通常の文(in \Foreign{Mincho})と, + \emph{強調された文}(in \Foreign{Gothic})か + \kenten{強調された文}(with \Foreign{Kenten}; 圏点) +\end{itemize} + +Most of common Japanese classes, including those used in the +previous sections, use \Foreign{Mincho} and \Foreign{Gothic} with +a single weight each. +Nowadays, some multi-weight Japanese fonts are available for free, +so using them is a good way to overcome the situation. +The \Opt{[deluxe]} option of packages +\Pkg{luatexja-preset} (on \LuaLaTeX) or \Pkg{otf} (on (u)\pLaTeX) +supports maximum of 7 typefaces: +\begin{itemize} + \item {\HaraMC \fontseries{l}\selectfont 細明朝, + \fontseries{m}\selectfont 明朝, + \fontseries{b}\selectfont 太明朝} + (\Foreign{Mincho} Light, Medium and Bold) + \item {\HaraGT \fontseries{m}\selectfont ゴシック, + \fontseries{b}\selectfont 太ゴシック, + \fontseries{eb}\selectfont 極太ゴシック} + (\Foreign{Gothic} Medium, Bold and Extra Bold) + \item {\HaraMG \fontseries{m}\selectfont 丸ゴシック} + (\Foreign{Maru Gothic} Medium)\footnote{The + HaranoAji family used in this documentation does not provide + \Foreign{Maru Gothic} (rounded \Foreign{Gothic}) typefaces.} +\end{itemize} +With the help of these packages, you can emphasize Japanese text +by changing to bold, instead of changing Serif to Sans Serif. +\begin{itemize} + \item {\HaraMC 通常の文(in \Foreign{Mincho})と, + \textbf{強調された文}(in \Foreign{Mincho} Bold)} + \item {\HaraGT 通常の文(in \Foreign{Gothic})と, + \textbf{強調された文}(in \Foreign{Gothic} Bold)} +\end{itemize} + + +%% 各種文書への導線をはる +\section{Further readings} + +\begin{itemize} + \item ``The Lua\TeX-ja package'' (\file{luatexja-en.pdf}, in English) + \begin{itemize} + \item For beginners, refer to Part I ``User's manual.'' + \item For more interested users, refer to Part II ``Reference.'' + \item For developers, refer to Part III ``Implementations.'' + \item Japanese edition: \file{luatexja-ja.pdf} + \end{itemize} + \item ``Guide to \pTeX\ for developers unfamiliar with Japanese'' + (\file{ptex-guide-en.pdf}, in English) + \begin{itemize} + \item For developers who aim to support + \pTeX/\pLaTeX\ and its variants \upTeX/\upLaTeX. + \end{itemize} + \item ``About \upLaTeXe'' + (\file{uplatex-en.pdf}, in English) + \begin{itemize} + \item For users of \upLaTeX, but a somewhat legacy document. + \item Japanese edition: \file{uplatex-en.pdf} + \end{itemize} + \item ``About \pLaTeXe'' + (\file{platex-en.pdf}, in English) + \begin{itemize} + \item For users of \pLaTeX, but a somewhat legacy document. + \item Japanese edition: \file{platex-en.pdf} + \end{itemize} + \item ``Babel-Option \Opt{japanese}'' + (\file{babel-japanese.pdf}, in both English and Japanese) + \begin{itemize} + \item Basic introduction of \Opt{japanese} option of \Pkg{babel}. + \item Provides translated replacement texts for keywords and date. + \item Note: the translations provided by this package may not + become effective on most of Western classes, due to lack of + appropriate placeholders inside captions. + \end{itemize} +\end{itemize} + + +%% 日本の成果物 +\section{Japanese deliverables in \TL} + +There are many packages developed specially for Japanese typesetting +in \TL; most of these are installed as part of +\Pkg{collection-langjapanese}. +Only a subset of these useful packages are shown below. +For more details, please refer to individual documentation. + +\subsection{Document classes} + +Japanese text can be aligned in two directions. +One is horizontal direction, called \Foreign{yoko-gumi} (横組), +the other is vertical direction, called \Foreign{tate-gumi} (縦組). +The list below shows \ClsT{\Foreign{tate} classes in green} +and \ClsYT{\Foreign{yoko}/\Foreign{tate} classes in blue} (default is +\Foreign{yoko}, and the class option \Opt{[tate]} switches to +\Foreign{tate} mode). + +All the major frameworks for Japanese typesetting provide +``standard classes'': +\begin{itemize} + \item Lua\TeX-ja (\Pkg{luatexja} by Lua\TeX-ja project team) + \begin{itemize} + \item Bundle: \Pkg{ltjsclasses} + (\ClsY{ltjsarticle}, \ClsY{ltjsbook}, \ClsY{ltjsreport}) + \item Bundle: \Pkg{ltjclasses} + (\ClsY{ltjarticle}, \ClsY{ltjbook}, \ClsY{ltjreport}, + \ClsT{ltjtarticle}, \ClsT{ltjtbook}, \ClsT{ltjtreport}) + \end{itemize} + \item \upLaTeX\ (\Pkg{uplatex} by \JTDC) + \begin{itemize} + \item Bundle: \Pkg{ujclasses} + (\ClsY{ujarticle}, \ClsY{ujbook}, \ClsY{ujreport}, + \ClsT{utarticle}, \ClsT{utbook}, \ClsT{utreport})* + \end{itemize} + \item \pLaTeX\ (\Pkg{platex} by \JTDC) + \begin{itemize} + \item Bundle: \Pkg{jclasses} + (\ClsY{jarticle}, \ClsY{jbook}, \ClsY{jreport}, + \ClsT{tarticle}, \ClsT{tbook}, \ClsT{treport})* + \end{itemize} + * Due to historical reasons, \Pkg{ujclasses} and \Pkg{jclasses} + are left with some inconvenient behaviors. You may need to adjust + some layout parameters by hand, or use other classes mentioned below. +\end{itemize} + +Other major classes designed for Japanese: +\begin{itemize} + \item Class: \ClsYT{jlreq} (by Noriyuki Abe) + \begin{itemize} + \item Supports \LuaLaTeX, \upLaTeX\ and \pLaTeX. + \item This class aims to implement + ``Requirements for Japanese Text Layout'' + (JLReq, 日本語組版処理の要件, \cite{w3c-jlreq}). + The class file and necessary JFM (Japanese font metric) files + are included. + \end{itemize} + \item Bundle: \Pkg{jsclasses} (by Haruhiko Okumura \& \JTDC) + \begin{itemize} + \item Class: \ClsY{jsarticle}, \ClsY{jsbook}, \ClsY{jsreport} + \begin{itemize} + \item Supports only \upLaTeX\ (with option \Opt{[uplatex]}) and \pLaTeX. + \item In addition to layout adjustments, these classes use + newly developed JFM set (jis metrics) to avoid strange + behaviors of standard \pTeX\ JFM set (min10 etc). + For more details, please refer to \cite{ajt2008okumura}. + \item Note: when font size other than 10pt is specified, + the engine primitive \verb+\mag+ is employed. + Conflicts with other packages can lead to inconsistent + results in graphics and/or page size. + To avoid this, specify \Opt{nomag} or \Opt{nomag*} option. + \end{itemize} + \end{itemize} +\end{itemize} + +\subsection{Packages} + +\begin{itemize} + \item Package: \Pkg{plautopatch} (by Hironobu Yamashita) + \begin{itemize} + \item Supports \upLaTeX\ and \pLaTeX, but + does no harm on other \LaTeX\ (silently ignored). + \item (u)\pLaTeX\ users are recommended to load this package + \emph{always}, to resolve errors and incompatibilities with + Western \LaTeX\ packages which are not aware of (u)\pLaTeX. + \end{itemize} + \item Package: \Pkg{pxchfon} (by Takayuki Yato) + \begin{itemize} + \item Supports \upLaTeX\ and \pLaTeX. + \item Helps users to declate physical fonts embedded in + dvipdfmx's PDF output. It utilizes + \verb+\special{pdf:mapline}+ or + \verb+\special{pdf:mapfile}+ syntaxes. + \end{itemize} + \item Package: \Pkg{otf} + (\Pkg{japanese-otf}, \Pkg{japanese-otf-uptex} by Shuzaburo Saito \& TTK) + \begin{itemize} + \item Supports only \upLaTeX\ (with option \Opt{[uplatex]}) and \pLaTeX. + \item Main feature 1: allows switching between seven different + typefaces, compared to the standard of two typefaces. + This function is realized by shipping seven ``logical fonts'' + (= set of a JFM and a virtual font). + \item Main feature 2: provides commands for outputting + many characters by specifying Unicode (\verb+\UTF{....}+) + or Adobe CID (\verb+\CID{....}+), even with \pLaTeX. + This function is realized by mapping a huge real font from + lots of smaller subset virtual fonts. + A series of shorthand commands (\verb+\aj...+) are + also available. + \item Lua\TeX-ja provides \Pkg{luatexja-otf} to partially emulate + feature 2 of this package. + \end{itemize} +\end{itemize} + +\subsection{Other support files} + +\begin{itemize} + \item \Pkg{ptex-fontmaps} + \begin{itemize} + \item Provides map files to be used with dvipdfmx and dvips. + \item To customize Japanese fonts to be used in the output, + please use the command \code{kanji-config-updmap}. + \end{itemize} + \item \Pkg{cjk-gs-integrate} + \begin{itemize} + \item Supports easy configuration of Ghostscript for + CJK (Chinese, Japanese and Korean) fonts, which is + necessary for processing of PostScript file output from dvips. + \end{itemize} +\end{itemize} + + +%% 参考文献 +\begin{thebibliography}{99} + \bibitem{w3c-jlreq} + W3C Working Group, + \newblock ``{\em Requirements for Japanese Text Layout}''.\\ + \url{https://www.w3.org/TR/jlreq/?lang=en} + \bibitem{ajt2008okumura} + Haruhiko Okumura, + \newblock ``{\em \pTeX\ and Japanese Typesetting}''. + \newblock The Asian Journal of \TeX, Volume~2, No.~1, 2008.\\ + \url{http://ajt.ktug.org/2008/0201okumura.pdf} +\end{thebibliography} + + +\clearpage +\appendix + +\section{Examples of acceptable Japanese typesetting results} + +\subsection{A simple Japanese document} + +Using \LuaLaTeX: +\begin{lstlisting} + \documentclass[book]{jlreq} + \begin{document} + \chapter{日本語がメインのシンプルな文書} + こんにちは,日本語に少しEnglishを含めてみます。 + \end{document} +\end{lstlisting} + +Using \upLaTeX\ (or \pLaTeX) + dvipdfmx: +\begin{lstlisting} + \RequirePackage{plautopatch}% recommended + \documentclass[book,dvipdfmx]{jlreq}% driver option + \begin{document} + \chapter{日本語がメインのシンプルな文書} + こんにちは,日本語に少しEnglishを含めてみます。 + \end{document} +\end{lstlisting} + +Using \pdfLaTeX\ or \XeLaTeX: +though they have only limited Japanese typesetting capabilities, +\ClsY{bxjsbook} (from \Pkg{bxjscls} bundle by Takayuki Yato) +aims to emulate \Pkg{jsclasses} as much as possible. +Due to technical constraints, manual adjustments are often +required in the input.\footnote{\pdfTeX\ and \XeTeX\ cannot +insert a quarter em space (\Foreign{shibu aki}) automatically, so +the active character \code{\~} is redefined to a macro to +insert it manually.} +\begin{lstlisting} + \documentclass[pdflatex,ja=standard]{bxjsbook} + %\documentclass[xelatex,ja=standard]{bxjsbook} + \begin{document} + \chapter{日本語がメインのシンプルな文書} + こんにちは,日本語に少し~English~を含めてみます。 + \end{document} +\end{lstlisting} + +\subsection{Changing Japanese fonts} + +The default Japanese font family is ``HaranoAji Mincho/Gothic'' +which is derived from Source Han (or Noto) fonts. +Suppose you want to switch to ``IPAex Mincho/Gothic'' ... + +Using \LuaLaTeX: +\begin{lstlisting} + \documentclass[book]{jlreq} + \usepackage[ipaex]{luatexja-preset}% pre-defined + ... +\end{lstlisting} + +Using \upLaTeX\ (or \pLaTeX) + dvipdfmx: +\begin{lstlisting} + \RequirePackage{plautopatch}% recommended + \documentclass[book,dvipdfmx]{jlreq}% driver option + \usepackage[ipaex]{pxchfon}% pre-defined + ... +\end{lstlisting} + +\subsection{More typefaces} + +Using \LuaLaTeX: +\begin{lstlisting} + \documentclass[article]{jlreq} + \usepackage{jlreq-deluxe}% multi weight + \begin{document} + \section{簡単な文章} + 通常のテキストにはSerifと明朝体を使います。 + \textbf{太字も使うことができます。} + \textsf{Sans Serifにはゴシック体が似合います。 + \textbf{太字にも対応します。}} + \end{document} +\end{lstlisting} + +If you are using \LuaLaTeX\ with classes other than \Pkg{jlreq}, +you can also use \Pkg{luatexja-preset}: +\begin{lstlisting} + \documentclass{ltjsarticle} + \usepackage[deluxe]{luatexja-preset}% multi weight + \begin{document} + ... +\end{lstlisting} + +Using \upLaTeX\ (or \pLaTeX) + dvipdfmx: +\begin{lstlisting} + \documentclass[article,dvipdfmx]{jlreq}% driver option + \usepackage{jlreq-deluxe}% multi weight + \begin{document} + ... +\end{lstlisting} + +The package \Pkg{jlreq-deluxe} is relatively new, and it is +designed to be used with the \Pkg{jlreq} class. +Traditionally the \Pkg{otf} package has been widely used +for over a decade. + +Using \upLaTeX\ + dvipdfmx: +\begin{lstlisting} + \documentclass[uplatex,dvipdfmx]{jsarticle} + \usepackage[deluxe]{otf}% multi weight + \begin{document} + ... +\end{lstlisting} + +Using \pLaTeX\ + dvipdfmx: +\begin{lstlisting} + \documentclass[dvipdfmx]{jsarticle} + \usepackage[deluxe]{otf}% multi weight + \begin{document} + ... +\end{lstlisting} + + +\subsection{Vertical writing} + +As a Japanese version of \Pkg{lipsum}, here we use +\Pkg{bxjalipsum}. It provides several sample texts. + +Using \LuaLaTeX: +\begin{lstlisting} + \documentclass[article,tate]{jlreq} + \usepackage{bxjalipsum} + \begin{document} + \title{吾輩は猫である}% I Am A Cat + \author{夏目漱石}% Natsume Soseki + \maketitle + \jalipsum{wagahai}% 吾輩は猫である。名前… (33 paragraphs) + \end{document} +\end{lstlisting} + +Using \upLaTeX\ (or \pLaTeX) + dvipdfmx: +\begin{lstlisting} + \documentclass[article,tate,dvipdfmx]{jlreq}% driver option + \usepackage{bxjalipsum} + \begin{document} + % The preamble of the Constitution of Japan + \jalipsum{preamble}% 日本国民は、正当に選… (4 paragraphs) + \end{document} +\end{lstlisting} + +\subsection{Beamer with Japanese} + +Note that the class \Pkg{beamer} is not designed for Japanese. +% https://qiita.com/zr_tex8r/items/69e8cc32038ff29f5ac3 +% update: \usepackage{pxjahyper} -> supported by plautopatch + +Using \LuaLaTeX:\footnote{Since \Pkg{hyperref} 2020-08-14 v7.00f, +the option \Opt{unicode} is enabled by default, so the explicit +option is already redundant.} +\begin{lstlisting} + \documentclass[unicode,12pt]{beamer}% ensure unicode for hyperref + \usepackage{luatexja}% for Japanese + \renewcommand{\kanjifamilydefault}{\gtdefault}% sans-serif also for Japanese + \usetheme{Copenhagen}% as you like! + \begin{document} + \section{日本語のサンプル} + \begin{frame}{日本語でBeamerを使う} + こんにちは,日本語に少しEnglishを含めてみます。 + \end{frame} + \end{document} +\end{lstlisting} + +Using \upLaTeX\ + dvipdfmx: +% based on pLaTeX settings +\begin{lstlisting} + \RequirePackage{plautopatch}% loads (at least) the pxjahyper package + \documentclass[dvipdfmx,12pt]{beamer}% driver option + \usepackage{bxdpx-beamer}% additional settings for dvipdfmx + \renewcommand{\kanjifamilydefault}{\gtdefault}% sans-serif also for Japanese + ... +\end{lstlisting} + +Using \pLaTeX\ + dvipdfmx: +\begin{lstlisting} + \RequirePackage{plautopatch}% loads (at least) the pxjahyper package + \documentclass[dvipdfmx,12pt]{beamer}% driver option + \usepackage{bxdpx-beamer}% additional settings for dvipdfmx + \usepackage{minijs}% avoid pTeX's standard JFM (min10 etc.) + \renewcommand{\kanjifamilydefault}{\gtdefault}% sans-serif also for Japanese + ... +\end{lstlisting} + +\end{document} diff --git a/Master/texmf-dist/source/generic/babel-japanese/Makefile b/Master/texmf-dist/source/generic/babel-japanese/Makefile index a9d92127097..fa5d163cd0c 100644 --- a/Master/texmf-dist/source/generic/babel-japanese/Makefile +++ b/Master/texmf-dist/source/generic/babel-japanese/Makefile @@ -1,22 +1,29 @@ # Makefile for babel-japanese # Note that all files are UTF-8 (without BOM) encoded! -STRIPTARGET = japanese.ldf japanese-sample.tex -PDFTARGET = japanese.pdf japanese-sample.pdf -DVITARGET = japanese.dvi japanese-sample.dvi -KANJI = --kanji=utf8 -FONTMAP = -f ptex-ipaex.map -f ipaex.map +STRIPTARGET = japanese.ldf babel-japanese-sample.tex +PDFTARGET = babel-japanese.pdf babel-japanese-sample.pdf \ + japanese.pdf +DVITARGET = babel-japanese.dvi babel-japanese-sample.dvi +KANJI = -kanji=utf8 +FONTMAP = -f haranoaji.map -f ptex-haranoaji.map +TEXMF = $(shell kpsewhich -var-value=TEXMFHOME) default: $(STRIPTARGET) $(DVITARGET) strip: $(STRIPTARGET) all: $(STRIPTARGET) $(PDFTARGET) -japanese.ldf: japanese.dtx - platex $(KANJI) japanese.ins +japanese.ldf: babel-japanese.dtx + platex $(KANJI) babel-japanese.ins -japanese.dvi: japanese.dtx - platex $(KANJI) japanese.dtx - platex $(KANJI) japanese.dtx +babel-japanese.dvi: babel-japanese.dtx + platex $(KANJI) babel-japanese.dtx + platex $(KANJI) babel-japanese.dtx + +japanese.pdf: japanese.tex + lualatex japanese.tex + lualatex japanese.tex + lualatex japanese.tex .SUFFIXES: .tex .dvi .pdf .tex.dvi: @@ -27,6 +34,7 @@ japanese.dvi: japanese.dtx .PHONY: clean clean: - rm -f \ - japanese.ldf japanese-sample.tex \ - japanese.pdf japanese-sample.pdf + rm -f *.aux *.log *.out *.toc \ + japanese.ldf \ + babel-japanese-sample.tex \ + *.dvi *.pdf diff --git a/Master/texmf-dist/source/generic/babel-japanese/japanese.dtx b/Master/texmf-dist/source/generic/babel-japanese/babel-japanese.dtx index 8a7bf5558b9..1f3a150b0d6 100644 --- a/Master/texmf-dist/source/generic/babel-japanese/japanese.dtx +++ b/Master/texmf-dist/source/generic/babel-japanese/babel-japanese.dtx @@ -4,30 +4,7 @@ % providing Japanese language support for Babel. % % Copyright (C) 1999--2007 by ING (Toru INAGAKI) -% 2016--2019 by Japanese TeX Development Community -% -% This package 'japanese.dtx' supports the following Babel package: -% -% ==================================================================== -% -% Copyright (C) 2012-2018 Javier Bezos and Johannes L. Braams. -% Copyright (C) 1989-2012 Johannes L. Braams and -% any individual authors listed elsewhere in this file. -% All rights reserved. -% -% It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3 -% of this license or (at your option) any later version. -% The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3 or later is part of all distributions of LaTeX -% version 2003/12/01 or later. -% -% This work has the LPPL maintenance status "maintained". -% -% The Current Maintainer of this work is Javier Bezos. -% -% ==================================================================== +% 2016--2020 by Japanese TeX Development Community % % \fi % @@ -41,12 +18,12 @@ % Tell the \LaTeX\ system who we are and write an entry on the % transcript. %<*dtx> -\ProvidesFile{japanese.dtx} +\ProvidesFile{babel-japanese.dtx} %</dtx> %<code>\ProvidesLanguage{japanese} %<*!sample> -%\ProvidesFile{japanese.dtx} - [2019/04/03 v2.2 Japanese support for babel (texjporg)] +%\ProvidesFile{babel-japanese.dtx} + [2020/12/06 v3.0 Japanese support for babel (texjporg)] %</!sample> %\fi % @@ -55,41 +32,111 @@ %<*filedriver> \ifx\directlua\undefined \documentclass{jltxdoc} + \usepackage{minijs} \else \documentclass{ltjltxdoc} \fi -\GetFileInfo{japanese.dtx} +\usepackage[japanese]{babel}% load it +\GetFileInfo{babel-japanese.dtx} \setcounter{StandardModuleDepth}{1} \CodelineNumbered \MakeShortVerb{\|} \OnlyDescription \newcommand*\babel{\textsf{babel}} \newcommand*\langvar{$\langle \it lang \rangle$} -%\newcommand*\Lopt[1]{\textsf{#1}} -%\newcommand*\file[1]{\texttt{#1}} +\usepackage{hologo}% for XeLaTeX logo +\def\pTeX{p\kern-.15em\TeX} +\def\pdfTeX{\hologo{pdfTeX}} +\def\XeTeX{\hologo{XeTeX}} +\def\LuaTeX{\hologo{LuaTeX}} +\def\pdfLaTeX{\hologo{pdfLaTeX}} +\def\XeLaTeX{\hologo{XeLaTeX}} +\def\LuaLaTeX{\hologo{LuaLaTeX}} +\def\pLaTeX{p\hologo{LaTeX}} +\def\upLaTeX{up\hologo{LaTeX}} \begin{document} - \DocInput{japanese.dtx} + \DocInput{babel-japanese.dtx} \end{document} %</filedriver> % %\fi % -% \title{Babel-Option {\sffamily japanese} {\Large version \fileversion}} -% \author{\copyright\ 1999--2007 ING\\ 2016-- Japanese \TeX\ Development Community} +% \title{Babel-Option {\sffamily japanese} version \fileversion} +% \author{\copyright\ 1999--2007 ING\\ +% 2016--2020 Japanese \TeX\ Development Community} % \date{\filedate} % \maketitle % \baselineskip=14pt % -% \section*{The Japanese language} +% \section*{The Japanese language definition file} +% +% The package ``babel-japanese'' provides ``\texttt{japanese}'' +% option for Babel package. +% +% \begin{itemize} +% \def\textbf#1{{\fontseries{b}\selectfont #1}} +% \def\repl#1{``\nobreak#1\nobreak''} +% \item \textbf{This package provides only translated +% replacement texts for caption keywords and date} +% (e.g. \repl{Table of contents} $\rightarrow$ \repl{目次}, +% \verb+\today+ $\rightarrow$ \repl{\和暦\today}). +% \textbf{To display such Japanese terms correctly, +% you will need to select a proper Japanese font +% and set up Japanese typesetting rules beforehand.} +% This is because typesetting requirements of Japanese +% (including line breaking and spacing) are completely +% different from those of Western languages, so setting +% parameter values and additional hyphenation patterns +% are not enough. You may need to enable some engine +% extensions (\pTeX\ family) or use extensive package +% with Japanese support (Lua\TeX-ja). +% Please refer to \file{japanese.pdf} for detail. +% \item Moreover, \textbf{the translations provided by +% this package are \emph{incomplete} either}: +% to make full use of this package, you will need some +% common Japanese classes.\footnote{e.g. +% (u)jclasses or jsclasses for (u)\pLaTeX, +% ltj(s)classes for \LuaLaTeX\ with Lua\TeX-ja package.} +% This is due to the following reasons: +% \begin{itemize} +% \item The word order in Japanese is sometimes different +% from that in most Western languages +% (e.g. ``Part 1'' $\rightarrow$ ``第1部''). +% \item Common Western classes (article.cls etc) +% provide placeholders in front of the numbering +% (e.g. \cs{chaptername}), but lack any placeholders +% behind the numbering.\footnote{Starting from +% Babel v3.48 (2020-09-01), a new feature to adjust +% e.g. chapter format to have placeholders like +% \cs{prechaptername} ... \cs{postchaptername} is +% going to be added. However, it's still tentative so +% currently unused in \file{japanese.ldf}.} +% Therefore, the keywords like ``Part'' or ``Chapter'' +% cannot be simply replaced with Japanese counterpart. +% \end{itemize} +% \end{itemize} +% +% The importance of this package is to ``restore'' Japanese +% keywords which have been defined by Japanese classes +% but (partially) redefined by other languages while +% the main text is in Japanese. Example usage: +%\begin{verbatim} +% \documentclass{jbook} +% \usepackage[german,english,japanese]{babel} +%\end{verbatim} +% +% \section*{Babel日本語定義ファイル} % -% \file{japanese}パッケージは日本語による見出し語と日付を出力するためのマクロを +% \file{japanese}パッケージは, +% 日本語による見出し語と日付を出力するためのマクロを % 定義しています。\babel のオプションの最後で日本語を指定します。 % \begin{quote} % |\usepackage[...,japanese]{babel}| % \end{quote} % -% バージョンv2.0以降では,p\TeX{}系(p\LaTeX{},up\LaTeX{})に加えて, -% 新しいUnicodeな\TeX{}エンジン(Xe\TeX{},Lua\TeX{})もサポートしました。 +% バージョンv2.0以降では,\pTeX{}系(\pLaTeX{},\upLaTeX{})に加えて, +% ネイティブUnicodeなエンジン(\XeTeX{},\LuaTeX{})もサポートしました。 +% また,バージョンv3.0以降では\pdfLaTeX{}でも動作します。 % このため,ファイルはUTF-8エンコーディングで保存するようにしてください。 % % 2016年以降,本パッケージのメンテナンスは日本語\TeX{}開発コミュニティ @@ -107,29 +154,31 @@ % % \section{この文書について} % -% この文書ファイル(\jobname.pdf)自体はp\LaTeX{},up\LaTeX{},Lua\LaTeX{}で -% 処理できるようになっています。 +% このソースコード説明書(\jobname.pdf)自体は +% \pLaTeX{},\upLaTeX{},\LuaLaTeX{}で処理できるようになっています。 % % % \section{コード} % -% p\TeX{}系(p\LaTeX{},up\LaTeX{})でなく,かつUnicodeな\TeX{}(Xe\LaTeX{}, -% Lua\LaTeX{})でもない場合は,最初にエラーを出します。 +% [2020-11-27] エンジン検査は削除しました。 +% ^^A \pTeX{}系(\pLaTeX{},\upLaTeX{})でなく, +% ^^A かつUnicodeな\TeX{}(\XeLaTeX{}, +% ^^A \LuaLaTeX{})でもない場合は,最初にエラーを出します。 % % \begin{macrocode} %<*code> -\ifx\kanjiskip\@undefined\ifx\directlua\@undefined -\ifx\XeTeXversion\@undefined - \@latex@error{Option '\CurrentOption' requires one of the followings:\MessageBreak - pTeX, upTeX, XeTeX, LuaTeX\MessageBreak - It seems you are running unsupported engine!}\@ehc -\fi -\fi\fi +%\ifx\kanjiskip\@undefined\ifx\Umathcode\@undefined +% \@latex@error{Option '\CurrentOption' requires +% one of the followings:\MessageBreak +% pTeX, upTeX, XeTeX, LuaTeX\MessageBreak +% It seems you are running unsupported engine!}\@ehc +%\fi\fi % \end{macrocode} % % \begin{macrocode} \LdfInit\CurrentOption{captions\CurrentOption} % \end{macrocode} +% % \DescribeMacro{\l@japanese} % ここでは|\l@japanese|が定義されているか否かを判断し,定義されていれば % 日本語用ハイフネーションパターンを読み込みます。 @@ -169,104 +218,46 @@ % \end{macrocode} % % \DescribeMacro{\captionsjapanese} -% |\captionsjapanese|マクロはp\LaTeX{}の標準のクラスファイルで使われる +% |\captionsjapanese|マクロは\pLaTeX{}の標準のクラスファイルで使われる % 見出し語を日本語で出力します。\LaTeX{}の標準のクラスファイルでも動作 % しますが,元が英語用ですので,語順の関係上すべてを日本語化することは -% できません(たとえば、Part 1→第1部とは変更することは不可能です)。 +% できません(たとえば,Part 1→第1部とは変更することは不可能です)。 % % [2016-12-15] 「証明」と「用語集」も日本語化するようにしました。 % |\postpartname| がタイポで |\postpartnam| になっていたのを直しました。 % -% 新しいUnicodeな\TeX{}エンジン(Xe\TeX{},Lua\TeX{})の場合は, % UTF-8エンコーディングで直接和文文字を記述します。 % \begin{macrocode} -\ifx\kanjiskip\@undefined - \def\bbl@jpn@prefacename{前書き}% - \def\bbl@jpn@refname{参考文献}% - \def\bbl@jpn@abstractname{概要}% - \def\bbl@jpn@bibname{参考文献}% - %\def\bbl@jpn@chaptername{Chapter}% - \def\bbl@jpn@prechaptername{第}% -- added - \def\bbl@jpn@postchaptername{章}% -- added - \def\bbl@jpn@presectionname{}% 第 -- added - \def\bbl@jpn@postsectionname{}% 節 -- added - \def\bbl@jpn@appendixname{付録}% - \def\bbl@jpn@contentsname{目次}% - \def\bbl@jpn@listfigurename{図目次}% - \def\bbl@jpn@listtablename{表目次}% - \def\bbl@jpn@indexname{索引}% - \def\bbl@jpn@figurename{図}% - \def\bbl@jpn@tablename{表}% - %\def\bbl@jpn@partname{Part}% - \def\bbl@jpn@prepartname{第}% -- added - \def\bbl@jpn@postpartname{部}% -- added - %\def\bbl@jpn@enclname{encl}% 同封物 - %\def\bbl@jpn@ccname{cc}% Cc - %\def\bbl@jpn@headtoname{To}% To(宛先) - %\def\bbl@jpn@pagename{Page}% ページ - %\def\bbl@jpn@seename{see}% 参照 - %\def\bbl@jpn@alsoname{see also}% も参照 - \def\bbl@jpn@proofname{証明}% - \def\bbl@jpn@glossaryname{用語集}% -% \end{macrocode} -% -% p\TeX{}系の場合は,UTF-8を読めない可能性があるため, -% |\kansuji| トリックを使って和文文字の代わりにします。 -% -% \begin{macrocode} -\else -\begingroup - \kansujichar1=\jis"4130\relax % 前 - \kansujichar2=\jis"3D71\relax % 書 - \kansujichar3=\jis"242D\relax % き - \kansujichar4=\jis"3B32\relax % 参 - \kansujichar5=\jis"394D\relax % 考 - \kansujichar6=\jis"4A38\relax % 文 - \kansujichar7=\jis"3825\relax % 献 - \kansujichar8=\jis"3335\relax % 概 - \kansujichar9=\jis"4D57\relax % 要 - \xdef\bbl@jpn@prefacename{\kansuji123}% - \xdef\bbl@jpn@refname{\kansuji4567}% - \xdef\bbl@jpn@abstractname{\kansuji89}% - \xdef\bbl@jpn@bibname{\kansuji4567}% - \kansujichar1=\jis"4268\relax % 第 - \kansujichar2=\jis"3E4F\relax % 章 - \kansujichar3=\jis"4061\relax % 節 - \kansujichar4=\jis"4955\relax % 付 - \kansujichar5=\jis"4F3F\relax % 録 - \kansujichar6=\jis"3A77\relax % 索 - \kansujichar7=\jis"307A\relax % 引 - \kansujichar8=\jis"4974\relax % 部 - \xdef\bbl@jpn@prechaptername{\kansuji1}% - \xdef\bbl@jpn@postchaptername{\kansuji2}% - \xdef\bbl@jpn@presectionname{}% - \xdef\bbl@jpn@postsectionname{}% - \xdef\bbl@jpn@appendixname{\kansuji45}% - \xdef\bbl@jpn@indexname{\kansuji67}% - \xdef\bbl@jpn@prepartname{\kansuji1}% - \xdef\bbl@jpn@postpartname{\kansuji8}% - \kansujichar1=\jis"4C5C\relax % 目 - \kansujichar2=\jis"3C21\relax % 次 - \kansujichar3=\jis"3F5E\relax % 図 - \kansujichar4=\jis"493D\relax % 表 - \kansujichar5=\jis"3E5A\relax % 証 - \kansujichar6=\jis"4C40\relax % 明 - \kansujichar7=\jis"4D51\relax % 用 - \kansujichar8=\jis"386C\relax % 語 - \kansujichar9=\jis"3D38\relax % 集 - \xdef\bbl@jpn@contentsname{\kansuji12}% - \xdef\bbl@jpn@listfigurename{\kansuji312}% - \xdef\bbl@jpn@listtablename{\kansuji412}% - \xdef\bbl@jpn@figurename{\kansuji3}% - \xdef\bbl@jpn@tablename{\kansuji4}% - \xdef\bbl@jpn@proofname{\kansuji56}% - \xdef\bbl@jpn@glossaryname{\kansuji789}% -\endgroup -\fi +\def\bbl@jpn@prefacename{前書き}% +\def\bbl@jpn@refname{参考文献}% +\def\bbl@jpn@abstractname{概要}% +\def\bbl@jpn@bibname{参考文献}% +%\def\bbl@jpn@chaptername{Chapter}% +\def\bbl@jpn@prechaptername{第}% -- added +\def\bbl@jpn@postchaptername{章}% -- added +\def\bbl@jpn@presectionname{}% 第 -- added +\def\bbl@jpn@postsectionname{}% 節 -- added +\def\bbl@jpn@appendixname{付録}% +\def\bbl@jpn@contentsname{目次}% +\def\bbl@jpn@listfigurename{図目次}% +\def\bbl@jpn@listtablename{表目次}% +\def\bbl@jpn@indexname{索引}% +\def\bbl@jpn@figurename{図}% +\def\bbl@jpn@tablename{表}% +%\def\bbl@jpn@partname{Part}% +\def\bbl@jpn@prepartname{第}% -- added +\def\bbl@jpn@postpartname{部}% -- added +%\def\bbl@jpn@enclname{encl}% 同封物 +%\def\bbl@jpn@ccname{cc}% Cc +%\def\bbl@jpn@headtoname{To}% To(宛先) +%\def\bbl@jpn@pagename{Page}% ページ +%\def\bbl@jpn@seename{see}% 参照 +%\def\bbl@jpn@alsoname{see also}% も参照 +\def\bbl@jpn@proofname{証明}% +\def\bbl@jpn@glossaryname{用語集}% % \end{macrocode} % % 実際の命令にこれらをコピーします。 -% % \begin{macrocode} \@namedef{captions\CurrentOption}{% \let\prefacename\bbl@jpn@prefacename @@ -309,79 +300,32 @@ \newif\ifbbl@jpn@Seireki \bbl@jpn@Seirekitrue % \end{macrocode} % -% Unicodeな\TeX{}エンジン(Xe\TeX{},Lua\TeX{})の場合は, % UTF-8エンコーディングで直接和文文字を記述します。 -% Xe\TeX{}の場合は |\bbl@jpn@Tate...| の2つは実際には使いません。 -% \begin{macrocode} -\ifx\kanjiskip\@undefined - \def\西暦{\bbl@jpn@Seirekitrue}% - \def\和暦{\bbl@jpn@Seirekifalse}% - \def\bbl@jpn@kanjishowa{昭和} - \def\bbl@jpn@kanjiheisei{平成} - \def\bbl@jpn@kanjireiwa{令和} - \def\bbl@jpn@kanjigan{元}% - \def\bbl@jpn@TateSeirekiToday{% - \bbl@jpn@maybekansuji\year 年% - \bbl@jpn@maybekansuji\month 月% - \bbl@jpn@maybekansuji\day 日} - \def\bbl@jpn@TateWarekiToday{% - \bbl@jpn@gengo\bbl@jpn@maybekansuji\bbl@jpn@gengoyear 年% - \bbl@jpn@maybekansuji\month 月% - \bbl@jpn@maybekansuji\day 日} - \def\bbl@jpn@SeirekiToday{% - \number\year 年% - \number\month 月% - \number\day 日} - \def\bbl@jpn@WarekiToday{% - \bbl@jpn@gengo\number\bbl@jpn@gengoyear 年% - \number\month 月% - \number\day 日} -% \end{macrocode} -% -% p\TeX{}系では |\kansuji| トリックで同じ命令を定義します。 +% \pdfLaTeX{}や\XeLaTeX{}の場合は +% |\bbl@jpn@Tate...| の2つは実際には使いません。 % \begin{macrocode} -\else -\begingroup - \kansujichar1=\jis"472F\relax % 年 - \kansujichar2=\jis"376E\relax % 月 - \kansujichar3=\jis"467C\relax % 日 - \xdef\bbl@jpn@kanjinen{\kansuji1}% - \xdef\bbl@jpn@kanjigatsu{\kansuji2}% - \xdef\bbl@jpn@kanjinichi{\kansuji3}% - \kansujichar1=\jis"403E\relax % 西 - \kansujichar2=\jis"4F42\relax % 和 - \kansujichar3=\jis"4E71\relax % 暦 - \expandafter\expandafter\expandafter\gdef - \expandafter\csname\kansuji13\endcsname{\bbl@jpn@Seirekitrue}% - \expandafter\expandafter\expandafter\gdef - \expandafter\csname\kansuji23\endcsname{\bbl@jpn@Seirekifalse}% - \kansujichar4=\jis"4A3F\relax % 平 - \kansujichar5=\jis"402E\relax % 成 - \kansujichar6=\jis"3E3C\relax % 昭 - \kansujichar7=\jis"4E61\relax % 令 - \xdef\bbl@jpn@kanjishowa{\kansuji62}% - \xdef\bbl@jpn@kanjiheisei{\kansuji45}% - \xdef\bbl@jpn@kanjireiwa{\kansuji72}% - \kansujichar0=\jis"3835\relax % 元 - \xdef\bbl@jpn@kanjigan{\kansuji0}% -\endgroup - \def\bbl@jpn@TateSeirekiToday{% - \bbl@jpn@maybekansuji\year\bbl@jpn@kanjinen - \bbl@jpn@maybekansuji\month\bbl@jpn@kanjigatsu - \bbl@jpn@maybekansuji\day\bbl@jpn@kanjinichi} - \def\bbl@jpn@TateWarekiToday{% - \bbl@jpn@gengo\bbl@jpn@maybekansuji\bbl@jpn@gengoyear\bbl@jpn@kanjinen - \bbl@jpn@maybekansuji\month\bbl@jpn@kanjigatsu - \bbl@jpn@maybekansuji\day\bbl@jpn@kanjinichi} - \def\bbl@jpn@SeirekiToday{% - \number\year\bbl@jpn@kanjinen - \number\month\bbl@jpn@kanjigatsu - \number\day\bbl@jpn@kanjinichi} - \def\bbl@jpn@WarekiToday{% - \bbl@jpn@gengo\number\bbl@jpn@gengoyear\bbl@jpn@kanjinen - \number\month\bbl@jpn@kanjigatsu - \number\day\bbl@jpn@kanjinichi} -\fi +\def\西暦{\bbl@jpn@Seirekitrue}% +\def\和暦{\bbl@jpn@Seirekifalse}% +\def\bbl@jpn@kanjishowa{昭和} +\def\bbl@jpn@kanjiheisei{平成} +\def\bbl@jpn@kanjireiwa{令和} +\def\bbl@jpn@kanjigan{元}% +\def\bbl@jpn@TateSeirekiToday{% + \bbl@jpn@maybekansuji\year 年% + \bbl@jpn@maybekansuji\month 月% + \bbl@jpn@maybekansuji\day 日} +\def\bbl@jpn@TateWarekiToday{% + \bbl@jpn@gengo\bbl@jpn@maybekansuji\bbl@jpn@gengoyear 年% + \bbl@jpn@maybekansuji\month 月% + \bbl@jpn@maybekansuji\day 日} +\def\bbl@jpn@SeirekiToday{% + \number\year 年% + \number\month 月% + \number\day 日} +\def\bbl@jpn@WarekiToday{% + \bbl@jpn@gengo\number\bbl@jpn@gengoyear 年% + \number\month 月% + \number\day 日} % \end{macrocode} % % |\bbl@jpn@gengo| の内部で,元号を計算します。 @@ -413,22 +357,23 @@ } % \end{macrocode} % -% (u)p\LaTeXe{}とLua\TeX-jaで組方向判定方法が異なるため,|\catcode| のトリックで -% 別々のコードを使い分けます。Xe\LaTeX{}の場合,およびLua\LaTeX{}でLua\TeX-ja不使用の -% 場合は,縦組をサポートしません。 +% (u)\pLaTeX{}とLua\TeX-jaで組方向判定方法が異なるため, +% |\catcode| のトリックで別々のコードを使い分けます。 +% \pdfLaTeX{}や\XeLaTeX{}の場合,および\LuaLaTeX{}で +% Lua\TeX-ja不使用の場合は,縦組をサポートしません。 % \begin{macrocode} \chardef\bbl@jpn@l@catcode=\catcode`\L\relax \chardef\bbl@jpn@p@catcode=\catcode`\P\relax \chardef\bbl@jpn@x@catcode=\catcode`\X\relax \ifx\directlua\@undefined - \ifx\XeTeXversion\@undefined % ptex/uptex - \catcode`\L=14\relax - \catcode`\P=9\relax - \catcode`\X=9\relax - \else % xetex + \ifx\kanjiskip\@undefined % pdftex/xetex \catcode`\L=14\relax \catcode`\P=14\relax \catcode`\X=14\relax + \else % ptex/uptex + \catcode`\L=14\relax + \catcode`\P=9\relax + \catcode`\X=9\relax \fi \else \ifx\luatexjaLoaded\@undefined % luatex @@ -448,21 +393,14 @@ % [2019-04-03] 縦数式ディレクションは横組と同じ出力とします。 % \begin{macrocode} \@namedef{date\CurrentOption}{% - \def\today{% -P \iftdir\ifmdir % tate-math -P \ifbbl@jpn@Seireki -P \bbl@jpn@SeirekiToday -P \else -P \bbl@jpn@WarekiToday -P \fi -P \else % tate + \def\today{{% +P \ifnum1=\iftdir\ifmdir0\else1\fi\else0\fi % tate L \ifnum\ltjgetparameter{direction}=3 % tate X \ifbbl@jpn@Seireki X \bbl@jpn@TateSeirekiToday X \else X \bbl@jpn@TateWarekiToday X \fi -P \fi X \else \ifbbl@jpn@Seireki \bbl@jpn@SeirekiToday @@ -470,7 +408,7 @@ X \else \bbl@jpn@WarekiToday \fi X \fi - }% + }}% } % \end{macrocode} % @@ -515,7 +453,11 @@ X \fi % \verb|http://oku.edu.mie-u.ac.jp/~okumura/texfaq/qa/48625.html| % \item 2007年12月:ZRさん,ttkさんからいただいたご指摘を反映しました。 % \item 2016年12月:日本語\TeX{}開発コミュニティが開発を引き継ぎました。 -% 以降の変更履歴は本文中に直接書いてあります。 +% 以降の変更履歴は本文中に直接書いてあります。 +% \item 2020年12月:冒頭のドキュメントを英語にしました。 +% また,このドキュメントを\file{japanese.pdf}から +% \file{babel-japanese.pdf}にリネームし,新たに「ちゃんと日本語 +% する方法」を概説する新版\file{japanese.pdf}を追加しました。 % \end{itemize} % % \StopEventually{} @@ -523,9 +465,30 @@ X \fi % \begin{macrocode} %<*sample> \ifx\directlua\undefined - \documentclass{jbook} + \ifx\kanjiskip\undefined + \ifx\XeTeXversion\undefined + % pdfLaTeX: not beautiful + \documentclass{book} + \usepackage[whole]{bxcjkjatype} + \else + % XeLaTeX: not beautiful + \documentclass{book} + \usepackage{zxjatype} + \setCJKmainfont{ipaexm.ttf} + \fi + \else + \ifx\ucs\undefined + % pLaTeX: OK + \documentclass{jbook} + \usepackage{minijs} + \else + % upLaTeX: OK + \documentclass{ujbook} + \fi + \fi \else - \documentclass{ltjbook} + % LuaLaTeX: OK + \documentclass{ltjbook} \fi \usepackage[german,english,japanese]{babel} \makeatletter @@ -554,7 +517,8 @@ japaneseパッケージは日本語による見出し語と日付を出力する \begin{itemize} \se -\item ここで英語(\texttt{english})に変更します。(languageの値は\the\language) +\item ここで英語(\texttt{english})に変更します。 +(languageの値は\the\language) \TEXT @@ -562,10 +526,12 @@ japaneseパッケージは日本語による見出し語と日付を出力する ここはドイツ語? \iflanguage{german}{\yes}{\no}\par ここは日本語? \iflanguage{japanese}{\yes}{\no} -※ \verb:\adddialect\l@japanese0: と設定しているため,日本語?も「はい」となります。 +※ \verb:\adddialect\l@japanese0: と設定しているため, +日本語?も「はい」となります。 \sg -\item ここでドイツ語(\texttt{german})に変更します。(languageの値は\the\language) +\item ここでドイツ語(\texttt{german})に変更します。 +(languageの値は\the\language) \TEXT @@ -574,12 +540,15 @@ japaneseパッケージは日本語による見出し語と日付を出力する ここは日本語? \iflanguage{japanese}{\yes}{\no} ※ ハイフネーションがドイツ語―旧正書法―に切り替わっている点に注目。 -なお,新正書法(\texttt{ngerman})では\texttt{Leis-tungs-f\"a-hig-keit}のように分綴します。 +なお,新正書法(\texttt{ngerman})では +\texttt{Leis-tungs-f\"a-hig-keit}のように分綴します。 \sj -\item ここで日本語(\texttt{japanese})に変更します。(languageの値は\the\language) +\item ここで日本語(\texttt{japanese})に変更します。 +(languageの値は\the\language) \tbcaption -\item \verb:\和暦: は日付の表示をデフォルトの西暦「\today 」から和暦「\和暦\today 」に変更します。 +\item \verb:\和暦: は日付の表示をデフォルトの西暦「\today 」から +和暦「\和暦\today 」に変更します。 \end{itemize} \end{document} %</sample> diff --git a/Master/texmf-dist/source/generic/babel-japanese/japanese.ins b/Master/texmf-dist/source/generic/babel-japanese/babel-japanese.ins index 1e2d13cd0b6..1c1489815ea 100644 --- a/Master/texmf-dist/source/generic/babel-japanese/japanese.ins +++ b/Master/texmf-dist/source/generic/babel-japanese/babel-japanese.ins @@ -5,11 +5,11 @@ %% %% -\def\batchfile{japanese.ins} +\def\batchfile{babel-japanese.ins} \input docstrip.tex \expandafter\ifx\csname declarepreamble\endcsname\relax - \Msg{==> This file requires docstrip version 2.4} + \Msg{==> This file requires docstrip version 2.4 or later} \Msg{}\expandafter\endinput\fi \keepsilent @@ -20,7 +20,7 @@ This file is part of the `japanese' package, providing Japanese language support for Babel. Copyright (C) 1999--2007 by ING (Toru INAGAKI) - 2016-- by Japanese TeX Development Community + 2016--2020 by Japanese TeX Development Community This package is free software that can be redistributed and/or modified under the terms of the LaTeX Project Public License. @@ -40,9 +40,11 @@ or, GitHub repository is also available: \endpreamble \Msg{*** Generating files ***} -\generateFile{japanese.ldf}{f}{\from{japanese.dtx}{code}} +\generateFile{japanese.ldf}{f} + {\from{babel-japanese.dtx}{code}} \usepreamble\emptypreamble -\generateFile{japanese-sample.tex}{f}{\from{japanese.dtx}{sample}} +\generateFile{babel-japanese-sample.tex}{f} + {\from{babel-japanese.dtx}{sample}} \endbatchfile %% diff --git a/Master/texmf-dist/tex/generic/babel-japanese/japanese.ldf b/Master/texmf-dist/tex/generic/babel-japanese/japanese.ldf index 2e58a2da098..7dbe0be1195 100644 --- a/Master/texmf-dist/tex/generic/babel-japanese/japanese.ldf +++ b/Master/texmf-dist/tex/generic/babel-japanese/japanese.ldf @@ -4,13 +4,13 @@ %% %% The original source files were: %% -%% japanese.dtx (with options: `code') +%% babel-japanese.dtx (with options: `code') %% %% This file is part of the `japanese' package, %% providing Japanese language support for Babel. %% %% Copyright (C) 1999--2007 by ING (Toru INAGAKI) -%% 2016-- by Japanese TeX Development Community +%% 2016--2020 by Japanese TeX Development Community %% %% This package is free software that can be redistributed and/or %% modified under the terms of the LaTeX Project Public License. @@ -28,14 +28,7 @@ \epTeXinputencoding utf8 \fi \ProvidesLanguage{japanese} - [2019/04/03 v2.2 Japanese support for babel (texjporg)] -\ifx\kanjiskip\@undefined\ifx\directlua\@undefined -\ifx\XeTeXversion\@undefined - \@latex@error{Option '\CurrentOption' requires one of the followings:\MessageBreak - pTeX, upTeX, XeTeX, LuaTeX\MessageBreak - It seems you are running unsupported engine!}\@ehc -\fi -\fi\fi + [2020/12/06 v3.0 Japanese support for babel (texjporg)] \LdfInit\CurrentOption{captions\CurrentOption} \ifx\l@japanese\@undefined \PackageInfo{babel}{% @@ -43,83 +36,25 @@ so I will use the patterns preloaded for \bbl@nulllanguage\MessageBreak instead} \adddialect\l@japanese0\fi -\ifx\kanjiskip\@undefined - \def\bbl@jpn@prefacename{前書き}% - \def\bbl@jpn@refname{参考文献}% - \def\bbl@jpn@abstractname{概要}% - \def\bbl@jpn@bibname{参考文献}% - %\def\bbl@jpn@chaptername{Chapter}% - \def\bbl@jpn@prechaptername{第}% -- added - \def\bbl@jpn@postchaptername{章}% -- added - \def\bbl@jpn@presectionname{}% 第 -- added - \def\bbl@jpn@postsectionname{}% 節 -- added - \def\bbl@jpn@appendixname{付録}% - \def\bbl@jpn@contentsname{目次}% - \def\bbl@jpn@listfigurename{図目次}% - \def\bbl@jpn@listtablename{表目次}% - \def\bbl@jpn@indexname{索引}% - \def\bbl@jpn@figurename{図}% - \def\bbl@jpn@tablename{表}% - %\def\bbl@jpn@partname{Part}% - \def\bbl@jpn@prepartname{第}% -- added - \def\bbl@jpn@postpartname{部}% -- added - %\def\bbl@jpn@enclname{encl}% 同封物 - %\def\bbl@jpn@ccname{cc}% Cc - %\def\bbl@jpn@headtoname{To}% To(宛先) - %\def\bbl@jpn@pagename{Page}% ページ - %\def\bbl@jpn@seename{see}% 参照 - %\def\bbl@jpn@alsoname{see also}% も参照 - \def\bbl@jpn@proofname{証明}% - \def\bbl@jpn@glossaryname{用語集}% -\else -\begingroup - \kansujichar1=\jis"4130\relax % 前 - \kansujichar2=\jis"3D71\relax % 書 - \kansujichar3=\jis"242D\relax % き - \kansujichar4=\jis"3B32\relax % 参 - \kansujichar5=\jis"394D\relax % 考 - \kansujichar6=\jis"4A38\relax % 文 - \kansujichar7=\jis"3825\relax % 献 - \kansujichar8=\jis"3335\relax % 概 - \kansujichar9=\jis"4D57\relax % 要 - \xdef\bbl@jpn@prefacename{\kansuji123}% - \xdef\bbl@jpn@refname{\kansuji4567}% - \xdef\bbl@jpn@abstractname{\kansuji89}% - \xdef\bbl@jpn@bibname{\kansuji4567}% - \kansujichar1=\jis"4268\relax % 第 - \kansujichar2=\jis"3E4F\relax % 章 - \kansujichar3=\jis"4061\relax % 節 - \kansujichar4=\jis"4955\relax % 付 - \kansujichar5=\jis"4F3F\relax % 録 - \kansujichar6=\jis"3A77\relax % 索 - \kansujichar7=\jis"307A\relax % 引 - \kansujichar8=\jis"4974\relax % 部 - \xdef\bbl@jpn@prechaptername{\kansuji1}% - \xdef\bbl@jpn@postchaptername{\kansuji2}% - \xdef\bbl@jpn@presectionname{}% - \xdef\bbl@jpn@postsectionname{}% - \xdef\bbl@jpn@appendixname{\kansuji45}% - \xdef\bbl@jpn@indexname{\kansuji67}% - \xdef\bbl@jpn@prepartname{\kansuji1}% - \xdef\bbl@jpn@postpartname{\kansuji8}% - \kansujichar1=\jis"4C5C\relax % 目 - \kansujichar2=\jis"3C21\relax % 次 - \kansujichar3=\jis"3F5E\relax % 図 - \kansujichar4=\jis"493D\relax % 表 - \kansujichar5=\jis"3E5A\relax % 証 - \kansujichar6=\jis"4C40\relax % 明 - \kansujichar7=\jis"4D51\relax % 用 - \kansujichar8=\jis"386C\relax % 語 - \kansujichar9=\jis"3D38\relax % 集 - \xdef\bbl@jpn@contentsname{\kansuji12}% - \xdef\bbl@jpn@listfigurename{\kansuji312}% - \xdef\bbl@jpn@listtablename{\kansuji412}% - \xdef\bbl@jpn@figurename{\kansuji3}% - \xdef\bbl@jpn@tablename{\kansuji4}% - \xdef\bbl@jpn@proofname{\kansuji56}% - \xdef\bbl@jpn@glossaryname{\kansuji789}% -\endgroup -\fi +\def\bbl@jpn@prefacename{前書き}% +\def\bbl@jpn@refname{参考文献}% +\def\bbl@jpn@abstractname{概要}% +\def\bbl@jpn@bibname{参考文献}% +\def\bbl@jpn@prechaptername{第}% -- added +\def\bbl@jpn@postchaptername{章}% -- added +\def\bbl@jpn@presectionname{}% 第 -- added +\def\bbl@jpn@postsectionname{}% 節 -- added +\def\bbl@jpn@appendixname{付録}% +\def\bbl@jpn@contentsname{目次}% +\def\bbl@jpn@listfigurename{図目次}% +\def\bbl@jpn@listtablename{表目次}% +\def\bbl@jpn@indexname{索引}% +\def\bbl@jpn@figurename{図}% +\def\bbl@jpn@tablename{表}% +\def\bbl@jpn@prepartname{第}% -- added +\def\bbl@jpn@postpartname{部}% -- added +\def\bbl@jpn@proofname{証明}% +\def\bbl@jpn@glossaryname{用語集}% \@namedef{captions\CurrentOption}{% \let\prefacename\bbl@jpn@prefacename \let\refname\bbl@jpn@refname @@ -150,71 +85,28 @@ \let\glossaryname\bbl@jpn@glossaryname } \newif\ifbbl@jpn@Seireki \bbl@jpn@Seirekitrue -\ifx\kanjiskip\@undefined - \def\西暦{\bbl@jpn@Seirekitrue}% - \def\和暦{\bbl@jpn@Seirekifalse}% - \def\bbl@jpn@kanjishowa{昭和} - \def\bbl@jpn@kanjiheisei{平成} - \def\bbl@jpn@kanjireiwa{令和} - \def\bbl@jpn@kanjigan{元}% - \def\bbl@jpn@TateSeirekiToday{% - \bbl@jpn@maybekansuji\year 年% - \bbl@jpn@maybekansuji\month 月% - \bbl@jpn@maybekansuji\day 日} - \def\bbl@jpn@TateWarekiToday{% - \bbl@jpn@gengo\bbl@jpn@maybekansuji\bbl@jpn@gengoyear 年% - \bbl@jpn@maybekansuji\month 月% - \bbl@jpn@maybekansuji\day 日} - \def\bbl@jpn@SeirekiToday{% - \number\year 年% - \number\month 月% - \number\day 日} - \def\bbl@jpn@WarekiToday{% - \bbl@jpn@gengo\number\bbl@jpn@gengoyear 年% - \number\month 月% - \number\day 日} -\else -\begingroup - \kansujichar1=\jis"472F\relax % 年 - \kansujichar2=\jis"376E\relax % 月 - \kansujichar3=\jis"467C\relax % 日 - \xdef\bbl@jpn@kanjinen{\kansuji1}% - \xdef\bbl@jpn@kanjigatsu{\kansuji2}% - \xdef\bbl@jpn@kanjinichi{\kansuji3}% - \kansujichar1=\jis"403E\relax % 西 - \kansujichar2=\jis"4F42\relax % 和 - \kansujichar3=\jis"4E71\relax % 暦 - \expandafter\expandafter\expandafter\gdef - \expandafter\csname\kansuji13\endcsname{\bbl@jpn@Seirekitrue}% - \expandafter\expandafter\expandafter\gdef - \expandafter\csname\kansuji23\endcsname{\bbl@jpn@Seirekifalse}% - \kansujichar4=\jis"4A3F\relax % 平 - \kansujichar5=\jis"402E\relax % 成 - \kansujichar6=\jis"3E3C\relax % 昭 - \kansujichar7=\jis"4E61\relax % 令 - \xdef\bbl@jpn@kanjishowa{\kansuji62}% - \xdef\bbl@jpn@kanjiheisei{\kansuji45}% - \xdef\bbl@jpn@kanjireiwa{\kansuji72}% - \kansujichar0=\jis"3835\relax % 元 - \xdef\bbl@jpn@kanjigan{\kansuji0}% -\endgroup - \def\bbl@jpn@TateSeirekiToday{% - \bbl@jpn@maybekansuji\year\bbl@jpn@kanjinen - \bbl@jpn@maybekansuji\month\bbl@jpn@kanjigatsu - \bbl@jpn@maybekansuji\day\bbl@jpn@kanjinichi} - \def\bbl@jpn@TateWarekiToday{% - \bbl@jpn@gengo\bbl@jpn@maybekansuji\bbl@jpn@gengoyear\bbl@jpn@kanjinen - \bbl@jpn@maybekansuji\month\bbl@jpn@kanjigatsu - \bbl@jpn@maybekansuji\day\bbl@jpn@kanjinichi} - \def\bbl@jpn@SeirekiToday{% - \number\year\bbl@jpn@kanjinen - \number\month\bbl@jpn@kanjigatsu - \number\day\bbl@jpn@kanjinichi} - \def\bbl@jpn@WarekiToday{% - \bbl@jpn@gengo\number\bbl@jpn@gengoyear\bbl@jpn@kanjinen - \number\month\bbl@jpn@kanjigatsu - \number\day\bbl@jpn@kanjinichi} -\fi +\def\西暦{\bbl@jpn@Seirekitrue}% +\def\和暦{\bbl@jpn@Seirekifalse}% +\def\bbl@jpn@kanjishowa{昭和} +\def\bbl@jpn@kanjiheisei{平成} +\def\bbl@jpn@kanjireiwa{令和} +\def\bbl@jpn@kanjigan{元}% +\def\bbl@jpn@TateSeirekiToday{% + \bbl@jpn@maybekansuji\year 年% + \bbl@jpn@maybekansuji\month 月% + \bbl@jpn@maybekansuji\day 日} +\def\bbl@jpn@TateWarekiToday{% + \bbl@jpn@gengo\bbl@jpn@maybekansuji\bbl@jpn@gengoyear 年% + \bbl@jpn@maybekansuji\month 月% + \bbl@jpn@maybekansuji\day 日} +\def\bbl@jpn@SeirekiToday{% + \number\year 年% + \number\month 月% + \number\day 日} +\def\bbl@jpn@WarekiToday{% + \bbl@jpn@gengo\number\bbl@jpn@gengoyear 年% + \number\month 月% + \number\day 日} \def\bbl@jpn@gengo#1\bbl@jpn@gengoyear{% \@tempcnta\year\relax \multiply\@tempcnta100 @@ -242,14 +134,14 @@ \chardef\bbl@jpn@p@catcode=\catcode`\P\relax \chardef\bbl@jpn@x@catcode=\catcode`\X\relax \ifx\directlua\@undefined - \ifx\XeTeXversion\@undefined % ptex/uptex - \catcode`\L=14\relax - \catcode`\P=9\relax - \catcode`\X=9\relax - \else % xetex + \ifx\kanjiskip\@undefined % pdftex/xetex \catcode`\L=14\relax \catcode`\P=14\relax \catcode`\X=14\relax + \else % ptex/uptex + \catcode`\L=14\relax + \catcode`\P=9\relax + \catcode`\X=9\relax \fi \else \ifx\luatexjaLoaded\@undefined % luatex @@ -263,21 +155,14 @@ \fi \fi \@namedef{date\CurrentOption}{% - \def\today{% -P \iftdir\ifmdir % tate-math -P \ifbbl@jpn@Seireki -P \bbl@jpn@SeirekiToday -P \else -P \bbl@jpn@WarekiToday -P \fi -P \else % tate + \def\today{{% +P \ifnum1=\iftdir\ifmdir0\else1\fi\else0\fi % tate L \ifnum\ltjgetparameter{direction}=3 % tate X \ifbbl@jpn@Seireki X \bbl@jpn@TateSeirekiToday X \else X \bbl@jpn@TateWarekiToday X \fi -P \fi X \else \ifbbl@jpn@Seireki \bbl@jpn@SeirekiToday @@ -285,7 +170,7 @@ X \else \bbl@jpn@WarekiToday \fi X \fi - }% + }}% } \let\bbl@jpn@maybekansuji\number \bbl@declare@ttribute{japanese}{kansujitoday}{\let\bbl@jpn@maybekansuji\kansuji} |