Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

MathJax

1 réponse
Avatar
ast
Bonjour,

Avec l'appel suivant à un fichier de scripts javascript placé par exemple dans le header d'une
page:

<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>

puis en écrivant une formule mathématique écrite en latex placée entre \[ ...\] dans le
code html et bien le browser affiche une jolie formule de maths.

par exemple

<HTML>


<HEAD>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
</HEAD>


<BODY>

\[ \int_0^\infty e^{-x²} dx \]

</BODY>

</HTML>


mais j'aimerais comprendre comment ça marche.

Quand le brower rencontre \[ ... \], que fait-il exactement ?

merci

1 réponse

Avatar
Julien Arlandis
"ast" a écrit :
Bonjour,

Avec l'appel suivant un fichier de scripts javascript plac par exemple dans le header d'une
page:

<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>

puis en crivant une formule mathmatique crite en latex place entre [ ...] dans le
code html et bien le browser affiche une jolie formule de maths.

par exemple

<HTML>


<HEAD>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
</HEAD>


<BODY>

[ int_0^infty e^{-x} dx ]

</BODY>

</HTML>


mais j'aimerais comprendre comment a marche.

Quand le brower rencontre [ ... ], que fait-il exactement ?

merci



Je suppose que javascript référence en tout premier lieu au moyen
d'une expression régulière tous les codes latex inclus entre les
balises [ et ] ou $ $ et $ $.
qu'il remplace par du code HTML/CSS. Ton intégrale a été remplacée
par le code HTML que j'ai copié depuis la boite à outil chrome en
visualisant ton message depuis Nemo :


<div class="MathJax_Display" role="textbox" aria-readonly="true"
style="text-align: center;"><span class="MathJax"
id="MathJax-Element-8-Frame" style=""><nobr><span class="math"
id="MathJax-Span-54"><span style="display: inline-block; position:
relative; width: 69px; height: 0px; font-size: 104%;"><span
style="position: absolute; clip: rect(13.6px 14560px 53.3px -8.2px);
top: -37px; left: 0px;"><span class="mrow" id="MathJax-Span-55"><span
class="msubsup" id="MathJax-Span-56"><span style="display: inline-block;
position: relative; width: 27.5px; height: 0px;"><span style="position:
absolute; clip: rect(33.2px 14560px 71.5px -8.2px); top: -56px; left:
0px;"><span class="mo" id="MathJax-Span-57" style="font-family:
MathJax_Size2; vertical-align: 0px;">∫<span style="display:
inline-block; overflow: hidden; height: 1px; width:
5.6px;"></span></span><span style="display: inline-block; width: 0px;
height: 56px;"></span></span><span style="position: absolute; clip:
rect(26.4px 14560px 37.1px -8.4px); top: -49.8px; left: 16.4px;"><span
class="mi" id="MathJax-Span-58" style="font-size: 70.7%; font-family:
MathJax_Main;">∞</span><span style="display: inline-block; width: 0px;
height: 34px;"></span></span><span style="position: absolute; clip:
rect(24.1px 14560px 37.2px -8.6px); top: -20.9px; left: 8.4px;"><span
class="mn" id="MathJax-Span-59" style="font-size: 70.7%; font-family:
MathJax_Main;">0</span><span style="display: inline-block; width: 0px;
height: 34px;"></span></span></span></span><span class="msubsup"
id="MathJax-Span-60" style="padding-left: 2.4px;"><span style="display:
inline-block; position: relative; width: 22.1px; height: 0px;"><span
style="position: absolute; clip: rect(27.6px 14560px 40.2px -8.4px);
top: -37px; left: 0px;"><span class="mi" id="MathJax-Span-61"
style="font-family: MathJax_Math; font-style: italic;">e</span><span
style="display: inline-block; width: 0px; height:
37px;"></span></span><span style="position: absolute; top: -40px; left:
7px;"><span class="texatom" id="MathJax-Span-62"><span class="mrow"
id="MathJax-Span-63"><span class="mo" id="MathJax-Span-64"
style="font-size: 70.7%; font-family: MathJax_Main;">−</span><span
class="mi" id="MathJax-Span-65" style="font-size: 70.7%; font-family:
MathJax_Math; font-style: italic;">x</span></span></span><span
style="display: inline-block; width: 0px; height:
34px;"></span></span></span></span><span class="mi" id="MathJax-Span-66"
style="font-family: MathJax_Math; font-style: italic;">d<span
style="display: inline-block; overflow: hidden; height: 1px; width:
0px;"></span></span><span class="mi" id="MathJax-Span-67"
style="font-family: MathJax_Math; font-style:
italic;">x</span></span><span style="display: inline-block; width: 0px;
height: 37px;"></span></span></span><span style="border-left-width: 0px;
border-left-style: solid; display: inline-block; overflow: hidden;
width: 0px; height: 35.7px; vertical-align:
-14.3px;"></span></span></nobr></span></div>

--
Pour lire ce message avec Nemo :
<http://news.julien-arlandis.fr/?IDx65>