3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

TeX パッケージのstyファイルが読み込まれないときの対処法(ls-R手動編集)

Posted at

jlisting パッケージを入れようと思い,listings パッケージのフォルダにjlisting.styを入れて,mktexlsrを実行したがどうもうまく反映されなかったらしいので,その時にやった対処法を書く.

<筆者の環境>

  • Ubuntu 18.04 LTS
  • TeX Live 2018
bash
cd /usr/local/texlive/2018/texmf-dist/tex/latex/listings
sudo cp ~/jlisting.sty jlisting.sty
sudo chmod 644 jlisting.sty
sudo mktexlsr
mktexlsr: Updating /usr/local/share/texmf/ls-R... 
mktexlsr: Updating /var/lib/texmf/ls-R-TEXLIVEDIST... 
mktexlsr: Updating /var/lib/texmf/ls-R-TEXMFMAIN... 
mktexlsr: Updating /var/lib/texmf/ls-R... 
mktexlsr: Done.

普通ここまでやれば,うまくいくらしいが,コンパイル時に「styファイルが見つからない」旨のエラーが出てしまう.

bash
! LaTeX Error: File `jlisting.sty' not found.

よく見ると,上の部分でtexmfのls-Rは書き換えられてるのに,texmf-distのそれは書き換えられてなかった.なので,手動で書き換えます.

texmf-distまで戻ってから

bash
sudo gedit ls-R

/tex/latex/listingsで検索をかけるとこんなのが出てくる.

ls-R(例)
./tex/latex/listings:
listings-acm.prf
listings-bash.prf
listings-fortran.prf
listings-lua.prf
listings-python.prf
listings.cfg
listings.sty
lstdoc.sty
lstlang1.sty
lstlang2.sty
lstlang3.sty
lstmisc.sty

このリストの一番下に,jlisting.styを追加すればOK.

ちなみに保存時に

** (gedit:29568): WARNING **: 11:50:40.231: Set document metadata failed: metadata::gedit-position という属性値はセットできません

とかいうエラーメッセージが頻繁に出るけど無視して大丈夫です.

3
1
2

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
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?