From 723b6ded0066651ac8521ce1320371c8430b1434 Mon Sep 17 00:00:00 2001
From: Christopher Baines <mail@cbaines.net>
Date: Tue, 1 Apr 2014 19:10:41 +0100
Subject: Initial commit

---
 fib.sty | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 fib.sty

(limited to 'fib.sty')

diff --git a/fib.sty b/fib.sty
new file mode 100644
index 0000000..e5465a5
--- /dev/null
+++ b/fib.sty
@@ -0,0 +1,68 @@
+\NeedsTeXFormat{LaTeX2e}[1994/06/01]
+\ProvidesPackage{fib}[2013/01/13 Custom Package]
+
+% Source:
+% https://tex.stackexchange.com/questions/147701/graphical-placeholder-for-variables
+% adjusted slightly to fit better with the exam class (printanswers)
+
+\tikzset{box/.style={draw, rectangle, rounded corners, thick, node distance=7em, text width=6em, text centered, minimum height=3.5em}}
+\tikzset{container/.style={draw, rectangle, dashed, inner sep=2em}}
+\tikzset{line/.style={draw, thick, -latex'}}
+
+\makeatletter
+\newlength\fib@width
+\def\fib@widthfactor{1.75}
+
+\tikzset{
+   every fill in box/.style={
+     inner xsep=0pt,
+     minimum height=3ex,
+     align=center,
+     font={\sffamily\slshape},
+   },
+   colored box/.style={
+      every fill in box,
+      fill=yellow!50!white,
+   },
+   framed box/.style={
+      every fill in box,
+      draw,
+   },
+   fill in/.style={
+      framed box,
+   }
+}
+\NewDocumentCommand { \fib@hide } { m } {%
+   \ifprintanswers
+        #1%
+   \else
+        \phantom{#1}%
+   \fi
+}
+\NewDocumentCommand { \fib@makebox }{ m }{%
+   \settowidth{\fib@width}{\tikz\node[fill in]{#1};}%
+   \begin{tikzpicture}[baseline=(fill in node.base)]
+      \node (fill in node) [text width=\fib@widthfactor*\fib@width,fill in] {%
+         \fib@hide{#1}%
+      };
+   \end{tikzpicture}%
+}
+\NewDocumentCommand { \fib } { s d{<}{>} o m }{{%
+   \IfBooleanT{#1}{\noprintanswers}%
+   \IfValueT{#2}{\only<#2>{\noprintanswers}}%
+   \IfValueT{#3}{\tikzset{fill in/.style={#3}}}%
+   \ifmmode
+      \mathchoice
+         {\fib@makebox{$\displaystyle#4$}}
+         {\fib@makebox{$\textstyle#4$}}
+         {\fib@makebox{$\scriptstyle#4$}}
+         {\fib@makebox{$\scriptscriptstyle#4$}}
+   \else
+      \fib@makebox{#4}%
+   \fi
+   \IfValueT{#2}{}%
+}}
+\makeatother
+% end fib definition
+
+ \endinput
\ No newline at end of file
-- 
cgit v1.2.3

