title: MathJax or similar: render arbitrary HTML element inside expression?
body: <p>I have a specific need regarding mathematical expression rendering in a web application, and while I've so far been mostly looking at MathJax, I'm certainly not wedded to it.</p>
  
  <p>What I need is the ability to render a mathematical expression where one or more of the terms can be, essentially, an arbitrary HTML box element, like so:
  <a href="https://i.stack.imgur.com/UVG7s.png" rel="noreferrer"><img src="https://i.stack.imgur.com/UVG7s.png" alt="Example output"></a></p>
  
  <p>...It would be preferable if the layout responded to the size of the HTML box (e.g. parenthesis would auto-size to match its height, like any other "normal" LaTeX/MathJax element), but if I need to specify an exact size in pixels or something like that, that'd be OK too. Would even be OK if I had to e.g. insert a "placeholder" element in the actual visualization, but could know exactly where it wound up in the output so I could overlay the HTML element precisely on top of it.</p>
  
  <p>In other words, I'm open to outside-the-box or even hackish solutions; just need something that works.</p>
  
  <p>Also possibly relevant: I'm really only going to be using pretty basic LaTeX elements: parentheses, fractions, normal operators. I don't even really need to be able to support the summation in the above example, if that's a complicating factor. </p>