on master help sign in
Improved macros.
c75a418Jan de Muijnck-Hughes
tutorial/macros.ltx → tutorial/fpmacros.styrenamed+41−21
@@ -1,11 +1,25 @@
1−%\usepackage{amstex}
1+%% ------------------------------------------- [ Functional Programming Macros ]
2−\usepackage{amssymb}
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}
3−\usepackage{latexsym}
9+\RequirePackage{latexsym}
4−\usepackage{eepic}
10+\RequirePackage{eepic}
5−
11+\RequirePackage{fancyvrb}
12+%% ----------------------------------------------------- [ Option Delcarations ]
13+\newboolean{useverb}
14+\setboolean{useverb}{true}
15+
16+\DeclareOption{noverb}{%
17+ \setboolean{useverb}{false}
18+}
6
19
7−%%%%%%%%% INFERENCE RULES
20+\ProcessOptions\relax
8
21
22+%% --------------------------------------------------------- [ Inference Rules ]
9\newlength{\rulevgap}
23\newlength{\rulevgap}
10\setlength{\rulevgap}{0.05in}
24\setlength{\rulevgap}{0.05in}
11\newlength{\ruleheight}
25\newlength{\ruleheight}
@@ -78,8 +92,7 @@
78\setlength{\unitlength}{0.0005in}
92\setlength{\unitlength}{0.0005in}
79\begin{picture}(69,180)(0,12)
93\begin{picture}(69,180)(0,12)
80\blacken\path(12,192)(12,12)(57,102)
94\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)
83 (12,192)(12,192)
96 (12,192)(12,192)
84\end{picture}
97\end{picture}
85}
98}
@@ -305,18 +318,20 @@
305
318
306\newcommand{\DBOX}[2]{\fbox{\parbox{#1}{\textbf{Definition:}#2}}}
319\newcommand{\DBOX}[2]{\fbox{\parbox{#1}{\textbf{Definition:}#2}}}
307
320
321+\ifthenelse{\boolean{useverb}}{%
308−\newcommand{\useverbtb}[1]{\begin{tiny}\BUseVerbatim{#1}\end{tiny}}
322+ \newcommand{\useverbtb}[1]{\begin{tiny}\BUseVerbatim{#1}\end{tiny}}
309−\newcommand{\useverb}[1]{\BUseVerbatim{#1}}
323+ \newcommand{\useverb}[1]{\BUseVerbatim{#1}}
310−\newcommand{\useverbs}[1]{\begin{small}\BUseVerbatim{#1}\end{small}}
324+ \newcommand{\useverbs}[1]{\begin{small}\BUseVerbatim{#1}\end{small}}
311−\newcommand{\useverbb}[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+}{}
312
332
313\newcommand{\diagfig}[3]{\begin{figure}[h]\begin{center}\includegraphics[width=#1]{#2}\end{center}
333\newcommand{\diagfig}[3]{\begin{figure}[h]\begin{center}\includegraphics[width=#1]{#2}\end{center}
314\caption{#3}\label{#2}\end{figure}}
334\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}}
320\newcommand{\diagfigtc}[3]{\begin{figure*}[t]\begin{center}\includegraphics[width=#1]{#2}\end{center}
335\newcommand{\diagfigtc}[3]{\begin{figure*}[t]\begin{center}\includegraphics[width=#1]{#2}\end{center}
321\caption{#3}\label{#2}\end{figure*}}
336\caption{#3}\label{#2}\end{figure*}}
322
337
@@ -324,10 +339,13 @@
324\newcommand{\FFIG}[3]{\begin{figure}\begin{center}\DM{#1}\end{center}\caption{#2}\label{#3}\end{figure}}
339\newcommand{\FFIG}[3]{\begin{figure}\begin{center}\DM{#1}\end{center}\caption{#2}\label{#3}\end{figure}}
325\newcommand{\FFIGB}[3]{\begin{figure}[b]\begin{center}\DM{#1}\end{center}\caption{#2}\label{#3}\end{figure}}
340\newcommand{\FFIGB}[3]{\begin{figure}[b]\begin{center}\DM{#1}\end{center}\caption{#2}\label{#3}\end{figure}}
326\newcommand{\FFIGTC}[3]{\begin{figure*}[t]\begin{center}\DM{#1}\end{center}\caption{#2}\label{#3}\end{figure*}}
341\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}}
328\newcommand{\PFIG}[3]{\begin{figure}[p]\begin{center}\fbox{\DM{#1}}\end{center}\caption{#2}\label{#3}\end{figure}}
342\newcommand{\PFIG}[3]{\begin{figure}[p]\begin{center}\fbox{\DM{#1}}\end{center}\caption{#2}\label{#3}\end{figure}}
329\newcommand{\CFIG}[3]{\begin{figure}[h]\begin{center}\DM{#1}\end{center}\caption{#2}\label{#3}\end{figure}}
343\newcommand{\CFIG}[3]{\begin{figure}[h]\begin{center}\DM{#1}\end{center}\caption{#2}\label{#3}\end{figure}}
330
344
345+\ifthenelse{\boolean{useverb}}{%
346+ \newcommand{\VFIG}[3]{\begin{figure}[h]\begin{boxedverbatim}#1\end{boxedverbatim}\caption{#2}\label{#3}\end{figure}}
347+}{}
348+
331\newcommand{\TFIG}[4]{\begin{figure}[h]\begin{center}\begin{tabular}{#1}#2\end{tabular}\end{center}\caption{#3}\label{#4}\end{figure}}
349\newcommand{\TFIG}[4]{\begin{figure}[h]\begin{center}\begin{tabular}{#1}#2\end{tabular}\end{center}\caption{#3}\label{#4}\end{figure}}
332\newcommand{\TFIGTC}[4]{\begin{figure*}[t]\begin{center}\begin{tabular}{#1}#2\end{tabular}\end{center}\caption{#3}\label{#4}\end{figure*}}
350\newcommand{\TFIGTC}[4]{\begin{figure*}[t]\begin{center}\begin{tabular}{#1}#2\end{tabular}\end{center}\caption{#3}\label{#4}\end{figure*}}
333
351
@@ -676,8 +694,9 @@ Program & Version & Instructions & Thunks & Memory Accesses & Cells \\
676\newcommand{\falsecase}{\Cases{\False}}
694\newcommand{\falsecase}{\Cases{\False}}
677
695
678% Code
696% Code
697+\ifthenelse{\boolean{useverb}}{%
679−\newcommand{\Haskell}[1]{\begin{quotation}\begin{verbatim}#1\end{verbatim}\end{quotation}}
698+ \newcommand{\Haskell}[1]{\begin{quotation}\begin{verbatim}#1\end{verbatim}\end{quotation}}
680−
699+}{}
681% Quicksort
700% Quicksort
682
701
683\newcommand{\QSView}{\TC{QuickSort}}
702\newcommand{\QSView}{\TC{QuickSort}}
@@ -1063,4 +1082,5 @@ Program & Version & Instructions & Thunks & Memory Accesses & Cells \\
1063\newcommand{\direct}[1]{\texttt{\%#1}}
1082\newcommand{\direct}[1]{\texttt{\%#1}}
1064
1083
1065\newcommand{\Feature}[1]{\textbf{Remark:}}
1084\newcommand{\Feature}[1]{\textbf{Remark:}}
1066−%\newcommand{\Remark}[1]{\textbf{Remark:}}
1085+
1086+\endinput
tutorial/idris-tutorial.tex+2−2
@@ -15,12 +15,12 @@
15\usepackage{courier}
15\usepackage{courier}
16
16
17\usepackage{fullpage}
17\usepackage{fullpage}
18−\usepackage{fancyvrb}
19\usepackage{hyperref}
18\usepackage{hyperref}
20\usepackage[missing=0.9.10]{gitinfo}
19\usepackage[missing=0.9.10]{gitinfo}
21
20
21+\usepackage{fpmacros}
22+
22\input{conf.ltx}
23\input{conf.ltx}
23−\input{macros.ltx}
24\input{library.ltx}
24\input{library.ltx}
25
25
26\newcommand{\Idris}{\textsc{Idris}}
26\newcommand{\Idris}{\textsc{Idris}}