How to manually add a package to MiKTex

The fact that I’m writing this article implies that it is far from a trivial task to do this. After about 2 hours I finally found a solution that just works. Note that I’m using MiKTeX 2.9 on Windows 7, so the solution may not be working for other versions of MiKTeX and the path to the directory may vary depending on your version of windows and/or your installation preferences. The concept however is the same.

To make this work you should complete the following steps:

  1. Download the package file that you want to install.
  2. Create a directory in (make sure that you have admin privileges in case of Vista/7):
    • C:\Program Files\MiKTeX 2.9\tex\latex\base (for Windows XP/Vista/7 on a 32-bit Windows version)
    • C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base (for Vista/7 on a 64-bit Windows version)
  3. Go to Start > MiKTeX > Maintenance (Admin) > Settings (Admin) and click on Refresh FNDB.
  4. Restart your LaTeX editor (in my case it was WinEdt 6.0) and now you should be able to use your new package.

 

Note that in step 3 I have deliberately wrote that you should chose the Admin folder, which is important if you are running Windows Vista or Windows 7, since otherwise refreshing FNDB will not result in your package being added to the database! Alternatively, you can also open the settings from the non-Admin or in some other way, but in any case make sure that the process has admin rights to update the database. If you have a more complex setup you can read this post that gives some more advanced information on how to manually add packages.

“LaTeX source files more than 5 years old!”

Got this compile error from LaTeX today and I really don’t have any idea what is exactly going on.

This is pdfTeX, Version 3.1415926-1.40.10 (MiKTeX 2.8)
Running miktex-pdftex.exe...
This is pdfTeX, Version 3.1415926-1.40.10 (MiKTeX 2.8) (INITEX)
entering extended mode
("C:\Program Files\MiKTeX 2.8\tex\latex\config\latex.ini"
(C:\Users\Edin\AppData\Roaming\MiKTeX\2.8\tex\generic\config\pdftexconfig.tex)
("C:\Program Files\MiKTeX 2.8\tex\latex\base\latex.ltx"
("C:\Program Files\MiKTeX 2.8\tex\latex\00miktex\texsys.cfg")
./texsys.aux found

\@currdir set to: ./.

Assuming \openin and \input
have the same search path.

Defining UNIX/DOS style filename parser.

catcodes, registers, compatibility for TeX 2,  parameters,

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! You are attempting to make a LaTeX format from a source file
! That is more than five years old.
!
! If you enter <return> to scroll past this message then the format
! will be built, but please consider obtaining newer source files
! before continuing to build LaTeX.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

! LaTeX source files more than 5 years old!.
l.545 ...aTeX source files more than 5 years old!}

No pages of output.
Transcript written on latex.log.
miktex-makefmt: miktex-pdftex.exe failed on latex.ini.
initexmf.exe: The operation failed for some reason.
initexmf.exe: Data: C:\Program Files\MiKTeX 2.8\miktex\bin\miktex-makefmt.exe
I can't find the default format file!

However, I did find a workaround that seemed to solve the problem and I decided to share it. Perform the following steps:

  1. Open “C:\Program Files\MiKTeX 2.8\tex\latex\base\latex.ltx” (or wherever your latex.ltx resides). One alternative path that is different from mine is “C:\Program Files\MiKTeX\miktex\bin\tex\latex\base”.
  2. Find “\ifnum\count@65>” and change it into “\ifnum\count@>100” (or some number larger than 100)
  3. Save the file.

The real problem is not fixed, but at least you should now be able to compile your files.

Note that in Windows Vista and Windows 7 you’ll have to have administrator access to be able to overwrite this file since Program Files is a system directory. One way to accomplish this is to simply copy the file to let’s say the desktop, edit it, and then overwrite the original file with the edited file.

LaTeX Concatenation Symbol

When you can’t find it or it doesn’t exist, then build it yourself! So it went with the concatenation symbol in latex that I was looking for. I’m really curious why it is not in the standard symbol set in for example WinEdt where you can find a huge collection of beautiful mathematical symbols.

Anyway, with this command

\newcommand{\concat}{\ensuremath{+\!\!\!\!+\,}}

we can define our own concatenation symbol, which is actually just two pluses overlapping each other. As the command is defined, we can just use it by doing

$a \concat b$

which results in a concatenation of a and b as displayed in the image below. 🙂

It is important to note that for the effect to happen you need to put the concatenation in math mode. Otherwise, you’ll get the pluses too tight to each other.

The total LaTeX document would look something like this:

\documentclass[a4paper]{article}
\newcommand{\concat}{\ensuremath{+\!\!\!\!+\,}}
\begin{document}
$a \concat b$
\end{document}

LaTeX MSC package error

While using the MSC (Message Sequence Chart) package (msc.sty) I couldn’t compile my document by using PDF Texify in WinEdt. With the following sample code

\documentclass{article}
\usepackage{msc}
\begin{document}

\begin{msc}{Example}

\declinst{usr}{User}{}
\declinst{m1}{Machine 1}{control}
\declinst{m2}{Machine 2}{drill}
\declinst{m3}{Machine 3}{test}

\mess{startm1}{usr}{m1}
\nextlevel
\mess{startm2}{m1}{m2}
\nextlevel
\mess{continue}{m2}{m3}
\mess{log}{m1}{envleft}
\nextlevel
\mess{output}{m3}{usr}[2]
\nextlevel
\mess{free}{m1}{usr}
\nextlevel

\end{msc}

\end{document}

I get this error

! Undefined control sequence.
..
\declinst

I don’t know why exactly this happens, but the error suggests that it probably calls a command that doesn’t exist. Anyway, a quick fix (in WinEdt – MikTeX) is to do the following:

  1. LaTeX compile it (Shift+Ctrl+L).
  2. Then convert the .dvi file to .ps with DVIPS.
  3. Finally use PS2PDF to get the PDF.

Any other sugestions are welcome.

Bosnian alphabet characters in LaTeX

While working on a document in LaTeX I had to insert a specific character which I was not able to find in WinEdt. Wiki was only of temporal help because it showed only the latex code for the character č and not ć which i actually was looking for. After googling a lot more than I initially thought I would need, I found the trick by using \v{c} and puzzled the rest by myself.

Anyway, I thought it would be helpful to post all of the Bosnian special characters in one neat table. So here it is.

You can also download this nice PDF if you need it locally for a quick reference.

Bosanski opis:
Tabela ispod pokazuje sva naša slova i u koloni pored kod za latex. Kod dva
slučaja, kod slova đ i Đ je potrebno instalirati dodatni paket pošto ova slova
nisu standardno podržana (to je barem kod mene trenutno slučaj). U svakom
slučaju ce ovo dati željeni rezultat.

U ovom pdf-u se moze naći ovaj sav sadržaj.

Edit
Made my contribution to the Bosnian wikipedia. 😀

BosnianLatex