全角スペースから始まるverbatim環境でエラー

全角スペースから始まるverbatim環境でエラー

- 齊藤 年秀 の投稿
返信数: 2
LuaLaTeX と jlreq の環境で,全角スペースから始まるverbatim環境でエラーになりました.upLaTeX ではエラーにならないようなので念のため,報告します.

% cat tmp.tex
\documentclass[a4paper]{jlreq}
\begin{document}
\begin{verbatim}
全角スペースから始まるverbatim環境でエラー.
\end{verbatim}
\end{document}

% lualatex ~/tmp
(中略)
ABD: EverySelectfont initializing macros
! Missing number, treated as zero.
<to be read again>
\ltj@reset@globaldefs
l.7 \end{verbatim}

?


% lualatex --version
This is LuaHBTeX, Version 1.12.0 (TeX Live 2020)

Execute 'luahbtex --credits' for credits and version details.

There is NO warranty. Redistribution of this software is covered by
the terms of the GNU General Public License, version 2 or (at your option)
any later version. For more information about these matters, see the file
named COPYING and the LuaTeX source.

LuaTeX is Copyright 2020 Taco Hoekwater and the LuaTeX Team.

齊藤 年秀 への返信

Re: 全角スペースから始まるverbatim環境でエラー

- 北川 弘典 の投稿
LuaTeX-ja の \lastnodechar 命令の実装に関わるバグでした.すみません.

luatexja.lua の 351 行目を次のように変更(「tex.sprint(-2, r)」と「-2, 」を追加)すると直ると思います.
========
--- a/src/luatexja.lua
+++ b/src/luatexja.lua
@@ -351,7 +351,7 @@ do
            r = tostring(n.char)
          end
      end
-      tex.sprint(r)
+      tex.sprint(-2, r)
    end
end
========
北川 弘典 への返信

Re: 全角スペースから始まるverbatim環境でエラー

- 齊藤 年秀 の投稿
/usr/local/texlive/2020/texmf-dist/tex/luatex/luatexja/luatexja.lua に修正を加えるとコンパイルが通ることを確認しました.ありがとうございました.

(ソースのコンパイルや,tlmgr update といった作業になるのかと思ったのですが,大変簡単で驚きました.また,最初のメールで説明のところの全角スペースが消えているなど,要領を得ておらずすみませんでした.)