summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/profcollege/PfCEquationComposition2.tex
blob: b26d06486ab4932b4cef086fd55e4c56a0774583 (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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
% Licence    : Released under the LaTeX Project Public License v1.3c
% or later, see http://www.latex-project.org/lppl.txtf
\newcommand{\EquaDeuxComposition}[5][]{%type ax+b=d ou b=cx+d$
  \useKVdefault[ClesEquation]%
  \setKV[ClesEquation]{#1}%
  \ifx\bla#2\bla%On échange en faisant attention à ne pas boucler : c doit être non vide
    \EquaDeuxComposition[#1]{#4}{#5}{#2}{#3}
  \else%cas ax+b=d
    \xintifboolexpr{#2==0}{%
      \xintifboolexpr{#3==#5}{%b=d
        L'équation $\num{#3}=\num{#5}$ a une infinité de solutions.}%
      {%b<>d
        L'équation $\num{#3}=\num{#5}$ n'a aucune solution.%
      }%
    }{%ELSE
      \xintifboolexpr{#3==0}{%ax+b=d
        \EquaBase[#1]{#2}{}{}{#5}%
      }{%ax+b=d$ Ici
        \ifboolKV[ClesEquation]{Decomposition}{\colorlet{Ccompo}{\useKV[ClesEquation]{CouleurCompo}}}{}
        \begin{align*}
          \tikzmark{A-\theNbequa}\xintifboolexpr{#2==1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\num{#5}}\tikzmark{E-\theNbequa}\\
          \xintifboolexpr{#2==1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\num{\fpeval{#5-#3}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}}\\
          \tikzmark{C-\theNbequa}\xdef\Coeffa{#2}\xdef\Coeffb{\fpeval{#5-#3}}\xintifboolexpr{\Coeffa==1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}&=\num{\Coeffb}\tikzmark{G-\theNbequa}%\\
          \xintifboolexpr{\Coeffa==1}{}{\\}
          \ifboolKV[ClesEquation]{Fleches}{%
          \leftcomment{A-\theNbequa}{C-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
          \rightcomment{E-\theNbequa}{G-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
          }{}
          \xintifboolexpr{\Coeffa==1}{% 
          }{%\ifnum\cmtd>1
          \tikzmark{D-\theNbequa}\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}\tikzmark{H-\theNbequa}%\\
          \ifboolKV[ClesEquation]{Fleches}{%
          \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
          \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
          }{%
          \ifboolKV[ClesEquation]{FlecheDiv}{%
          \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
          \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
          }{}
          }
          }
          \ifboolKV[ClesEquation]{Decimal}{%
          \\\useKV[ClesEquation]{Lettre}&=\num{\fpeval{\Coeffb/\Coeffa}}%
                                          }{}%
                                        %%%
          \ifboolKV[ClesEquation]{Entier}{%
          \SSimpliTest{\Coeffb}{\Coeffa}%
          \ifboolKV[ClesEquation]{Simplification}{%
          \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{}%\\
          }{}
          }{}
          \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
        \end{align*}
        \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2==1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\num{#5}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\ifboolKV[ClesEquation]{LettreSol}{\useKV[ClesEquation]{Lettre}=}{}\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.
        }{}
      }
    }
  \fi
}

\newcommand{\EquaTroisComposition}[5][]{%ax+b=cx ou ax=cx+d
  \useKVdefault[ClesEquation]%
  \setKV[ClesEquation]{#1}%
  \ifx\bla#3\bla%on inverse en faisant attention à la boucle #3<->#5
  \ifx\bla#5\bla%
  %% paramètre oublié
  \else
  \EquaTroisComposition[#1]{#4}{#5}{#2}{}%
  \fi
  \else
  \xintifboolexpr{#2==0}{%b=cx
    \EquaBase[#1]{#4}{}{}{#3}
  }{%
    \xintifboolexpr{#4==0}{%ax+b=0
      \EquaDeuxComposition[#1]{#2}{#3}{}{0}
    }{%ax+b=cx
      \xintifboolexpr{#2==#4}{%
        \xintifboolexpr{#3==0}{%ax=ax
          L'équation $\xintifboolexpr{#2==1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}=\xintifboolexpr{#4==1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}$ a une infinité de solutions.}%
        {%ax+b=ax
          L'équation $\xintifboolexpr{#2==1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4==1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}$ n'a aucune solution.%
        }%
      }{%% Cas délicat
        \xintifboolexpr{#2>#4}{%ax+b=cx avec a>c
          \ifboolKV[ClesEquation]{Decomposition}{\colorlet{Ccompo}{\useKV[ClesEquation]{CouleurCompo}}}{}
          \begin{align*}
            \tikzmark{A-\theNbequa}\mathcolor{Ccompo}{\xintifboolexpr{#2==1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}}\xintifboolexpr{#3==0}{}{\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}}&=\xintifboolexpr{#4==1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\tikzmark{E-\theNbequa}\\
            \mathcolor{Ccompo}{\num{\fpeval{#2-#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#4>0}{+\num{#4}\useKV[ClesEquation]{Lettre}}{-\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre}}}\xintifboolexpr{#3==0}{}{\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}}&=\xintifboolexpr{#4==1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\\
            \tikzmark{B-\theNbequa}\xdef\Coeffa{\fpeval{#2-#4}}\xintifboolexpr{\Coeffa==1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3==0}{}{\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}}&=0\tikzmark{F-\theNbequa}%\mathcolor{Ccompo}{0}\tikzmark{F-\theNbequa}%\\
            \xintifboolexpr{#3==0}{}{\\
            \xintifboolexpr{\Coeffa==1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\num{\fpeval{0-#3}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}}\tikzmark{F-\theNbequa}\\
            \tikzmark{C-\theNbequa}\xdef\Coeffb{\fpeval{0-#3}}\xintifboolexpr{\Coeffa==1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}&=\num{\Coeffb}\tikzmark{G-\theNbequa}%\\
            \xintifboolexpr{\Coeffa==1}{}{\\}
            \ifboolKV[ClesEquation]{Fleches}{%
            \leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#4>0}{-\num{#4}}{+\num{\fpeval{0-#4}}}\useKV[ClesEquation]{Lettre}$}
            \rightcomment{E-\theNbequa}{F-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#4>0}{-\num{#4}}{+\num{\fpeval{0-#4}}}\useKV[ClesEquation]{Lettre}$}
            \leftcomment{B-\theNbequa}{C-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
            \rightcomment{F-\theNbequa}{G-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
            }{}
            \xintifboolexpr{\Coeffa==1}{}{%\ifnum\cmtd>1
            \tikzmark{D-\theNbequa}\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}\tikzmark{H-\theNbequa}%\\
            \ifboolKV[ClesEquation]{Fleches}{%
            \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
            \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
            }{
            \ifboolKV[ClesEquation]{FlecheDiv}{%
            \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
            \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
            }{}
            }
            \ifboolKV[ClesEquation]{Decimal}{%
            \\\useKV[ClesEquation]{Lettre}&=\num{\fpeval{\Coeffb/\Coeffa}}%
                                        }{}%
                                        %%%
            \ifboolKV[ClesEquation]{Entier}{%
            \SSimpliTest{\Coeffb}{\Coeffa}%
            \ifboolKV[ClesEquation]{Simplification}{%
            \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{}%\\
            }{}
            }{}
            }
            \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
            }
          \end{align*}
          \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2==1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4==1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\ifboolKV[ClesEquation]{LettreSol}{\useKV[ClesEquation]{Lettre}=}{}\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.}{}
        }{%ax+b=cx avec a<c              % Autre cas délicat
          \ifboolKV[ClesEquation]{Decomposition}{\colorlet{Ccompo}{\useKV[ClesEquation]{CouleurCompo}}}{}
          \begin{align*}%
            \tikzmark{A-\theNbequa}\xintifboolexpr{#2==1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\xintifboolexpr{#4==1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}}\tikzmark{E-\theNbequa}\\
            \xintifboolexpr{#2==1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\num{\fpeval{#4-#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#2>0}{+\num{#2}\useKV[ClesEquation]{Lettre}}{-\num{\fpeval{0-#2}}\useKV[ClesEquation]{Lettre}}}\\
            \tikzmark{B-\theNbequa}\xdef\Coeffb{#3}\xdef\Coeffa{\fpeval{#4-#2}}\xintifboolexpr{#3>0}{\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{\Coeffa==1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\tikzmark{F-\theNbequa}
                                                                                                                                      \xintifboolexpr{\Coeffa==1}{}{\\}
            \ifboolKV[ClesEquation]{Fleches}{%
            \leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#2>0}{-\num{#2}}{+\num{\fpeval{0-#2}}}\useKV[ClesEquation]{Lettre}$}
            \rightcomment{E-\theNbequa}{F-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#2>0}{-\num{#2}}{+\num{\fpeval{0-#2}}}\useKV[ClesEquation]{Lettre}$}
            }{}
            \xintifboolexpr{\Coeffa==1}{}{%\ifnum\cmtd>1
            \tikzmark{D-\theNbequa}\frac{\num{\Coeffb}}{\num{\Coeffa}}&=\useKV[ClesEquation]{Lettre}\tikzmark{H-\theNbequa}%\\
            \ifboolKV[ClesEquation]{Fleches}{%
            \leftcomment{B-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
            \rightcomment{F-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
            }{
            \ifboolKV[ClesEquation]{FlecheDiv}{%
            \leftcomment{B-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
            \rightcomment{F-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
            }{}
            }
            \ifboolKV[ClesEquation]{Decimal}{%
            \\\num{\fpeval{\Coeffb/\Coeffa}}&=\useKV[ClesEquation]{Lettre}%
                                            }{}%
                                            %%% 
            \ifboolKV[ClesEquation]{Entier}{%
            \SSimpliTest{\Coeffb}{\Coeffa}%
            \ifboolKV[ClesEquation]{Simplification}{%
            \ifthenelse{\boolean{Simplification}}{\\\SSimplifie{\Coeffb}{\Coeffa}&=\useKV[ClesEquation]{Lettre}}{}%\\
            }{}
            }{}
            }
            \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
          \end{align*}
          \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2==1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4==1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\ifboolKV[ClesEquation]{LettreSol}{\useKV[ClesEquation]{Lettre}=}{}\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.}{}%
        }%
      }%
    }%
  }%
  \fi
}%

\newcommand{\ResolEquationComposition}[5][]{%
  \useKVdefault[ClesEquation]%
  \setKV[ClesEquation]{#1}%
  \xintifboolexpr{#2==0}{%
    \xintifboolexpr{#4==0}{%
      \xintifboolexpr{#3==#5}{%b=d
        L'équation $\num{#3}=\num{#5}$ a une infinité de solutions.}%
      {%b<>d
        L'équation $\num{#3}=\num{#5}$ n'a aucune solution.%
      }%
    }%
    {%0x+b=cx+d$
      \EquaDeuxComposition[#1]{#4}{#5}{#2}{#3}%
    }%
  }{%
    \xintifboolexpr{#4==0}{%ax+b=0x+d
      \EquaDeuxComposition[#1]{#2}{#3}{}{#5}%
    }
    {%ax+b=cx+d$
      \xintifboolexpr{#3==0}{%
        \xintifboolexpr{#5==0}{%ax=cx
          \EquaTroisComposition[#1]{#2}{0}{#4}{}%
        }%
        {%ax=cx+d
          \EquaTroisComposition[#1]{#4}{#5}{#2}{}%
        }%
      }%
      {\xintifboolexpr{#5==0}{%ax+b=cx
          \EquaTroisComposition[#1]{#2}{#3}{#4}{}%
        }%
        {%ax+b=cx+d -- ici
          \xintifboolexpr{#2==#4}{%
            \xintifboolexpr{#3==#5}{%b=d
              L'équation $\xintifboolexpr{#2==1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4==1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}$ a une infinité de solutions.}%
            {%b<>d
              L'équation $\xintifboolexpr{#2==1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4==1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}$ n'a aucune solution.%
            }%
          }{
            %% Cas délicat
            \xintifboolexpr{#2>#4}{%ax+b=cx+d avec a>c
              \ifboolKV[ClesEquation]{Decomposition}{\colorlet{Ccompo}{\useKV[ClesEquation]{CouleurCompo}}}{}
              \begin{align*}
                \tikzmark{A-\theNbequa}\mathcolor{Ccompo}{\xintifboolexpr{#2==1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4==1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\tikzmark{E-\theNbequa}\\
                \mathcolor{Ccompo}{\num{\fpeval{#2-#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#4>0}{+\num{#4}\useKV[ClesEquation]{Lettre}}{-\num{\fpeval{0-#4}}\useKV[ClesEquation]{Lettre}}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\xintifboolexpr{#4==1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\\
                \tikzmark{B-\theNbequa}\xdef\Coeffa{\fpeval{#2-#4}}\xintifboolexpr{\Coeffa==1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\num{#5}}\tikzmark{F-\theNbequa}\\
                \xintifboolexpr{\Coeffa==1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\num{\fpeval{#5-#3}}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}}\\
                \tikzmark{C-\theNbequa}\xdef\Coeffb{\fpeval{#5-#3}}\xintifboolexpr{\Coeffa==1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}&=\num{\Coeffb}\tikzmark{G-\theNbequa}%\\
                \xintifboolexpr{\Coeffa==1}{}{\\}
                \ifboolKV[ClesEquation]{Fleches}{%
                \leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#4>0}{-\num{#4}}{+\num{\fpeval{0-#4}}}\useKV[ClesEquation]{Lettre}$}
                \rightcomment{E-\theNbequa}{F-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#4>0}{-\num{#4}}{+\num{\fpeval{0-#4}}}\useKV[ClesEquation]{Lettre}$}
                \leftcomment{B-\theNbequa}{C-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
                \rightcomment{F-\theNbequa}{G-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#3>0}{-\num{#3}}{+\num{\fpeval{0-#3}}}$}%
                }{}
                \xintifboolexpr{\Coeffa==1}{}{%\ifnum\cmtd>1
                \tikzmark{D-\theNbequa}\useKV[ClesEquation]{Lettre}&=\frac{\num{\Coeffb}}{\num{\Coeffa}}\tikzmark{H-\theNbequa}%\\
                \ifboolKV[ClesEquation]{Fleches}{%
                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
                }{
                \ifboolKV[ClesEquation]{FlecheDiv}{%
                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
                }{}
                }
                %% decimal
                \ifboolKV[ClesEquation]{Decimal}{%
                \\\useKV[ClesEquation]{Lettre}&=\num{\fpeval{\Coeffb/\Coeffa}}%
                                        }{}%
                                        %%%
                \ifboolKV[ClesEquation]{Entier}{%
                \SSimpliTest{\Coeffb}{\Coeffa}%
                \ifboolKV[ClesEquation]{Simplification}{%
                \ifthenelse{\boolean{Simplification}}{\\\useKV[ClesEquation]{Lettre}&=\SSimplifie{\Coeffb}{\Coeffa}}{}%\\
                }{}
                }{}
                }
                \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
              \end{align*}
              \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2==1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4==1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\ifboolKV[ClesEquation]{LettreSol}{\useKV[ClesEquation]{Lettre}=}{}\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.%
              }{}
            }{%ax+b=cx+d avec a<c              % Autre cas délicat
              \ifboolKV[ClesEquation]{Decomposition}{\colorlet{Ccompo}{\useKV[ClesEquation]{CouleurCompo}}}{}%
              \begin{align*}%
                \tikzmark{A-\theNbequa}\xintifboolexpr{#2==1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\xintifboolexpr{#4==1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\tikzmark{E-\theNbequa}\\
                \xintifboolexpr{#2==1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}&=\mathcolor{Ccompo}{\num{\fpeval{#4-#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#2>0}{+\num{#2}\useKV[ClesEquation]{Lettre}}{-\num{\fpeval{0-#2}}\useKV[ClesEquation]{Lettre}}}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\\
                \tikzmark{B-\theNbequa}\xdef\Coeffa{\fpeval{#4-#2}}\mathcolor{Ccompo}{\xintifboolexpr{#3>0}{\num{#3}}{-\num{\fpeval{0-#3}}}}&=\xintifboolexpr{\Coeffa==1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\tikzmark{F-\theNbequa}\\
                \mathcolor{Ccompo}{\num{\fpeval{#3-#5}}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}}&=\xintifboolexpr{\Coeffa==1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}\\
                \tikzmark{C-\theNbequa}\xdef\Coeffb{\fpeval{#3-#5}}\num{\Coeffb}&=\xintifboolexpr{\Coeffa==1}{}{\num{\Coeffa}}\useKV[ClesEquation]{Lettre}\tikzmark{G-\theNbequa}%\\
                \xintifboolexpr{\Coeffa==1}{}{\\}
                \ifboolKV[ClesEquation]{Fleches}{%
                \leftcomment{A-\theNbequa}{B-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#2>0}{-\num{#2}}{+\num{\fpeval{0-#2}}}\useKV[ClesEquation]{Lettre}$}
                \rightcomment{E-\theNbequa}{F-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#2>0}{-\num{#2}}{+\num{\fpeval{0-#2}}}\useKV[ClesEquation]{Lettre}$}
                \leftcomment{B-\theNbequa}{C-\theNbequa}{A-\theNbequa}{$\xintifboolexpr{#5>0}{-\num{#5}}{+\num{\fpeval{0-#5}}}$}%
                \rightcomment{F-\theNbequa}{G-\theNbequa}{E-\theNbequa}{$\xintifboolexpr{#5>0}{-\num{#5}}{+\num{\fpeval{0-#5}}}$}%
                }{}
                \xintifboolexpr{\Coeffa==1}{}{%\ifnum\cmtd>1
                \tikzmark{D-\theNbequa}\frac{\num{\Coeffb}}{\num{\Coeffa}}&=\useKV[ClesEquation]{Lettre}\tikzmark{H-\theNbequa}%\\
                \ifboolKV[ClesEquation]{Fleches}{%
                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
                }{
                \ifboolKV[ClesEquation]{FlecheDiv}{%
                \leftcomment{C-\theNbequa}{D-\theNbequa}{A-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
                \rightcomment{G-\theNbequa}{H-\theNbequa}{E-\theNbequa}{$\div\xintifboolexpr{\Coeffa<0}{(\num{\Coeffa})}{\num{\Coeffa}}$}%
                }{}
                }
                %% decimal
                \ifboolKV[ClesEquation]{Decimal}{%
                \\\num{\fpeval{\Coeffb/\Coeffa}}&=\useKV[ClesEquation]{Lettre}%
                                                }{}%
                                        %%%
                \ifboolKV[ClesEquation]{Entier}{%
                \SSimpliTest{\Coeffb}{\Coeffa}%
                \ifboolKV[ClesEquation]{Simplification}{%
                \ifthenelse{\boolean{Simplification}}{\\\SSimplifie{\Coeffb}{\Coeffa}&=\useKV[ClesEquation]{Lettre}}{}%\\
                }{}
                }{}
                }
                \ifboolKV[ClesEquation]{Fleches}{\stepcounter{Nbequa}}{\ifboolKV[ClesEquation]{FlecheDiv}{\stepcounter{Nbequa}}{}}
              \end{align*}
              \ifboolKV[ClesEquation]{Solution}{L'équation $\xintifboolexpr{#2==1}{}{\num{#2}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#3>0}{+\num{#3}}{-\num{\fpeval{0-#3}}}=\xintifboolexpr{#4==1}{}{\num{#4}}\useKV[ClesEquation]{Lettre}\xintifboolexpr{#5>0}{+\num{#5}}{-\num{\fpeval{0-#5}}}$ a une unique solution : \opdiv*{\Coeffb}{\Coeffa}{solution}{resteequa}\opcmp{resteequa}{0}$\ifboolKV[ClesEquation]{LettreSol}{\useKV[ClesEquation]{Lettre}=}{}\displaystyle\ifopeq\opexport{solution}{\solution}\num{\solution}\else\ifboolKV[ClesEquation]{Entier}{\SSimplifie{\Coeffb}{\Coeffa}}{\frac{\num{\Coeffb}}{\num{\Coeffa}}}\fi$.%
              }{}%
            }%
          }%
        }%
      }%
    }%
  }%
}%