This is the easiest and most painless way to install latex packages I have found on ubuntu. Then the extra installed packages per discussion below are easily transported between my home/laptop computers. The texmf folder just needs to be copied between computers or just the newly installed packages copy over. Some preliminaries below and then the directions follow:
$HOME = User's Home Folder
$PACKAGE = Downloaded Package (natbib will be used throughout but could be any package in CTan or provided by a journal. Just replace journal or package name where natbib is below)
1. Create a folder in your home folder that will contain all the user installed tex files. The location should be in $HOME/texmf (the -p just ensures all directories in the path that are not there will be created):
mkdir -p ~/texmf/tex/latex/natbib
mkdir -p ~/texmf/bibtex/bst/natbib
mkdir -p ~/texmf/docs/natbib
mkdir -p ~/texmf/fonts/natbib
2. This step depends on whether the class files .cls or .sty were provided in the download or you need to run a *.ins file to create the .cls or .sty files. This will probably be told to you in a readme or install file but for natbib this is required but for a lot of journal packages the .cls files are provided already. The documentation is contained in .dtx files so if documentation is required also need to run latex on these files. Make sure you go to the directory where the package is located to run this and subsequent commands (eg. cd ~/Downloads/natbib):
latex natbib.ins
latex natbib.dtx (might need to run multiple times to get all cross-references correct just like a normal latex document. If you want a .pdf instead of a .dvi here run pdflatex instead of latex or you can run both multiple times to produce both a .dvi and .pdf)
3. Take the (.cls or .sty) files and place them in a folder inside the texmf directory structure you created above in the correct location. The *.cls and *.sty go in the tex directory structure where is the .bst goes in the bibtex directory structure.
cp *.cls *.sty ~/texmf/tex/latex/natbib
cp *.bst ~/texmf/bibtex/bst/natbib
cp *.dvi *.pdf ~/texmf/docs/natbib
cp *.fd *.mf *.pfb *.afm *.tfm *.vf ~/texmf/fonts/natbib (Not required for natbib but fonts may come with some packages. Can also place fonts in folders categorized by the type above but I don't install enough packages that I deem this necessary. You can see in the system install this is what they do.)
4. Run the command texhash on the texmf directories so it updates the system so it knows of the newly installed packages.
texhash ~/texmf
5. Enjoy the newly installed packages.
Notes on the above:
1. Tex actually searches your home folder first before the system path of /usr/share/texmf-texlive or /usr/local/share/texmf. Due to this, if new or updated packages are placed in ~/texmf they will replace the older packages found in the system install. If you need the newest natbib and follow the above, it will be found before the system natbib install and the newest version is a go.
2. /usr/local/share/texmf is the location to put system wide changes made to tex for all users. If this is desired follow similar instructions to above for this folder but will need to use sudo and then just run sudo texhash at the end. It automatically runs in /usr/local/share/texmf when run with sudo.
3. More detailed but very general instructions for installing latex packages can be found here:Installing Extra Latex Packages
4. /usr/share/texmf-texlive is where the system tex and latex reside so look here if interested in keeping the same directory structure or for other issues.
Essential, efficient, and effective tools for any researcher working on a linux / ubuntu system. Great information for those just starting Masters or PhD research or any researcher moving to Linux from another system. This essentially will be a guide across a series of blog postings to tools available, how to get them working properly, and the ways I have found most effective to use them. Also anything else random I deem as useful to somebody using Ubuntu/Linux.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment