Add another reference.
[matthijs/master-project/report.git] / Utils / Shortcuts.tex
index 75bff27b950bba6b68cdb64898da92ec3b60aa08..5c46d3709e567227be9668978d1969dc70ee66bb 100644 (file)
@@ -2,8 +2,38 @@
 % This file defines some useful shortcut commands
 %
 
+\def\autoinsertnextspace{}
 
 % A shortcut for italicized e.g. and i.e.
-% TODO: Prevent this macro from globbing the following space
-\define[0]\eg{{\em e.g.}}
-\define[0]\ie{{\em i.e.}}
+\define[0]\eg{{\em e.g.}\autoinsertnextspace}
+\define[0]\ie{{\em i.e.}\autoinsertnextspace}
+
+
+% Define a new reference to a definition of the term. The text of the
+% reference is the term itself, the name is the term with def: prefixed.
+% For example, \defref{some defined term} defines the reference named
+% "def:some defined term" to point to this location with the text "some
+% defined term".
+% You can refer to this reference with refdef, e.g., 
+% \refdef{def:some defined term}.
+\define[1]\defref{\defreftxt{#1}{#1}}
+
+% Define a new reference with a text different from the name, #1 is the name
+% of the reference, #2 is the text.
+% This automatically prefixes the reference name with def:
+\define[2]\defreftxt{\reference[def:#1]{#2}}
+
+% Reference a defined reference (using \defref). Will put the reference text
+% and a page number in the margin. We use \inothermargin, since it is slightly
+% bigger.
+% This automatically prefixes the reference name with def:
+\define[1]\refdef{\inothermargin{\goto{\ref[t][def:#1] p.\ref[p][def:#1]}[def:#1]}}
+
+% Shortcuts to write in smallcaps
+\def\VHDL{\small{VHDL}\autoinsertnextspace}
+\def\GHC{\small{GHC}\autoinsertnextspace}
+
+% TODO: Use this instead of $ to fool syntax highlighting
+\def\${\char36}
+
+% vim: set sw=2 sts=2 expandtab: