4

I have installed Tex Live on OS X using the install-tl with the -portable option. (I can't use MacTeX because I don't have admin access on the particular machine.)

Having installed, I ran

tlmgr conf texmf TEXMFHOME "~/texmf"

as suggested in this answer

How to make LaTeX see local texmf tree

and put stuff under

~/texmf/latex

but I get an error.

! LaTeX Error: File not found.

kpsewhich --var-value TEXMFHOME

returns

~/texmf

so I think it should work.

What am I doing wrong?

  • What did you put in ~/texmf/latex? By default, TeX won't look for anything there. Probably, you needed ~/texmf/tex/latex? For example, mypackage.sty would go in ~/texmf/tex/latex/mypackage/mypackage.sty. – cfr Jan 22 '15 at 23:43
  • As cfr explained, your TEXMFHOME directory structure at (now) ~/texmf must mimic the normal TDS, which means LaTeX stuff goes at ~/texmf/tex/latex. I'd do something like mkdir ~/texmf/bibtex/{bib,bst} && mkdir ~/texmf/tex/latex if you plan on using your local tree. – jon Jan 23 '15 at 0:15
  • @jon Should probably note that this is not the local tree but the home/personal one. The local one is given in TEXMFLOCAL. – cfr Oct 7 '15 at 2:05
  • @cfr -- Indeed. Apparently I wrote the last sentence too carelessly. For clarity, the command kpsewhich --var-value can be completed by using TEXMFHOME, TEXMFLOCAL, and TEXMFDIST to learn about the 'home', 'local', and 'system' directories; meanwhile, kpsewhich --var-value TEXMF will list all your 'texmf's in the order (I believe) that they will be searched. – jon Oct 7 '15 at 2:11
7

Note first that there is a difference between the local tree and your home tree. By default, they are in different places and are searched in different ways.

kpsewhich -var-value TEXMFHOME

returns the current location of your personal tree.

However, this isn't enough. TeX looks in specific places for specific kinds of files. For example, it looks for .sty, .cls and .tex files in some directories but not others. Similarly for .bib and bst files and so on.

The easiest way to figure out where to put something is often to mimic the structure of the main distribution tree.

ls $(kpsewhich -var-value TEXMFDIST)

shows the top level directory. .sty and .cls files are in sub-directories under tex/latex/, .bib files in sub-directories under bibtex/bib/ and so on.

Another approach to to query the search path. For example

kpsewhich -show-path=bib

will tell me where BibTeX will look for .bib files.

kpsewhich -show-path=tex

will tell me where TeX will look for .tex files.

However, it is a bit less clear how to use this method to get the search path for .sty and .cls files.

kpsewhich -show-path=sty

returns an error. To figure out which values are acceptable, you can display a full list

kpsewhich -help-format

which, on my system, returns

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 tex-k@tug.org.

This is best used with grep else you may never find what you need:

kpsewhich -help-format | grep -1 sty

returns

  [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,}//]

So we know that .sty and .cls files will be found in sub-directories under sub-directories such as tex/latex/, as well as tex/generic/.

It is usual to use a further sub-directory for files belonging to a package e.g. tex/latex/fancyhdr/ or whatever. This tends to keep things a bit tidier and saner than they might otherwise be.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.