# Please edit system and help pages ONLY in the master wiki! ## For more information, please see MoinMoin:MoinDev/Translation. ## IMPORTANT NOTE: ## When you use this page as a template for creating your project page: ## * please remove all lines starting with two hashes (##) ## * except the acl line, please keep that, but remove one hash, so it reads #acl ... ## * fix the acl line so it has the correct page instead of the sample Project/...Group ##acl Project/AdminGroup:admin,read,write,delete,revert Project/ReadWriteGroup:read,write Project/ReadGroup:read ##master-page:Unknown-Page ##master-date:Unknown-Date #format wiki #language en = Tex Live 2021 on CentOS 8 = [[https://web.archive.org/web/20181005082653/http://be.nucl.ap.titech.ac.jp/~koba/cgi-bin/moin.cgi/TeX%20Live%202013%20on%20Scientific%20Linux%206.4|このアーカイブ]]を参考にCentOS 8 にTex Live 2021 (日本語対応)をインストールする。CentOS 7 / Scientific Linux (SL) 7 でも同様。 == 使用可能なコマンド == 以下のコマンドが使える。 ||<-5> '''日本語と英語に対応しているコマンド'''|| ||コマンド ||動作 ||使い方 ||入力ファイル||出力ファイル|| ||platex ||TeX ファイルのコンパイル ||$ platex test.tex ||test.tex || test.dvi || ||dvipdfmx||DVI から PDF ファイルを直接作成 || $ dvipdfmx test.dvi ||test.dvi || test.pdf || ||dvipdf ||DVI から PDF ファイルを直接作成 || $ dvipdf test.dvi ||test.dvi || test.pdf || ||dvips ||DVI から PS ファイルを作成 || $ pdvips test.dvi ||test.dvi ||test.ps || ||ps2pdf ||PS から PDF ファイルを作成 || $ ps2pdf test.ps || test.ps ||test.pdf || ||pdf2ps ||PDF から PS ファイルを作成 || $ pdf2ps test.pdf || test.pdf ||test.ps || ||pxdvi ||DVI ファイルビューワ || $ pxdvi test.dvi || test.dvi ||-|| ||evince ||PS/PDF ファイルビューワ || $ evince test.ps <
> $ evince test.pdf || test.ps<
>test.pdf ||- || ||gv ||PS/PDF ファイルビューワ || $ gv test.ps <
> gv test.pdf || test.ps <
>test.pdf || - || ## ||acroread || Adobe Reader <
> (PS/PDF インタプリタ) || $ acroread test.pdf || test.pdf||-|| ||gs ||Ghostscript インタプリタ<
>(PS/PDF インタプリタ) || $ gs test.ps <
>$ gs test.pdf || test.ps<
>test.pdf ||misc. || ||lualatex ||TeX ファイルのコンパイル <
>[[https://texwiki.texjp.org/?LaTeX%E5%85%A5%E9%96%80%2F%E7%99%BA%E5%B1%95%E7%B7%A8#mb665da8|LuaLaTeX (LuaTeX-ja)]] ||$ lualatex test.tex ||test.tex || test.pdf || <
> ||<-5> '''英語のみに対応しているコマンド'''|| ||コマンド ||動作 ||使い方 ||入力ファイル||出力ファイル|| ||latex ||TeX ファイルのコンパイル ||$ latex test.tex ||test.tex || test.dvi || ||xdvi ||DVI ファイルビューワ || $ xdvi test.dvi || test.dvi ||-|| ここで、test.ps は !PostScript (PS) ファイル、test.pdf は PDF (Portable Document Format) ファイル、 test.dvi は DVI(!DeVice-Independent file format) ファイルを表す。 また、[[https://texwiki.texjp.org/?LaTeX%E5%85%A5%E9%96%80%2F%E7%99%BA%E5%B1%95%E7%B7%A8#mb665da8|LuaLaTeX (LuaTeX-ja)]] もインストールされているので [[https://ja.osdn.net/projects/luatex-ja/wiki/LuaTeX-ja%E3%81%AE%E4%BD%BF%E3%81%84%E6%96%B9|ここ]]で動作テストができる。 == TeX Live 2021 のインストール == 1. まず ISO イメージを保存するディレクトリ (どこでも良い) に移動し、wget コマンドで TeX Live 2021 の ISO イメージを近くのミラーサーバからダウンロードする。 {{{ $ cd "ISO イメージを保存するディレクトリ" $ wget http://ftp.riken.jp/tex-archive/systems/texlive/Images/texlive2021-20210325.iso }}} 2. 同じディレクトリに、ISO イメージをマウントするディレクトリを作る。 {{{ $ mkdir texlive2021 }}} 3. ISO イメージのマウントとインストーラの実行には管理者権限が必要なので、su コマンドで root ユーザになる。 4. ISO イメージとマウントディレクトリがあるかを確認したら、ISO イメージをマウント。 {{{ # ls texlive2021 texlive2021-20210325.iso # # mount -o loop -t iso9660 texlive2021-20210325.iso texlive2021 }}} 5.マウントディレクトリ内の install-tl を実行。Enter command: に対して I を入力するとインストールがスタートする。速いPCだと 12分くらいでインストールできる。 {{{ # ./texlive2021/install-tl ... Enter command: I ... }}} 6.インストール終了後、インストーラが出力したメッセージの最後を見ると、以下のように表示されている。このメッセージに従い PATH の設定をする。 {{{ Add /usr/local/texlive/2021/texmf-dist/doc/man to MANPATH. Add /usr/local/texlive/2021/texmf-dist/doc/info to INFOPATH. Most importantly, add /usr/local/texlive/2021/bin/x86_64-linux to your PATH for current and future sessions. }}} 7. platex がインストールされているか確認。試しに platex のバージョンを確認してみる。 {{{ $ platex -v e-pTeX 3.141592653-p3.9.0-210218-2.6 (utf8.euc) (TeX Live 2021) kpathsea version 6.3.3 ptexenc version 1.3.9 }}} 8.アップデートを実行しておく。少し時間がかかる。 {{{ # tlmgr update --self # tlmgr update --all }}} == pxdvi のインストール == [[https://www.sym.me/archives/310|ここ]]を参考に pxdviをインストールする。 (2021.5.24時点で current(2021)に tltexjp/pxdvi はまだないので 2020 のをインストール) {{{ # wget https://texlive.texjp.org/tltexjp-key.asc # tlmgr key add tltexjp-key.asc # tlmgr repository add http://texlive.texjp.org/2020/tltexjp tltexjp # tlmgr pinning add tltexjp '*' # tlmgr install pxdvi # tlmgr path add # cd /usr/local/texlive/2021 # ln -s texmf-dist texmf }}} == gv のインストール == EPELから gv をインストールする。 {{{ # dnf -y install epel-release # dnf -y install gv }}} == Ghostscript (gs) の日本語対応 == Tex Live 2020 から、dvipdfmx / dvips での日本語フォント埋込の既定値が[[https://moji.or.jp/ipafont/|「IPAex フォント」]]から[[https://github.com/trueroad/HaranoAjiFonts|「原ノ味フォント」]]に変更された。Ghostscript もこの[[https://oku.edu.mie-u.ac.jp/tex/mod/forum/discuss.php?d=2795|日本語フォント埋込に対応]]する必要がある。(Ghostscript(gs)の日本語対応が未設定の場合でも、platex, dvipfdmx, pxdvi のコマンドで日本語TeXの処理は正常にできる。) CentOS 8.3 にプリインストールされている gs のバージョンを調べる。 {{{ $ gs -help GPL Ghostscript 9.25 (2018-09-13) Copyright (C) 2018 Artifex Software, Inc. All rights reserved. Search path: /usr/share/ghostscript/Resource/Init : /usr/share/ghostscript/lib : /usr/share/ghostscript/Resource/Font : /usr/share/ghostscript/fonts : /usr/share/fonts/urw-base35 : /usr/share/fonts/google-droid : /usr/share/ghostscript/conf.d/ : /usr/share/fonts }}} CentOS 8.3 には Ghostscript 9.25 (2018-09-13) がインストールされている。 Ghostscript を日本語フォント埋込に対応するために [[https://www.ctan.org/pkg/cjk-gs-integrate|cjk-gs-integrate]]スクリプトを実行する。最初に念のため初期化(クリーンアップ)をし、次にフォントマップの組み込みを行う。 {{{ # cjk-gs-integrate --link-texmf --cleanup --force cjk-gs-integrate: reading font database ... cjk-gs-integrate: searching for Ghostscript resource cjk-gs-integrate: going to clean up /usr/share/ghostscript/Resource cjk-gs-integrate: cleaning up all links, snippets and cidfmap.local ... cjk-gs-integrate: removing cidfmap.local from cidfmap file ... cjk-gs-integrate: removing snippets and cidfmap.aliases for font aliases ... cjk-gs-integrate: removing cidfmap.aliases from cidfmap file ... cjk-gs-integrate: running mktexlsr ... mktexlsr: Updating /usr/local/texlive/2021/texmf-config/ls-R... mktexlsr: Updating /usr/local/texlive/2021/texmf-dist/ls-R... mktexlsr: Updating /usr/local/texlive/2021/texmf-var/ls-R... mktexlsr: Updating /usr/local/texlive/texmf-local/ls-R... mktexlsr: Done. cjk-gs-integrate: finished # # cjk-gs-integrate --link-texmf --force cjk-gs-integrate: reading font database ... cjk-gs-integrate: checking for files ... cjk-gs-integrate: searching for Ghostscript resource cjk-gs-integrate: output is going to /usr/share/ghostscript/Resource cjk-gs-integrate: generating links and snippets for CID fonts ... cjk-gs-integrate: generating links, snippets and cidfmap.local for non-CID fonts ... cjk-gs-integrate: adding cidfmap.local to cidfmap file ... cjk-gs-integrate: generating snippets and cidfmap.aliases for font aliases ... cjk-gs-integrate: adding cidfmap.aliases to cidfmap file ... cjk-gs-integrate: running mktexlsr ... mktexlsr: Updating /usr/local/texlive/2021/texmf-config/ls-R... mktexlsr: Updating /usr/local/texlive/2021/texmf-dist/ls-R... mktexlsr: Updating /usr/local/texlive/2021/texmf-var/ls-R... mktexlsr: Updating /usr/local/texlive/texmf-local/ls-R... mktexlsr: Done. cjk-gs-integrate: finished # }}} これで Ghostscript (gs) の日本語対応 (cjkフォントの組み込み)が行われた。 == 日本語対応の確認 == Tex Live 2021 が日本語対応になっているかどうか、簡単にテストする。 以下のファイル jtest.tex を作成する。 {{{ \documentclass{jarticle} \begin{document} こんにちは世界 \end{document} }}} これを platex でコンパイル {{{ $ platex jtest.tex This is e-pTeX, Version 3.141592653-p3.9.0-210218-2.6 (utf8.euc) (TeX Live 2021) : Output written on jtest.dvi (1 page, 308 bytes). $ Transcript written on jtest.log. }}} X11 windows 環境下で {{{ $ pxdvi jtest.dvi }}} を実行すると xdvik のウインドウが開いて日本語テキストが表示されればOK。 また {{{ $ dvipdfmx jtest.dvi jtest.dvi -> jtest.pdf [1] 4821 bytes written $ }}} のコマンドでpdfが作成でき、この pdf ファイルを X windows下で evince を実行すると {{{ $ evince jtest.pdf }}} 日本語テキストが表示され、さらに Properties の Font メニューで {{{ HaranoAjiMincho-Regular-Identity-H Type 1C (CID) Encoding: Identity-H Enbedded subset CMR10 Type 1C Encoding:Builtin Enbedded subset }}} と、日本語フォント(原ノ味フォント)が埋め込まれていることを確認できればOK。さらに gsの日本語対応が行われているのを確認するため {{{ $ platex jtest.tex $ dvipdf jtest.dvi $ evince jtest.pdf }}} で、日本語文章が表示されることを確認する。gsの日本語対応が行われていないと、dvipdf で作ったpdfファイルの日本語部分は文字化けする。 == 参考: コマンドがインストールされる/設定されるタイミング == [[https://web.archive.org/web/20181005082653/http://be.nucl.ap.titech.ac.jp/~koba/cgi-bin/moin.cgi/TeX%20Live%202013%20on%20Scientific%20Linux%206.4|このアーカイブ]]から表を引用し修正する。Ghostscript(gs)の日本語対応により多くのコマンドが日英対応となる。(Ghostscript(gs)の日本語対応が未設定の場合でも、platex, dvipfdmx, pxdvi のコマンドで日本語TeXの処理は正常にできる。) || ||Step 0 ||Step 1 ||Step 2 ||Step 3 || ||コマンド ||CentOS 8.3 <
>!WorkStation環境<
>(デフォルト) ||TeX Live 2021<
>インストール後||pxdvi, gv <
>インストール後||Ghostscript<
>日本語対応後 || || platex ||- ||J/E ||J/E ||J/E || || dvipdfmx ||- ||J/E ||J/E ||J/E || || dvipdf||- ||E ||E ||J/E || || dvips ||- || E || E ||J/E || || pxdvi ||- ||- ||J/E ||J/E || || gv (for PS) ||- ||- ||E ||J/E || || gv (for PDF) ||- ||- ||E ||J/E || || evince (for PS) ||E ||E ||E ||J/E || || evince (for PDF) ||J/E||J/E||J/E ||J/E || || gs ||E ||E ||E ||J/E || || ps2pdf ||E ||E ||E ||J/E || || pdf2ps ||E ||E ||E ||J/E || || latex ||-||E ||E ||E || || xdvi ||-||E ||E ||E || ||<-5> 凡例 <
> - : インストールされていない <
> E : 英語の文書に対しては動く <
>J/E : 日本語と英語の文書に対して動く || ただし、日本語フォントが埋め込まれている PS, PDF に対しては、gs コマンドの日本語設定が行われていなくても、gv, evince, gs, dvipdf, ps2pdf, pdf2ps コマンドは正しく動作するようである。 == 参考: コマンドのメモ == [[https://web.archive.org/web/20181005082653/http://be.nucl.ap.titech.ac.jp/~koba/cgi-bin/moin.cgi/TeX%20Live%202013%20on%20Scientific%20Linux%206.4|このアーカイブ]]から表を引用し修正する。コマンドに対するメモは以下の通り。 || コマンド ||gs コマンド<
>の使用||フォントの埋め込み ||備考 || || platex || || || || || dvipdfmx || ||行う ||gsとは独立に<
>日英のフォントを埋め込む || || dvipdf||使用 ||行う ||dvips と ps2pdf を呼んでいる<
>ただのシェルスクリプト|| || dvips || 使用 ||行う ||gsを用いて<
>日英のフォントを埋め込む || || pxdvi || || || || || gv (for PS) ||使用 || ||PS を表示する際、gs を使う。 || || gv (for PDF) ||使用 || ||PDF を表示する際、pdf2ps コマンドを<
>使って PS に変換している。 || || evince (for PS) ||使用 || ||PS を表示する際、gs を使う。 || || evince (for PDF) || || || || || gs ||使用 ||行う? ||下記参照 || || ps2pdf || 使用 || 行う || gs のラッパー || || pdf2ps || 使用 || 行う || gs のラッパー || || latex || || || || || xdvi || || || || '''gs について'''  入力ファイルにフォントが埋め込まれていない場合、gs は設定に従いフォントを参照する。入力ファイルに日本語フォントが埋め込まれていない場合、gs の日本語の設定が正しくされていないと、エラーとなったり、出力結果が文字化けする。gs の出力ファイルには、設定に従ったフォントが埋め込まれる。入力ファイルにフォントが埋め込まれている場合、特に問題は起きないようだ。