[Tex/LaTex] How to install todonotes.sty package on Linux CentOS 7

linuxtexlivetodonotes

I'm working with Kile on a Dell Latitude 3540 computer running a Linux CentOS 7 operating system. I'm trying to compile a tex file and I get this error:

File 'todonotes.sty' not found. ^ ^ M

I tried to install it through the command sudo yum install texlive-* but it did not work.

Any idea on how to install this package?

Best Answer

First, you need to locate where exactly that package is, which you seem to have already done (well, by trying to install the standard bundles). Anyway, this is how you need to formally do it. Running

$ yum search todonotes

at some shell prompt gives:

Warning: No matches found for: todonotes

Looks like it is not part of any pre-packaged bundle, so you need to install it manually. You need to find this in CTAN.

Go to the corresponding CTAN page, https://www.ctan.org/pkg/todonotes. The .zip file download link is at bottom left. Download this file in some local directory. say, in the Downloads directory in your home.

Go to the corresponding directory, unzip the .zip file (unzip todonotes.zip). Move inside the directory todonotes (cd todonotes).

As you can find (ls -l) there is no .sty file there, there is only an .ins file. In order to generate the .sty file, run the following command:

$ latex todonotes.ins

This generates todonotes.sty.

Now, we need to put this at some appropriate place. In order to find the suggested location, run:

$ kpsewhich -var-value=TEXMFHOME 

This is likely to generate something like, /home/username/texmf.

Following the TeX directory structure, you should place your file in a subdirectory like ~/texmf/tex/latex/. This has the advantage that it is not necessary to update the package database as TeX searches your personal texmftree directly. See this post for details.

So. create a directory ~/texmf/tex/latex/ (mkdir -p ~/texmf/tex/latex/) and then copy the complete todonotes directory under it (cp -vr ~/Downloads/todonotes ~/texmf/tex/latex/).

You can then verify which file will be used with:

kpsewhich todonotes.sty

The above is should show something like:

/home/username/texmf/tex/latex/todonotes/todonotes.sty

Now, it you try to use the todonotes.sty file inside any LaTeX file, no problem should occur.

Related Question