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:
I think you are a little bit confused about TikZ capabilities and of course the package pgfplots
. First problem is that you need to let pdflatex
or whichever engine you are using to reach out the system commands. For example, I use TeXnicCenter and my command line parameters are configured as
-synctex=-1 -max-print-line=120 -interaction=nonstopmode "%wm" -shell-escape
The last bit allows for system calls (and the "%wm"
bit is equivalent to your %.tex
). And direct compilation of your code gives me
but I don't have TeXStudio so I couldn't test it. However the idea is essentially the same.
Alternatively you can use TikZ or pgfplots for plotting functions if your function is not really esoteric or complicated.
Here are two examples :
In TikZ you replace one line of your code with
\draw plot (\x,{sin(\x r)}) node[right] {$f(x) = \sin x$};
And in pgfplots
with default settings
\documentclass[a4paper]{article}
\usepackage{pgfplots,mathrsfs}
\begin{document}
\begin{tikzpicture}
\begin{axis}[axis lines=middle,xmax=6,ymin=-1,ymax=1]
\addplot[domain=0:4] {sin(deg(x))} node[right]{$f(x)=\sin(x)$};
\end{axis}
\end{tikzpicture}
\end{document}
Best Answer
Real answer is using tlmgr command: