[Tex/LaTex] LaTeX packages: automatic versus manual installation, and related issues


I often run into problems in LaTeX with packages. I did a reinstall (MiKTeX) and it seemed to fix some issues with knowing where packages coming from or going. In general, I am not sure what should or does happen when using \usepackage command.

Is it standard that these packages are automatically pulled from the internet? Where do they go (by default)? Is there a better place to put them?

If I am troubleshooting, and if we can say packages are usually installed automatically, when, and should I ever, install packages manually? If so, where would I put them?

For instance, I believe the package easylist is installed on my computer. I was able, with some difficulty, to get into the roaming folder, looked around, and really the only package I saw, was several easylist files, such as .sty, and an associated readme file. I did a windows search for easylist, and only found one, with suffix .tpm and in the Program Files (x86)\MiKTeX 2.9\tpm folder.

My problem currently, is that I am trying to use the todonotes package. It seems to require the xcolor package. But this "can not be found". It asks to choose a place to get it. I think default was "choose random", but I just switched it to internet, and some random mirror site in country (USA). That didn't work, and I'm afraid I've now fiddled with the default settings for getting packages, which will create problems later.

Here are some other threads I have been fishing through:

In lieu of picture, I have this:

miktex-pdftex.exe: No connection could be made because the target
machine actively refused it.

miktex-pdftex.exe: Data: connect failed in tcp_connect()

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

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

Enter file name:

and from clipboard:

MiKTeX Problem Report Message: No connection could be made because the
target machine actively refused it.

Data: connect failed in tcp_connect()
Source: Libraries\MiKTeX\PackageManager\PackageManager.cpp
Line: 2461
MiKTeX: 2.9
OS: Microsoft Windows 7 Home Premium Edition, 64-bit Service Pack 1 (build 7601)
Invokers: explorer
SystemAdmin: no
PowerUser: no
Root0: C:\Users\aUserName\AppData\Roaming\MiKTeX\2.9
Root1: C:\Users\aUserName\AppData\Local\MiKTeX\2.9
Root2: C:\ProgramData\MiKTeX\2.9
Root3: C:\Program Files (x86)\MiKTeX 2.9
UserInstall: C:\Users\aUserName\AppData\Roaming\MiKTeX\2.9
UserConfig: C:\Users\aUserName\AppData\Roaming\MiKTeX\2.9
UserData: C:\Users\aUserName\AppData\Local\MiKTeX\2.9
CommonInstall: C:\Program Files (x86)\MiKTeX 2.9
CommonConfig: C:\ProgramData\MiKTeX\2.9
CommonData: C:\ProgramData\MiKTeX\2.9

(from "Package Installation" window below)

The required file 


is missing. It is part of the following package: 


The package will be installed from:  ftp://... [Change...] The package
will be installed for...

Best Answer

Yes, it is default behaviour of MiKTeX to install missing packages “on-the-fly”, but this can be changed in the Options dialogue. All in this way installed packages go into %APPDATA%\MiKTeX\<version>\ (<version> is 2.9 at time of writing), the MiKTeX variable is UserInstall. Since Windows Vista %APPDATA% resolves to C:\Users\<username>\AppData\Roaming, therefore your observation.

But this needs an active connection and a responding download mirror. At least one of these two things did not work in your case. If it was the mirror you can take a look on the CTAN mirror monitor Status of CTAN Mirrors, and if necessary in MiKTeX settings change the active mirror (MiKTeX Options, in tab “Packages” the first line shows the active MiKTeX repository and on the right you can change it).

I prefer to install all packages with the Package Manager, but this needs to be done on a regular basis, about once a week, and of course one needs enough disk space. In the rare cases, when I was asked for installation, I stopped this and ran the installation with the package manager. (Note, that this is different from, what is usually meant with “manual installation”! You already linked to the according question.)

All with the package manager installed packages go into the main MiKTeX tree (see Root 3 in your question), if you made the update in admin mode or in single user installation with writing rights in this folder. If you did a user mode installation packages will always be installed in UserInstall.

One would expect, that installation in admin mode goes into CommonInstall, what is the same folder in your case. But on my system this is not used, the folder, to whome CommonInstall points, does not exist!

Other related questions, at least partially:

Related Question