summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/proflycee/tex/proflycee-tools-ecritures.tex
blob: ec26d66da2bcb981e0ea1feb3d9014d29815a519 (plain)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
% proflycee-tools-ecritures.tex
% Copyright 2023  Cédric Pierquet
% Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt

%===PACKAGE
\RequirePackage{interval}
\RequirePackage{esvect}
\RequirePackage{ifthen}
\RequirePackage{xspace}
%\RequirePackage{mathrsfs}%pour \mathscr (à voir...)

%===ENSEMBLES CLASSIQUES
\ifthenelse{\isundefined{\N}}%
	{%
		\NewDocumentCommand\N{ s }{\IfBooleanTF{#1}{\ensuremath{\mathbb{N}^{*}}\xspace}{\ensuremath{\mathbb{N}}\xspace}}%
	}%
	{%
		\RenewDocumentCommand\N{ s }{\IfBooleanTF{#1}{\ensuremath{\mathbb{N}^{*}}\xspace}{\ensuremath{\mathbb{N}}\xspace}}%
	}%
\ifthenelse{\isundefined{\Z}}%
	{%
		\NewDocumentCommand\Z{ s }{\IfBooleanTF{#1}{\ensuremath{\mathbb{Z}^{*}}\xspace}{\ensuremath{\mathbb{Z}}\xspace}}%
	}%
	{%
		\RenewDocumentCommand\Z{ s }{\IfBooleanTF{#1}{\ensuremath{\mathbb{Z}^{*}}\xspace}{\ensuremath{\mathbb{Z}}\xspace}}%
	}%
\ifthenelse{\isundefined{\D}}%
	{%
		\NewDocumentCommand\D{ s }{\IfBooleanTF{#1}{\ensuremath{\mathbb{D}^{*}}\xspace}{\ensuremath{\mathbb{D}}\xspace}}%
	}%
	{%
		\RenewDocumentCommand\D{ s }{\IfBooleanTF{#1}{\ensuremath{\mathbb{D}^{*}}\xspace}{\ensuremath{\mathbb{D}}\xspace}}%
	}%
\ifthenelse{\isundefined{\Q}}%
	{%
		\NewDocumentCommand\Q{ s }{\IfBooleanTF{#1}{\ensuremath{\mathbb{Q}^{*}}\xspace}{\ensuremath{\mathbb{Q}}\xspace}}%
	}%
	{%
		\RenewDocumentCommand\Q{ s }{\IfBooleanTF{#1}{\ensuremath{\mathbb{Q}^{*}}\xspace}{\ensuremath{\mathbb{Q}}\xspace}}%
	}%
\ifthenelse{\isundefined{\R}}%
	{%
		\NewDocumentCommand\R{ s }{\IfBooleanTF{#1}{\ensuremath{\mathbb{R}^{*}}\xspace}{\ensuremath{\mathbb{R}}\xspace}}%
	}%
	{%
		\RenewDocumentCommand\R{ s }{\IfBooleanTF{#1}{\ensuremath{\mathbb{R}^{*}}\xspace}{\ensuremath{\mathbb{R}}\xspace}}%
	}%
\ifthenelse{\isundefined{\C}}%
	{%
		\NewDocumentCommand\C{ s }{\IfBooleanTF{#1}{\ensuremath{\mathbb{C}^{*}}\xspace}{\ensuremath{\mathbb{C}}\xspace}}%
	}%
	{%
		\RenewDocumentCommand\C{ s }{\IfBooleanTF{#1}{\ensuremath{\mathbb{C}^{*}}\xspace}{\ensuremath{\mathbb{C}}\xspace}}%
	}%
\ifthenelse{\isundefined{\ensH}}%
	{%
		\NewDocumentCommand\ensH{ s }{\IfBooleanTF{#1}{\ensuremath{\mathbb{H}^{*}}\xspace}{\ensuremath{\mathbb{H}}\xspace}}%
	}%
	{%
		\RenewDocumentCommand\ensH{ s }{\IfBooleanTF{#1}{\ensuremath{\mathbb{H}^{*}}\xspace}{\ensuremath{\mathbb{H}}\xspace}}%
	}%

%====INTERVALLES
\intervalconfig{separator symbol=;}
\NewDocumentCommand\IntervalleFF{ O{scaled} m m }{\ensuremath{\interval[#1]{#2}{#3}}}
\NewDocumentCommand\IntervalleOF{ O{scaled} m m }{\ensuremath{\interval[#1,open left]{#2}{#3}}}
\NewDocumentCommand\IntervalleFO{ O{scaled} m m }{\ensuremath{\interval[#1,open right]{#2}{#3}}}
\NewDocumentCommand\IntervalleOO{ O{scaled} m m }{\ensuremath{\interval[#1,open]{#2}{#3}}}

%====ARRONDI
\DeclareDocumentCommand\Arrondi{ s O{3} m }{% * pour afficher signe / opt = précision / argument = nb
	\IfBooleanTF{#1}{\num[print-implicit-plus]{\xinteval{round(#3,#2)}}}{\num{\xinteval{round(#3,#2)}}}%
}

%====MODULO
\NewDocumentCommand\Modulo{ s O{Cro} m }{%
	\IfStrEq{#2}{Cro}%
		{\IfBooleanTF{#1}{\quad}{\:\:}[#3]}{}%
	\IfStrEq{#2}{Par}%
		{\IfBooleanTF{#1}{\quad}{\:\:}(#3)}{}%
	\IfStrEq{#2}{Txt}%
		{\IfBooleanTF{#1}{\:\:}{\:}\text{modulo }#3}{}%
}

%====COURBE
\NewDocumentCommand\Courbe{ s O{} }{%
	\IfBooleanTF{#1}%
	{%
		\IfNoValueTF{#2}%
			{\ensuremath{{\mathscr{C}}}\xspace}%
			{\ensuremath{{\mathscr{C}}_{#2}}\xspace}%
	}%
	{%
		\IfNoValueTF{#2}%
			{\ensuremath{{\mathcal{C}}}\xspace}%
			{\ensuremath{{\mathcal{C}}_{#2}}\xspace}%
	}%
}

%====SUITE
\NewDocumentCommand\Suite{ O{n} m }{%
	\ensuremath{\left( #2_{#1} \right)}%
}

%===DIVERS
\AtBeginDocument{%voir hyperref...
	\ifthenelse{\isundefined{\i}}{\newcommand\i{{\rm i}}}{\renewcommand\i{{\rm i}}}%
	\ifthenelse{\isundefined{\e}}{\newcommand\e{{\rm e}}}{\renewcommand\e{{\rm e}}}%
	\ifthenelse{\isundefined{\j}}{\newcommand\j{{\rm j}}}{\renewcommand\j{{\rm j}}}%
}

\ifthenelse{\isundefined{\jfexp}}%
	{\newcommand\jfexp{\ensuremath{\e^{\i\frac{\pi}{3}}}}}%
	{\renewcommand\jfexp{\ensuremath{\e^{\i\frac{\pi}{3}}}}}%

\ifthenelse{\isundefined{\jfalg}}%
	{\newcommand\jfalg{\ensuremath{\frac{1}{2}+\i\frac{\sqrt{3}}{2}}}}%
	{\renewcommand\jfalg{\ensuremath{\frac{1}{2}+\i\frac{\sqrt{3}}{2}}}}%

\ifthenelse{\isundefined{\Esper}}%
	{\newcommand\Esper[2][\mathbb{E}]{\ensuremath{{#1}{\left({#2}\right)}}}}%
	{\renewcommand\Esper[2][\mathbb{E}]{\ensuremath{{#1}{\left({#2}\right)}}}}%

\ifthenelse{\isundefined{\Varianc}}%
	{\newcommand\Varianc[2][\mathbb{V}]{\ensuremath{{#1}{\left({#2}\right)}}}}%
	{\renewcommand\Varianc[2][\mathbb{V}]{\ensuremath{{#1}{\left({#2}\right)}}}}%

\ifthenelse{\isundefined{\EcType}}%
	{\newcommand\EcType[1]{\ensuremath{\sigma{\left({#1}\right)}}}}%
	{\renewcommand\EcType[1]{\ensuremath{\sigma{\left({#1}\right)}}}}%

\ifthenelse{\isundefined{\dx}}%
	{\newcommand\dx[1][x]{\ensuremath{~\text{d}#1}}}%
	{\renewcommand\dx[1][x]{\ensuremath{~\text{d}#1}}}%

\ifthenelse{\isundefined{\Integrale}}%
	{\newcommand\Integrale{\displaystyle\int}}%
	{\renewcommand\Integrale{\displaystyle\int}}%


%====PROBAS
\NewDocumentCommand\LoiNormale{ s m m }{%
	\IfBooleanTF{#1}{\ensuremath{\mathscr{N}{\left(#2;#3\right)}}}{\ensuremath{\mathcal{N}{\left(#2;#3\right)}}}%
}
\NewDocumentCommand\LoiBinomiale{ s m m }{%
	\IfBooleanTF{#1}{\ensuremath{\mathscr{B}{\left(#2;#3\right)}}}{\ensuremath{\mathcal{B}{\left(#2;#3\right)}}}%
}
\NewDocumentCommand\LoiPoisson{ s m }{%
	\IfBooleanTF{#1}{\ensuremath{\mathscr{P}_{#2}}}{\ensuremath{\mathcal{P}_{#2}}}%
}
\NewDocumentCommand\LoiUnif{ s m }{%
	\IfBooleanTF{#1}{\ensuremath{\mathscr{U}_{#2}}}{\ensuremath{\mathcal{U}_{#2}}}%
}
\NewDocumentCommand\LoiExpo{ s m }{%
	\IfBooleanTF{#1}{\ensuremath{\mathscr{E}_{#2}}}{\ensuremath{\mathcal{E}_{#2}}}%
}

%====COORDONNEES, VECTEURS
\NewDocumentCommand\CoordPtPl{ m m }{\ensuremath{\left(#1;#2\right)}}
\NewDocumentCommand\CoordPtEsp{ m m m }{\ensuremath{\left(#1;#2;#3\right)}}
\NewDocumentCommand\CoordVecPl{ m m }{\ensuremath{\begin{pmatrix} #1 \\ #2 \end{pmatrix}}}
\NewDocumentCommand\CoordVecEsp{ m m m }{\ensuremath{\begin{pmatrix} #1 \\ #2 \\ #3 \end{pmatrix}}}
\NewDocumentCommand\MatDeux{ m m m m }{\ensuremath{\begin{pmatrix} #1 & #2 \\ #3 & #4 \end{pmatrix}}}
\NewDocumentCommand\Vecteur{ s m O{} }{%
	\IfBooleanTF{#1}{\ensuremath{\vv*{#2}{#3}}}{\ensuremath{\vv{#2}}}%
}

%====REPÈRES
\setKVdefault[ecrituresreperes]{%
	Sep={;}
}

\NewDocumentCommand\RepereOij{ s O{} }{%
	\useKVdefault[ecrituresreperes]%
	\setKV[ecrituresreperes]{#2}%
	\IfBooleanTF{#1}%si étoilé := on n'aligne pas les flèches + nosmash
		{%
			\ensuremath{\left(O\useKV[ecrituresreperes]{Sep}\Vecteur{\imath},\Vecteur{\jmath}\right)}\xspace%
		}%
		{%
			\ensuremath{\left(O\useKV[ecrituresreperes]{Sep}\Vecteur{\vphantom{t}\imath},\Vecteur{\vphantom{t}\jmath}\right)}\xspace%
		}%
}

\NewDocumentCommand\RepereOuv{ s O{} }{%
	\useKVdefault[ecrituresreperes]%
	\setKV[ecrituresreperes]{#2}%
	\IfBooleanTF{#1}%si étoilé := on n'aligne pas les flèches + nosmash
		{%
			\ensuremath{\left(O\useKV[ecrituresreperes]{Sep}\Vecteur{u},\Vecteur{v}\right)}\xspace%
		}%
		{%
			\ensuremath{\left(O\useKV[ecrituresreperes]{Sep}\Vecteur{\vphantom{t}u},\Vecteur{\vphantom{t}v}\right)}\xspace%
		}%
}

\NewDocumentCommand\RepereOijk{ s O{} }{%
	\useKVdefault[ecrituresreperes]%
	\setKV[ecrituresreperes]{#2}%
	\IfBooleanTF{#1}%si étoilé := on n'aligne pas les flèches + nosmash
		{%
			\ensuremath{\left(O\useKV[ecrituresreperes]{Sep}\Vecteur{\imath},\Vecteur{\jmath},\Vecteur{k}\right)}\xspace%
		}%
		{%
			\ensuremath{\left(O\useKV[ecrituresreperes]{Sep}\Vecteur{\vphantom{t}\imath},\Vecteur{\vphantom{t}\jmath},\Vecteur{\vphantom{t}\smash{k}}\right)}\xspace%
		}%
}

\NewDocumentCommand\ReperePlan{ s O{} m m m }{%
	\useKVdefault[ecrituresreperes]%
	\setKV[ecrituresreperes]{#2}%
	\IfBooleanTF{#1}%si étoilé := on n'aligne pas les flèches + nosmash
		{%
			\def\vecteurun{#4}\def\vecteurdeux{#5}%
		}%
		{%
			\def\vecteurun{\smash{#4}}\def\vecteurdeux{\smash{#5}}%
		}%
	\IfStrEq{#4}{i}{\def\vecteurun{\imath}}{}%
	\IfStrEq{#4}{j}{\def\vecteurun{\jmath}}{}%
	\IfStrEq{#5}{i}{\def\vecteurdeux{\imath}}{}%
	\IfStrEq{#5}{j}{\def\vecteurdeux{\jmath}}{}%
	\IfBooleanTF{#1}%si étoilé := on n'aligne pas les flèches + nosmash
		{%
			\ensuremath{\left(#3\useKV[ecrituresreperes]{Sep}\Vecteur{\vecteurun},\Vecteur{\vecteurdeux}\right)}%
		}%
		{%
			\ensuremath{\left(#3\useKV[ecrituresreperes]{Sep}\Vecteur{\vphantom{t}\vecteurun},\Vecteur{\vphantom{t}\vecteurdeux}\right)}%
		}%
}

\NewDocumentCommand\RepereEspace{ s O{} m m m m }{%
	\useKVdefault[ecrituresreperes]%
	\setKV[ecrituresreperes]{#2}%
	\IfBooleanTF{#1}%si étoilé := on n'aligne pas les flèches + nosmash
		{%
			\def\vecteurun{#4}\def\vecteurdeux{#5}\def\vecteurtrois{#6}%
		}%
		{%
			\def\vecteurun{\smash{#4}}\def\vecteurdeux{\smash{#5}}\def\vecteurtrois{\smash{#6}}%
		}%
	\IfStrEq{#4}{i}{\def\vecteurun{\imath}}{}%
	\IfStrEq{#4}{j}{\def\vecteurun{\jmath}}{}%
	\IfStrEq{#5}{i}{\def\vecteurdeux{\imath}}{}%
	\IfStrEq{#5}{j}{\def\vecteurdeux{\jmath}}{}%
	\IfStrEq{#6}{i}{\def\vecteurtrois{\imath}}{}%
	\IfStrEq{#6}{j}{\def\vecteurtrois{\jmath}}{}%
	\IfBooleanTF{#1}%si étoilé := on n'aligne pas les flèches + nosmash
		{%
			\ensuremath{\left(#3\useKV[ecrituresreperes]{Sep}\Vecteur{\vecteurun},\Vecteur{\vecteurdeux},\Vecteur{\vecteurtrois}\right)}%
		}%
		{%
			\ensuremath{\left(#3\useKV[ecrituresreperes]{Sep}\Vecteur{\vphantom{t}\vecteurun},\Vecteur{\vphantom{t}\vecteurdeux},\Vecteur{\vphantom{t}\vecteurtrois}\right)}%
		}%
}


\endinput