编辑: 5天午托 | 2019-07-05 |
2006 This is the cool package: a COntent Oriented L A TEX package.
That is, it is designed to give L A TEX commands the ability to contain the mathematical meaning while retaining the typesetting versatility. Please note that there are examples of use of each of the de?ned commands at the location where they are de?ned. This package requires the following, non-standard L A TEX packages (all of which are available on www.ctan.org): coolstr, coollist, forloop
1 Implementation
1 \newcounter{COOL@ct} %just a general counter
2 \newcounter{COOL@ct@}%just a general counter 1.1 Parenthesis
3 \newcommand{\inp}[2][0cm]{\mathopen{}\left(#2\parbox[h][#1]{0cm}{}\right)}
4 % in parentheses ()
5 \newcommand{\inb}[2][0cm]{\mathopen{}\left[#2\parbox[h][#1]{0cm}{}\right]}
6 % in brackets []
7 \newcommand{\inbr}[2][0cm]{\mathopen{}\left\{#2\parbox[h][#1]{0cm}{}\right\}}
8 % in braces {}
9 \newcommand{\inap}[2][0cm]{\mathopen{}\left}
10 % in angular parentheses
11 \newcommand{\nop}[1]{\mathopen{}\left.{#1}\right.}
12 % no parentheses \COOL@decide@paren \COOL@decide@paren[ parenthesis type ]{ function name }{ contained text }. Since the handling of parentheses is something that will be common to many elements this function will take care of it. If the optional argument is given, \COOL@notation@ function name Paren is ignored and parenthesis type is used parenthesis type and \COOL@notation@ function name Paren must be one of none, p for (), b for [], br for {}, ap for , inv for \left.\right.
13 \let\COOL@decide@paren@no@type=\relax
14 \newcommand{\COOL@decide@paren}[3][\COOL@decide@paren@no@type]{%
15 \ifthenelse{ \equal{#1}{\COOL@decide@paren@no@type} }%
16 {%
17 \def\COOL@decide@paren@type{\csname COOL@notation@#2Paren\endcsname}%
18 }% ?This document corresponds to cool v1.35, dated 2006/12/29.
1 19 % Else
20 {%
21 \def\COOL@decide@paren@type{#1}%
22 }%
23 \ifthenelse{ \equal{\COOL@decide@paren@type}{none} }%
24 {%
25 #3%
26 }%
27 % Else
28 {%
29 \ifthenelse{ \equal{\COOL@decide@paren@type}{p} }%
30 {%
31 \inp{#3}%
32 }%
33 % Else
34 {%
35 \ifthenelse{ \equal{\COOL@decide@paren@type}{b} }%
36 {%
37 \inb{#3}%
38 }%
39 % Else
40 {%
41 \ifthenelse{ \equal{\COOL@decide@paren@type}{br} }%
42 {%
43 \inbr{#3}%
44 }%
45 % Else
46 {%
47 \ifthenelse{ \equal{\COOL@decide@paren@type}{ap} }%
48 {%
49 \inap{#3}%
50 }%
51 % Else
52 {%
53 \ifthenelse{ \equal{\COOL@decide@paren@type}{inv} }%
54 {%
55 \nop{#3}%
56 }%
57 % Else
58 {%
59 \PackageError{cool}{Invalid Parenthesis Option}%
60 {*Paren can only be '
none'
, '
p'
, '
b'
, '
br'
, '
ap'
, '
inv'
}%
61 }%
62 }%
63 }%
64 }%
65 }%
66 }%
67 } 1.2 Indicies \COOL@decide@indicies \COOL@decide@indicies{ function name }{ local indication }{ indicies } Since up or down indicies can be as common as the parenthesis decision, this
2 macro is the solution. local indication must be either u or d indicies is very likely to be required to be a comma separated list in the near future the options for indicies are local allow the indicies to be decided by an optional argument to the function (such as \LeviCivita[u]{i j}) up force the indicies to appear as superscript down force the indicies to appear as subscript
68 \newcommand{\COOL@decide@indicies}[3]{%