adbird(広告鳥) 備忘録

Texエラー対処方法(tlmgrでパッケージをインストール)

texliveをfull schemeではなく、「basic scheme +アルファ」でインストールすると、full schemeではインストールされていたのかもしれないパッケージ等が入っていなくて、エラーが出ることがある。

その対処方法。

なお、「tlmgr」とは「TeX Live Manager」の略。

目次

事例1

\usepackage{titlesec}を使ったら、titlesecというパッケージが見つからなかったとエラーが出た。

$ tlmgr info titlesecでチェックしてみる。

$ tlmgr info titlesec
package:     titlesec
category:    Package
shortdesc:   Select alternative section titles
longdesc:    A package providing an interface to sectioning commands for selection from various title styles. E.g., marginal titles and to change the font of all headings with a single command, also providing simple one-step page styles. Also includes a package to change the page styles when there are floats in a page. You may assign headers/footers to individual floats, too.
installed:   No
sizes:       doc: 741k, run: 97k
relocatable: Yes
cat-version: 2.14
cat-license: mit
cat-topics:  headings page-hf
cat-related: fancyhdr titleps sectsty titletoc tocloft
cat-contact-bugs: https://github.com/jbezos/titlesec/issues
cat-contact-repository: https://github.com/jbezos/titlesec
collection:  collection-latexextra

installed: Noとなっているので、titlesecパッケージがインストールされていないことが分かる。

titlesecパッケージをインストールする。(Windowsの場合、sudoはいらない)

$ sudo tlmgr install titlesec

無事、\usepackage{titlesec}が使えるようになった。

事例2

以下、geanyでlualatexを実行したときに出たエラー。

./B6tate.sty:249: Emergency stop.
<read *>
l.249 \makeatletter
 3211 words of node memory still in use:
   6 hlist, 4 rule, 1 dir, 48 kern, 1 glyph, 1167 attribute, 58 glue_spec, 68 a
ttribute_list, 2 if_stack, 1 write, 9 user_defined nodes
   avail lists: 1:10,2:104,3:2,4:2,5:2,7:9,8:3,9:3
./B6tate.sty:249:  ==> Fatal error occurred, no output PDF file produced!
Transcript written on 原稿.log.
コンパイル失敗

これは B6tate.sty (自作スタイルファイル)の249行目でエラーが出たということ。

TeX Wikiによると「状況をつかむためには,エラーメッセージの本体に続く記述(l.### [### はエラーが判明した箇所の行番号]で始まる行までの部分)も調べる必要があることがあります.」(LaTeX のエラーメッセージ - TeX Wiki)とある。

ということは、上記の場合、249行目自体というより、その直前の行が

\usepackage{newunicodechar}

となっているので、もしかしたら、newunicodecharパッケージがインストールされていないのでは?と推測した。

そこで、

$ sudo tlmgr install newunicodechar

で、newunicodecharパッケージをインストールしたら、エラーがでなくなった。

パッケージが見つからない場合

LaTeX パッケージの名前がそのまま tlmgr でインストールされるパッケージの名前になっているとは限らない」(TeX Live をホンキで語る ― 「TeX Live ってなんだろう?」 - Acetaminophen’s diary)らしく、tlmgr でインストールしたいパッケージ(仮にxxx.sty の場合)を見つけられない場合、

$ tlmgr info xxx.sty

$ tlmgr search --global --file xxx.sty

で、xxx.styが入っているパッケージが分かるはずなので、パッケージがわかったら、改めて$ sudo tlmgr installでインストールする。

64bit版インストール後のエラー

tlmgr update --self --all

で、TeXLiveをアップデート後に下記のようなエラーが出て、コンパイルできない現象が発生。

. L3 programming layer <2022-04-29>c:/texlive/2022/texmf-dist/tex/latex/l3kernel
/expl3.lua:245: bad bytecode register
stack traceback:
    [C]: in function 'lua.getbytecode'
    c:/texlive/2022/texmf-dist/tex/latex/l3kernel/expl3.lua:245: in main chunk
    [C]: in function 'require'
    [\directlua]:1: in main chunk.
\lua_now:e #1->\__lua_now:n {#1}

l.1 
  \documentclass{ltjsarticle}
? 
! Emergency stop.
\lua_now:e #1->\__lua_now:n {#1}

l.1 
  \documentclass{ltjsarticle}
End of file on the terminal!

直近でやったことと言えば、64bit版をインストールした(TexLiveを64bit版にしてコンパイル速度を速くする - adbird(広告鳥) 備忘録)ことだったのを思い出し、改めて

fmtutil-sys --all
luaotfload-tool --force --update -vvv

をやったら、直った。

参照