TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


There is a .cls file that pdflatex should use. I have read the following

Using TeX Live 2012, installed into /usr/local/texlive/.

I would like to install the .cls file into $HOME/.texmf (or some other non-standard directory), rather than $HOME/texmf. I thought this would be:

mkdir $HOME/.texmf
initexmf --register-root=$HOME/.texmf
sudo /usr/local/texlive/2012/bin/x86_64-linux/tlmgr conf texmf TEXMFHOME $HOME/.texmf
mv amazingbook.cls $HOME/.texmf
latex amazing-stories-1.tex


The initexmf program does not exist (in TeX Live 2012). I have read that the mktexlsr command is equivalent to initexmf.



mktexlsr $HOME/.texmf
mv amazingbook.cls $HOME/.texmf
mktexlsr $HOME/.texmf

The .cls file cannot be found when running:

pdflatex amazing-stories-1.tex


What are the exact steps necessary to install a custom .cls file into a given directory and configure the environment so that the .cls file is visible from LaTeX using TeX Live 2012?

share|improve this question
AFAIK initexmf is MikTeX-specific; MikTeX can easily handle many texmf trees. – Martin Schröder Feb 6 '13 at 10:34
initexmf is a multi-purpose tool. initexmf --update is the equivalent to mktexlsr, but initexmf --register-root is a (wonderful) miktex specific feature. – Ulrike Fischer Feb 6 '13 at 13:50
up vote 9 down vote accepted

The following commands create the required directory hierarchy and register the .cls file:

mkdir -p $HOME/.texmf/tex/latex/amazing
sudo /usr/local/texlive/2012/bin/x86_64-linux/tlmgr conf texmf TEXMFHOME $HOME/.texmf
mv amazingbook.cls $HOME/.texmf/tex/latex/amazing
mktexlsr $HOME/.texmf
latex amazing-stories-1.tex

The pdflatex command can now find amazingbook.cls.

share|improve this answer

Hello I had the same problem and found a suitable and easy solution.


kpsewhich -var-value=TEXMFHOME

find your personal tex home directory, where you would put your own .cls files. On my Ubuntu with texlive 2013 it will show "~/texmf" which can lead to a misunderstandung.

Check it again with:

kpsepath -n latex tex

which will show all folders where latex will search for .cls files. Here it can be seen that the folder is: ~/texmf/tex/latex. Copy your file in this folder. Make a update with:

sudo mktexlsr

Check if it worked with:

kpsewhich my_class_file.cls

This should show path where you copied the file!

Here are some references: https://www.math.hmc.edu/computing/support/tex/installing/ http://latex-community.org/forum/viewtopic.php?f=24&t=17242

share|improve this answer
Welcome to TeX.SX! – Christian Hupfer May 18 '15 at 15:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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