This file is indexed.

/usr/lib/libreoffice/share/extensions/DmathsAddon/CmathOOo/mFormuleOOo2Tex.xba is in libreoffice-dmaths 3.4+dfsg1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="mFormuleOOo2Tex" script:language="StarBasic">&apos;*****  BASIC  *****
&apos;CmathOOo
&apos;Copyright (C) 2005  Christophe devalland

&apos;This program is free software; you can redistribute it and/or
&apos;modify it under the terms of the GNU General Public License
&apos;as published by the Free Software Foundation; either version 2
&apos;of the License, or (at your option) any later version.

&apos;This program is distributed in the hope that it will be useful,
&apos;but WITHOUT ANY WARRANTY; without even the implied warranty of
&apos;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
&apos;GNU General Public License for more details.

&apos;You should have received a copy of the GNU General Public License
&apos;along with this program; if not, write to the Free Software
&apos;Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

&apos; substitutions
Option explicit

public sOOoKey() as String
public sLatexKey() as String
&apos; opérateurs 
public sOOoOperator() as String
public sLatexOperator() as String
public iTypeOperator() as Integer

const cFRAC=0
const cINT=1
const cNROOT=2
const cLIMIT=3
const cLEFT=4
const cMATRIX=5
const cABS=6
const cSTACK=7
const cBINOM=8
const cDELETE=9
const cALIGN=10
const cOVER=11
const cUNDER=12
const cDELETE0=13
const cDELETE1=14
const cFUNC=15
const cBRACE=16
const cLSUP=17
const cCSUB=18
const cFACT=19


sub InitVariablesOOo2TeX
		&apos; les mots-clés qui ne demandent qu&apos;une traduction
		&apos; il faut se contenter d&apos;un language TeX basique : par exemple \geqslant n&apos;est pas reconnu
		sOOoKey=Array(&quot;im&quot;,&quot;re&quot;,&quot;arcosh&quot;,&quot;arcoth&quot;,&quot;aleph&quot;,&quot;and&quot;,&quot;approx&quot;,&quot;arccos&quot;,&quot;arccot&quot;,_
						&quot;acute&quot;,&quot;arcsin&quot;,&quot;arctan&quot;,&quot;arsinh&quot;,&quot;artanh&quot;,&quot;backepsilon&quot;,&quot;bar&quot;,_
						&quot;breve&quot;,&quot;bslash&quot;,&quot;cdot&quot;,&quot;check&quot;,&quot;circ&quot;,&quot;circle&quot;,&quot;coprod&quot;,_
						&quot;cos&quot;,&quot;cosh&quot;,&quot;cot&quot;,&quot;coth&quot;,&quot;dddot&quot;,&quot;ddot&quot;,&quot;def&quot;,&quot;div&quot;,&quot;divides&quot;,_
						&quot;dlarrow&quot;,&quot;dlrarrow&quot;,&quot;dot&quot;,&quot;dotsaxis&quot;,&quot;dotsdiag&quot;,&quot;dotsdown&quot;,_
						&quot;dotslow&quot;,&quot;dotsup&quot;,&quot;dotsvert&quot;,&quot;downarrow&quot;,&quot;drarrow&quot;,&quot;emptyset&quot;,_
						&quot;equiv&quot;,&quot;exists&quot;,&quot;exp&quot;,&quot;forall&quot;,&quot;ge&quot;,&quot;geslant&quot;,&quot;gg&quot;,&quot;grave&quot;,_
						&quot;gt&quot;,&quot;hat&quot;,&quot;hbar&quot;,&quot;in&quot;,&quot;infinity&quot;,&quot;infty&quot;,&quot;intersection&quot;,_
						&quot;le&quot;,&quot;leftarrow&quot;,&quot;leslant&quot;,&quot;ll&quot;,&quot;ln&quot;,&quot;log&quot;,_
						&quot;lt&quot;,&quot;minusplus&quot;,&quot;mline&quot;,&quot;nabla&quot;,&quot;ndivides&quot;,&quot;neg&quot;,&quot;neq&quot;,_
						&quot;ni&quot;,&quot;notin&quot;,&quot;nsubset&quot;,&quot;nsupset&quot;,&quot;nsubseteq&quot;,&quot;nsupseteq&quot;,_
						&quot;odivide&quot;,&quot;odot&quot;,&quot;ominus&quot;,&quot;oplus&quot;,&quot;or&quot;,&quot;ortho&quot;,&quot;otimes&quot;,_
						&quot;owns&quot;,&quot;parrallel&quot;,&quot;partial&quot;,&quot;phantom&quot;,&quot;plusminus&quot;,&quot;prop&quot;,_
						&quot;rightarrow&quot;,&quot;rsub&quot;,&quot;rsup&quot;,&quot;setC&quot;,&quot;setN&quot;,&quot;setQ&quot;,&quot;setR&quot;,&quot;setZ&quot;,_
						&quot;setminus&quot;,&quot;sim&quot;,&quot;simeq&quot;,&quot;sin&quot;,&quot;sinh&quot;,&quot;slash&quot;,&quot;sqrt&quot;,&quot;sub&quot;,&quot;subset&quot;,_
						&quot;subseteq&quot;,&quot;sup&quot;,&quot;supset&quot;,&quot;supseteq&quot;,&quot;tan&quot;,&quot;tanh&quot;,&quot;tilde&quot;,&quot;times&quot;,_
						&quot;toward&quot;,&quot;union&quot;,&quot;uparrow&quot;,&quot;vec&quot;,_
						&quot;wp&quot;,&quot;left&quot;,&quot;right&quot;,&quot;none&quot;,&quot;lbrace&quot;,&quot;rbrace&quot;,&quot;langle&quot;,&quot;rangle&quot;,_
						&quot;lceil&quot;,&quot;rceil&quot;,&quot;ldbracket&quot;,&quot;rdbracket&quot;,&quot;ldline&quot;,&quot;rdline&quot;,&quot;lfloor&quot;,&quot;rfloor&quot;,_
						&quot;lline&quot;,&quot;rline&quot;,_
						&quot;%alpha&quot;,&quot;%ALPHA&quot;,&quot;%bêta&quot;,&quot;%BÊTA&quot;,&quot;%gamma&quot;,&quot;%GAMMA&quot;,&quot;%delta&quot;,&quot;%DELTA&quot;,_
						&quot;%epsilon&quot;,&quot;%EPSILON&quot;,&quot;%zêta&quot;,&quot;%ZÊTA&quot;,&quot;%êta&quot;,&quot;%ÊTA&quot;,&quot;%thêta&quot;,&quot;%THÊTA&quot;,_
						&quot;%iota&quot;,&quot;%IOTA&quot;,&quot;%kappa&quot;,&quot;%KAPPA&quot;,&quot;%lambda&quot;,&quot;%LAMBDA&quot;,&quot;%mu&quot;,&quot;%MU&quot;,_
						&quot;%nu&quot;,&quot;%NU&quot;,&quot;%xi&quot;,&quot;%XI&quot;,&quot;%omicron&quot;,&quot;%OMICRON&quot;,&quot;%pi&quot;,&quot;%PI&quot;,&quot;%rhô&quot;,&quot;%RHÔ&quot;,_
						&quot;%sigma&quot;,&quot;%SIGMA&quot;,&quot;%tau&quot;,&quot;%TAU&quot;,&quot;%upsilon&quot;,&quot;%UPSILON&quot;,&quot;%phi&quot;,&quot;%PHI&quot;,_
						&quot;%khi&quot;,&quot;%KHI&quot;,&quot;%psi&quot;,&quot;%PSI&quot;,&quot;%oméga&quot;,&quot;%OMÉGA&quot;,&quot;%varepsilon&quot;,&quot;%varthêta&quot;,_
						&quot;%varpi&quot;,&quot;%varrhô&quot;,&quot;%varsigma&quot;,&quot;%varphi&quot;,&quot;%infini&quot;)
		sLatexKey=Array(&quot;\Im&quot;,&quot;\Re&quot;,&quot;\textrm{arcosh}&quot;,&quot;\textrm{arcoth}&quot;,&quot;\aleph&quot;,&quot;\wedge&quot;,&quot;\approx&quot;,&quot;\arccos&quot;,&quot;\arccot&quot;,_
						&quot;\acute&quot;,&quot;\arcsin&quot;,&quot;\arctan&quot;,&quot;\textrm{arsinh}&quot;,&quot;\textrm{artanh}&quot;,&quot;\backepsilon&quot;,&quot;\bar&quot;,_
						&quot;\breve&quot;,&quot;\backslash&quot;,&quot;\cdot&quot;,&quot;\check&quot;,&quot;\circ&quot;,&quot;\overset{\circ}&quot;,&quot;\coprod&quot;,_
						&quot;\cos&quot;,&quot;\cosh&quot;,&quot;\cot&quot;,&quot;\coth&quot;,&quot;\dddot&quot;,&quot;\ddot&quot;,&quot;\defeq&quot;,&quot;\div&quot;,&quot;|&quot;,_
						&quot;\leftarrow&quot;,&quot;\Leftrightarrow&quot;,&quot;\dot&quot;,&quot;\cdots&quot;,&quot;\ddotsup&quot;,&quot;\ddots&quot;,_
						&quot;\ldots&quot;,&quot;\ddotsup&quot;,&quot;\vdots&quot;,&quot;\downarrow&quot;,&quot;\Rightarrow&quot;,&quot;\emptyset&quot;,_
						&quot;\equiv&quot;,&quot;\exists&quot;,&quot;\exp&quot;,&quot;\forall&quot;,&quot;\geq&quot;,&quot;\geq&quot;,&quot;\gg&quot;,&quot;\grave&quot;,_
						&quot;&gt;&quot;,&quot;\hat&quot;,&quot;\hbar&quot;,&quot;\in&quot;,&quot;\infty&quot;,&quot;\infty&quot;,&quot;\cap&quot;,_
						&quot;\leq&quot;,&quot;\leftarrow&quot;,&quot;\leq&quot;,&quot;\ll&quot;,&quot;\ln&quot;,&quot;\log&quot;,_
						&quot;&lt;&quot;,&quot;\_mp&quot;,&quot;\left | \right. &quot;,&quot;\nabla&quot;,&quot;\nmid&quot;,&quot;\neg&quot;,&quot;\neq&quot;,_
						&quot;\ni&quot;,&quot;\notin&quot;,&quot;\not\subset&quot;,&quot;\not\supset&quot;,&quot;\nsubseteq&quot;,&quot;\nsupseteq&quot;,_
						&quot;\oslash&quot;,&quot;\odot&quot;,&quot;\ominus&quot;,&quot;\oplus&quot;,&quot;\vee&quot;,&quot;\perp&quot;,&quot;\otimes&quot;,_
						&quot;\ni&quot;,&quot;\parallel&quot;,&quot;\partial&quot;,&quot;\phantom&quot;,&quot;\pm&quot;,&quot;\propto&quot;,_
						&quot;\rightarrow&quot;,&quot;_&quot;,&quot;^&quot;,&quot;\mathbb{C}&quot;,&quot;\mathbb{N}&quot;,&quot;\mathbb{Q}&quot;,&quot;\mathbb{R}&quot;,&quot;\mathbb{Z}&quot;,_
						&quot;\setminus&quot;,&quot;\sim&quot;,&quot;\simeq&quot;,&quot;\sin&quot;,&quot;\sinh&quot;,&quot;/&quot;,&quot;\sqrt&quot;,&quot;_&quot;,&quot;\subset&quot;,_
						&quot;\subseteq&quot;,&quot;^&quot;,&quot;\supset&quot;,&quot;\subseteq&quot;,&quot;\tan&quot;,&quot;\tanh&quot;,&quot;\tilde&quot;,&quot;\times&quot;,_
						&quot;\to&quot;,&quot;\cup&quot;,&quot;\uparrow&quot;,&quot;\vec&quot;,_
						&quot;\wp&quot;,&quot;\left&quot;,&quot;\right&quot;,&quot;.&quot;,&quot;\{&quot;,&quot;\}&quot;,&quot;\langle&quot;,&quot;rangle&quot;,_
						&quot;\lceil&quot;,&quot;\rceil&quot;,&quot;\llbracket&quot;,&quot;\rrbracket&quot;,&quot;\|&quot;,&quot;\|&quot;,&quot;\lfloor&quot;,&quot;\rfloor&quot;,_
						&quot;|&quot;,&quot;|&quot;,_
						&quot;\alpha&quot;,&quot;A&quot;,&quot;\beta&quot;,&quot;B&quot;,&quot;\gamma&quot;,&quot;\Gamma&quot;,&quot;\delta&quot;,&quot;\Delta&quot;,_
						&quot;\epsilon&quot;,&quot;E&quot;,&quot;\zeta&quot;,&quot;Z&quot;,&quot;\eta&quot;,&quot;H&quot;,&quot;\theta&quot;,&quot;\Theta&quot;,_
						&quot;\iota&quot;,&quot;I&quot;,&quot;\kappa&quot;,&quot;K&quot;,&quot;\lambda&quot;,&quot;\Lambda&quot;,&quot;\mu&quot;,&quot;M&quot;,_
						&quot;\nu&quot;,&quot;N&quot;,&quot;\xi&quot;,&quot;\Xi&quot;,&quot;\omicron&quot;,&quot;O&quot;,&quot;\pi&quot;,&quot;\Pi&quot;,&quot;\rho&quot;,&quot;P&quot;,_
						&quot;\sigma&quot;,&quot;\Sigma&quot;,&quot;\tau&quot;,&quot;T&quot;,&quot;\upsilon&quot;,&quot;\Upsilon&quot;,&quot;\phi&quot;,&quot;\Phi&quot;,_
						&quot;\khi&quot;,&quot;X&quot;,&quot;\psi&quot;,&quot;\Psi&quot;,&quot;\omega&quot;,&quot;\Omega&quot;,&quot;\varepsilon&quot;,&quot;\vartheta&quot;,_
						&quot;\varpi&quot;,&quot;\varrho&quot;,&quot;\varsigma&quot;,&quot;\varphi&quot;,&quot;\infty&quot;)
						
						
		&apos; les opérateurs qui demandent une réorganisation des arguments
		sOOoOperator=Array(&quot;over&quot;,&quot;int&quot;,&quot;iint&quot;,&quot;iiint&quot;,&quot;lim&quot;,&quot;matrix&quot;,&quot;abs&quot;,&quot;stack&quot;,&quot;binom&quot;,_
							&quot;nroot&quot;,&quot;sum&quot;,&quot;prod&quot;,&quot;alignl&quot;,&quot;alignr&quot;,&quot;alignc&quot;,&quot;overbrace&quot;,_
							&quot;underbrace&quot;,&quot;size&quot;,&quot;func&quot;,&quot;color&quot;,&quot;font&quot;,&quot;lsup&quot;,&quot;lsub&quot;,_
							&quot;widevec&quot;,&quot;widehat&quot;,&quot;widetilde&quot;,&quot;nitalic&quot;,&quot;overline&quot;,_
							&quot;underline&quot;,&quot;italic&quot;,&quot;csub&quot;,&quot;csup&quot;,&quot;fact&quot;)
		sLatexOperator=Array(&quot;\frac&quot;,&quot;\int&quot;,&quot;\int\!\!\!\!\int&quot;,&quot;\int\!\!\!\!\int\!\!\!\!\int&quot;,&quot;\lim&quot;,&quot;\matrix&quot;,&quot;\left|&quot;,&quot;\matrix&quot;,&quot;\matrix&quot;,_
							&quot;\sqrt&quot;,&quot;\sum&quot;,&quot;\prod&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;\overbrace&quot;,_
							&quot;\underbrace&quot;,&quot;size&quot;,&quot;\textrm&quot;,&quot;\color&quot;,&quot;font&quot;,&quot;{}^&quot;,&quot;{}_&quot;,_
							&quot;\overrightarrow&quot;,&quot;\widehat&quot;,&quot;\widetilde&quot;,&quot;\mathrm&quot;,&quot;\overline&quot;,_
							&quot;\underline&quot;,&quot;\mit&quot;,&quot;\matrix&quot;,&quot;\matrix&quot;,&quot;!&quot;)
		iTypeOperator=Array(cFRAC,cINT,cINT,cINT,cLIMIT,cMATRIX,cABS,cSTACK,cBINOM,_
							cNROOT,cINT,cINT,cALIGN,cALIGN,cDELETE0,cOVER,_
							cUNDER,cDELETE1,cFUNC,cFUNC,cDELETE1,cLSUP,cLSUP,_
							cFUNC,cFUNC,cFUNC,cFUNC,cFUNC,_
							cFUNC,cFUNC,cCSUB,cCSUB,cFACT)

end sub

function sFormuleOOo2TeX(oEmbeddedObject as Object) as String
	dim sLatex as string, sMotAChercher as string, sFormuleOOo as string
	dim i as integer, j as integer, k as integer
	dim iArg1Debut as integer, iArg1Fin as integer
	dim iArg2Debut as integer, iArg2Fin as integer
	
&apos;	if UBound(sOOoKey())&lt;0 then
		&apos; initialisation des variables si besoin
&apos;	end if
	sFormuleOOo=oEmbeddedObject.Formula
	sLatex=oEmbeddedObject.Formula
	
	&apos; détection d&apos;un commentaire
	if Instr(sLatex,&quot;%%&quot;)&gt;0 then sLatex=left(sLatex,Instr(sLatex,&quot;%%&quot;)-1)
	
	&apos; suppression des \
	i=Instr(sLatex,&quot;\&quot;)
	do while i&gt;0
		sLatex=left(sLatex,i-1) &amp; mid(sLatex,i+1)
		i=Instr(sLatex,&quot;\&quot;)
	loop

	&apos; détection d&apos;une petite espace
	i=Instr(sLatex,&quot;`&quot;)
	do while i&gt;0
		sLatex=left(sLatex,i-1) &amp; &quot;\, &quot; &amp; mid(sLatex,i+1)
		i=Instr(sLatex,&quot;`&quot;)
	loop

	&apos; détection d&apos;une grande espace
	i=Instr(sLatex,&quot;~&quot;)
	do while i&gt;0
		sLatex=left(sLatex,i-1) &amp; &quot;\  &quot; &amp; mid(sLatex,i+1)
		i=Instr(sLatex,&quot;~&quot;)
	loop

	
	&apos; changement d&apos;orthographe
	i=1
	&apos; parcours linéaire de la formule
	do while i&lt;=len(sLatex)
		&apos;rechercher le début d&apos;une expression
		do while (bEstCeDelimiteurSubstitutions(mid(sLatex,i,1)) or bEstCeChiffreOuVirgule(mid(sLatex,i,1))) and (i&lt;=len(sLatex))
			&apos;si zone de texte
			if mid(sLatex,i,1)=&quot;&quot;&quot;&quot; then
				&apos; mettre \text{}	
				sLatex=left(sLatex,i-1) &amp; &quot;\textrm{&quot; &amp; mid(sLatex,i+1)
				i=i+7
				do
					i=i+1
					if i&gt;len(sLatex) then
						msgbox(&quot;Erreur de guillemets dans la formule !&quot;)
						stop
					end if
				loop while mid(sLatex,i,1)&lt;&gt;&quot;&quot;&quot;&quot;
				sLatex=left(sLatex,i-1) &amp; &quot;}&quot; &amp; mid(sLatex,i+1)	
			end if
			&apos; test des caractères à substituer
			select case mid(sLatex,i,1)
			case &quot;(&quot;
				&apos;mettre \left( si left n&apos;est pas présent
				if i&lt;5 then
					sLatex=left(sLatex,i-1) &amp; &quot;\left( &quot; &amp; mid(sLatex,i+1)
					i=i+7
				else
					iArg1Fin=i-1
					iArg1Debut=i-1 &apos;inconnu à ce moment
					bTrouveExpressionGauche(sLatex,iArg1Debut,iArg1Fin)
					if mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1)&lt;&gt;&quot;left&quot; then
						sLatex=left(sLatex,i-1) &amp; &quot;\left( &quot; &amp; mid(sLatex,i+1)
						i=i+7
					end if
				end if
			case &quot;)&quot;
				&apos; mettre \right)
				iArg1Fin=i-1
				iArg1Debut=i-1 &apos;inconnu à ce moment
				bTrouveExpressionGauche(sLatex,iArg1Debut,iArg1Fin)
				if mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1)&lt;&gt;&quot;right&quot; then
					sLatex=left(sLatex,i-1) &amp; &quot;\right) &quot; &amp; mid(sLatex,i+1)
					i=i+7
				end if
			end select
			i=i+1
			
		loop
		
		&apos;parcours de l&apos;expression
		j=i
		do while not(bEstCeDelimiteurSubstitutions(mid(sLatex,j,1)) or bEstCeChiffreOuVirgule(mid(sLatex,j,1))) and (j&lt;=len(sLatex))
			j=j+1
		loop
		&apos; recherche de substitution
		sMotAChercher=mid(sLatex,i,j-i)
		if sMotAChercher&lt;&gt;&quot;&quot; then
			for k=0 to UBound(sOOoKey())
				if sMotAChercher=sOOoKey(k) then
					sLatex=left(sLatex,i-1)&amp;sLatexKey(k)&amp;mid(sLatex,j)
					j=j+len(sLatexKey(k))-len(sOOoKey(k))
					exit for
				end if
			next k
		end if
		i=j
	loop
	
	&apos; changement de grammaire
	&apos; parcours récursif et conversion de la formule
	sLatex=sFormatLatex(sLatex)
	&apos; renvoie de la formule convertie	
	if oEmbeddedObject.isTextMode=True then
		sFormuleOOo2TeX=&quot;$\textstyle{&quot;+sLatex+&quot;}$&quot;
	else
		sFormuleOOo2TeX=&quot;$&quot;+sLatex+&quot;$&quot;
	end if
end function

function bEstCeDelimiteurSubstitutions(char as String) as boolean
	bEstCeDelimiteurSubstitutions=(InStr(&quot; +-*/=#&quot;&amp;&quot;&quot;&quot;&quot;&amp;&quot;&gt;&quot;&amp;&quot;&lt;&quot;&amp;&quot;&amp;&quot;&amp;&quot;|&quot;&amp;&quot;(&quot;&amp;&quot;)&quot;&amp;&quot;{&quot;&amp;&quot;}&quot;&amp;&quot;~&quot;&amp;&quot;^&quot;&amp;&quot;_&quot;&amp;&quot;[&quot;&amp;&quot;]&quot;&amp;&quot;\&quot;&amp;&quot;;&quot;,char)&gt;0)
end function

function bEstCeDelimiteurOperateurs(char as String) as boolean
	bEstCeDelimiteurOperateurs=(InStr(&quot; +-*/=#&quot;&amp;&quot;&quot;&quot;&quot;&amp;&quot;&gt;&quot;&amp;&quot;&lt;&quot;&amp;&quot;&amp;&quot;&amp;&quot;|&quot;&amp;&quot;(&quot;&amp;&quot;)&quot;&amp;&quot;{&quot;&amp;&quot;}&quot;&amp;&quot;~&quot;&amp;&quot;[&quot;&amp;&quot;]&quot;&amp;&quot;\&quot;&amp;&quot;;&quot;,char)&gt;0)
end function

function bEstCeChiffreOuVirgule(char as String) as boolean
	bEstCeChiffreOuVirgule=(InStr(&quot;0123456789.,&quot;,char)&gt;0)
end function

function sFormatLatex(sLatex as String) as String
	dim i as integer, iNiveau as integer
	dim j as integer, k as integer
	dim sFormuleTraitee as string, sMotAChercher as string, sResteFormuleLatex as string
	dim iArg1Debut as integer, iArg1Fin as integer
	dim iArg2Debut as integer, iArg2Fin as integer
	dim iArg3Debut as integer, iArg3Fin as integer
	dim sArg1 as string, sArg2 as string, sArg3 as string

	i=1
	j=1
	&apos; parcours récursif de la formule
	do while bTrouveExpressionSuite(sLatex,i,j)
		sFormuleTraitee=sFormatLatex(mid(sLatex,i+1,j-i-1))
		sLatex=left(sLatex,i) &amp; sFormuleTraitee &amp; mid(sLatex,j)
		i=i+len(sFormuleTraitee)+2
	loop
	&apos;chercher les mots-clés
	i=1
	&apos; parcours linéaire de la formule en évitant les expressions entre {}
	do while i&lt;=len(sLatex)
		&apos;rechercher le début d&apos;une expression
		iNiveau=0
		
		do while (bEstCeDelimiteurSubstitutions(mid(sLatex,i,1)) or bEstCeChiffreOuVirgule(mid(sLatex,i,1))) and (i&lt;=len(sLatex))
			&apos;si zone déjà traitée
			if mid(sLatex,i,2)=&quot;\{&quot; then i=i+2
			if mid(sLatex,i,1)=&quot;{&quot; then
				iNiveau=iNiveau+1
				do while iNiveau&gt;0
					i=i+1
					if mid(sLatex,i,1)=&quot;{&quot; and  mid(sLatex,i-1,2)&lt;&gt;&quot;\{&quot; then
						iNiveau=iNiveau+1
					elseif mid(sLatex,i,1)=&quot;}&quot; and mid(sLatex,i-1,2)&lt;&gt;&quot;\}&quot; then
						iNiveau=iNiveau-1
					end if
				loop
			end if
			i=i+1
		loop
		
		&apos;parcours de l&apos;expression
		j=i
		do while not(bEstCeDelimiteurSubstitutions(mid(sLatex,j,1)) or bEstCeChiffreOuVirgule(mid(sLatex,j,1))) and (j&lt;=len(sLatex))
			j=j+1
		loop
		&apos; recherche d&apos;opérateur
		sMotAChercher=mid(sLatex,i,j-i)
		if sMotAChercher&lt;&gt;&quot;&quot; then
			for k=0 to UBound(sOOoOperator())
				if Lcase(sMotAChercher)=sOOoOperator(k) then
					&apos; changement de grammaire
					select case iTypeOperator(k)
					case cFRAC
						&apos;********************* Type Fractions *************************************
						&apos; {A}OOoOperator{B} -&gt; LatexOperator{A}{B}
						iArg1Debut=1 &apos;inconnu actuellement
						iArg1Fin=i-1
						if not(bTrouveExpressionGauche(sLatex,iArg1Debut,iArg1Fin)) then
							&apos; pas d&apos;accolades : on en rajoute
							sLatex=left(sLatex,iArg1Debut-1) &amp; &quot;{&quot; &amp; mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1) &amp; &quot;}&quot; &amp; mid(sLatex,iArg1Fin+2)
							iArg1Fin=iArg1Fin+2
							i=i+2
							j=j+2
						end if
						iArg2Debut=j
						iArg2Fin=len(sLatex) &apos;inconnu actuellement
						if not(bTrouveExpressionDroite(sLatex,iArg2Debut,iArg2Fin,sArg2)) then
							&apos; pas d&apos;accolades : on en rajoute
							sLatex=left(sLatex,iArg2Debut-1) &amp; &quot;{&quot; &amp; mid(sLatex,iArg2Debut,iArg2Fin-iArg2Debut+1) &amp; &quot;}&quot; &amp; mid(sLatex,iArg2Fin+1)
							iArg2Fin=iArg2Fin+2
						end if
						sLatex=left(sLatex,iArg1Debut-1) &amp; sLatexOperator(k) &amp; mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1) &amp; mid(sLatex,j)
						j=iArg2Fin+len(sLatexOperator(k))-len(sOOoOperator(k))+1

					case cINT
						&apos;********************* Type Intégrale *************************************
						&apos; OOoOperator from{A}to{B}{C} -&gt; \LatexOperator _{A}^{B}{C}
						iArg1Debut=i+len(sOOoOperator(k))
						iArg1Fin=iArg1Debut &apos;inconnu actuellement
						&apos;passer le from ou le &quot;_&quot;
						bTrouveExpressionDroite(sLatex,iArg1Debut,iArg1Fin,sArg1)
						if sArg1=&quot;from&quot; then
							&apos; il y a un from
							iArg1Debut=iArg1Fin+1
							if not(bTrouveExpressionDroite(sLatex,iArg1Debut,iArg1Fin,sArg1)) then
								&apos; pas d&apos;accolades : on en rajoute en supprimant les espaces
								sArg1=&quot;{&quot; &amp; sArg1 &amp; &quot;}&quot;
							end if
						else
							&apos; il n&apos;y a pas de from
							sArg1=&quot;{}&quot;
							iArg1Debut=i+len(sOOoOperator(k))
							iArg1Fin=iArg1Debut-1
						end if
						&apos;passer le to ou le ^
						iArg2Debut=iArg1Fin+1
						iArg2Fin=len(sLatex) &apos;inconnu actuellement
						bTrouveExpressionDroite(sLatex,iArg2Debut,iArg2Fin,sArg2)
						if sArg2=&quot;to&quot; then
							&apos; il y a un to
							iArg2Debut=iArg2Fin+1
							if not(bTrouveExpressionDroite(sLatex,iArg2Debut,iArg2Fin,sArg2)) then
								&apos; pas d&apos;accolades : on en rajoute
								sArg2=&quot;{&quot; &amp; sArg2 &amp; &quot;}&quot;
							end if
						else
							&apos; il n&apos;y a pas de to
							sArg2=&quot;{}&quot;
							iArg2Debut=iArg1Fin+1
							iArg2Fin=iArg2Debut-1					
						end if
						iArg3Debut=iArg2Fin+1
						iArg3Fin=len(sLatex) &apos;inconnu actuellement
						if not(bTrouveExpressionDroite(sLatex,iArg3Debut,iArg3Fin,sArg3)) then
							&apos; pas d&apos;accolades : on en rajoute
							sArg3=&quot;{&quot; &amp; sArg3 &amp; &quot;}&quot;
						end if
						sResteFormuleLatex=mid(sLatex,iArg3Fin+1)
						sLatex=left(sLatex,i-1) &amp; sLatexOperator(k) &amp; &quot;_&quot; &amp; sArg1 &amp; &quot;^&quot; &amp; sArg2 &amp; mid(sLatex,iArg3Debut,iArg3Fin-iArg3Debut+1)
						j=len(sLatex)+1
						sLatex=sLatex &amp; sResteFormuleLatex

					Case cLIMIT
						&apos;********************* Type Limite ****************************************
						&apos; lim from{A}{B} -&gt; \lim _{A}{B}
						iArg1Debut=i+len(sOOoOperator(k))
						iArg1Fin=iArg1Debut &apos;inconnu actuellement
						&apos;passer le from
						bTrouveExpressionDroite(sLatex,iArg1Debut,iArg1Fin,sArg1)
						if sArg1=&quot;from&quot; then
							&apos; il y a un from
							iArg1Debut=iArg1Fin+1
							if not(bTrouveExpressionDroite(sLatex,iArg1Debut,iArg1Fin,sArg1)) then
								&apos; pas d&apos;accolades : on en rajoute
								sArg1=&quot;{&quot; &amp; sArg1 &amp; &quot;}&quot;
							end if
						else
							&apos; il n&apos;y a pas de from
							sArg1=&quot;{}&quot;
							iArg1Debut=i+len(sOOoOperator(k))
							iArg1Fin=iArg1Debut-1
						end if
						iArg2Debut=iArg1Fin+1
						iArg2Fin=len(sLatex) &apos;inconnu actuellement
						if not(bTrouveExpressionDroite(sLatex,iArg2Debut,iArg2Fin,sArg2)) then
							&apos; pas d&apos;accolades : on en rajoute
							sArg2=&quot;{&quot; &amp; sArg2 &amp; &quot;}&quot;
						end if
						sResteFormuleLatex=mid(sLatex,iArg2Fin+1)
						sLatex=left(sLatex,i-1) &amp; sLatexOperator(k) &amp; &quot;_&quot; &amp; sArg1 &amp; sArg2
						j=len(sLatex)+1
						sLatex=sLatex &amp; sResteFormuleLatex


&apos;					Case cLEFT
						&apos;********************* Type Left *************************************
&apos;						Select case mid(sLatex,i+len(sOOoOperator(k)),1)
&apos;							Case &quot; &quot;
&apos;								Select Case mid(sLatex,i+len(sOOoOperator(k))+1,4)
&apos;									Case &quot;lbra&quot;
&apos;										sLatex=left(sLatex,i-1) &amp; sLatexOperator(k) &amp; &quot;\{&quot; &amp; mid(sLatex,i+len(sOOoOperator(k))+7)
&apos;										j=j+len(sLatexOperator(k))-len(sOOoOperator(k))+2
&apos;									Case &quot;rbra&quot;
&apos;										sLatex=left(sLatex,i-1) &amp; sLatexOperator(k) &amp; &quot;\}&quot; &amp; mid(sLatex,i+len(sOOoOperator(k))+7)
&apos;										j=j+len(sLatexOperator(k))-len(sOOoOperator(k))+2
&apos;									Case &quot;llin&quot;,&quot;rlin&quot;
&apos;										sLatex=left(sLatex,i-1) &amp; sLatexOperator(k) &amp; &quot;|&quot; &amp; mid(sLatex,i+len(sOOoOperator(k))+6)
&apos;										j=j+len(sLatexOperator(k))-len(sOOoOperator(k))+1
&apos;									Case &quot;ldli&quot;,&quot;rdli&quot;
&apos;										sLatex=left(sLatex,i-1) &amp; sLatexOperator(k) &amp; &quot;\|&quot; &amp; mid(sLatex,i+len(sOOoOperator(k))+7)
&apos;										j=j+len(sLatexOperator(k))-len(sOOoOperator(k))+2
&apos;									Case &quot;none&quot;
&apos;										sLatex=left(sLatex,i-1) &amp; sLatexOperator(k) &amp; &quot;.&quot; &amp; mid(sLatex,i+len(sOOoOperator(k))+5)
&apos;										j=j+len(sLatexOperator(k))-len(sOOoOperator(k))+1
&apos;								end select
&apos;							Case &quot;[&quot;
&apos;								sLatex=left(sLatex,i-1) &amp; sLatexOperator(k) &amp; &quot;[&quot; &amp; mid(sLatex,i+len(sOOoOperator(k))+1)
&apos;								j=j+len(sLatexOperator(k))-len(sOOoOperator(k))+1
&apos;							Case &quot;]&quot;
&apos;								sLatex=left(sLatex,i-1) &amp; sLatexOperator(k) &amp; &quot;]&quot; &amp; mid(sLatex,i+len(sOOoOperator(k))+1)						
&apos;								j=j+len(sLatexOperator(k))-len(sOOoOperator(k))+1						
&apos;							Case &quot;(&quot;
&apos;								sLatex=left(sLatex,i-1) &amp; sLatexOperator(k) &amp; &quot;(&quot; &amp; mid(sLatex,i+len(sOOoOperator(k))+1)
&apos;								j=j+len(sLatexOperator(k))-len(sOOoOperator(k))+1
&apos;							Case &quot;)&quot;
&apos;								sLatex=left(sLatex,i-1) &amp; sLatexOperator(k) &amp; &quot;)&quot; &amp; mid(sLatex,i+len(sOOoOperator(k))+1)						
&apos;								j=j+len(sLatexOperator(k))-len(sOOoOperator(k))+1						
&apos;						end select	
&apos;						
						
						&apos;********************* Type Matrix *************************************
					Case cMATRIX
						iArg1Debut=i+len(sOOoOperator(k))
						iArg1Fin=iArg1Debut &apos;inconnu actuellement
						if not(bTrouveExpressionDroite(sLatex,iArg1Debut,iArg1Fin,sArg1)) then
							&apos; pas d&apos;accolades : ne doit pas arriver si formule créée avec CmathOOo
						end if
						iArg1Debut=iArg1Debut+1
						iArg1Fin=iArg1Fin-1
						iSubstitue(sLatex,iArg1Debut,iArg1Fin,&quot;##&quot;,&quot; \cr &quot;)
						iSubstitue(sLatex,iArg1Debut,iArg1Fin,&quot;#&quot;,&quot; &amp; &quot;)
						sLatex=left(sLatex,i-1) &amp; sLatexOperator(k) &amp; mid(sLatex,iArg1Debut-1,iArg1Fin-iArg1Debut+2) &amp; mid(sLatex,iArg1Fin+1)
						j=iArg1Fin+len(sLatexOperator(k))-len(sOOoOperator(k))+2

						&apos;********************* Type Stack *************************************
					Case cSTACK
						iArg1Debut=i+len(sOOoOperator(k))
						iArg1Fin=iArg1Debut &apos;inconnu actuellement
						if not(bTrouveExpressionDroite(sLatex,iArg1Debut,iArg1Fin,sArg1)) then
							&apos; pas d&apos;accolades : ne doit pas arriver si formule créée avec CmathOOo
						end if
						iArg1Debut=iArg1Debut+1
						iArg1Fin=iArg1Fin-1
						iSubstitue(sLatex,iArg1Debut,iArg1Fin,&quot;#&quot;,&quot; \cr &quot;)
						sLatex=left(sLatex,i-1) &amp; sLatexOperator(k) &amp; mid(sLatex,iArg1Debut-1,iArg1Fin-iArg1Debut+2) &amp; mid(sLatex,iArg1Fin+1)
						j=iArg1Fin+len(sLatexOperator(k))-len(sOOoOperator(k))+2

						&apos;********************* Type Csub *************************************
						&apos; {A}OOoOperator{B} -&gt; \LatexOperator{A \cr B}
						&apos; traduction en matrice à 1 colonne : ce n&apos;est pas l&apos;idéal mais je ne trouve rien avec TeX
					
					Case cCSUB
						iArg1Debut=1 &apos;inconnu actuellement
						iArg1Fin=i-1
						if not(bTrouveExpressionGauche(sLatex,iArg1Debut,iArg1Fin)) then
							&apos; pas d&apos;accolades : on en rajoute
							sLatex=left(sLatex,iArg1Debut-1) &amp; &quot;{&quot; &amp; mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1) &amp; &quot;}&quot; &amp; mid(sLatex,iArg1Fin+2)
							iArg1Fin=iArg1Fin+2
							i=i+2
							j=j+2
						end if
						iArg2Debut=j
						iArg2Fin=len(sLatex) &apos;inconnu actuellement
						if not(bTrouveExpressionDroite(sLatex,iArg2Debut,iArg2Fin,sArg2)) then
							&apos; pas d&apos;accolades : on en rajoute
							sLatex=left(sLatex,iArg2Debut-1) &amp; &quot;{&quot; &amp; mid(sLatex,iArg2Debut,iArg2Fin-iArg2Debut+1) &amp; &quot;}&quot; &amp; mid(sLatex,iArg2Fin+1)
							iArg2Fin=iArg2Fin+2
						end if
						sLatex=left(sLatex,iArg1Debut-1) &amp; sLatexOperator(k) &amp; &quot;{&quot; &amp; mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1) &amp; &quot; \cr &quot; &amp; mid(sLatex,iArg2Debut,iArg2Fin-iArg2Debut+1) &amp; &quot;}&quot; &amp; mid(sLatex,iArg2Fin+1)
						j=iArg2Fin+len(sLatexOperator(k))-len(sOOoOperator(k))+6


					&apos;********************* Type ABS ****************************************
					&apos; abs{A} -&gt; \left|{A}\right|
					Case cABS
						iArg1Debut=i+len(sOOoOperator(k))
						iArg1Fin=iArg1Debut &apos;inconnu actuellement
						if not(bTrouveExpressionDroite(sLatex,iArg1Debut,iArg1Fin,sArg1)) then
							&apos; pas d&apos;accolades : on en rajoute
							sLatex=left(sLatex,iArg1Debut-2) &amp; &quot;{&quot; &amp; mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1) &amp; &quot;}&quot; &amp; mid(sLatex,iArg1Fin+2)
							iArg1Fin=iArg1Fin+1
							iArg1Debut=iArg1Debut-1
&apos;							sLatex=left(sLatex,iArg1Debut-1) &amp; &quot;{&quot; &amp; mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1) &amp; &quot;}&quot; &amp; mid(sLatex,iArg1Fin+1)
&apos;							iArg1Fin=iArg1Fin+2
						end if
						sLatex=left(sLatex,i-1) &amp; &quot;\left|&quot; &amp; mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1) &amp; &quot;\right|&quot; &amp; mid(sLatex,iArg1Fin+1)
						j=iArg1Fin+2*len(sLatexOperator(k))-len(sOOoOperator(k))+2

					Case cBINOM
					&apos;********************* Type Binom ****************************************
					&apos; binome{A}{B} -&gt; \matrix{{A} \cr {B}}
						iArg1Debut=i+len(sOOoOperator(k))
						iArg1Fin=iArg1Debut &apos;inconnu actuellement
						if not(bTrouveExpressionDroite(sLatex,iArg1Debut,iArg1Fin,sArg1)) then
							&apos; pas d&apos;accolades : on en rajoute
							sLatex=left(sLatex,iArg1Debut-2) &amp; &quot;{&quot; &amp; mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1) &amp; &quot;}&quot; &amp; mid(sLatex,iArg1Fin+2)
							iArg1Fin=iArg1Fin+1
							iArg1Debut=iArg1Debut-1
&apos;							sLatex=left(sLatex,iArg1Debut-1) &amp; &quot;{&quot; &amp; mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1) &amp; &quot;}&quot; &amp; mid(sLatex,iArg1Fin+1)
&apos;							iArg1Fin=iArg1Fin+2
						end if
						iArg2Debut=iArg1Fin+1
						iArg2Fin=len(sLatex) &apos;inconnu actuellement
						if not(bTrouveExpressionDroite(sLatex,iArg2Debut,iArg2Fin,sArg2)) then
							&apos; pas d&apos;accolades : on en rajoute
							sLatex=left(sLatex,iArg2Debut-2) &amp; &quot;{&quot; &amp; mid(sLatex,iArg2Debut,iArg2Fin-iArg2Debut+1) &amp; &quot;}&quot; &amp; mid(sLatex,iArg2Fin+2)
							iArg2Fin=iArg2Fin+1
							iArg2Debut=iArg2Debut-1
&apos;							sLatex=left(sLatex,iArg2Debut-1) &amp; &quot;{&quot; &amp; mid(sLatex,iArg2Debut,iArg2Fin-iArg2Debut+1) &amp; &quot;}&quot; &amp; mid(sLatex,iArg2Fin+1)
&apos;							iArg2Fin=iArg2Fin+2
						end if
						sLatex=left(sLatex,i-1) &amp; sLatexOperator(k) &amp; mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut) &amp; &quot; \cr &quot; &amp; mid(sLatex,iArg2Debut+1,iArg2Fin-iArg2Debut) &amp; mid(sLatex,iArg2Fin+1)
						j=iArg2Fin+len(sLatexOperator(k))-len(sOOoOperator(k))+3
						&apos; si ams-latex est supporté par le serveur générant les formules TeX, remplacer les deux lignes précédentes 
						&apos; par les deux situées juste après ce commentaire.
						&apos; en attendant, la fonction limite, s&apos;il y a deux indices, ne s&apos;affichera pas proprement.
						&apos;sLatex=left(sLatex,i-1) &amp; &quot;\genfrac{}{}{0}{1}&quot; &amp; mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1) &amp; mid(sLatex,iArg2Debut,iArg2Fin-iArg2Debut+1) &amp; mid(sLatex,iArg2Fin+1)
						&apos;j=iArg2Fin+len(&quot;\genfrac&quot;)-len(sOOoOperator(k))+16

					Case cNROOT
					&apos;********************* Type Nroot ****************************************
					&apos; nroot{A}{B} -&gt; \sqrt[{A}]{B}
						iArg1Debut=i+len(sOOoOperator(k))
						iArg1Fin=iArg1Debut &apos;inconnu actuellement
						if not(bTrouveExpressionDroite(sLatex,iArg1Debut,iArg1Fin,sArg1)) then
							&apos; pas d&apos;accolades : on en rajoute
							sLatex=left(sLatex,iArg1Debut-1) &amp; &quot;{&quot; &amp; mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1) &amp; &quot;}&quot; &amp; mid(sLatex,iArg1Fin+1)
							iArg1Fin=iArg1Fin+2
						end if
						iArg2Debut=iArg1Fin+1
						iArg2Fin=len(sLatex) &apos;inconnu actuellement
						if not(bTrouveExpressionDroite(sLatex,iArg2Debut,iArg2Fin,sArg2)) then
							&apos; pas d&apos;accolades : on en rajoute
							sLatex=left(sLatex,iArg2Debut-1) &amp; &quot;{&quot; &amp; mid(sLatex,iArg2Debut,iArg2Fin-iArg2Debut+1) &amp; &quot;}&quot; &amp; mid(sLatex,iArg2Fin+1)
							iArg2Fin=iArg2Fin+2
						end if
						sLatex=left(sLatex,i-1) &amp; sLatexOperator(k) &amp; &quot;[&quot; &amp; mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1) &amp; &quot;]&quot; &amp; mid(sLatex,iArg2Debut,iArg2Fin-iArg2Debut+1) &amp; mid(sLatex,iArg2Fin+1)
						j=iArg2Fin+len(sLatexOperator(k))-len(sOOoOperator(k))+3

					Case cALIGN
					&apos;********************* Type Align ****************************************
					&apos; si alignl, alignr, cherche s&apos;il y a un système, sinon ignore
					&apos; {alignl left lbrace stack{{{x}={1}}#{{j}={G}}} right none}
					&apos; ${ { \begin{cases}{{{2 a}={2}}\cr {a+{2 b}={7} \cr {c+{b}={5}}}\end{cases} }$
						Select case sOOoOperator(k)
						case &quot;alignl&quot;
							sLatex=left(sLatex,i-1) &amp; sLatexOperator(k) &amp; mid(sLatex,j)
							iArg1Debut=instr(mid(sLatex,i),&quot;stack&quot;)
							j=j-6
							if iArg1Debut&gt;0 then &apos;and iArg1Debut=instr(sLatex,&quot;{&quot;)-5 then
								iArg1Debut=iArg1Debut+5
								iArg1Fin=iArg1Debut
								bTrouveExpressionDroite(sLatex,iArg1Debut,iArg1Fin,sArg1)
								iArg1Debut=iArg1Debut+1
								iArg1Fin=iArg1Fin-1
								iSubstitue(sLatex,iArg1Debut,iArg1Fin,&quot;#&quot;,&quot;\hfill #&quot;)
								sLatex=left(sLatex,iArg1Fin) &amp; &quot;\hfill&quot; &amp; mid(sLatex,iArg1Fin+1)
							end if			
												
						case &quot;alignr&quot;
							sLatex=left(sLatex,i-1) &amp; sLatexOperator(k) &amp; mid(sLatex,j)
							iArg1Debut=instr(mid(sLatex,i),&quot;stack&quot;)
							j=j-6
							if iArg1Debut&gt;0 then &apos;and iArg1Debut=instr(sLatex,&quot;{&quot;)-5 then
								iArg1Debut=iArg1Debut+5
								iArg1Fin=iArg1Debut
								bTrouveExpressionDroite(sLatex,iArg1Debut,iArg1Fin,sArg1)
								iArg1Debut=iArg1Debut+1
								iArg1Fin=iArg1Fin-1
								sLatex=left(sLatex,iArg1Debut-1) &amp; &quot;\hfill &quot; &amp; mid(sLatex,iArg1Debut)
								iSubstitue(sLatex,iArg1Debut,iArg1Fin+6,&quot;#&quot;,&quot;#\hfill &quot;)
							end if			
						end select

					Case cDELETE0
						&apos;********************* Type Delete 0 ****************************************
						&apos; opérateur non traduit et effacé, sans argument
						sLatex=left(sLatex,i-1) &amp; mid(sLatex,j)
						j=i
							
					Case cDELETE1
						&apos;********************* Type Delete 1 ****************************************
						&apos; opérateur non traduit et effacé, avec 1 argument
						iArg1Debut=i+len(sOOoOperator(k))
						iArg1Fin=iArg1Debut &apos;inconnu actuellement
						bTrouveExpressionDroite(sLatex,iArg1Debut,iArg1Fin,sArg1)
						sLatex=left(sLatex,i-1) &amp; mid(sLatex,iArg1Fin+1)
						j=i
							
					case cOVER
						&apos;********************* Type Over *************************************
						&apos; {A}OOoOperator{B} -&gt; \LatexOperator{A}^{B}
						iArg1Debut=1 &apos;inconnu actuellement
						iArg1Fin=i-1
						if not(bTrouveExpressionGauche(sLatex,iArg1Debut,iArg1Fin)) then
							&apos; pas d&apos;accolades : on en rajoute
							sLatex=left(sLatex,iArg1Debut-1) &amp; &quot;{&quot; &amp; mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1) &amp; &quot;}&quot; &amp; mid(sLatex,iArg1Fin+2)
							iArg1Fin=iArg1Fin+2
							i=i+2
							j=j+2
						end if
						iArg2Debut=j
						iArg2Fin=len(sLatex) &apos;inconnu actuellement
						if not(bTrouveExpressionDroite(sLatex,iArg2Debut,iArg2Fin,sArg2)) then
							&apos; pas d&apos;accolades : on en rajoute
							sLatex=left(sLatex,iArg2Debut-1) &amp; &quot;{&quot; &amp; mid(sLatex,iArg2Debut,iArg2Fin-iArg2Debut+1) &amp; &quot;}&quot; &amp; mid(sLatex,iArg2Fin+1)
							iArg2Fin=iArg2Fin+2
						end if
						sLatex=left(sLatex,iArg1Debut-1) &amp; sLatexOperator(k) &amp; mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1) &amp; &quot;^&quot; &amp; mid(sLatex,j)
						j=iArg2Fin+len(sLatexOperator(k))-len(sOOoOperator(k))+2
												
					case cUNDER
						&apos;********************* Type Under *************************************
						&apos; {A}OOoOperateur{B} -&gt; \LatexOperateur{A}_{B}
						iArg1Debut=1 &apos;inconnu actuellement
						iArg1Fin=i-1
						if not(bTrouveExpressionGauche(sLatex,iArg1Debut,iArg1Fin)) then
							&apos; pas d&apos;accolades : on en rajoute
							sLatex=left(sLatex,iArg1Debut-1) &amp; &quot;{&quot; &amp; mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1) &amp; &quot;}&quot; &amp; mid(sLatex,iArg1Fin+2)
							iArg1Fin=iArg1Fin+2
							i=i+2
							j=j+2
						end if
						iArg2Debut=j
						iArg2Fin=len(sLatex) &apos;inconnu actuellement
						if not(bTrouveExpressionDroite(sLatex,iArg2Debut,iArg2Fin,sArg2)) then
							&apos; pas d&apos;accolades : on en rajoute
							sLatex=left(sLatex,iArg2Debut-1) &amp; &quot;{&quot; &amp; mid(sLatex,iArg2Debut,iArg2Fin-iArg2Debut+1) &amp; &quot;}&quot; &amp; mid(sLatex,iArg2Fin+1)
							iArg2Fin=iArg2Fin+2
						end if
						sLatex=left(sLatex,iArg1Debut-1) &amp; sLatexOperator(k) &amp; mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1) &amp; &quot;_&quot; &amp; mid(sLatex,j)
						j=iArg2Fin+len(sLatexOperator(k))-len(sOOoOperator(k))+2

					case cFUNC
						&apos;********************* Type Func *************************************
						&apos; OOoOperator A -&gt; LatexOperator{A}
						iArg1Debut=i+len(sOOoOperator(k))
						iArg1Fin=iArg1Debut &apos;inconnu actuellement
						if not(bTrouveExpressionDroite(sLatex,iArg1Debut,iArg1Fin,sArg2)) then
							&apos; pas d&apos;accolades : on en rajoute
							sLatex=left(sLatex,iArg1Debut-1) &amp; &quot;{&quot; &amp; mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1) &amp; &quot;}&quot; &amp; mid(sLatex,iArg1Fin+1)
							iArg1Fin=iArg1Fin+2
						end if
						sLatex=left(sLatex,i-1) &amp; sLatexOperator(k) &amp; mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1) &amp; mid(sLatex,iArg1Fin+1)
						j=iArg1Fin+len(sLatexOperator(k))-len(sOOoOperator(k))+1

					case cFACT
						&apos;********************* Type Factoriel *************************************
						&apos; OOoOperator A -&gt; {A}LatexOperator
						iArg1Debut=i+len(sOOoOperator(k))
						iArg1Fin=iArg1Debut &apos;inconnu actuellement
						if not(bTrouveExpressionDroite(sLatex,iArg1Debut,iArg1Fin,sArg2)) then
							&apos; pas d&apos;accolades : on en rajoute
							sLatex=left(sLatex,iArg1Debut-1) &amp; &quot;{&quot; &amp; mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1) &amp; &quot;}&quot; &amp; mid(sLatex,iArg1Fin+1)
							iArg1Fin=iArg1Fin+2
						end if
						sLatex=left(sLatex,i-1) &amp; mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1) &amp; sLatexOperator(k)&amp; mid(sLatex,iArg1Fin+1)
						j=iArg1Fin+len(sLatexOperator(k))-len(sOOoOperator(k))+1

					case cLSUP
						&apos;********************* Type Lsup *************************************
						&apos; {A}OOoOperator{B} -&gt; LatexOperator{B}{A}
						iArg1Debut=1 &apos;inconnu actuellement
						iArg1Fin=i-1
						if not(bTrouveExpressionGauche(sLatex,iArg1Debut,iArg1Fin)) then
							&apos; pas d&apos;accolades : on en rajoute
							sLatex=left(sLatex,iArg1Debut-1) &amp; &quot;{&quot; &amp; mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1) &amp; &quot;}&quot; &amp; mid(sLatex,iArg1Fin+2)
							iArg1Fin=iArg1Fin+2
							i=i+2
							j=j+2
						end if
						iArg2Debut=j
						iArg2Fin=len(sLatex) &apos;inconnu actuellement
						if not(bTrouveExpressionDroite(sLatex,iArg2Debut,iArg2Fin,sArg2)) then
							&apos; pas d&apos;accolades : on en rajoute
							sLatex=left(sLatex,iArg2Debut-1) &amp; &quot;{&quot; &amp; mid(sLatex,iArg2Debut,iArg2Fin-iArg2Debut+1) &amp; &quot;}&quot; &amp; mid(sLatex,iArg2Fin+1)
							iArg2Fin=iArg2Fin+2
						end if
						sLatex=left(sLatex,iArg1Debut-1) &amp; sLatexOperator(k) &amp; mid(sLatex,iArg2Debut,iArg2Fin-iArg2Debut+1) &amp; mid(sLatex,iArg1Debut,iArg1Fin-iArg1Debut+1) &amp; mid(sLatex,iArg2Fin+1)
						j=iArg2Fin+len(sLatexOperator(k))-len(sOOoOperator(k))+1
												
					end select	

					exit for
				end if
			next k
		end if
		i=j
	loop


	sFormatLatex=sLatex
end function

function bTrouveExpressionSuite(sLatex as string,i as integer,j as integer) as boolean
&apos; cherche une expression entre {} à partir de la position i
&apos; renvoie true s&apos;il en existe, faux sinon
	Dim iNiveau as integer, k as integer, iPos as integer
	Dim sCarac as String
	
	iPos=i
	do
		sCarac=mid(sLatex,iPos,1)

		if sCarac=&quot;{&quot; then
			if iPos=1 then 
				exit do
			elseif mid(sLatex,iPos-1,2)&lt;&gt;&quot;\{&quot; then 
				exit do
			end if
		end if
		iPos=iPos+1
	loop while iPos&lt;=len(sLatex)
	if iPos&lt;=len(sLatex) then
		iNiveau=1
		k=iPos+1
		do while k&lt;=len(sLatex) and iNiveau&gt;0
			sCarac=mid(sLatex,k,1)
			if sCarac=&quot;{&quot; and  mid(sLatex,k-1,2)&lt;&gt;&quot;\{&quot; then 
				iNiveau=iNiveau+1
			elseif sCarac=&quot;}&quot; and  mid(sLatex,k-1,2)&lt;&gt;&quot;\}&quot; then
				iNiveau=iNiveau-1
			end if
			k=k+1
		loop
		if iNiveau&gt;0 then
			msgbox(&quot;Erreur d&apos;accolades dans la formule.&quot;)
			stop
		end if
		j=k-1
		i=iPos
		bTrouveExpressionSuite=True
	else
		bTrouveExpressionSuite=False		
	end if
end function

function bTrouveExpressionGauche(sLatex as string,i as integer,j as integer) as boolean
&apos; cherche une expression dans la chaine sLatex située à gauche de la position j
&apos; renvoie true si l&apos;expression trouvée est entre {}, faux sinon
	Dim iNiveau as integer, k as integer, iPos as integer, jtemp as integer
	Dim sCarac as String
	
	
	iPos=j
	do while mid(sLatex,iPos,1)=&quot; &quot;
		iPos=iPos-1
	loop
	j=iPos
	if mid(sLatex,j,1)=&quot;}&quot; then
		&apos; expression avec {}
		iNiveau=1
		k=j-1
		do while k&gt;0 and iNiveau&gt;0
			sCarac=mid(sLatex,k,1)
			if sCarac=&quot;}&quot; then 
				iNiveau=iNiveau+1
			elseif sCarac=&quot;{&quot; then
				iNiveau=iNiveau-1
			end if
			k=k-1
		loop
		if iNiveau&gt;0 then
			msgbox(&quot;Erreur d&apos;accolades dans la formule.&quot;)
			stop
		end if
		i=k+1
		bTrouveExpressionGauche=True
	else
		&apos;expression sans {}
		k=iPos
		do while k&gt;1 and not bEstCeDelimiteurOperateurs(mid(sLatex,k,1))
			if instr(&quot;_^&quot;,mid(sLatex,k,1))&gt;0 then
				k=k-1
				jtemp=k
				bTrouveExpressionGauche(sLatex,k,jtemp)
			end if
			k=k-1
		loop
		if not bEstCeDelimiteurOperateurs(mid(sLatex,k,1)) then
			&apos; début de la formule
			i=1
		else
			i=k+1
		end if
		bTrouveExpressionGauche=False		
	end if
end function

function bTrouveExpressionDroite(sLatex as string,i as integer,j as integer,optional sArgument as string) as boolean
&apos; cherche une expression dans la chaine sLatex située à droite de la position i
&apos; renvoie true si l&apos;expression trouvée est entre {}, faux sinon
	Dim iNiveau as integer, k as integer, iPos as integer, itemp as integer
	Dim sCarac as String
	
	iPos=i
	do while mid(sLatex,iPos,1)=&quot; &quot;
		iPos=iPos+1
	loop
	i=iPos
	if mid(sLatex,i,1)=&quot;{&quot; then
		&apos; expression avec {}
		iNiveau=1
		k=i+1
		do while k&lt;=len(sLatex) and iNiveau&gt;0
			sCarac=mid(sLatex,k,1)
			if sCarac=&quot;{&quot; and  mid(sLatex,k-1,2)&lt;&gt;&quot;\{&quot; then 
				iNiveau=iNiveau+1
			elseif sCarac=&quot;}&quot; and  mid(sLatex,k-1,2)&lt;&gt;&quot;\}&quot; then
				iNiveau=iNiveau-1
			end if
			k=k+1
		loop
		if iNiveau&gt;0 then
			msgbox(&quot;Erreur d&apos;accolades dans la formule.&quot;)
			stop
		end if
		j=k-1
		bTrouveExpressionDroite=True
	else
		&apos;expression sans {}
		k=iPos+1
		do while k&lt;=len(sLatex) and not bEstCeDelimiteurOperateurs(mid(sLatex,k,1))
			if instr(&quot;_^&quot;,mid(sLatex,k,1))&gt;0 then
				k=k+1
				itemp=k
				bTrouveExpressionDroite(sLatex,itemp,k)
			end if
			k=k+1
		loop
		j=k-1
		bTrouveExpressionDroite=False		
	end if
	if not(IsMissing(sArgument)) then
		sArgument=mid(sLatex,i,j-i+1)
	end if
end function


function iSubstitue(sChaine as String, i as integer, j as integer, sChercher as String, sRemplacer as String) as integer
&apos; cherche et remplace dans sChaine de la position i à j la chaine sChercher par sRemplacer
&apos; en évitant les {} (déjà traités par récursivité)
&apos; renvoie le nombre de remplacements effectués
	dim k as integer, iNb as integer, jtemp as integer, iNiveau as integer

	iNb=0
	k=i
	jtemp=j
	iNiveau=0
	do while k&lt;=jtemp-len(sChercher)+1
		if mid(sChaine,k,1)=&quot;{&quot; then
				iNiveau=iNiveau+1
				do while iNiveau&gt;0
					k=k+1
					if mid(sChaine,k,1)=&quot;{&quot; and  mid(sChaine,k-1,2)&lt;&gt;&quot;\{&quot; then
						iNiveau=iNiveau+1
					elseif mid(sChaine,k,1)=&quot;}&quot; and mid(sChaine,k-1,2)&lt;&gt;&quot;\}&quot; then
						iNiveau=iNiveau-1
					end if
				loop
		end if
		if mid(sChaine,k,len(sChercher))=sChercher then
			sChaine=left(sChaine,k-1) &amp; sRemplacer &amp; mid(sChaine,k+len(sChercher))
			jtemp=jtemp+len(sRemplacer)-len(sChercher)
			k=k+len(sRemplacer)-1
			iNb=iNb+1
		end if
		k=k+1
	loop
	j=jtemp
	iSubstitue=iNb
end function
</script:module>