I am attempting to add the subfloat.sty file to my LaTeX search path. In order to find that path, I executed:

kpsewhich -var-value=TEXMFHOME

which, as expected, gave


However, there are no subdirectories associated with that (seemingly empty) path, and I cannot even cd to ~/texmf nor copy files to this directory (consequently, I cannot move the .sty file into any subdirectory). However, I can run LaTeX successfully, including various other packages without error, so obviously it's looking for and finding them in some directory path, just not the one indicated.

Does anyone have any suggestions for how to trouble-shoot this problem?

  • TEXINPUTS is the variable you want to inspect Jan 2, 2017 at 20:11
  • If you have texlive or miktex you should just be able to update via the package manager. Jan 2, 2017 at 20:12
  • Note that subfloat.sty should be located (if in TEXMFHOME) in /home/max/texmf/tex/latex unless you have already fiddled with TEXINPUTS, texmf.cnf, etc. That is, TEXMFHOME should follow the pattern of TEXMFMAIN. I'm guessing if you 'cannot even cd to ~/texmf', then that means you have not created the folder yet..?
    – jon
    Jan 2, 2017 at 20:28
  • And are you sure you don't already have subfloat.sty installed? (Check with kpsewhich subfloat.sty.)
    – jon
    Jan 2, 2017 at 20:29
  • I don't have subfloat.sty.
    – Max
    Jan 2, 2017 at 21:10

1 Answer 1


The package subfloat.sty should be added to the LaTeX search path, i.e., if you have an openSUSE Linux machine, generally it is found to be in:




If you have never added manually to your LaTeX distribution a package for the only user max, the directory ~/texmf shouldn't exist. Furthermore, if you haven't added any other path to your TEXMFHOME, all the folders containing your LaTeX packages should be grouped in /usr/share/texmf/tex/latex.

The variables TEXMFHOME and your TEXMFDIST are defined in:

max@hostname ~: $ echo `kpsewhich texmf.cnf`

which should give as a result /etc/texmf/web2c/texmf.cnf.

Now, if the result of the following bash script is a message showing the word Yes or the word Nes (to execute a bash script: save it to a file named compare.sh, give it the proper permissions via chmod +x compare.sh and execute it via ./compare.sh):

if grep -q "TEXMFDIST = /usr/share/texmf" `kpsewhich texmf.cnf`; then
    if grep -q "TEXMFHOME = {~/texmf" `kpsewhich texmf.cnf`; then
        echo "Yes"
        echo "Nes"
    echo "No"

then you could try to follow this procedure:

  1. Download the package subfloat from CTAN: Direc­tory macros/latex/contrib/subfloat (wget is needed)
  2. unpack the package subfloat.zip;
  3. Run the script subfloat.ins;
  4. Copy subfloat.sty to your LaTeX search path;
  5. Optionally, copy the documentation in the documentation directory;
  6. Update your LaTeX distribution.
max@hostname ~: $ wget mirrors.ctan.org/macros/latex/contrib/subfloat.zip # download link for subfloat, if you don't trust this, you can download it manually
max@hostname ~: $ unzip subfloat.zip
max@hostname ~: $ cd subfloat
max@hostname ~/subfloat: $ latex subfloat.ins
max@hostname ~/subfloat: $ sudo mkdir /usr/share/texmf/tex/latex/subfloat
max@hostname ~/subfloat: $ sudo mkdir -p /usr/share/texmf/doc/subfloat
max@hostname ~/subfloat: $ sudo cp subfloat.sty /usr/share/texmf/tex/latex/subfloat/
max@hostname ~/subfloat: $ sudo cp subfloat.pdf /usr/share/texmf/doc/subfloat
max@hostname ~/subfloat: $ sudo texhash # update your LaTeX distribution
  • This looks like the TeX distribution was installed from a package manager (e.g., Apt), not from upstream from TUG (i.e., 'vanilla' TeX), so these instructions are not generalized to a 'Linux machine'. You also should not install the documentation in the same folder as the .sty file; use the result from kpsewhich TEXDOCS (likely, in this case, to be $TEXMFMAIN/doc/latex/subfloat).
    – jon
    Jan 3, 2017 at 3:09
  • I edited my answer. I hope it is correct. However, this does not seem to be the case of a guy which installed TeX distribution from TUG, but I might be wrong. That's why now I will ask to @Max, what type od TeX distribution is installed on your machine? Jan 3, 2017 at 3:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .