1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
|
%#!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}}
\def\cs#1{\texttt{\textbackslash#1}}
\usepackage[japanese,english]{babel}% References in English
\AtBeginDocument{\def\figurename{Figure~}}% add a space
\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.
\begin{itemize}
% babel-japanese (japanese.ldf) は訳語を登録するだけ
% 日本語組版に必要な設定は行わない
\item The \Opt{japanese} option of Babel package only defines
translated replacement texts for
keywords and dates (e.g. ``\contentsname'' $\rightarrow$
``{\selectlanguage{japanese}\contentsname}'',
\verb+\today+ $\rightarrow$ ``{\selectlanguage{japanese}\和暦\today}'');
it does not care about any Japanese typesetting requirements.
% CJK パッケージも不十分
\item It may seem sufficient to use a package such as \Pkg{CJK} or
\Pkg{xeCJK}, or switch to Japanese fonts with a Unicode-enabled engine;
however, that's not the case.
\end{itemize}
% この文書の目的:ちゃんと日本語する簡単な方法の紹介
%-- 日本語を「ちゃんと」組むことが西欧言語とは全く異なることを伝える。
%-- ほんの数文字・数行の行組版だけでも組版規則が全く異なる。
%-- ページレイアウトに関わる設定値(段落字下げ,行長,行送りなど)が
%-- 異なるのは,想像の範囲内と思われる。
This document describes how to get an ``acceptable'' Japanese
typesetting result and the eminent differences between Western
and Japanese typesetting requirements.
% とりあえず LuaLaTeX + \usepackage{luatexja} オススメ
%-- 対象読者が「日本語組版を全く知らない海外の人」なので
%-- 資産(=解説書,周囲の経験,歴史等)の面が日本と真逆である!
%-- つまり LuaTeX 最強+資産も最強
\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 (it loads \Pkg{luatexja} internally):
\begin{lstlisting}
\documentclass[book]{jlreq}% loads luatexja.sty internally
\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}.
\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}.
If you want to simplify the procedure, you can use the command
\begin{verbatim}
$ ptex2pdf -l -u jp2
\end{verbatim}
which runs \code{uplatex} and \code{dvipdfmx} in sequence.
\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,
and it 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.
If you want to simplify the procedure, you can use the command
\begin{verbatim}
$ ptex2pdf -l jp3
\end{verbatim}
which runs \code{platex} and \code{dvipdfmx} in sequence.
% 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 The input handling of (u)\pTeX\ engine is different
from that of Western \TeX\ engines. Since Japanese tokens
are no longer treated as active characters,
the subsequent processing becomes inconsistent.
\item Both the (u)\pLaTeX\ kernel and \file{CJK.sty} redefine
the command \verb+\selectfont+, and those definitions are
incompatible.
\end{itemize}
Anyway, if you use (u)\pLaTeX, which provides better Japanese support,
you will not need the \Pkg{CJK} package at all.
\end{NOTE}
% 本書のメイン:西欧組版と日本語組版の違い;ちゃんと日本語を組むには?
\section{Differences between Western and Japanese typesetting}
The sections above described some practical ways to achieve
``acceptable'' Japanese typesetting results.
In the Appendix, you will find more examples.
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.
%% 行分割と空白挿入
%-- 禁則文字を除く任意箇所での行分割が可能
%-- 和文文字直後の改行文字は空白にならない
%-- 約物どうしの字間調整
%-- 和欧文間空白の挿入
\subsection{Line breaks and spacing}
\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}%
}}
This is the most notable aspect of Japanese typesetting, and a concept
that would not be found in Western typesetting.
Consider the input list, Listing \ref{list:src1}. Using \LuaLaTeX,
it is allowed to include any Unicode character out-of-the-box,
and they are actually displayed correctly in the output when a suitable
Japanese font is 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.
%% レイアウト
%-- 前節の「ベタ組で任意箇所での行分割」「xkanjiskip」などは
%-- 西欧組版には相当概念が存在しないと思われる。
%-- 一方,レイアウトパラメータ(行送り・字下げ・行長)は
%-- 西欧の TeX でも変更可能なパラメータ化されているので,次元が低い。
\subsection{Page layout (brief description)}
% 正方形が和文書体の基本的デザイン指向であり,欧文書体と顕著に異なる
% 書体のデザインの違いが,後述の字下げや行長の慣習に寄与している
Also, if the main language of the document is Japanese, it is common
to choose a properly designed Japanese class.
Unlike Latin typefaces, most of Japanese typefaces are designed in squares
with a width of \Foreign{zenkaku}.
This difference greatly contributes to the overall page layout in
Japanese typesetting.
For example, the typesetting procedure can be simplified by setting
\cs{textwidth} to a multiple of \Foreign{zenkaku},
and \cs{parindent} to 1~\Foreign{zenkaku}.
Many recent Japanese classes determine margins accordingly, and
adjust other layout parameters to improve readability.
\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}
%% 日本語組版における多書体化の必要性
%-- 欧文組版で「セリフ体からのイタリック化」に相当するのは
%-- 和文組版では「明朝体(セリフ)からのゴシック(サンセリフ)化」
\subsection{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{Code Gallery --- acceptable Japanese typesetting results}
\subsection{A simple Japanese document}
Using \LuaLaTeX:
\begin{lstlisting}
\documentclass[book]{jlreq}% loads luatexja.sty internally
\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[deluxe]{luatexja-preset}% multi weight
\begin{document}
\section{簡単な文章}
通常のテキストにはSerifと明朝体を使います。
\textbf{太字も使うことができます。}
\textsf{Sans Serifにはゴシック体が似合います。
\textbf{太字にも対応します。}}
\end{document}
\end{lstlisting}
Using \upLaTeX\ (or \pLaTeX) + dvipdfmx with the \Pkg{jlreq} class:
the package \Pkg{jlreq-deluxe} is recommended.
\begin{lstlisting}
\RequirePackage{plautopatch}% recommended
\documentclass[article,dvipdfmx]{jlreq}% driver option
\usepackage{jlreq-deluxe}% multi weight
\begin{document}
...
\end{lstlisting}
Traditionally, the \Pkg{otf} package (distributed as \Pkg{japanese-otf}
on CTAN/\TL) has been widely used for over a decade on (u)\pLaTeX.
Using \upLaTeX\ + dvipdfmx:
\begin{lstlisting}
\RequirePackage{plautopatch}% recommended
\documentclass[uplatex,dvipdfmx]{jsarticle}
\usepackage[deluxe]{otf}% multi weight
\begin{document}
...
\end{lstlisting}
Using \pLaTeX\ + dvipdfmx:
\begin{lstlisting}
\RequirePackage{plautopatch}% recommended
\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}
\RequirePackage{plautopatch}% recommended
\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}
|