-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlatex-sheet.sty
70 lines (62 loc) · 2.06 KB
/
latex-sheet.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
% latex-sheet package v0.1.0
%
% Provides a new environment and commands for prettyfying and manipulating spreadsheets in
% LaTeX.
%
% Example sheet:
% \begin{sheet}[h!]
% \centering
% \begin{tabular}{|f|c|c|}
% \hline
% \fs & \col{A} & \col{B}\\\hline
% 1 & \texttt{=DEFINE("fatorial", B3, B2)} & \\\hline
% 2 & \texttt{\textquotesingle{}n=} & \farg\texttt{0}\\\hline
% 3 & \texttt{\textquotesingle{}out=} & \result\texttt{=IF(B2<=0, 1, B2*FACTORIAL(B2-1))}\\\hline
% \end{tabular}
% \caption{Computing the factorial using recursion in Funcalc.}\label{sheet:factorial}
% \end{sheet}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{latex-sheet}
% Declare package requirements
\RequirePackage{xcolor}
\RequirePackage{colortbl}
\RequirePackage{newfloat}
\RequirePackage{multirow}
\RequirePackage{longtable}
\RequirePackage{tabu}
\RequirePackage{tabularx}
% Declare package options
%\DeclareOption{...}
%\ExecuteOptions{...}
%\ProcessOptions\relax
% Define two new sheet environments
\DeclareFloatingEnvironment[
listname=List of Spreadsheets,
name=Sheet,
placement={tbhp!}
]{sheet}
\DeclareFloatingEnvironment[
listname=List of Function Sheets,
name=Function Sheet,
placement={tbhp!}
]{funsheet}
% Make cleveref recognise sheet environments
\crefname{sheet}{sheet}{sheets}
\Crefname{sheet}{Sheet}{Sheets}
\crefname{funsheet}{function sheet}{function sheets}
\Crefname{funsheet}{Function sheet}{Function sheets}
% Colors and commands for creating Funcalc sheets
\definecolor{lightpink}{RGB}{255,182,193}
\definecolor{lightgreen}{RGB}{144,238,144}
\definecolor{lightcyan}{RGB}{224,255,255}
\definecolor{lightblue}{RGB}{135,206,250}
\newcolumntype{g}{>{\columncolor{gray!15}}c}
\newcolumntype{f}{>{\columncolor{lightpink}}c}
\newcommand{\col}[1]{\multicolumn{1}{c|}{#1}}
\newcommand{\ns}{\rowcolor{gray!15}}
\newcommand{\fs}{\rowcolor{lightpink}}
\newcommand{\farg}{\cellcolor{lightgreen}}
\newcommand{\ftemp}{\cellcolor{lightcyan}}
\newcommand{\result}{\cellcolor{lightblue}}
% NOTE: MUST be the last command
\endinput