-
Notifications
You must be signed in to change notification settings - Fork 4
/
snellen.tex
45 lines (32 loc) · 1.1 KB
/
snellen.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
%! TEX program = XeLaTeX
\documentclass{article}
% Factor = 3m/6m.
% This is obtained by dividing the distance at which the chart is kept
% by 6 m. Note that this sometimes needs to be slightly tweaked to get
% the required optotype width.
\def\factor{0.5}
\usepackage{fontspec}
\usepackage{graphicx}
\usepackage{color}
\usepackage[pass]{geometry}
\usepackage{longtable}
\setlength\LTpre{0pt} % space before table
\newfontfamily\optsans{Optician-Sans.otf}[LetterSpace=40]
\def\optotype#1#2{\begin{tabular}{c}\resizebox{!}{#1}{\selectfont\optsans#2}\end{tabular}}
% https://tex.stackexchange.com/q/172234
\newcommand{\deflen}[2]{%
\expandafter\newlength\csname #1\endcsname
\expandafter\setlength\csname #1\endcsname{#2}%
}
\input{|python3 snellen.py --defs}
\definecolor{smoke}{rgb}{0.6,0.6,0.6}
\deflen{acuitylen}{0.25in}
\def\acuity#1#2{\resizebox{!}{\acuitylen}{$#1^{\,\color{smoke}(#2)}$}}
\makeatletter
\def\colorrule#1#2{\color{#1}\leavevmode\leaders\hrule height #2\hfill\kern\z@}
\makeatother
\pagestyle{empty}
\begin{document}
\newgeometry{margin=0.5in}
\input{|python3 snellen.py 10}
\end{document}