Question Details

No question body available.

Tags

html css mathjax

Answers (1)

Accepted Answer Available
Accepted Answer
March 15, 2026 Score: 0 Rep: 11,785 Quality: High Completeness: 60%

The problem here is not in popup, but in your MathJax configuration. Or in the htmlContent of the formula. Now MathJax only processes

\( ... \)
\[ ... \]

The easiest thing to change is htmlContent, because right now it's not clear what's there. Maybe something like this:

/ popup content /

const htmlContent = `

\\(\\text{ASSUME}\\) \\[\\text{R.V.}[N]\\] : Default happens on the Year \\[n\\,\\: n = 1(1)\\infty\\]

`;

function openPopup(){

const popupContent = document.getElementById("popupContent");

popupContent.innerHTML = htmlContent;

document.getElementById("overlay").style.display="block"; document.getElementById("popup").style.display="block";

/ render math /

MathJax.typesetPromise([popupContent]);

}
body{
font-family:serif;
padding:40px;
}

button{ font-size:16px; padding:10px 20px; }

#overlay{ position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.5); display:none; }

#popup{ position:fixed; left:50%; top:50%; transform:translate(-50%,-50%); width:60vw; height:60vh; background:#eee; border:3px solid gold; display:none; padding:20px; overflow:auto; }

.math-block{ font-size:18px; line-height:1.6; }

mjx-container[jax="CHTML"][display="true"]{ text-align:left !important; margin-left:0 !important; }

window.MathJax = { tex: { inlineMath: [['\\(','\\)']], displayMath: [['\\[','\\]']] } };

Open Example