## Using environment variables in C++

Posted: 26th February 2014 by Tim in C++
Tags: , , , , , ,

Sometimes you need to use environment variables from within your program. There are a few ways to get the environment into your program, but the most portable way is to use the getenv function. The function will return a pointer to the null-terminated string value, or NULL if the variable is not set. For example, […]

## Reading environment variables in python

Posted: 13th November 2012 by Tim in Python
Tags: , , , , , ,

Shell envronment variables contain many useful paths and settings. At times you may want to use these variables from within a python program. This can be done via the os.path.expandvars(<var>) call, defined in os.path. For example, the following program: import os.path print os.path.expandvars(‘\$SHELL’); Will print (on my machine): /bin/bash

## Math case definitions in LaTeX

Posted: 12th December 2011 by Tim in LaTeX
Tags: , , , , , , , , , ,

When writing a math definition of a function, for example, the function may have different results depending on the value of the inputs. These are called cases and are grouped together with a large left curly brace. If you’re trying to typeset this in LaTeX, the cases environment makes this nice and easy. It’s easiest […]

## Drawing pictures in LaTeX

Posted: 20th August 2010 by Tim in LaTeX
Tags: , , , , , , , , , , , , , , , , , ,

LaTeX has the ability to draw images out of the box. The drawing functionality is pretty basic — lines, circles, boxes and the like — but perfect for most simple diagrams. This tutorial will be split into three sections: configuring the environment, different ways of drawing shapes, and a description of the shapes themselves. Configuring […]

## Math blackboard (double-barred) font in LaTeX

Posted: 28th April 2010 by Tim in LaTeX
Tags: , , , , , , , , , , ,

In math, certain blackboard (double-barred) letters Z, N, R, etc. represent sets of numbers (integers, natural numbers, rational numbers, etc). These can be included in a LaTeX document using the \mathbb{[letter]} tag from within the math environment. Note that this requires the amssymb package to be included (ie: add \usepackage{amssymb} to the top of the […]