on master help sign in
Improved macros.

+ Turned macros into a distinct package. + made use of verbtim based commands optional. + fancyvb support included with fpmacros

commitc75a418d84962c0b528a3d9168c62b09d36c0c0d authorJan de Muijnck-Hughes <jfdm@st-andrews.ac.uk> dateTue 12 Nov 2013, 10:45 (13 years ago) parent87f17de
2 files changed+43−23
tutorial/macros.ltx → tutorial/fpmacros.sty+41−21 tutorial/idris-tutorial.tex+2−2
tutorial/macros.ltx → tutorial/fpmacros.styrenamed+41−21
@@ -1,11 +1,25 @@
1−%\usepackage{amstex}
2−\usepackage{amssymb}
3−\usepackage{latexsym}
4−\usepackage{eepic}
5−
1+%% ------------------------------------------- [ Functional Programming Macros ]
2+%% A Package to provide support for functional programming.
3+%%
4+\NeedsTeXFormat{LaTeX2e}[1994/06/01]
5+\ProvidesPackage{fpmacros}[2013/12/17 fpmacros]
6+%% ------------------------------------------------------- [ Required Packages ]
7+\RequirePackage{ifthen}
8+\RequirePackage{amssymb}
9+\RequirePackage{latexsym}
10+\RequirePackage{eepic}
11+\RequirePackage{fancyvrb}
12+%% ----------------------------------------------------- [ Option Delcarations ]
13+\newboolean{useverb}
14+\setboolean{useverb}{true}
15+
16+\DeclareOption{noverb}{%
17+ \setboolean{useverb}{false}
18+}
619
7−%%%%%%%%% INFERENCE RULES
20+\ProcessOptions\relax
821
22+%% --------------------------------------------------------- [ Inference Rules ]
923\newlength{\rulevgap}
1024\setlength{\rulevgap}{0.05in}
1125\newlength{\ruleheight}
@@ -78,8 +92,7 @@
7892\setlength{\unitlength}{0.0005in}
7993\begin{picture}(69,180)(0,12)
8094\blacken\path(12,192)(12,12)(57,102)
81− (12,192)(12,192)
82−\path(12,192)(12,12)(57,102)
95+ (12,192)(12,192)\path(12,192)(12,12)(57,102)
8396 (12,192)(12,192)
8497\end{picture}
8598}
@@ -305,18 +318,20 @@
305318
306319\newcommand{\DBOX}[2]{\fbox{\parbox{#1}{\textbf{Definition:}#2}}}
307320
308−\newcommand{\useverbtb}[1]{\begin{tiny}\BUseVerbatim{#1}\end{tiny}}
309−\newcommand{\useverb}[1]{\BUseVerbatim{#1}}
310−\newcommand{\useverbs}[1]{\begin{small}\BUseVerbatim{#1}\end{small}}
311−\newcommand{\useverbb}[1]{\begin{small}\BUseVerbatim{#1}\end{small}}
321+\ifthenelse{\boolean{useverb}}{%
322+ \newcommand{\useverbtb}[1]{\begin{tiny}\BUseVerbatim{#1}\end{tiny}}
323+ \newcommand{\useverb}[1]{\BUseVerbatim{#1}}
324+ \newcommand{\useverbs}[1]{\begin{small}\BUseVerbatim{#1}\end{small}}
325+ \newcommand{\useverbb}[1]{\begin{small}\BUseVerbatim{#1}\end{small}}
326+ \newcommand{\codefig}[2]{\begin{figure}[h]\useverb{#1}\caption{#2}\label{#1}\end{figure}}
327+ \newcommand{\codefigs}[2]{\begin{figure}[h]\useverbs{#1}\caption{#2}\label{#1}\end{figure}}
328+ \newcommand{\codefigt}[2]{\begin{figure}[t]\useverb{#1}\caption{#2}\label{#1}\end{figure}}
329+ \newcommand{\codefigb}[2]{\begin{figure}[b]\useverb{#1}\caption{#2}\label{#1}\end{figure}}
330+ \newcommand{\codefigtc}[2]{\begin{figure*}[t]\useverb{#1}\caption{#2}\label{#1}\end{figure}}
331+}{}
312332
313333\newcommand{\diagfig}[3]{\begin{figure}[h]\begin{center}\includegraphics[width=#1]{#2}\end{center}
314334\caption{#3}\label{#2}\end{figure}}
315−\newcommand{\codefig}[2]{\begin{figure}[h]\useverb{#1}\caption{#2}\label{#1}\end{figure}}
316−\newcommand{\codefigs}[2]{\begin{figure}[h]\useverbs{#1}\caption{#2}\label{#1}\end{figure}}
317−\newcommand{\codefigt}[2]{\begin{figure}[t]\useverb{#1}\caption{#2}\label{#1}\end{figure}}
318−\newcommand{\codefigb}[2]{\begin{figure}[b]\useverb{#1}\caption{#2}\label{#1}\end{figure}}
319−\newcommand{\codefigtc}[2]{\begin{figure*}[t]\useverb{#1}\caption{#2}\label{#1}\end{figure}}
320335\newcommand{\diagfigtc}[3]{\begin{figure*}[t]\begin{center}\includegraphics[width=#1]{#2}\end{center}
321336\caption{#3}\label{#2}\end{figure*}}
322337
@@ -324,10 +339,13 @@
324339\newcommand{\FFIG}[3]{\begin{figure}\begin{center}\DM{#1}\end{center}\caption{#2}\label{#3}\end{figure}}
325340\newcommand{\FFIGB}[3]{\begin{figure}[b]\begin{center}\DM{#1}\end{center}\caption{#2}\label{#3}\end{figure}}
326341\newcommand{\FFIGTC}[3]{\begin{figure*}[t]\begin{center}\DM{#1}\end{center}\caption{#2}\label{#3}\end{figure*}}
327−\newcommand{\VFIG}[3]{\begin{figure}[h]\begin{boxedverbatim}#1\end{boxedverbatim}\caption{#2}\label{#3}\end{figure}}
328342\newcommand{\PFIG}[3]{\begin{figure}[p]\begin{center}\fbox{\DM{#1}}\end{center}\caption{#2}\label{#3}\end{figure}}
329343\newcommand{\CFIG}[3]{\begin{figure}[h]\begin{center}\DM{#1}\end{center}\caption{#2}\label{#3}\end{figure}}
330344
345+\ifthenelse{\boolean{useverb}}{%
346+ \newcommand{\VFIG}[3]{\begin{figure}[h]\begin{boxedverbatim}#1\end{boxedverbatim}\caption{#2}\label{#3}\end{figure}}
347+}{}
348+
331349\newcommand{\TFIG}[4]{\begin{figure}[h]\begin{center}\begin{tabular}{#1}#2\end{tabular}\end{center}\caption{#3}\label{#4}\end{figure}}
332350\newcommand{\TFIGTC}[4]{\begin{figure*}[t]\begin{center}\begin{tabular}{#1}#2\end{tabular}\end{center}\caption{#3}\label{#4}\end{figure*}}
333351
@@ -676,8 +694,9 @@ Program & Version & Instructions & Thunks & Memory Accesses & Cells \\
676694\newcommand{\falsecase}{\Cases{\False}}
677695
678696% Code
679−\newcommand{\Haskell}[1]{\begin{quotation}\begin{verbatim}#1\end{verbatim}\end{quotation}}
680−
697+\ifthenelse{\boolean{useverb}}{%
698+ \newcommand{\Haskell}[1]{\begin{quotation}\begin{verbatim}#1\end{verbatim}\end{quotation}}
699+}{}
681700% Quicksort
682701
683702\newcommand{\QSView}{\TC{QuickSort}}
@@ -1063,4 +1082,5 @@ Program & Version & Instructions & Thunks & Memory Accesses & Cells \\
10631082\newcommand{\direct}[1]{\texttt{\%#1}}
10641083
10651084\newcommand{\Feature}[1]{\textbf{Remark:}}
1066−%\newcommand{\Remark}[1]{\textbf{Remark:}}
1085+
1086+\endinput
tutorial/idris-tutorial.tex+2−2
@@ -15,12 +15,12 @@
1515\usepackage{courier}
1616
1717\usepackage{fullpage}
18−\usepackage{fancyvrb}
1918\usepackage{hyperref}
2019\usepackage[missing=0.9.10]{gitinfo}
2120
21+\usepackage{fpmacros}
22+
2223\input{conf.ltx}
23−\input{macros.ltx}
2424\input{library.ltx}
2525
2626\newcommand{\Idris}{\textsc{Idris}}