# A Pupil Dilation Gauge using LaTeX

This Latex document generates a pupil dilation gauge. This can be used to measure the size of one's pupil by holding it up to the eye and peering at the black gap between the windows. Look through the various gap-sizes until the windows just touch. Then read off the size indicated to the left of the gap.

This technique is handy for astronomers wishing to measure their dark-adapted pupil, since this places an upper limit for the size of exit pupil they might want to use.

The code is shown below, with comments, but the document and the resulting PDF can be downloaded from the links above. You can also download the PNG files for the left window and the right window.


\documentclass[a4paper,12pt]{article}

% NAME: Pupil Dilation Gauge
%
% LAST UPDATED: 2012-03-15
%
% AUTHOR: Neil Carter, Swansea University
%
% CREATED: 2012-03-12

% We need the array package in order to use the centering and cellcolor commands
% for each column.
\usepackage{array}

% The colortbl package gives us the cellcolor command.
\usepackage{colortbl}

% The graphicx package enables us to use an image file to create the 'windows'.
\usepackage{graphicx}

% No page numbers.
\pagestyle{empty}

% No gaps between columns.
\setlength{\tabcolsep}{0pt}

% Reduce the height of rows.
\renewcommand{\arraystretch}{0.5}

% Create a command that we can use to insert one pupil-size. We do it as a
% command so that we can repeat it for each required pupil-size with the minimum
% of effort; we just supply the size as a parameter.
%
% For each pupil-size, we use a table of five columns, thus:
%
% Col1       Col2         Col3          Col4          Col5
% Size       left-window  variable gap  right-window  mirror of col1 for symmetry

\newcommand{\slot}[1]{\begin{tabular}{>{\raggedright}p{20mm}p{10mm}p{#1}p{10mm}p{20mm}}
\cellcolor{black} & \cellcolor{black} & \cellcolor{black} & \cellcolor{black} & \cellcolor{black} \\
\cellcolor{black} & \cellcolor{black} & \cellcolor{black} & \cellcolor{black} & \cellcolor{black} \\
\cellcolor{black} \raisebox{1mm}{\textsf{\textcolor{white}{#1}}} &
\cellcolor{black}\includegraphics[height=5mm,width=10mm]{white_l} &
\cellcolor{black} & \cellcolor{black}\includegraphics[height=5mm,width=10mm]{white_r} & \cellcolor{black} \\
\cellcolor{black} & \cellcolor{black} & \cellcolor{black} &
\cellcolor{black} & \cellcolor{black} \\
\cellcolor{black} & \cellcolor{black} & \cellcolor{black} & \cellcolor{black} & \cellcolor{black}
\end{tabular}}

\begin{document}

%Centre the gauge on the page.
\centering

% Use bold for the text.
\textbf

% Make the gauge as a table of two columns, narrower sizes to the left, wider to
% the right.
%
% The >{} option places whatever appears in the braces at the start of each
% column.
%
% The p{} option makes a column of a width specified by the size specified in
% the braces. For some reason, a third (0-width) column is needed to prevent an
% error caused by using \centering in the final column.

\begin{tabular}{>{\cellcolor{black}}p{10mm}>{\cellcolor{black}\centering}p{70mm}>{\centering\cellcolor{black}}p{70mm}p{0mm}}
& \slot{2mm}    & \slot{5mm} & \\
& \slot{2.33mm} & \slot{5.33mm}&  \\
& \slot{2.66mm} & \slot{5.66mm}&  \\
& \slot{3mm}    & \slot{6mm} & \\
& \slot{3.33mm} & \slot{6.33mm} & \\
& \slot{3.66mm} & \slot{6.66mm} & \\
& \slot{4mm}    & \slot{7mm} & \\
& \slot{4.33mm} & \slot{7.33mm} & \\
& \slot{4.66mm} & \slot{7.66mm}
\end{tabular}

\end{document}