4

I have the MacTex basic 2015 installed, and when I open a latex file using the command \usepackage{authblk}, TexShop says authblk.sty not found. I've also tried to change that command to \usepackage{preprint}, but it then says preprint.sty not found. But even when I install the preprint package from CTAN, the folder has no .sty files. Only .ins and .dtx files.

How to solve this problem?

  • 1
    ctan doesn't normally have sty, you run tex on the ins to generate the files, but you should not need to do that you can use the texlive manager to install the packages. If you started with the basic rather than full installation what you describe is the expected behaviour for most packages, you need to install them as you need – David Carlisle Jul 13 '16 at 19:01
  • I can't seem to find TexLive on my laptop. Seems like I might have accidentally deleted it. What should I do to reinstall it? – Sidd Jul 13 '16 at 19:09
  • 1
    If you have Basic TeX installed, use TeXLive Utility to install packages. – Alan Munn Jul 13 '16 at 19:12
  • The issue is a bit more complicated than my previous comment, since TeX Live Utility is set up to only install packages from the current year's TeX Live. So it's probably simpler (if you can) to just install a full MacTeX 2016 (instead of Basic TeX) which will save you lots of headaches like this in the future. Or if you really are short on space, install Basic TeX for 2016 and then use TeX Live utility to install the missing packages. Download from here: tug.org/mactex – Alan Munn Jul 13 '16 at 19:27
3

The problem

The Basic TeX distribution installs a limited set of packages, and it is up to you to install other packages manually. The normal way to do this is to use TeX Live Utility, which is not installed with Basic TeX, but can be downloaded here: http://amaxwell.github.io/tlutility/.

However, TeXLive Utility is set up by default to manage only the current year's distribution. This is because of TeX Live's yearly distribution system:

It is possible to use TeX Live Utility to add packages to an older distribution, but it requires changing the repository, and I would not recommend it unless you are sure of what you are doing. The method for doing so is outlined here (although this solution doesn't use TeX Live utility explicitly.)

Possible solutions

There are a few ways you could go to solve this problem.

  1. Perhaps the simplest solution is to abandon Basic TeX altogether, and install the full TeX Live 2016. This will install everything and you will almost never encounter missing package errors again.

  2. If you are really short on space, you could install Basic TeX 2016. Then you can use TeX Live utility to install missing packages. This is the best route if you feel you must use Basic TeX.

    Notice, however, that another drawback of Basic TeX is that there is no simple way to keep track of packages you have installed, so that when you update to the following year, you will have to reinstall those extra packages. See:

  3. A really quick and dirty solution (which I don't recommend) is to install the package manually from CTAN and place it in your local texmf folder. I don't recommend this for various reasons. First, some packages are distributed as .ins + .dtx documents, which require running TeX on the .ins file to generate the .sty file. So installing is not as simple as just copying the file to your local texmf. But a more serious reason for not doing this for any package that is part of TeX Live, is that the local version you install will always take precedence over a newer version if you update your distribution. This can (and likely will) lead to problems in the future. For more information on installing local packages, see:

I really don't recommend Option 3. So personally I would go for Option 1 which will save you lots of hassle in the future.

  • At first I couldn't find the TeX Live Utility anywhere on my Mac even though I just installed Basic TeX 2016. But then I downloaded it from some website. Any reason why I had to download it separately? – Sidd Jul 14 '16 at 9:45
  • 1
    @sidd It seems that Basic TeX doesn't actually come with the GUIs as part of the install, so you have to install them separately. – Alan Munn Jul 14 '16 at 12:33
-1

@AlanMunn & @Sidd: You will not be able to update your BasicTeX 2015 using TeX Live Utility since they have been replaced by BasicTeX (and MacTeX) 2016. TeX Live (and Basic TeX) reside in a directory that is hidden from view by Finder. But that is not the place to put any files. After generating the .sty file as discussed above you should place it in your personal texmf tree at ~/Library/texmf/tex/latex/authblk/. First ~/Library is the Library folder in your HOME folder---NOT the /Library folder at the root of your Hard Drive. Open that folder by Clicking on the Go menu in Finder and then pressing the Option key; a new item to open that Library folder will appear. Then create the nested folders texmf/tex/latex/authblk/ in that Library folder. Finally place the authblk.sty file (and other files generated as above) in that folder. From then on LaTeX will be able to find the authblk package.

  • Herb, it's really not a good idea to install local versions of any package that is part of the TeX Live distribution, since it will almost certainly lead to incompatibilities down the road since the local package will always be found overriding any updated version. – Alan Munn Jul 13 '16 at 19:57
  • But it isn't part of BadicTeX. The best solution would be to install MacTeX 2016 and be done with it. – Herb Schulz Jul 13 '16 at 22:08
  • Whether authblk is part of Basic TeX isn't the issue. It is part of TeX Live and so installing a local copy of it is generally a bad idea. If you are using a current year Basic TeX the correct way to install packages is with TeX Live Utility or tlmgr. You shouldn't install them locally. The issue here though is the complication of an out-of-date Basic TeX, which is hard to add to given the TeX Live infrastructure. – Alan Munn Jul 13 '16 at 23:19
  • @AlanMunn: I assume you then suggest either installing BasicTeX-2016 and then installing authblk using TeX Live Utility or installing the full MacTeX-2016 and being done with it. – Herb Schulz Jul 14 '16 at 0:02
  • I've already tried putting the .sty file for authblk (which I found online) in that local folder. It didn't work. I'll try installing MacTex 2016 now as pointed out by Alan Munn. – Sidd Jul 14 '16 at 6:33

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.