| 1 |
Copyright (C) 2013 by Song Zhiwei <[email protected]> |
| 2 |
|
| 3 |
The package memory.sty provides an easy way to declare object or array |
| 4 |
containers. If you are considering to use an auxiliary file, you really |
| 5 |
need this package rather than the heavy I/O manipulation. |
| 6 |
|
| 7 |
Usage: |
| 8 |
|
| 9 |
1. Declares a data variable in local scope or global scope. |
| 10 |
|
| 11 |
\newdata{<local variable name>} |
| 12 |
\newdata*{<global variable name>} |
| 13 |
|
| 14 |
e.g. \newdata{Person} % Note: no backslash for variable declaration |
| 15 |
\newdata*{Time} % Note: \Time is declared in global scope |
| 16 |
|
| 17 |
2. Uses = or := to set value. The := version sets expanded value to variable. |
| 18 |
|
| 19 |
1) Sets value as a single variable |
| 20 |
|
| 21 |
\Person = {Song Zhiwei} % Note: add backslash for declared variable |
| 22 |
\Time := \today % Note: set the expanded result of \today to \Time |
| 23 |
|
| 24 |
2) Sets value as an array. |
| 25 |
|
| 26 |
\Person[1] = {28.3} |
| 27 |
|
| 28 |
3) Sets value as a multiple dimensional array. |
| 29 |
|
| 30 |
\Time[2,5,\thesection] = \today % Note: the value will be saved globally |
| 31 |
% for the global variable |
| 32 |
|
| 33 |
4) Sets value as an object. |
| 34 |
|
| 35 |
\Person[description] = {A Chinese gentleman.} |
| 36 |
\Person[hair] = {black} |
| 37 |
|
| 38 |
3. Gets values. |
| 39 |
|
| 40 |
\Person % Song Zhiwei |
| 41 |
\Time % May 13, 2013 |
| 42 |
\Person[1] % 28.3 |
| 43 |
\Time[2,5,\thesection] % May 13, 2013 |
| 44 |
\Person[description] % A Chinese gentleman. |
| 45 |
\Person[hair] % black |