Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Mathjax in answer options

  • modernity4r
  • modernity4r's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 months 5 days ago - 2 months 4 days ago #256953 by modernity4r
Mathjax in answer options was created by modernity4r
Please help us help you and fill where relevant:
Your LimeSurvey version: 6.4.8+
Own server or LimeSurvey hosting: Both
Survey theme/template: Fruity
==================The questions and answers sometimes contain numbers. To improve the readability of numbers, I have the habit of using Mathjax's number expression uniformly. This does not affect the Mathjax-linked numbers in the questions, but there is a peculiarity with the single choice radio button responses. When one radio button is pressed, the space where the number is expressed is covered in white, obscuring the number.This only happens on iPhones (iOS). It does not occur on Android devices. It is also not related to the browser. On Android, it does not occur in Chrome, Firefox, or Opera.

Mathjax was added to custom.js as follows:
Code:
/******************
    User custom JS
    ---------------
 
   Put JS-functions for your template here.
   If possible use a closure, or add them to the general Template Object "Template"
*/
 
// MathJax 
function loadMathJax() {
  var script = document.createElement('script');
  script.type = 'text/javascript';
  script.src = 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js';
  script.async = true;
  document.head.appendChild(script);
}
 
// MathJax 
window.MathJax = {
  tex: {
    inlineMath: [['$', '$'], ['\\(', '\\)']] 
  },
  startup: {
    ready: function() {
      console.log('MathJax is ready');
      MathJax.startup.defaultReady();
    }
  }  
};
 
//  MathJax Excute
document.addEventListener('DOMContentLoaded', function () {
  loadMathJax();
});
 
$(document).on('ready pjax:scriptcomplete', function() {
 
  /**
   * Code included inside this will only run once the page Document Object Model (DOM) is ready for JavaScript code to execute
   * @see https://learn.jquery.com/using-jquery-core/document-ready/
   */
   
  if(localStorage.getItem("lsFontSize") === null) {
    localStorage.setItem('lsFontSize', 110);
  }
 
  $('body').attr('data-ls-font-size', localStorage.getItem('lsFontSize'));
 
  $('.text-size-container button').on('click', function(e) {
    var lsCurrentFontSize = Number(localStorage.getItem('lsFontSize'));
    var sizeIncrement = 10;
    
    if($(this).hasClass('minus')) {
      sizeIncrement = -10
    }
    
    var lsNewFontSize = lsCurrentFontSize+sizeIncrement;
    localStorage.setItem('lsFontSize', lsNewFontSize);
    $('body').attr('data-ls-font-size', localStorage.getItem('lsFontSize'));
  });
 
});
Last edit: 2 months 4 days ago by DenisChenu. Reason: [code]

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 months 4 days ago #256984 by DenisChenu
Replied by DenisChenu on topic Mathjax in answer options

This only happens on iPhones (iOS).
 
Arg !
Just Courage to correct this type of problem.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: modernity4r

Please Log in to join the conversation.

  • modernity4r
  • modernity4r's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 months 4 days ago #257053 by modernity4r
Replied by modernity4r on topic Mathjax in answer options
Let me simplify the question for further inquiry. :)

I would like to include numbers expressed in LaTeX format using mathjax as an answer option. Unlike PCs and Android devices, there is a phenomenon of being obscured from the screen on iOS devices.

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 months 3 days ago #257076 by tpartner
Replied by tpartner on topic Mathjax in answer options
I would suggest that this is a topic for a MathJax forum.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu, modernity4r

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose