# Installing and updating

Before you install and try out PiScript, you should be sure that your computing environment is adequate. This is explained in the section Prerequisites. Briefly, you need python (but not version 3, which is a totally different animal from the original friendly and relaxed version 2), TEX, and a PostScript viewer available. But if you are confident that your environment is OK, just go to Initial download.

## Contents

At the moment, there is no version of PiScript available for Windows machines, only for Linux and MacOSX. For an initial installation of PiScript on one of these systems you should download the file
Unpack it and read the Appendix in the PiScript manual on installation. In a nutshell: you unpack the file and put the graphics library in your Python path. But you also need to set up local configuration files to run TEX perfectly. See later.

There are several different components of PiScript. Only the code and the manual are likely to need frequent updating. In updating your code, it is important not to overwrite your TEX configuration files, so you should update using only the following files.

## Prerequisites

Before you begin, you should be sure that the programming language Python 2 is available on your machine. I cannot tell you how to achieve this if it is not already there, but I can tell you that the home page for Python is

Be sure to get Python 2! Python 3 is a very different language (don't ask me how or above all why) and the files for PiScript will not run under it. If you think that's weird, you are in good company. I can only hope that Python 2 stays around as long as I live, because changing to Python 3 will be extremely painful.

There are different ways to run Python on a file. Under UNIX flavours, the simplest way is to type python (filename) in a terminal window.

You should also have a proper version of TEX available. With flavours of UNIX, this usually comes automatically

You should also have a program that views PostScript files. With UNIX, the best choice by far is

You may well find the default TEX environment unsatisfactory. The most obvious problem is that the output from the command "tex" is extraordinarily verbose. On UNIX machines, you can suppress this bavardage by redirecting output in the command. To do this in the default configuration, change the command string from "tex" to one of these:
"tex >& /dev/null"
"tex > /dev/null"
"tex > 2>/dev/null"
"tex > /dev/null 2>/dev/null"

These suppress either standard output or error output or both. Some experiment might be necessary to see what works in your environment. I do not see how suppression can be done easily on machines running Windows, at least not in a flexible manner.

The file TexConfig.py, which assumes the standard LaTeX environment, is the one used by default, but you might well want to change your configuration from time to time. You can do this in any drawing program with the command settexenv, naming your TEX configuration file. I advise making up a custom collection of TEX configuration files for different purposes. For example, much of the time I myself prefer a heavier weight for text in diagrams, and I use BoldMathTexConfig.py with the command settexenv("BoldMathTexConfig").

There are three parts to the TEX environment. One is the TEX command actually run. For example, it can be "tex" or "latex". But it also includes a prefix and a postfix. The point is that when you place a TEX string, say "$y=x$", TEX will first input the prefix, then the string, and after that the postfix. In a very simple example, LATEX would be run on the file

\documentclass[12pt]{article}
\pagestyle{empty}
\begin{document}
% --------------
$y=x$
% --------------
\end{document}

The postfix is very simple and not very important. But the prefix as well as the TEX command are important and not so simple. The simplest choices for the command are either tex or latex, but they have the drawback that every time you insert TEX you will get copious TEX output. On UNIX systems, this can be dealt with by adding >& /dev/null to the command, so that TEX output all goes off into outer space. This is good if you are confident of your TEX, bad if not.

The prefix is much more complicated. The defaults supplied are minimal, and you should probably not truncate them. But you may easily add to them. All choices at this point are not final, since as is explained elsewhere they may be overridden in a local TEX configuration file.

WARNING: It is important to save your customized configuration files in some directory where they will not be overwritten or lost when you update PiScript. You will want to reuse them when updating PiScript.

In the present version, thanks to David Maxwell, fonts are located through a search of the TEXMF directory on your computer. That's the good news.

## Problems

The bad news is that there may be some problem with locating fonts. This is because recent TEXMF distributions no longer install certain font map files. (

This is just one example of recent improvements' to the TEX distribution by people who don't really understand what they are improving. Compare http://gaspra.kettering.edu/dvipdfm/ and https://bugs.launchpad.net/ubuntu/+source/texlive-base/+bug/1178006. I think the real probem is that the current TEX distributors don't understand the value of modularity in programs (or, for that matter, in life itself). Another problem relevant to those using PiScript is that current versions of dvips seem to require the -j0 option, or else certain characters will not appear in the output file. (See https://groups.google.com/forum/#!topic/linux.debian.bugs.dist/uRrphBPBcrc.)

I'm working on the problem of locating fonts in PiScript, but one possible fix has been suggested by David Austin:
(b) Unpack it into the directory \$HOME/.texlive2013/texmf-var/fonts/map/dvipdfm/updmap.

On linux this is fairly straightforward. As for MACs, I have the following message from a MAC user:
 I did some further hunting on my computer with the find' command and found three directories with texmf-var in them: /Library/TeX/Distributions/.FactoryDefaults/TeXLive-2013/Contents/AllTexmf/texmf-var /usr/local/texlive/2013/texmf-var /usr/local/texlive/2011/texmf-var In the last two I found an _empty_ directory at ../fonts/map/dvipdfm/updmap/ So I moved the files you sent me to the appropriate empty directory so that they both look like: Then run `sudo texhash' and everything worked. /usr/local/texlive/2011/texmf-var/fonts/map/dvipdfm/updmap/dvipdfm.map /usr/local/texlive/2011/texmf-var/fonts/map/dvipdfm/updmap/dvipdfm_dl14.map /usr/local/texlive/2011/texmf-var/fonts/map/dvipdfm/updmap/dvipdfm_ndl14.map
(c) Complain to me by email (cass@math.ubc.ca) if this doesn't fix the problem.

## Version history

The current version of PiScript is 1.202. I'll explain shortly changes since version 1.