Skip to content

Instantly share code, notes, and snippets.

@betaveros
Created July 22, 2015 05:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save betaveros/dca12db265b067e334b3 to your computer and use it in GitHub Desktop.
Save betaveros/dca12db265b067e334b3 to your computer and use it in GitHub Desktop.
I wrote this in... December 2009? What the hell?
% underblank.sty: Blanks for tests and study guides and all that multiverse cr&p
% to get the answers, declare a command \underblankanswers to anything.
\ProvidesPackage{underblank}
\usepackage{ulem}
\usepackage{ifthen} % need 2 versions: w/, w/o answers
\normalem
\newlength{\answerwidth}
\newcommand{\emptyline}{\vspace{\baselineskip}}
\newcommand{\underblank}[2]{\settowidth{\answerwidth}{#1}\uline{\makebox[\answerwidth][c]{#2}}}
\ifthenelse{\isundefined{\underblankanswers}}
{ % With answers
\newcommand{\answerblank}[2]{\underblank{#1}{#2}}
\newcommand{\answerhide}[1]{#1}
\newcommand{\answerline}[1]{\mtline #1 \mtline}
} % End with answers
{ % Without answers
\newcommand{\answerblank}[2]{\underblank{#1}{}}
\newcommand{\answerhide}[1]{}
\newcommand{\answerline}[1]{\mtline ~ \mtline}
} % End without answers
% \answertblank: blank is twice the length of answer.
\newcommand{\answertblank}[1]{\answerblank{#1#1}{#1}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment