Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
1
Help us understand the problem. What is going on with this article?
@t_asa

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

More than 1 year has passed since last update.

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 という属性値はセットできません

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

1
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
t_asa

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
1
Help us understand the problem. What is going on with this article?