Writing computer or programming code in Latex

To write a code in latex, you can use \begin{verbatim} \end{verbatim} environtment. A similar approach is by doing this


\usepackage{fancyvrb}
\DefineVerbatimEnvironment{code}{Verbatim}{fontsize=\small}
\DefineVerbatimEnvironment{example}{Verbatim}{fontsize=\small}

and then you can type your code in the body

\begin{code}
c+=1;
\end{code}

Advertisements

Installing laspack

Laspack is

a package for solving large sparse systems of linear equations like those which arise from the discretization of partial differential equations.

To install it, first you need to download the file laspack.tgz. Then you can read the installation guide from this page. First, we need to unarchive the file and then run the ./install script. This, however, will install to your $HOME/bin and $HOME/lib directory. If you want to install to somewhere else, you need to modify all the makefiles in all the directories. If you only want to install into the /usr/local/bin and /usr/local/lib, you just need to type

./install local

without any modifications. Once you run it, it will compile and install into your corresponding directory, and then it will run a test. For my case, however, it didn’t run the test, so I need to go manually to the “check” folder and run the test by typing ./check. Then if everything is alright, you will see

LASPack tested successfully.