You're reading: Posts Tagged: LaTeX

Introducing hexboard – a LaTeX package for drawing games of Hex

Chris Sangwin and I wrote a LaTeX package for drawing Hex boards and games called hexboard. It can produce diagrams like this.

Hex board with counters.

First: why? Then: how do you use it?

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:

Three Nim heaps: 5 sticks, 3 sticks and 4 sticks

Prime Climb colouring in with LuaTeX

A while ago, my son did the Prime Climb colouring sheet.

TeXnique: a LaTeX typesetting game

You know what’s fun? Typesetting mathematics! Glad you agree, because here’s a game that puts the fun in ‘underfilled hbox’.

Screenshot of TeXnique. A box showing the target formula above a box showing a rendering of code typed in the box below.

In TeXnique, you’re shown a typeset bit of mathematical notation, and have to frantically type LaTeX to reproduce it. You get three minutes, and you’re awarded points when you produce something that’s a pixel-perfect replica of the original. Think Typing of the Dead crossed with The Art of Computer Programming.

When I first saw this I rolled my eyes, but now my high score is 68 and I don’t know why I keep going back to it.

The formulas are largely well-known snippets of notation, so you might find some of them coming out through muscle memory, but if a symbol shows up that you can’t remember the macro for, there’s always the brilliant Detexify tool.

Play: texnique.xyz by Akshay Ravikumar.

realhats: Writing a $\LaTeX$ Package

A few months ago, Adam Townsend went to lunch and had a conversation. I wasn’t there, but I imagine the conversation went something like this:

Adam: Hello.
Smitha: Hello.
Adam: How are you?
Smitha: Not bad. I’ve had a funny idea, actually.
Adam: Yes?
Smitha: You know how the \hat command in LaTeΧ puts a caret above a letter?… Well I was thinking it would be funny if someone made a package that made the \hat command put a picture of an actual hat on the symbol instead?
Adam: (After a few hours of laughter.) I’ll see what my flatmate is up to this weekend…
Jeff: What on Earth are you two talking about?!

As anyone who has been anywhere near maths at a university in the last ∞ years will be able to tell you, LaTeΧ (or $\LaTeX$) is a piece of maths typesetting software. It’s a bit like a version of Word that runs in terminal and makes PDFs with really pretty equations.

By default, LaTeΧ can’t do very much, but features can easily added by importing packages: importing the graphicsx package allows you to put images in your PDF; importing geometry allows you to easily change the page margins; and importing realhats makes the \hat command put real hats above symbols.

LaTeX/TikZ to draw a star graph $K_{1,n}$

For a diagram for a class this week, I’ve written a LaTeX command to draw star graphs using TikZ. A star graph $K_{1,n}$ is a graph with a single central node, $n$ radial nodes, and $n$ edges connecting the central node to each radial node. I am sharing this here in case it is useful to anyone else.

Google+