Notebook

これは日々の作業を通して学んだことや毎日の生活で気づいたことをを記録しておく備忘録である。

HTML ファイル生成日時: 2024/11/21 17:40:55.112 (台灣標準時)

LuaTeX を使って PDF ファイルを作成する方法

LuaTeX を使って、日本語や中国語を含む文書を作成してみたでござる。

日本語も中国語も含まない文書

まずは、アルファベットだけを含む文書を作ってみるでござる。以下のような 内容の LaTeX のソースファイルを用意してみたでござる。


\documentclass{article}

% Time-stamp: <2024/04/11 17:39:18 (UT+8) daisuke>

\title{\bf Making a PDF file using Lua\TeX}
\author{Kinoshita Daisuke}
\date{10 April 2024}

\begin{document}

\maketitle

\begin{abstract}
 This is a test for making a PDF file using Lua\TeX. The command ``{\tt
 lualatex}'' can be used to generate a PDF file directly from a \LaTeX
 \, source file.
\end{abstract}

\section{Introduction}

This is an example of \LaTeX \, source file for making a PDF file. By
using pdf\TeX, we do not need to make a DVI file, and a PDF file is
created directly from a \LaTeX \, source file.

\end{document}

lualatex コマンドで処理し、 PDF ファイルを作成してみるでござる。


% ls -lF
total 8
-rw-r--r--  1 daisuke  taiwan  617 Apr 11 18:00 test_luatex_0.tex
% lualatex test_luatex_0.tex
This is LuaTeX, Version 1.18.0 (Web2C 2024) 
 restricted system commands enabled.
(./test_luatex_0.tex
LaTeX2e <2023-11-01> patch level 1
L3 programming layer <2024-03-14>
 (/usr/pkg/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(/usr/pkg/share/texmf-dist/tex/latex/base/size10.clo
luaotfload | db : Font names database not found, generating new one.
luaotfload | db : This can take several minutes; please be patient.))
(/usr/pkg/share/texmf-dist/tex/latex/l3backend/l3backend-luatex.def)
(./test_luatex_0.aux) (/usr/pkg/share/texmf-dist/tex/latex/base/ts1cmr.fd)
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./test_luatex_0.aux))
 411 words of node memory still in use:
   3 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 4 attribute, 49 glue_spec
, 4 attribute_list, 1 write nodes
   avail lists: 2:170,3:48,4:7,5:64,6:14,7:1076,8:1,9:90,10:6,11:38

Output written on test_luatex_0.pdf (1 page, 25148 bytes).
Transcript written on test_luatex_0.log.
% ls -lF
total 88
-rw-r--r--  1 daisuke  taiwan    132 Apr 11 18:04 test_luatex_0.aux
-rw-r--r--  1 daisuke  taiwan   6125 Apr 11 18:04 test_luatex_0.log
-rw-r--r--  1 daisuke  taiwan  25148 Apr 11 18:04 test_luatex_0.pdf
-rw-r--r--  1 daisuke  taiwan    617 Apr 11 18:00 test_luatex_0.tex

出来上がった PDF ファイルは以下の通りでござる。

fig_202404/test_luatex_image_0.png

日本語を含む文書の作成

次に、日本語を含む文書を作成してみるでござる。以下のような内容のファイ ルを準備してみるでござる。


\documentclass{article}

% Time-stamp: <2024/04/11 18:08:31 (UT+8) daisuke>

\title{\bf Making a PDF file using Lua\TeX}
\author{Kinoshita Daisuke}
\date{11 April 2024}

\begin{document}

\maketitle

\begin{abstract}
 This is a test for making a PDF file using Lua\TeX. The command ``{\tt
 lualatex}'' can be used to generate a PDF file directly from a \LaTeX
 \, source file.
\end{abstract}

\section{Introduction}

This is an example of \LaTeX \, source file for making a PDF file. By
using Lua\TeX, we do not need to make a DVI file, and a PDF file is
created directly from a \LaTeX \, source file.

Lua\TeX では、日本語も取り扱うことができるようなので、試してみるでござる。
上手くいくのでござろうか。

\end{document}

LuaTeX で処理してみるでござる。


% lualatex test_luatex_1.tex
This is LuaTeX, Version 1.18.0 (Web2C 2024) 
 restricted system commands enabled.
(./test_luatex_1.tex
LaTeX2e <2023-11-01> patch level 1
L3 programming layer <2024-03-14>
 (/usr/pkg/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(/usr/pkg/share/texmf-dist/tex/latex/base/size10.clo))
(/usr/pkg/share/texmf-dist/tex/latex/l3backend/l3backend-luatex.def)
(./test_luatex_1.aux) (/usr/pkg/share/texmf-dist/tex/latex/base/ts1cmr.fd)
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}
Missing character: There is no 㧠(U+3067) in font [lmroman10-regular]:+tlig;!
Missing character: There is no 㯠(U+306F) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã (U+3001) in font [lmroman10-regular]:+tlig;!
Missing character: There is no æ¥ (U+65E5) in font [lmroman10-regular]:+tlig;!
Missing character: There is no æ¬ (U+672C) in font [lmroman10-regular]:+tlig;!
Missing character: There is no èª (U+3082) in font [lmroman10-regular]:+tlig;!
Missing character: There is no å (U+53D6) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã (U+308A) in font [lmroman10-regular]:+tlig;!
Missing character: There is no æ± (U+6271) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã (U+3046) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã (U+3053) in font [lmroman10-regular]:+tlig;!
Missing character: There is no 㨠(U+3068) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã (U+304C) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã (U+304D) in font [lmroman10-regular]:+tlig;!!
Missing character: There is no ã (U+308B) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã (U+3088) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã (U+3046) in font [lmroman10-regular]:+tlig;!
Missing character: There is no 㪠(U+306A) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã® (U+306E) in font [lmroman10-regular]:+tlig;!
Missing character: There is no 㧠(U+3067) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã (U+3001) in font [lmroman10-regular]:+tlig;!
Missing character: There is no 試 (U+8A66) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã (U+3057) in font [lmroman10-regular]:+tlig;!
Missing character: There is no 㦠(U+3066) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã¿ (U+307F) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã (U+308B) in font [lmroman10-regular]:+tlig;!
Missing character: There is no 㧠(U+3067) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã (U+3054) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã (U+3056) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã (U+308B) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã (U+3002) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ä¸ (U+4E0A) in font [lmroman10-regular]:+tlig;!
Missing character: There is no æ (U+624B) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã (U+304F) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã
                                 (U+3044) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã (U+304F) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã® (U+306E) in font [lmroman10-regular]:+tlig;!
Missing character: There is no 㧠(U+3067) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã (U+3054) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã (U+308D) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã (U+3046) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã (U+304B) in font [lmroman10-regular]:+tlig;!
Missing character: There is no ã (U+3002) in font [lmroman10-regular]:+tlig;!
] (./test_luatex_1.aux))
 411 words of node memory still in use:
   3 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 4 attribute, 49 glue_spec
, 4 attribute_list, 1 write nodes
   avail lists: 2:178,3:50,4:7,5:68,6:16,7:1284,8:1,9:96,10:6,11:38

Output written on test_luatex_1.pdf (1 page, 25208 bytes).
Transcript written on test_luatex_1.log.

どうも、問題があるようでござる。 okular で出来上がった PDF ファイルを 表示してみるでござる。日本語の部分が表示されていないでござる。

fig_202404/test_luatex_image_1.png

"\usepackage{luatexja}" を追加すると、日本語がきちんと表示さ れる PDF ファイルが生成されるようなので、以下のようなファイルを準備し てみるでござる。


\documentclass{article}

% Time-stamp: <2024/04/11 18:23:52 (UT+8) daisuke>

\usepackage{luatexja}

\title{\bf Making a PDF file using Lua\TeX}
\author{Kinoshita Daisuke}
\date{11 April 2024}

\begin{document}

\maketitle

\begin{abstract}
 This is a test for making a PDF file using Lua\TeX. The command ``{\tt
 lualatex}'' can be used to generate a PDF file directly from a \LaTeX
 \, source file.
\end{abstract}

\section{Introduction}

This is an example of \LaTeX \, source file for making a PDF file. By
using Lua\TeX, we do not need to make a DVI file, and a PDF file is
created directly from a \LaTeX \, source file.

Lua\TeX では、日本語も取り扱うことができるようなので、試してみるでござる。
上手くいくのでござろうか。

\end{document}

pkgsrc を使って、 print/tex-luatexja と fonts/tex-haranoaji をインストー ルしてから、 lualatex コマンドで処理してみるでござる。


% lualatex test_luatex_2.tex
This is LuaTeX, Version 1.18.0 (Web2C 2024) 
 restricted system commands enabled.
(./test_luatex_2.tex
LaTeX2e <2023-11-01> patch level 1
L3 programming layer <2024-03-14>
 (/usr/pkg/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(/usr/pkg/share/texmf-dist/tex/latex/base/size10.clo))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/luatexja.sty
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/luatexja-core.sty
(/usr/pkg/share/texmf-dist/tex/generic/infwarerr/infwarerr.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexbase/luatexbase.sty
(/usr/pkg/share/texmf-dist/tex/luatex/ctablestack/ctablestack.sty))
(/usr/pkg/share/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty)
(/usr/pkg/share/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty
(/usr/pkg/share/texmf-dist/tex/generic/iftex/iftex.sty))
(/usr/pkg/share/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/pkg/share/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/pkg/share/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(/usr/pkg/share/texmf-dist/tex/generic/xkeyval/keyval.tex))))
(/usr/pkg/share/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/ltj-base.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/ltj-latex.sty
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
(/usr/pkg/share/texmf-dist/tex/latex/base/tuenc.def))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjdefs.sty
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/jfm-ujisv.lua)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/jfm-ujis.lua))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty
(/usr/pkg/share/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/pkg/share/texmf-dist/tex/latex/l3backend/l3backend-luatex.def)))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjp-atbegshi.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjp-geometry.sty
(/usr/pkg/share/texmf-dist/tex/generic/iftex/ifluatex.sty))))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/luatexja-compat.sty))
(./test_luatex_2.aux) (/usr/pkg/share/texmf-dist/tex/latex/base/ts1cmr.fd)
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./test_luatex_2.aux))
 792 words of node memory still in use:
   7 hlist, 1 vlist, 4 rule, 2 glue, 3 kern, 1 glyph, 129 attribute, 49 glue_sp
ec, 20 attribute_list, 1 write, 9 user_defined nodes
   avail lists: 1:22,2:8953,3:62,4:93,5:68,6:16,7:1298,8:1,9:194,10:6,11:38

Output written on test_luatex_2.pdf (1 page, 33691 bytes).
Transcript written on test_luatex_2.log.

出来上がった PDF ファイルは以下の通りでござる。

fig_202404/test_luatex_image_2.png

フォント関連の設定

フォントの設定をするためには、 "\usepackage{luatexja-preset}" とするとよいようなので、それ を試してみるでござる。 IPA フォントを使うよう、以下のようなファイルを 準備してみるでござる。


\documentclass{article}

% Time-stamp: <2024/04/11 19:12:22 (UT+8) daisuke>

\usepackage[ipaex]{luatexja-preset}

\title{\bf Making a PDF file using Lua\TeX}
\author{Kinoshita Daisuke}
\date{11 April 2024}

\begin{document}

\maketitle

\begin{abstract}
 This is a test for making a PDF file using Lua\TeX. The command ``{\tt
 lualatex}'' can be used to generate a PDF file directly from a \LaTeX
 \, source file.
\end{abstract}

\section{Introduction}

This is an example of \LaTeX \, source file for making a PDF file. By
using Lua\TeX, we do not need to make a DVI file, and a PDF file is
created directly from a \LaTeX \, source file.

Lua\TeX では、日本語も取り扱うことができるようなので、試してみるでござる。
上手くいくのでござろうか。

{\bf Lua\TeX では、日本語も取り扱うことができるようなので、試してみるでござる。
上手くいくのでござろうか。}

\end{document}

lualatex コマンドを実行してみるでござる。


% lualatex test_luatex_3.tex
This is LuaTeX, Version 1.18.0 (Web2C 2024) 
 restricted system commands enabled.
(./test_luatex_3.tex
LaTeX2e <2023-11-01> patch level 1
L3 programming layer <2024-03-14>
 (/usr/pkg/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(/usr/pkg/share/texmf-dist/tex/latex/base/size10.clo))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty
(/usr/pkg/share/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/pkg/share/texmf-dist/tex/latex/l3backend/l3backend-luatex.def))
(/usr/pkg/share/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/luatexja.sty
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/luatexja-core.sty
(/usr/pkg/share/texmf-dist/tex/generic/infwarerr/infwarerr.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexbase/luatexbase.sty
(/usr/pkg/share/texmf-dist/tex/luatex/ctablestack/ctablestack.sty))
(/usr/pkg/share/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty)
(/usr/pkg/share/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty
(/usr/pkg/share/texmf-dist/tex/generic/iftex/iftex.sty))
(/usr/pkg/share/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/pkg/share/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/pkg/share/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(/usr/pkg/share/texmf-dist/tex/generic/xkeyval/keyval.tex))))
(/usr/pkg/share/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/ltj-base.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/ltj-latex.sty
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
(/usr/pkg/share/texmf-dist/tex/latex/base/tuenc.def))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjdefs.sty
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/jfm-ujisv.lua)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/jfm-ujis.lua))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjp-atbegshi.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjp-geometry.sty
(/usr/pkg/share/texmf-dist/tex/generic/iftex/ifluatex.sty))))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/luatexja-compat.sty))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec.sty
(/usr/pkg/share/texmf-dist/tex/latex/fontspec/fontspec.sty
(/usr/pkg/share/texmf-dist/tex/latex/l3packages/xparse/xparse.sty)
(/usr/pkg/share/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
(/usr/pkg/share/texmf-dist/tex/latex/base/fontenc.sty)
(/usr/pkg/share/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec-27c.sty
))

Package luatexja-preset Warning: Japanese fonts will be scaled by
(luatexja-preset)                0.96221923828125.


Package luatexja-fontspec Warning: \addjfontfeature(s) ignored;
(luatexja-fontspec)                it cannot be used with a font that wasn't
(luatexja-fontspec)                selected by luatexja-fontspec.

) (./test_luatex_3.aux) (/usr/pkg/share/texmf-dist/tex/latex/base/ts1cmr.fd)
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./test_luatex_3.aux))
 792 words of node memory still in use:
   7 hlist, 1 vlist, 4 rule, 2 glue, 3 kern, 1 glyph, 129 attribute, 49 glue_sp
ec, 20 attribute_list, 1 write, 9 user_defined nodes
   avail lists: 1:14,2:10956,3:76,4:99,5:72,6:18,7:1520,8:1,9:294,10:6,11:38

Output written on test_luatex_3.pdf (1 page, 344687 bytes).
Transcript written on test_luatex_3.log.

出来上がった PDF ファイルは以下の通りにござる。

fig_202404/test_luatex_image_3.png

noto フォントを使ってみるでござる。以下のようなファイルを準備してみる でござる。


\documentclass{article}

% Time-stamp: <2024/04/11 19:15:22 (UT+8) daisuke>

\usepackage[noto]{luatexja-preset}

\title{\bf Making a PDF file using Lua\TeX}
\author{Kinoshita Daisuke}
\date{11 April 2024}

\begin{document}

\maketitle

\begin{abstract}
 This is a test for making a PDF file using Lua\TeX. The command ``{\tt
 lualatex}'' can be used to generate a PDF file directly from a \LaTeX
 \, source file.
\end{abstract}

\section{Introduction}

This is an example of \LaTeX \, source file for making a PDF file. By
using Lua\TeX, we do not need to make a DVI file, and a PDF file is
created directly from a \LaTeX \, source file.

Lua\TeX では、日本語も取り扱うことができるようなので、試してみるでござる。
上手くいくのでござろうか。

{\bf Lua\TeX では、日本語も取り扱うことができるようなので、試してみるでござる。
上手くいくのでござろうか。}

\end{document}

lualatex コマンドで処理してみるでござる。


% lualatex test_luatex_4.tex
This is LuaTeX, Version 1.18.0 (Web2C 2024) 
 restricted system commands enabled.
(./test_luatex_4.tex
LaTeX2e <2023-11-01> patch level 1
L3 programming layer <2024-03-14>
 (/usr/pkg/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(/usr/pkg/share/texmf-dist/tex/latex/base/size10.clo))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty
(/usr/pkg/share/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/pkg/share/texmf-dist/tex/latex/l3backend/l3backend-luatex.def))
(/usr/pkg/share/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/luatexja.sty
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/luatexja-core.sty
(/usr/pkg/share/texmf-dist/tex/generic/infwarerr/infwarerr.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexbase/luatexbase.sty
(/usr/pkg/share/texmf-dist/tex/luatex/ctablestack/ctablestack.sty))
(/usr/pkg/share/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty)
(/usr/pkg/share/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty
(/usr/pkg/share/texmf-dist/tex/generic/iftex/iftex.sty))
(/usr/pkg/share/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/pkg/share/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/pkg/share/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(/usr/pkg/share/texmf-dist/tex/generic/xkeyval/keyval.tex))))
(/usr/pkg/share/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/ltj-base.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/ltj-latex.sty
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
(/usr/pkg/share/texmf-dist/tex/latex/base/tuenc.def))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjdefs.sty
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/jfm-ujisv.lua)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/jfm-ujis.lua))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjp-atbegshi.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjp-geometry.sty
(/usr/pkg/share/texmf-dist/tex/generic/iftex/ifluatex.sty))))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/luatexja-compat.sty))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec.sty
(/usr/pkg/share/texmf-dist/tex/latex/fontspec/fontspec.sty
(/usr/pkg/share/texmf-dist/tex/latex/l3packages/xparse/xparse.sty)
(/usr/pkg/share/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
(/usr/pkg/share/texmf-dist/tex/latex/base/fontenc.sty)
(/usr/pkg/share/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec-27c.sty
))

Package luatexja-preset Warning: Japanese fonts will be scaled by
(luatexja-preset)                0.96221923828125.


Package luatexja-fontspec Warning: \addjfontfeature(s) ignored;
(luatexja-fontspec)                it cannot be used with a font that wasn't
(luatexja-fontspec)                selected by luatexja-fontspec.

) (./test_luatex_4.aux) (/usr/pkg/share/texmf-dist/tex/latex/base/ts1cmr.fd)
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./test_luatex_4.aux))
 792 words of node memory still in use:
   7 hlist, 1 vlist, 4 rule, 2 glue, 3 kern, 1 glyph, 129 attribute, 49 glue_sp
ec, 20 attribute_list, 1 write, 9 user_defined nodes
   avail lists: 1:14,2:10956,3:76,4:99,5:72,6:18,7:1520,8:1,9:294,10:6,11:38

Output written on test_luatex_4.pdf (1 page, 41984 bytes).
Transcript written on test_luatex_4.log.

出来上がった PDF ファイルは以下の通りでござる。

fig_202404/test_luatex_image_4.png

ume フォントを試してみるでござる。


\documentclass{article}

% Time-stamp: <2024/04/11 19:26:22 (UT+8) daisuke>

\usepackage[ume]{luatexja-preset}

\title{\bf Making a PDF file using Lua\TeX}
\author{Kinoshita Daisuke}
\date{11 April 2024}

\begin{document}

\maketitle

\begin{abstract}
 This is a test for making a PDF file using Lua\TeX. The command ``{\tt
 lualatex}'' can be used to generate a PDF file directly from a \LaTeX
 \, source file.
\end{abstract}

\section{Introduction}

This is an example of \LaTeX \, source file for making a PDF file. By
using Lua\TeX, we do not need to make a DVI file, and a PDF file is
created directly from a \LaTeX \, source file.

Lua\TeX では、日本語も取り扱うことができるようなので、試してみるでござる。
上手くいくのでござろうか。

{\bf Lua\TeX では、日本語も取り扱うことができるようなので、試してみるでござる。
上手くいくのでござろうか。}

\end{document}

lualatex を実行してみるでござる。


% lualatex test_luatex_5.tex
This is LuaTeX, Version 1.18.0 (Web2C 2024) 
 restricted system commands enabled.
(./test_luatex_5.tex
LaTeX2e <2023-11-01> patch level 1
L3 programming layer <2024-03-14>
 (/usr/pkg/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(/usr/pkg/share/texmf-dist/tex/latex/base/size10.clo))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty
(/usr/pkg/share/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/pkg/share/texmf-dist/tex/latex/l3backend/l3backend-luatex.def))
(/usr/pkg/share/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/luatexja.sty
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/luatexja-core.sty
(/usr/pkg/share/texmf-dist/tex/generic/infwarerr/infwarerr.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexbase/luatexbase.sty
(/usr/pkg/share/texmf-dist/tex/luatex/ctablestack/ctablestack.sty))
(/usr/pkg/share/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty)
(/usr/pkg/share/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty
(/usr/pkg/share/texmf-dist/tex/generic/iftex/iftex.sty))
(/usr/pkg/share/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/pkg/share/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/pkg/share/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(/usr/pkg/share/texmf-dist/tex/generic/xkeyval/keyval.tex))))
(/usr/pkg/share/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/ltj-base.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/ltj-latex.sty
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
(/usr/pkg/share/texmf-dist/tex/latex/base/tuenc.def))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjdefs.sty
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/jfm-ujisv.lua)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/jfm-ujis.lua))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjp-atbegshi.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjp-geometry.sty
(/usr/pkg/share/texmf-dist/tex/generic/iftex/ifluatex.sty))))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/luatexja-compat.sty))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec.sty
(/usr/pkg/share/texmf-dist/tex/latex/fontspec/fontspec.sty
(/usr/pkg/share/texmf-dist/tex/latex/l3packages/xparse/xparse.sty)
(/usr/pkg/share/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
(/usr/pkg/share/texmf-dist/tex/latex/base/fontenc.sty)
(/usr/pkg/share/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec-27c.sty
))

Package luatexja-preset Warning: Japanese fonts will be scaled by
(luatexja-preset)                0.96221923828125.


Package luatexja-fontspec Warning: \addjfontfeature(s) ignored;
(luatexja-fontspec)                it cannot be used with a font that wasn't
(luatexja-fontspec)                selected by luatexja-fontspec.



Package fontspec Warning: Font "UmeMincho" does not contain requested Script
(fontspec)                "CJK".



Package fontspec Warning: Font "UmeGothicO5" does not contain requested Script
(fontspec)                "CJK".

) (./test_luatex_5.aux) (/usr/pkg/share/texmf-dist/tex/latex/base/ts1cmr.fd)
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./test_luatex_5.aux))
 792 words of node memory still in use:
   7 hlist, 1 vlist, 4 rule, 2 glue, 3 kern, 1 glyph, 129 attribute, 49 glue_sp
ec, 20 attribute_list, 1 write, 9 user_defined nodes
   avail lists: 1:14,2:10956,3:76,4:99,5:72,6:18,7:1520,8:1,9:294,10:6,11:38
<
/usr/pkg/share/texmf-dist/fonts/opentype/public/lm/lmroman7-regular.otf>
Output written on test_luatex_5.pdf (1 page, 90519 bytes).
Transcript written on test_luatex_5.log.

出来上がった PDF ファイルは以下の通りでござる。

fig_202404/test_luatex_image_5.png

どのフォントが使えるようになっているのかということについては、 https://ctan.org/pkg/luatexja にある package documentation を見ればよいようでござる。

fig_202404/www_luatexja_manual.png

日本語と中国語を混在させる

日本語と中国語が混在した文書を作ってみるでござる。以下のようなファイル を用意してみたでござる。


\documentclass{article}

% Time-stamp: <2024/04/11 20:46:07 (UT+8) daisuke>

\usepackage[noto]{luatexja-preset}

\title{\bf Making a PDF file using Lua\TeX}
\author{Kinoshita Daisuke}
\date{11 April 2024}

\begin{document}

\maketitle

\begin{abstract}
 This is a test for making a PDF file using Lua\TeX. The command ``{\tt
 lualatex}'' can be used to generate a PDF file directly from a \LaTeX
 \, source file.
\end{abstract}

\section{Introduction}

This is an example of \LaTeX \, source file for making a PDF file. By
using Lua\TeX, we do not need to make a DVI file, and a PDF file is
created directly from a \LaTeX \, source file.

Lua\TeX では、日本語も取り扱うことができるようなので、試してみるでござる。
上手くいくのでござろうか。

{\bf Lua\TeX では、日本語も取り扱うことができるようなので、試してみるでござる。
上手くいくのでござろうか。}

國立中央大學在桃園市中壢區

日本語と中国語で字体が異なる文字の例。

\begin{itemize}
 \item 内內
 \item 黄黃
 \item 徳德
 \item 聴聽
 \item 温溫
\end{itemize}

\end{document}

lualatex を実行してみるでござる。


% lualatex test_luatex_6.tex
This is LuaTeX, Version 1.18.0 (Web2C 2024) 
 restricted system commands enabled.
(./test_luatex_6.tex
LaTeX2e <2023-11-01> patch level 1
L3 programming layer <2024-03-14>
 (/usr/pkg/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(/usr/pkg/share/texmf-dist/tex/latex/base/size10.clo))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty
(/usr/pkg/share/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/pkg/share/texmf-dist/tex/latex/l3backend/l3backend-luatex.def))
(/usr/pkg/share/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/luatexja.sty
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/luatexja-core.sty
(/usr/pkg/share/texmf-dist/tex/generic/infwarerr/infwarerr.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexbase/luatexbase.sty
(/usr/pkg/share/texmf-dist/tex/luatex/ctablestack/ctablestack.sty))
(/usr/pkg/share/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty)
(/usr/pkg/share/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty
(/usr/pkg/share/texmf-dist/tex/generic/iftex/iftex.sty))
(/usr/pkg/share/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/pkg/share/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/pkg/share/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(/usr/pkg/share/texmf-dist/tex/generic/xkeyval/keyval.tex))))
(/usr/pkg/share/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/ltj-base.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/ltj-latex.sty
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
(/usr/pkg/share/texmf-dist/tex/latex/base/tuenc.def))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjdefs.sty
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/jfm-ujisv.lua)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/jfm-ujis.lua))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjp-atbegshi.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjp-geometry.sty
(/usr/pkg/share/texmf-dist/tex/generic/iftex/ifluatex.sty))))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/luatexja-compat.sty))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec.sty
(/usr/pkg/share/texmf-dist/tex/latex/fontspec/fontspec.sty
(/usr/pkg/share/texmf-dist/tex/latex/l3packages/xparse/xparse.sty)
(/usr/pkg/share/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
(/usr/pkg/share/texmf-dist/tex/latex/base/fontenc.sty)
(/usr/pkg/share/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty)
(/usr/pkg/share/texmf-dist/tex/luatex/luatexja/addons/luatexja-fontspec-27c.sty
))

Package luatexja-preset Warning: Japanese fonts will be scaled by
(luatexja-preset)                0.96221923828125.


Package luatexja-fontspec Warning: \addjfontfeature(s) ignored;
(luatexja-fontspec)                it cannot be used with a font that wasn't
(luatexja-fontspec)                selected by luatexja-fontspec.

) (./test_luatex_6.aux) (/usr/pkg/share/texmf-dist/tex/latex/base/ts1cmr.fd)
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./test_luatex_6.aux))
 792 words of node memory still in use:
   7 hlist, 1 vlist, 4 rule, 2 glue, 3 kern, 1 glyph, 129 attribute, 49 glue_sp
ec, 20 attribute_list, 1 write, 9 user_defined nodes
   avail lists: 1:14,2:13790,3:128,4:143,5:72,6:32,7:1832,8:1,9:426,10:6,11:38

Output written on test_luatex_6.pdf (1 page, 49771 bytes).
Transcript written on test_luatex_6.log.

出来上がった PDF ファイルは以下の通りでござる。日本語の漢字も、中国語 の漢字も、どちらも問題なく表示されているようでござる。ただ、フォントの 設定の仕方がよくわからないので、それはまた時間を見つけて調べてみようと 思うでござる。

fig_202404/test_luatex_image_6.png

参考文献



Frequently accessed files

  1. Computer___Python/20220518_0.html
  2. Computer___Network/20230726_00.html
  3. Misc___Taiwan/20240207_00.html
  4. Computer___Network/20230516_00.html
  5. Computer___FreeBSD/20220621_0.html
  6. Computer___Python/20220715_0.html
  7. Computer___Network/20230508_00.html
  8. Food___Taiwan/20220429_0.html
  9. Computer___NetBSD/20220817_3.html
  10. Computer___Python/20220410_0.html
  11. Computer___Network/20240416_00.html
  12. Computer___Network/20240130_00.html
  13. Computer___Debian/20210223_1.html
  14. Computer___NetBSD/20230119_00.html
  15. Computer___Python/20210124_0.html
  16. Computer___Python/20221013_0.html
  17. Computer___NetBSD/20220818_1.html
  18. Computer___NetBSD/20220428_0.html
  19. Science___Math/20220420_0.html
  20. Computer___NetBSD/20240101_02.html
  21. Computer___NetBSD/20220808_0.html
  22. Computer___TeX/20230503_00.html
  23. Computer___NetBSD/20230515_00.html
  24. Science___Astronomy/20220503_0.html
  25. Computer___NetBSD/20210127_0.html
  26. Computer___Python/20240101_00.html
  27. Computer___Network/20220413_1.html
  28. Computer___Python/20220816_1.html
  29. Computer___NetBSD/20210204_0.html
  30. Travel___Taiwan/20220809_2.html


HTML file generated by Kinoshita Daisuke.