LoginSignup
1
0

More than 1 year has passed since last update.

[LaTeX][Fedora]latexindentコマンドを動かすまで

Last updated at Posted at 2021-06-21

環境

  • Fedora35
    • perl5.34.0
  • texlive2021
    • latexindent3.9.3

背景

texliveでLaTeX環境をインストールし、VSCodeを使ってLaTeXを書いている。

文書の整形を行ないたくLaTeX Workshopを入れてみたのだが、下記のようなエラーが出てうまく動作しなかった。

Formatting failed. Please refer to LaTeX Workshop Output for details.

ネットで色々と調べると、LaTeX Workshopのフォーマッタの本体はtexliveに同梱されているlatexindentコマンドであるようで、このコマンドが正常に実行されていなかったようだ。

ちなみにlatexindentコマンドをコンソールで動かすと次のようなエラーが出ていた。

$ latexindent --version
Can't locate FindBin.pm in @INC (you may need to install the FindBin module) (@INC contains: /usr/local/lib64/perl5/5.34 /usr/local/share/perl5/5.34 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at /usr/local/texlive/2021/bin/x86_64-linux/latexindent line 22.
BEGIN failed--compilation aborted at /usr/local/texlive/2021/bin/x86_64-linux/latexindent line 22.

解決策

このコマンドを動かすにはPerlのモジュールを追加でインストールしてやる必要があるようだ。
たとえば次のようにしたら正常に動くようになった。

sudo dnf install perl-FindBin perl-open perl-YAML perl-YAML-Tiny perl-File-HomeDir perl-Unicode-LineBreak

CPANはあまりつかったことがなかったので、OS標準のパッケージ管理ソフトdnfでやってしまったがCPAN経由で入れるのが正攻法だとは思う1

参考リンク


  1. Can't locate Unicode/GCString.pm in @INC (you may need to install the Unicode::GCString module)というエラーが出た時、どのパッケージにこのモジュールが入っているのかわからず10分くらい悩んだ。結局perl-Unicode-LineBreakパッケージの中に入っていたのだが、CPANが使えたら悩む必要がなかった。 

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