tags:

views:

575

answers:

3

Question 1

I am getting the following error in Latex:

! LaTeX Error: File `fancybox.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Enter file name:

However, the file fancybox.sty is actually located in the folder from where I am running the pdflatex command. Why is not able to find it?

I just installed Latex on Ubuntu using the command

apt-get install texlive-latex-base

and the pdflatex command works.

Question 2

I want to install this texments from CTAN. Can I do this through apt-get? Is there another Easy way?

Thanks, Ajay G.

A: 

Have you tried manually as it says in the official Ubuntu documentation?

https://help.ubuntu.com/community/LaTeX

If a package you desire is not in Ubuntu's repositories, you may look on CTAN's web site or TeX Catalogue Online to see if they have the package. If they do, download the archive containing the files. In this example, we'll install example package foo, contained in foo.tar.gz.

Once foo.tar.gz has finished downloading, we unzip it somewhere in our home directory:

tar xvf foo.tar.gz

This expands to folder foo/. We cd into foo/ and see foo.ins. We now run LaTeX on the file:

latex foo.ins

This will generate foo.sty. We now have to copy this file into the correct location. For the purposes of this example, we will copy this into our personal texmf tree. The advantages of this solution are that if we migrate our files to a new computer, we will remember to take our texmf tree with us, resulting in keeping the same packages we had. The disadvantages are that if multiple users want to use the same packages, the tree will have to be copied to each user's home folder.

We'll first create the necessary directory structure:

cd ~
mkdir -p texmf/tex/latex/foo

Notice that the final directory created is labeled foo. It is a good idea to name directories after the packages they contain. The -p attribute to mkdir tells it to create all the necessary directories, since they don't exist. Now, using either the terminal, or the file manager, copy foo.sty into the directory labeled foo.

Now, we must make LaTeX recognize the new package:

texhash ~/texmf

The new package should now be installed. To use it in your LaTeX document, merely insert \usepackage{foo} in the preamble.

davidrobles
+1  A: 

The fancybox LaTeX package is included in the texlive-latex-extra package for Ubuntu. If you install the texlive-latex-extra package using Synaptic or apt-get, your document should compile:

$ sudo apt-get install texlive-latex-extra

A couple other things that may help you in the future:

  1. The TeXLive installation in Ubuntu is currently the 2007 edition. The 2009 edition of TeXLive was just released recently (see the TeXLive website for downloads). The 2007 edition will work most of the time, but the 2009 edition contains the latest version of the packages with their bug fixes. Just a heads-up.

  2. I'd recommend installing the full set of TeXLive package under Ubuntu so that you don't have to dig through the repository and install new files each time you want to add a new \usepackage line to your .tex file. If you install the texlive-full package, that'll cover all the bases:

    $ sudo apt-get install texlive-full
    

    Note, however, that the full TeXLive package set is a large download and will take some time to install.

godbyk
A: 

It should work with the style file in the directory from where you were running the pdflatex command, but a solution to this problem is simple:

$ sudo cp *.sty /usr/share/texmf-texlive/tex/latex/base/

$ sudo mktexlsr

Good Luck!

Paulo