LoginSignup
1
0

latexmkでコンパイルしたときのluatexja.styのエラーの解決法

Posted at

0. はじめに

  • .tex files を latexmk コマンドを使ってコンパイルしたかった.
  • LuaLaTeX を使う.
  • Visual Studio Code を使って .tex files を書いたりプレビューしたりしている.
  • しかし致命的なエラーが出て .tex files のコンパイルと PDF の生成ができなかった.
  • その後,.latexmkrc ファイルに pdflatex コマンドを追加することで問題を解決した.

Keywords

LaTeX, latexmk, VSCode, LuaLaTeX

English version!

1. LaTeX Problems

まずはエラーメッセージをお見せしよう.長い間,とても悩まされていた.

TeX luatexja.sty /usr/local/texlive/2018/texmf-dist/tex/luatex/luatexja/luatexja.sty
    ❌ Undefined control sequence. LaTeX [Ln 42, Col 1] ^
    ❌ ==> Fatal error occurred, no output PDF file produced! LaTeX [Ln 42, Col 1] ^
    Transcript written on "(absolute path)".
    === TeX engine is 'pdfTeX'
    Latexmk: Errors, so I did not complete making targets
all messages
[{
	"resource": "/usr/local/texlive/2018/texmf-dist/tex/luatex/luatexja/luatexja.sty",
	"owner": "LaTeX",
	"severity": 8,
	"message": "Undefined control sequence.",
	"source": "LaTeX",
	"startLineNumber": 42,
	"startColumn": 1,
	"endLineNumber": 42,
	"endColumn": 65536
},{
	"resource": "/usr/local/texlive/2018/texmf-dist/tex/luatex/luatexja/luatexja.sty",
	"owner": "LaTeX",
	"severity": 8,
	"message": " ==> Fatal error occurred, no output PDF file produced!\nTranscript written on \"(absolute path)\".\n=== TeX engine is 'pdfTeX'\nLatexmk: Errors, so I did not complete making targets\n",
	"source": "LaTeX",
	"startLineNumber": 42,
	"startColumn": 1,
	"endLineNumber": 42,
	"endColumn": 65536
}]
Undefined control sequence.
[{
	"resource": "/usr/local/texlive/2018/texmf-dist/tex/luatex/luatexja/luatexja.sty",
	"owner": "LaTeX",
	"severity": 8,
	"message": "Undefined control sequence.",
	"source": "LaTeX",
	"startLineNumber": 42,
	"startColumn": 1,
	"endLineNumber": 42,
	"endColumn": 65536
}]
Fatal error occurred,
[{
	"resource": "/usr/local/texlive/2018/texmf-dist/tex/luatex/luatexja/luatexja.sty",
	"owner": "LaTeX",
	"severity": 8,
	"message": " ==> Fatal error occurred, no output PDF file produced!\nTranscript written on \"(absolute path)\".\n=== TeX engine is 'pdfTeX'\nLatexmk: Errors, so I did not complete making targets\n",
	"source": "LaTeX",
	"startLineNumber": 42,
	"startColumn": 1,
	"endLineNumber": 42,
	"endColumn": 65536
}]

2. 1番目のメッセージ

最初のメッセージを見ると,ソースコードのこの行が問題だとわかる.
これはよくエラーを引き起こすものらしい.

\directlua{require('ltj-unicode-ccfix.lua')}% catcode of ideographs

このメッセージの内容を調べても解決には至らなかったが,このエラーが何かデフォルト言語の選択の困難に起因するものであることが分かった.

3. 2番目のメッセージ

2番目のメッセージを見ると,致命的に実行を妨げているエラーは pdfTeX である事が分かる.

    === TeX engine is 'pdfTeX'

そこで下の文を加えてエラーの原因が確認できるように pdflatex のコマンドを変えた.

$pdflatex = 'lualatex --synctex=1 --halt-on-error --interaction=nonstopmode %O %S';

結果は明白だった.エラーは発生しなかった.

付け加えておくと,latex コマンド は lualatex である.

latex command
$latex = 'lualatex -synctex=1 -interaction=nonstopmode -file-line-error -halt-on-error %O %S';

n. おわりに

pdflatex コマンドの変更によって luatexja.sty における "\directlua{require('ltj-unicode-ccfix.lua')}% catcode of ideographs" のエラーを解消した.

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0