如何设置 TEXMFHOME 以使其正常工作

如何设置 TEXMFHOME 以使其正常工作

install-tl我已使用该选项在 OS X 上安装了 Tex Live -portable。(我无法使用 MacTeX,因为我没有该特定机器的管理员权限。)

安装后,我运行

tlmgr conf texmf TEXMFHOME "~/texmf"

正如这个答案所建议的那样

如何让 LaTeX 看到本地 texmf 树

并把东西放在

~/texmf/latex

但我收到了一个错误。

!LaTeX 错误:未找到文件。

kpsewhich --var-value TEXMFHOME

返回

~/texmf

所以我认为它应该有效。

我究竟做错了什么?

答案1

首先要注意的是当地的树和你的树。默认情况下,它们位于不同位置,并以不同的方式进行搜索。

kpsewhich -var-value TEXMFHOME

返回您的个人树的当前位置。

然而,这还不够。TeX 会在特定位置查找特定类型的文件。例如,它会在某些目录中查找.sty.cls.tex文件,但在其他目录中则不会。同样,它也会查找.bibbst文件等等。

找出放置物品位置的最简单方法通常是模仿主分布树的结构。

ls $(kpsewhich -var-value TEXMFDIST)

显示顶级目录。.sty.cls文件位于 下的子目录中tex/latex/.bib文件位于 下的子目录中,bibtex/bib/等等。

查询搜索路径的另一种方法。例如

kpsewhich -show-path=bib

将告诉我 BibTeX 将在哪里寻找.bib文件。

kpsewhich -show-path=tex

将告诉我 TeX 将在哪里寻找.tex文件。

.sty但是,如何使用此方法获取和文件的搜索路径尚不清楚.cls

kpsewhich -show-path=sty

返回错误。要确定哪些值是可接受的,您可以显示完整列表

kpsewhich -help-format

在我的系统上,返回

kpathsea version 6.2.1

Recognized Kpathsea format names and their (abbreviations) and suffixes:
gf: gf  [variables: GFFONTS GLYPHFONTS TEXFONTS]
  [original path (from texmf.cnf) = .:$TEXMF/fonts/gf/$MAKETEX_MODE//]
pk: pk  [variables: PKFONTS TEXPKS GLYPHFONTS TEXFONTS]
  [original path (from texmf.cnf) = .:{$TEXMF/fonts,$VARTEXFONTS}/pk/{$MAKETEX_MODE,modeless}//]
bitmap font (bitmapfont):  [variables: GLYPHFONTS TEXFONTS]
  [original path (from texmf.cnf) = .:$TEXMF/fonts]
tfm: .tfm  [variables: TFMFONTS TEXFONTS]
  [original path (from texmf.cnf) = .:{$TEXMF/fonts,$VARTEXFONTS}/tfm//]
afm: .afm  [variables: AFMFONTS TEXFONTS]
  [original path (from texmf.cnf) = .:$TEXMF/fonts/afm//:$OSFONTDIR//]
base: .base  [variables: MFBASES TEXMFINI]
  [original path (from texmf.cnf) = .:$TEXMF/web2c{/$engine,}]
bib: .bib  [variables: BIBINPUTS TEXBIB]
  [original path (from texmf.cnf) = .:$TEXMF/bibtex/bib//]
bst: .bst  [variables: BSTINPUTS]
  [original path (from texmf.cnf) = .:$TEXMF/bibtex/{bst,csf}//]
cnf: .cnf  [variables: TEXMFCNF]
  [original path (from compile-time paths.h) = {$SELFAUTOLOC,$SELFAUTOLOC/share/texmf-local/web2c,$SELFAUTOLOC/share/texmf-dist/web2c,$SELFAUTOLOC/share/texmf/web2c,$SELFAUTOLOC/texmf-local/web2c,$SELFAUTOLOC/texmf-dist/web2c,$SELFAUTOLOC/texmf/web2c,$SELFAUTODIR,$SELFAUTODIR/share/texmf-local/web2c,$SELFAUTODIR/share/texmf-dist/web2c,$SELFAUTODIR/share/texmf/web2c,$SELFAUTODIR/texmf-local/web2c,$SELFAUTODIR/texmf-dist/web2c,$SELFAUTODIR/texmf/web2c,$SELFAUTOGRANDPARENT/texmf-local/web2c,$SELFAUTOPARENT,$SELFAUTOPARENT/share/texmf-local/web2c,$SELFAUTOPARENT/share/texmf-dist/web2c,$SELFAUTOPARENT/share/texmf/web2c,$SELFAUTOPARENT/texmf-local/web2c,$SELFAUTOPARENT/texmf-dist/web2c,$SELFAUTOPARENT/texmf/web2c}]
ls-R: ls-R ls-r  [variables: TEXMFDBS]
  [original path (from texmf.cnf) = {!!$TEXMFSYSCONFIG,!!$TEXMFSYSVAR,!!$TEXMFLOCAL,!!$TEXMFDIST,$TEXMFARCH}]
fmt: .fmt  [variables: TEXFORMATS TEXMFINI]
  [original path (from texmf.cnf) = .:$TEXMF/web2c{/$engine,}]
map: .map  [variables: TEXFONTMAPS TEXFONTS]
  [original path (from texmf.cnf) = .:$TEXMF/fonts/map/{$progname,pdftex,dvips,}//]
mem: .mem  [variables: MPMEMS TEXMFINI]
  [original path (from texmf.cnf) = .:$TEXMF/web2c{/$engine,}]
mf: .mf  [variables: MFINPUTS]
  [original path (from texmf.cnf) = .:$TEXMF/metafont//:{$TEXMF/fonts,$VARTEXFONTS}/source//]
mfpool: .pool  [variables: MFPOOL TEXMFINI]
  [original path (from texmf.cnf) = ${TEXPOOL}]
mft: .mft  [variables: MFTINPUTS]
  [original path (from texmf.cnf) = .:$TEXMF/mft//]
mp: .mp  [variables: MPINPUTS]
  [original path (from texmf.cnf) = .:$TEXMF/metapost//]
mppool: .pool  [variables: MPPOOL TEXMFINI]
  [original path (from texmf.cnf) = ${TEXPOOL}]
MetaPost support (mpsupport):  [variables: MPSUPPORT]
  [original path (from texmf.cnf) = .:$TEXMF/metapost/support]
ocp: .ocp  [variables: OCPINPUTS]
  [original path (from texmf.cnf) = .:$TEXMF/omega/ocp//]
ofm: .ofm .tfm  [variables: OFMFONTS TEXFONTS]
  [original path (from texmf.cnf) = .:{$TEXMF/fonts,$VARTEXFONTS}/{ofm,tfm}//]
opl: .opl  .pl  [variables: OPLFONTS TEXFONTS]
  [original path (from texmf.cnf) = .:{$TEXMF/fonts,$VARTEXFONTS}/opl//]
otp: .otp  [variables: OTPINPUTS]
  [original path (from texmf.cnf) = .:$TEXMF/omega/otp//]
ovf: .ovf .vf  [variables: OVFFONTS TEXFONTS]
  [original path (from texmf.cnf) = .:{$TEXMF/fonts,$VARTEXFONTS}/{ovf,vf}//]
ovp: .ovp  .vpl  [variables: OVPFONTS TEXFONTS]
  [original path (from texmf.cnf) = .:{$TEXMF/fonts,$VARTEXFONTS}/ovp//]
graphic/figure:  .eps .epsi  [variables: TEXPICTS TEXINPUTS]
  [original path (from texmf.cnf) = .:$TEXMF/tex/{$progname,generic,}//]
tex: .tex  .sty .cls .fd .aux .bbl .def .clo .ldf  [variables: TEXINPUTS]
  [original path (from texmf.cnf) = .:$TEXMF/tex/{$progname,generic,}//]
TeX system documentation (doc):  [variables: TEXDOCS]
  [original path (from texmf.cnf) = $TEXMF/doc//]
texpool: .pool  [variables: TEXPOOL TEXMFINI]
  [original path (from texmf.cnf) = .:$TEXMF/web2c]
TeX system sources (source):  .dtx .ins  [variables: TEXSOURCES]
  [original path (from texmf.cnf) = .:$TEXMF/source//]
PostScript header:  .pro  [variables: TEXPSHEADERS PSHEADERS]
  [original path (from texmf.cnf) = .:$TEXMF/{dvips,fonts/{enc,type1,type42,type3}}//]
Troff fonts (trofffont):  [variables: TRFONTS]
  [original path (from texmf.cnf) = /usr{/local,}/share/groff/{current/font,site-font}/devps]
type1 fonts: .pfa .pfb  [variables: T1FONTS T1INPUTS TEXFONTS TEXPSHEADERS PSHEADERS]
  [original path (from texmf.cnf) = .:$TEXMF/fonts/type1//:$OSFONTDIR//]
vf: .vf  [variables: VFFONTS TEXFONTS]
  [original path (from texmf.cnf) = .:$TEXMF/fonts/vf//]
dvips config (dvipsconfig):  [variables: TEXCONFIG]
  [original path (from texmf.cnf) = $TEXMF/dvips//]
ist: .ist  [variables: TEXINDEXSTYLE INDEXSTYLE]
  [original path (from texmf.cnf) = .:$TEXMF/makeindex//]
truetype fonts: .ttf .ttc .TTF .TTC .dfont  [variables: TTFONTS TEXFONTS]
  [original path (from texmf.cnf) = .:$TEXMF/fonts/{truetype,opentype}//:$OSFONTDIR//]
type42 fonts: .t42 .T42  [variables: T42FONTS TEXFONTS]
  [original path (from texmf.cnf) = .:$TEXMF/fonts/type42//]
web2c files (web2c):  [variables: WEB2C]
  [original path (from texmf.cnf) = $TEXMF/web2c]
other text files (othertext):  [variables: KPSEWHICHINPUTS]
  [original path (from compile-time paths.h) = .:$TEXMF/kpsewhich//]
other binary files (otherbin):  [variables: KPSEWHICHINPUTS]
  [original path (from compile-time paths.h) = .:$TEXMF/kpsewhich//]
misc fonts (miscfont):  [variables: MISCFONTS TEXFONTS]
  [original path (from texmf.cnf) = .:$TEXMF/fonts/misc//]
web: .web  .ch  [variables: WEBINPUTS]
  [original path (from texmf.cnf) = .:$TEXMF/web//]
cweb: .w .web  .ch  [variables: CWEBINPUTS]
  [original path (from texmf.cnf) = .:$TEXMF/cweb//]
enc files: .enc  [variables: ENCFONTS TEXFONTS]
  [original path (from texmf.cnf) = .:$TEXMF/fonts/enc//]
cmap files (cmap):  [variables: CMAPFONTS TEXFONTS]
  [original path (from texmf.cnf) = .:$TEXMF/fonts/cmap//]
subfont definition files: .sfd  [variables: SFDFONTS TEXFONTS]
  [original path (from texmf.cnf) = .:$TEXMF/fonts/sfd//]
opentype fonts: .otf  [variables: OPENTYPEFONTS TEXFONTS]
  [original path (from texmf.cnf) = .:$TEXMF/fonts/{opentype,truetype}//:$OSFONTDIR//]
pdftex config (pdftexconfig):  [variables: PDFTEXCONFIG]
  [original path (from texmf.cnf) = .:$TEXMF/pdftex/{$progname,}//]
lig files: .lig  [variables: LIGFONTS TEXFONTS]
  [original path (from texmf.cnf) = .:$TEXMF/fonts/lig//]
texmfscripts:  [variables: TEXMFSCRIPTS]
  [original path (from texmf.cnf) = $TEXMF/scripts/{$progname,$engine,}//]
lua: .lua .luatex .luc .luctex .texlua .texluc .tlu  [variables: LUAINPUTS]
  [original path (from texmf.cnf) = .:$TEXMF/scripts/{$progname,$engine,}/{lua,}//:$TEXMF/tex/{luatex,plain,generic,}//]
font feature files: .fea  [variables: FONTFEATURES]
  [original path (from texmf.cnf) = .:$TEXMF/fonts/fea//]
cid maps: .cid .cidmap  [variables: FONTCIDMAPS]
  [original path (from texmf.cnf) = .:$TEXMF/fonts/cid//]
mlbib: .mlbib .bib  [variables: MLBIBINPUTS BIBINPUTS TEXBIB]
  [original path (from texmf.cnf) = .:$TEXMF/bibtex/bib/{mlbib,}//]
mlbst: .mlbst .bst  [variables: MLBSTINPUTS BSTINPUTS]
  [original path (from texmf.cnf) = .:$TEXMF/bibtex/{mlbst,bst}//]
clua: .dll .so  [variables: CLUAINPUTS]
  [original path (from texmf.cnf) = .:$SELFAUTOLOC/lib/{$progname,$engine,}/lua//]
ris: .ris  [variables: RISINPUTS]
  [original path (from texmf.cnf) = .:$TEXMF/bibtex/ris//]
bltxml: .bltxml  [variables: BLTXMLINPUTS]
  [original path (from texmf.cnf) = .:$TEXMF/bibtex/bltxml//]

To see paths after expansion, use --show-path=FMT.

Email bug reports to [email protected].

最好与以下方法一起使用grep,否则您可能永远找不到所需的内容:

kpsewhich -help-format | grep -1 sty

返回

  [original path (from texmf.cnf) = .:$TEXMF/tex/{$progname,generic,}//]
tex: .tex  .sty .cls .fd .aux .bbl .def .clo .ldf  [variables: TEXINPUTS]
  [original path (from texmf.cnf) = .:$TEXMF/tex/{$progname,generic,}//]

因此我们知道.sty和文件可以在诸如、以及的.cls子目录下的子目录中找到。tex/latex/tex/generic/

通常情况下,会使用另一个子目录来存放属于某个包的文件,例如tex/latex/fancyhdr/或其他什么。这往往比平时更整洁、更合理。

相关内容