# You're reading: Posts Tagged: nim

### nimsticks: LaTeX package for drawing Nim sticks and games

A while ago on this blog I shared a LaTeX macro I had written for drawing games of Nim. I have now taken the plunge and written this into a LaTeX package called nimsticks. (Why? What do you do to relax on a lazy Sunday morning?)

Here is the description of the nimsticks package:

This LaTeX package provides commands \drawnimstick to draw a single nim stick and \nimgame which represents games of multi-pile Nim. Nim sticks are drawn with a little random wobble so they look ‘thrown together’ and not too regular.

What this does it allows commands such as \nimgame{5,3,4} which renders like this:

### Mathematical Objects: Pile of matchsticks

A conversation about mathematics inspired by a pile of matchsticks. Presented by Katie Steckles and Peter Rowlett.

### LaTeX for typesetting a multi-pile Nim game

Update July 2020: I have now taken the plunge and written this into a LaTeX package called nimsticks. The version in the package is an improved version of the macro given below in a couple of ways – it works with LuaTeX and XeTeX, and it has both block-centred and inline modes. I describe this in a new blog post nimsticks: LaTeX package for drawing Nim sticks and games.

I am preparing to teach our new final year module ‘Game Theory and Recreational Mathematics’. So I’m thinking about game typesetting in LaTeX (texlive-games is useful in this regard). I was looking for an easy way to display multi-pile Nim games. Usually, I find searching “latex thing” finds numerous options for typesetting “thing” in LaTeX, but here I was struggling.

Nim objects could be anything, of course, but conventionally sticks or stones are used. There are various types of dot in LaTeX that might look like stones, but somehow a line of dots didn’t seem satisfactory. There are various ways to draw a line (not least simply typing ‘|’), including some tally markers (e.g. in hhcount). My problem with these (call me picky) is that they are all identical lines, and a ‘heap’ of them just looks very organised. Really, I want a set of lines that looks like someone just threw them into heaps (though probably without crossings for the avoidance of ambiguity). So I wrote my own.

### All Squared, Number 5: Favourite maths books (part 1)

Good maths books are simultaneously plentiful and rare. While there are a few classics almost everyone knows about and has copies of (Gardner, Hardy, etc.), the trade in lesser-known maths books is considerably less well-organised. Very few bookshops have well-stocked maths sections, and insipid pop maths books dominate. Unless you hear about a good maths book through word of mouth, you’ll often only encounter it once it’s ended up in a second-hand bookshop, usually a refugee from an emptied maths department library.

But books, more than anything else, are where the beauty of maths really manifests itself. It’s where ideas are presented most clearly, after they’ve had time to percolate through a few more brains. We talked to David Singmaster, professor of maths and metagrobologist, about his favourite maths books.