latex et embed

Vous lisez 17 fils de discussion
  • Auteur
    Messages
    • #1849
      Julien
      Modérateur
      Up
      0
      Down
      ::

      Bonjour,

      Le code suivant ne fonctionne pas à l’affichage.
      \(\bar{x}=\frac{\embed{reply53, 4}}{\embed{reply54, 4}}=\embed{reply55, 4})

      Je pourrais effectuer un tableau mais je dois déjà placer ce code dans un tableau donc bof!bof!

    • #1853
      bernadette
      Maître des clés
      Up
      0
      Down
      ::

      Joke a fait ce qu’il faut dans Mathml mais je n’ai jamais eu le temps d’adapter aux exercices OEF.
      Un exercice de ce type serait incompatible avec le mode images, qui reste utilisé.
      C’est aussi ce qui me retient !

      Bernadette

      • #1855
        Julien
        Modérateur
        Up
        0
        Down
        ::

        En utilisant une variable d’environement, on peut conditionner l’affichage. Cela régle le problème.

        Using an environment variable, you can condition the display. This solves the problem.

        Exemple :

        \if{\oef_environnement isin mode_images}{\(\bar{x}=\embed{reply55, 4}}{'\(\bar{x}=\frac{\embed{reply53, 4}}{\embed{reply54, 4}}=\embed{reply55, 4})'}
        
        \if{\oef_environnement notin mode_images}{
        \answer{53}{}{...}
        \answer{54}{}{...}}
        • Cette réponse a été modifiée le il y a 10 années et 3 mois par Julien.
    • #1854
      jm.evers
      Participant
      Up
      0
      Down
      ::

      Hi,
      Latex will not -never- support this, however in some cases MathML
      (using firefox) can use inputfields anywhere ! in a latex constuct…
      An inputfield in MathML using pseudo latex:
      \input{size}{id}{style}{value}{readonly}
      The value can be read by using something like:
      var reply=document.getElementById(‘mathml’+id);
      But make sure users use only Mathml & Firefox !!!
      kind regards,
      joke

    • #1857
      bernadette
      Maître des clés
      Up
      0
      Down
      ::

      Je pense qu’il vaudrait mieux que cela soit réglé hors de l’exercice.
      Avoir dans oef quelque chose \special{mathml ….} à la place de \embed{}.

      Mais j’attends de voir aussi ce qu’on peut faire aussi avec canvas que développe Joke (pas de développement important de ma part avant avril …).

      Bernadette

    • #1858
      jm.evers
      Participant
      Up
      0
      Down
      ::

      Mathjax seems to allow inputfields in mathml as well.
      Using a slightly different pseudo latex syntax,
      \FormInput[class][value]{name}
      see:https://github.com/leathrum/mathjax-ext-contrib/tree/master/forminput
      this include is needed for support:http://cs.jsu.edu/mathjax-ext/contrib/forminput/forminput.js

      Maybe we should adapt wims_mathml to allow same syntax?
      Since google’s browser chromium is -at this point- not supporting native MathML…but advising javascript Mathjax as ‘add on’ for math displa (grrrr)
      joke

    • #1859
      jm.evers
      Participant
      Up
      0
      Down
      ::

      As for canvas and mathml&input
      see:
      http://wims.math.leidenuniv.nl/canvas/drag_clickfill_mathml.html
      joke

    • #1863
      bernadette
      Maître des clés
      Up
      0
      Down
      ::

      En tout cas, en ajoutant l’extension Mathajax à Google Chrome, les formules de math en mathml passent très bien. Merci, Joke, de l’avoir signalé ! Mais je reste quant à moi avec Firefox !
      https://chrome.google.com/webstore/detail/mathjax-for-chrome/

      Bernadette

    • #1864
      jm.evers
      Participant
      Up
      0
      Down
      ::

      Well here are some local data from a highschool in the Netherlands:
      Approx 50% of our pupils use Chrome at home as default browser (on windows)
      The rest is mainly Firefox (>=19) and MSIE (mostly version 9 and 10)

      Because of MathML in WIMS our school switched from default browser Chrome to Firefox.Our ‘systems administration’ preferred Chrome because it’s light weight and very fast on older pc-systems.

      In using MathJax our pupils (and sysadmin) can use their favorite browser and use mathml…and canvas…and svg…and html-inputfields in MathML 🙂
      joke

    • #1865
      jm.evers
      Participant
      Up
      0
      Down
      ::

      A small note on mathjax (again…)
      I’ve installed mathjax on Leiden wims-mirror and on intranet school servers.
      All browsers -except firefox- will now use MathJax for typesetting.
      This line of javascript will exclude firefox:

      <script type="text/javascript">
      if (navigator.userAgent.indexOf("Firefox") == -1){
      var script = document.createElement("script");
      script.type = "text/javascript";
      script.src  = "mathjax/MathJax.js?config=MML_HTMLorMML-full.js";
      document.body.appendChild(script);
      }
      </script>

      So now -in theory- all browsers could have nice looking mathtypesetting
      (the price to pay is ofcourse a faily slow rendering of math)

    • #1866
      Julien
      Modérateur
      Up
      0
      Down
      ::

      If I update the version of wims the svn, the following code works ?
      \(\sqrt{\embed{reply53, 4}}
      The work on canvas is perfect. The rendering is fast.

    • #1867
      jm.evers
      Participant
      Up
      0
      Down
      ::

      No , I’m afraid this calls for another (new) command, like Bernadette proposed something like \special{mathml ….}

      However you work on wims-phtml directly, you can simply use use

      \begin{html} 
       <span  xmlns="http://www.w3.org/1999/xhtml">
        <textarea xmlns="http://www.w3.org/1999/xhtml" id="mathml0" size="5" style="vertical-align:middle;overflow:hidden;resize:none;color:red" >?</textarea>
       </span>
      \end{html}

      or even better, use
      \input{0}{5}{color:red}{?}{0} which generates the dame code as above
      and use some simple javascript function to read the inputfield.
      The « \input » may be used anywhere in latex (fractions,matrix etc etc etc)
      The \begin{html}\end{html} may include any valid html-thing (images, etc), as long as you tell the system it’s encoding / namespace is xmlns= »http://www.w3.org/1999/xhtml »
      joke

    • #1868
      jm.evers
      Participant
      Up
      0
      Down
      ::

      Some demo OEF shows it all 🙂
      Just copy and paste in createxo on http://wims.math.leidenuniv.nl/wims
      Use any browser you like…

      \statement{
      <script type= »text/javascript »>
      function read_mathml(){
      var p=0;
      var reply=new Array();
      while(document.getElementById(« mathml »+p)){
      reply[p] = document.getElementById(« mathml »+p).value;
      p++;
      };
      alert(« r\statement{
      <script type= »text/javascript »>
      function read_mathml(){
      var p=0;
      var reply=new Array();
      while(document.getElementById(« mathml »+p)){
      reply[p] = document.getElementById(« mathml »+p).value;
      p++;
      };
      alert(« reply = « +reply);
      }
      </script>

      \(
      \left(
      \frac{\sqrt{\input{2}{0}{background-color:red;color:yellow;text-align:center}{?}{0}^{2}}}
      {\pi \cdot \input{2}{1}{background-color:red;color:yellow;text-align:center}{?}{0}}
      \right)^{ \input{3}{2}{background-color:red;color:yellow;text-align:center}{?}{0}}
      = \left(\input{4}{3}{background-color:lightgreen;color:red;text-align:center}{?}{0}\right)^{\frac{1}{\pi}} = \input{6}{4}{background-color:lightgreen;color:red;text-align:center}{?}{0}
      )
      <hr />
      \(
      \Huge{\bigggint}^{\input{2}{5}{background-color:red;color:yellow;text-align:center}{?}{0}}_{\input{2}{6}{background-color:red;color:yellow;text-align:center}{?}{0}} f(x) \bf{d}x
      )
      <hr />
      \(
      \left(
      \begin{array}{ccc}
      1 & \input{1}{6}{background-color:orange;color:yellow;text-align:center}{?}{0} & 3 \\
      4 & 5 & \input{1}{7}{background-color:blue;color:yellow;text-align:center}{?}{0} \\
      \input{1}{8}{background-color:lightgreen;color:blue;text-align:center}{?}{0} & 8 & 9 \\
      10 & 11 & \input{1}{9}{background-color:black;color:yellow;text-align:center}{?}{0}
      \end{array}
      \right)
      )

      <hr />
      <input type= »button » onclick= »javascript:read_mathml() » value= »click me »>
      }eply = « +reply);
      }
      </script>

      \(
      \left(
      \frac{\sqrt{\input{2}{0}{background-color:red;color:yellow;text-align:center}{?}{0}^{2}}}
      {\pi \cdot \input{2}{1}{background-color:red;color:yellow;text-align:center}{?}{0}}
      \right)^{ \input{3}{2}{background-color:red;color:yellow;text-align:center}{?}{0}}
      = \left(\input{4}{3}{background-color:lightgreen;color:red;text-align:center}{?}{0}\right)^{\frac{1}{\pi}} = \input{6}{4}{background-color:lightgreen;color:red;text-align:center}{?}{0}
      )
      <hr />
      \(
      \Huge{\bigggint}^{\input{2}{5}{background-color:red;color:yellow;text-align:center}{?}{0}}_{\input{2}{6}{background-color:red;color:yellow;text-align:center}{?}{0}} f(x) \bf{d}x
      )
      <hr />
      \(
      \left(
      \begin{array}{ccc}
      1 & \input{1}{6}{background-color:orange;color:yellow;text-align:center}{?}{0} & 3 \\
      4 & 5 & \input{1}{7}{background-color:blue;color:yellow;text-align:center}{?}{0} \\
      \input{1}{8}{background-color:lightgreen;color:blue;text-align:center}{?}{0} & 8 & 9 \\
      10 & 11 & \input{1}{9}{background-color:black;color:yellow;text-align:center}{?}{0}
      \end{array}
      \right)
      )

      <hr />
      <input type= »button » onclick= »javascript:read_mathml() » value= »click me »>
      }

      `

    • #1869
      jm.evers
      Participant
      Up
      0
      Down
      ::

      Sorry, but something went really wrong in cutting & pasting here…
      So forget previous ‘post’ and get the demo.oef at
      http://84.83.123.204/demo.oef

      • #2885
        Yves NOEL
        Participant
        Up
        0
        Down
        ::

        Thank you Joke or this example.

        I don’t know if it is still valid or if new developments have been made since your post making it obsolete.

        I have few stupid questions :

        How do you send to wims the values contained in the inputfields after the javascript function have read them ?

        Should we tell to the javascript function to copy the contents of inputfields to a (hidden) input fields named reply1 ?

        Does the oef exercise still contains « \answer » fields ?

        Is it possible to call this javascript function when the user click on the usual « send the answer » button ?

        Thanks
        Yves

    • #2886
      Yves NOEL
      Participant
      Up
      0
      Down
      ::

      OK I have found the \special{mathmlinput } command

      This command at the moment is not available on all servers (for example available on wims.unice.fr but not on wims.auto.u-psud.fr). I have tried it on my personal svn version of WIMS and it is perfect ! It works with Chrome, Safari and Firefox

      You can find help on this special command (on the Nice server) in possibiltés avancées (« advanced features » ?) in the createxo help section.

      Yves

    • #2887
      jm.evers
      Participant
      Up
      0
      Down
      ::

      Hi,

      Yes, it’s a very new command for the OEF interface

      from Changelog:
      —-
      2015-03-10: add special method mathmlinput (Julien Lyotard)
      ____

      Although the pseudo latex command « \input » has been available since the introduction of MathML within WIMS (2012-07-02): but only for « native Mathml » Gecko browsers like Firefox.

      Now through the default use of MathJax library it is fairly « crossbrowser ».

      kind regards,
      Joke

    • #2888
      Yves NOEL
      Participant
      Up
      0
      Down
      ::

      In fact I have problems when I click the « send answer » button.
      I obtain a red error message (incomplete answer)

      Erreur 
      Vous avez envoyé une réponse incomplète. Veuillez compléter vos données avant de les envoyer

      I have also noticed that there is no « Insert the good answers » button.

      This problem appears also with the code coming from the « advanced features » help.

      any idea?

      Yves

    • #2889
      bernadette
      Maître des clés
      Up
      0
      Down
      ::

      Je viens d’essayer le code

      \statement{
      \special{mathmlinput [\frac{reply1}{reply2}], 5,noanswer
      reply 1
      reply 2
      }
      }
      \answer{}{x^2}{type=formal}
      \answer{}{2}{type=numeric}

      et cela fonctionne (serveur svn bien sûr).

      Le bouton y est bien : envoyez la réponse y est bien.

      Bernadette

      PS : bien sûr c’est quand même encore expérimental, donc il peut y avoir des bogues ou des syntaxes mal interprétées.
      Vérifie que quand tu as fait un copier-coller, tu n’as pas pris des caractères bizarres.

      • #2890
        Yves NOEL
        Participant
        Up
        0
        Down
        ::

        OK. ma version svn n’était pas complètement up to date.

        Maintenant ca fonctionne (mais il n’y a pas le bouton « inserer la bonne réponse »)

        Merci

        Yves

    • #2891
      bernadette
      Maître des clés
      Up
      0
      Down
      ::

      Tu veux dire le bouton en mode de développement ?

      En effet, dans aucun des méthodes spéciales, pour l’instant.
      Je sais faire, mais avec du copier coller, donc pour l’instant, je ne l’ai pas fait en attendant de penser à une meilleure solution qui ne
      casse rien.
      Mais le bouton « Envoyez » la réponse y est bien.

      Bernadette

Vous lisez 17 fils de discussion
  • Vous devez être connecté pour répondre à ce sujet.