🟩 もくじ
参考になったサイト
■LaTeX でスタイルファイル (.sty) の置き場所と反映方法メモ – みんな重力のせい
パッケージファイル〔.sty〕は、LaTeXファイルのプリアンブルに長々とコマンドが並んでいるのを、外部ファイルにして、外部ファイル参照するだけの仕組みでしかない
プリアンブルに長々とコマンドが並んでいるのを、例えば、[annai-hyouji.sty]という外部ファイルに移し替えて、プリアンブルで以下のように呼び出すだけのことである。
\usepackage{annai-hyouji}
\usepackage{annai-hyouji}などを行なっても[! LaTeX Error: File `annai-hyouji.sty’ not found.]などのエラー表示が出てしまう場合、どうすればいいのか?
C:\Users\pure\Desktop\BATCH>cd C:\Users\pure\Documents\2023-09-27-LaTeX
C:\Users\pure\Documents\2023-09-27-LaTeX>lualatex test.tex
This is LuaHBTeX, Version 1.17.0 (TeX Live 2023)
restricted system commands enabled.
(./test.tex
LaTeX2e <2023-06-01> patch level 1
L3 programming layer <2023-08-29>
(c:/texlive/2023/texmf-dist/tex/latex/plautopatch/plautopatch.sty)
(c:/texlive/2023/texmf-dist/tex/latex/jlreq/jlreq.cls
Document Class: jlreq 2023/06/19 jlreq
(c:/texlive/2023/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty
(c:/texlive/2023/texmf-dist/tex/latex/l3kernel/expl3.sty
(c:/texlive/2023/texmf-dist/tex/latex/l3backend/l3backend-luatex.def)))
(c:/texlive/2023/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
(c:/texlive/2023/texmf-dist/tex/latex/jlreq/jlreq-helpers.sty)
jlreq guessed engine: lualatex
(c:/texlive/2023/texmf-dist/tex/luatex/luatexja/luatexja.sty
(c:/texlive/2023/texmf-dist/tex/luatex/luatexja/luatexja-core.sty
(c:/texlive/2023/texmf-dist/tex/luatex/luatexbase/luatexbase.sty
(c:/texlive/2023/texmf-dist/tex/luatex/ctablestack/ctablestack.sty))
(c:/texlive/2023/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty)
(c:/texlive/2023/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty
(c:/texlive/2023/texmf-dist/tex/generic/infwarerr/infwarerr.sty)
(c:/texlive/2023/texmf-dist/tex/generic/iftex/iftex.sty))
(c:/texlive/2023/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(c:/texlive/2023/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(c:/texlive/2023/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(c:/texlive/2023/texmf-dist/tex/generic/xkeyval/keyval.tex))))
(c:/texlive/2023/texmf-dist/tex/latex/everyhook/everyhook.sty
(c:/texlive/2023/texmf-dist/tex/latex/svn-prov/svn-prov.sty))
(c:/texlive/2023/texmf-dist/tex/luatex/luatexja/ltj-base.sty)
(c:/texlive/2023/texmf-dist/tex/luatex/luatexja/ltj-latex.sty
(c:/texlive/2023/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
(c:/texlive/2023/texmf-dist/tex/latex/base/tuenc.def))
(c:/texlive/2023/texmf-dist/tex/luatex/luatexja/patches/lltjdefs.sty
(c:/texlive/2023/texmf-dist/tex/luatex/jlreq/jfm-jlreqv.lua)
(c:/texlive/2023/texmf-dist/tex/luatex/jlreq/jfm-jlreq.lua))
(c:/texlive/2023/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty)
(c:/texlive/2023/texmf-dist/tex/luatex/luatexja/patches/lltjp-atbegshi.sty)
(c:/texlive/2023/texmf-dist/tex/luatex/luatexja/patches/lltjp-geometry.sty
(c:/texlive/2023/texmf-dist/tex/generic/iftex/ifluatex.sty))))
(c:/texlive/2023/texmf-dist/tex/luatex/luatexja/luatexja-compat.sty))
(c:/texlive/2023/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty)
(c:/texlive/2023/texmf-dist/tex/latex/lm/lmodern.sty)
(c:/texlive/2023/texmf-dist/tex/latex/jlreq/jlreq-complements.sty
(c:/texlive/2023/texmf-dist/tex/latex/filehook/filehook.sty
(c:/texlive/2023/texmf-dist/tex/latex/filehook/filehook-2020.sty))))
(c:/texlive/2023/texmf-dist/tex/latex/marginfix/marginfix.sty)
(c:/texlive/2023/texmf-dist/tex/luatex/luatexja/addons/luatexja-preset.sty)
(c:/texlive/2023/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(c:/texlive/2023/texmf-dist/tex/latex/amsmath/amstext.sty
(c:/texlive/2023/texmf-dist/tex/latex/amsmath/amsgen.sty))
(c:/texlive/2023/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(c:/texlive/2023/texmf-dist/tex/latex/amsmath/amsopn.sty))
(c:/texlive/2023/texmf-dist/tex/latex/unicode-math/unicode-math.sty
(c:/texlive/2023/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty
(c:/texlive/2023/texmf-dist/tex/latex/l3packages/xparse/xparse.sty)
(c:/texlive/2023/texmf-dist/tex/latex/fontspec/fontspec.sty
(c:/texlive/2023/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
(c:/texlive/2023/texmf-dist/tex/latex/base/fontenc.sty)
(c:/texlive/2023/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
(c:/texlive/2023/texmf-dist/tex/luatex/luatexja/patches/lltjp-fontspec.sty)
(c:/texlive/2023/texmf-dist/tex/latex/base/fix-cm.sty
(c:/texlive/2023/texmf-dist/tex/latex/base/ts1enc.def))
(c:/texlive/2023/texmf-dist/tex/lualatex/lualatex-math/lualatex-math.sty)
(c:/texlive/2023/texmf-dist/tex/latex/unicode-math/unicode-math-table.tex)))
(c:/texlive/2023/texmf-dist/tex/luatex/luatexja/patches/lltjp-unicode-math.sty)
(c:/texlive/2023/texmf-dist/tex/platex/pxrubrica/pxrubrica.sty)
(c:/texlive/2023/texmf-dist/tex/latex/pgf/frontendlayer/tikz.sty
(c:/texlive/2023/texmf-dist/tex/latex/pgf/basiclayer/pgf.sty
(c:/texlive/2023/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty
(c:/texlive/2023/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex
(c:/texlive/2023/texmf-dist/tex/generic/pgf/pgf.revision.tex)))
(c:/texlive/2023/texmf-dist/tex/latex/pgf/basiclayer/pgfcore.sty
(c:/texlive/2023/texmf-dist/tex/latex/graphics/graphicx.sty
(c:/texlive/2023/texmf-dist/tex/latex/graphics/graphics.sty
(c:/texlive/2023/texmf-dist/tex/latex/graphics/trig.sty)
(c:/texlive/2023/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(c:/texlive/2023/texmf-dist/tex/latex/graphics-def/luatex.def)))
(c:/texlive/2023/texmf-dist/tex/latex/pgf/systemlayer/pgfsys.sty
(c:/texlive/2023/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex
(c:/texlive/2023/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
(c:/texlive/2023/texmf-dist/tex/generic/pgf/utilities/pgfkeyslibraryfiltered.co
de.tex)) (c:/texlive/2023/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-luatex.def
(c:/texlive/2023/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def))
)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex
)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex
)) (c:/texlive/2023/texmf-dist/tex/latex/xcolor/xcolor.sty
(c:/texlive/2023/texmf-dist/tex/latex/graphics-cfg/color.cfg)
(c:/texlive/2023/texmf-dist/tex/latex/graphics/mathcolor.ltx))
(c:/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex
(c:/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
(c:/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.te
x)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric
.code.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.t
ex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.co
de.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex
)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.te
x)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex
)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerarithm
etics.code.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex))
(c:/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfint.code.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconstruct.cod
e.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage.code.te
x)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code
.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.c
ode.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.code.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.code.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathprocessing.co
de.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex
) (c:/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.code.tex
)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransparency.code
.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.code.tex
) (c:/texlive/2023/texmf-dist/tex/generic/pgf/basiclayer/pgfcorerdf.code.tex)))
(c:/texlive/2023/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.code.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex)
(c:/texlive/2023/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-0-65.st
y)
(c:/texlive/2023/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-1-18.st
y)) (c:/texlive/2023/texmf-dist/tex/latex/pgf/utilities/pgffor.sty
(c:/texlive/2023/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty
(c:/texlive/2023/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex))
(c:/texlive/2023/texmf-dist/tex/latex/pgf/math/pgfmath.sty
(c:/texlive/2023/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex))
(c:/texlive/2023/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex))
(c:/texlive/2023/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex
(c:/texlive/2023/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.co
de.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/modules/pgfmodulematrix.code.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzli
brarytopaths.code.tex)))
(c:/texlive/2023/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzli
braryintersections.code.tex
(c:/texlive/2023/texmf-dist/tex/generic/pgf/libraries/pgflibraryintersections.c
ode.tex
(c:/texlive/2023/texmf-dist/tex/generic/pgf/libraries/pgflibraryfpu.code.tex)))
(c:/texlive/2023/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzli
brarycalc.code.tex)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.meta.cod
e.tex)
! LaTeX Error: File `annai-hyouji.sty' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)
Enter file name:
手順1《0》自作したパッケージファイル〔.sty〕のバックアップを取っておく|新しいTeX Liveをインストールするときにディレクトリごと消されるかもしれないから
手順2《1》コマンドプロンプトにおいて[kpsewhich -var-value=TEXINPUTS.latex]を実行することで、TeXがどのディレクトリをパッケージとして認識するのかを確認する
Microsoft Windows [Version 10.0.19045.3758]
(c) Microsoft Corporation. All rights reserved.
C:\Users\pure>kpsewhich -var-value=TEXINPUTS.latex
.;{{}C:/Users/pure/.texlive2023/texmf-config,C:/Users/pure/.texlive2023/texmf-var,C:/Users/pure/texmf,!!C:/texlive/texmf-local,!!C:/texlive/2023/texmf-config,!!C:/texlive/2023/texmf-var,!!C:/texlive/2023/texmf-dist}/tex/{latex,generic,}//
C:\Users\pure>
手順3《2》例えば、[C:/texlive/texmf-local]に、自作したパッケージファイル〔.sty〕をコピーする
copy C:\hogehoge\fugafuga\naninani.sty C:\texlive\texmf-local
手順4《3》コマンドプロンプトにおいて[mktexlsr]を実行する〔ls-Rというファイルが更新される〕|■作業完了
Microsoft Windows [Version 10.0.19045.3758]
(c) Microsoft Corporation. All rights reserved.
C:\Users\pure>mktexlsr
mktexlsr: Updating C:/texlive/texmf-local/ls-R...
mktexlsr: Updated C:/texlive/texmf-local/ls-R.
mktexlsr: Updating C:/texlive/2023/texmf-config/ls-R...
mktexlsr: Updated C:/texlive/2023/texmf-config/ls-R.
mktexlsr: Updating C:/texlive/2023/texmf-var/ls-R...
mktexlsr: Updated C:/texlive/2023/texmf-var/ls-R.
mktexlsr: Updating C:/texlive/2023/texmf-dist/ls-R...
mktexlsr: Updated C:/texlive/2023/texmf-dist/ls-R.
mktexlsr: Done.
C:\Users\pure>