user80946
user80946

Reputation: 385

Writing subscript in Mathjax?

I want to type this .enter image description here

I have tried like this

$$\lambda=\frac{0.693}{t_\frac{1}{2}}$$

Also,

$$\lambda=\frac{0.693}{{t}_\frac{1}{2}}$$

Also,

$$\lambda=\frac{0.693}{t_{\frac{1}{2}}}$$

But it don't work it display something like this enter image description here

This code

enter image description here

also gives something that we don't want

enter image description here

Mathjax Configuration

<div class="layout"><script type="text/x-mathjax-config">
MathJax.Hub.Config({
  TeX: {extensions: ["AMSmath.js","AMSsymbols.js","mhchem.js","noErrors.js","noUndefined.js"]},
  tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
      processEscapes: true
    },
});
</script>
<script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script>

Browser= Google Chrome OS= Windows 8.1

Upvotes: 12

Views: 14760

Answers (3)

Hitesh Sahu
Hitesh Sahu

Reputation: 45062

Use _{}

_{YOUR EXPRESSION}

Example:

$$Y_n = Y_{n-1}+{{(d/n)}sin(θ\pm n*Δ)}.$$  

Result:

enter image description here

Upvotes: 16

Penny Liu
Penny Liu

Reputation: 17408

See the live example below:

window.MathJax = {
  config: ["MMLorHTML.js"],
  jax: ["input/TeX", "input/MathML", "input/AsciiMath", "output/HTML-CSS", "output/NativeMML"],
  extensions: ["tex2jax.js", "mml2jax.js", "asciimath2jax.js", "MathMenu.js", "MathZoom.js"],
  asciimath2jax: {
    delimiters: [
      ['`', '`'],
      ['$', '$']
    ]
  },
  TeX: {
    extensions: ["AMSmath.js", "AMSsymbols.js", "noErrors.js", "noUndefined.js"]
  },
  tex2jax: {
    inlineMath: [
      ['$', '$'],
      ["\\(", "\\)"]
    ],
    processEscapes: true
  }
};
.MathJax_CHTML {
  font-size: 30px !important;
}
<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<p> $$\frac{1}{\lambda}=\frac{0.693}{t_\frac{1}{2}}$$</p>
<p> $$\frac{1}{\lambda}=\frac{0.693}{{t}_\frac{1}{2}}$$</p>
<p> $$\frac{1}{\lambda}=\frac{0.693}{t_{\frac{1}{2}}}$$</p>

Upvotes: 1

user2133061
user2133061

Reputation:

$$\frac{1}{\lambda}=\frac{0.693}{t_\frac{1}{2}}$$

renders exactly what you are asking for and I tested it already.

Note the difference:

I just copied your first mathjax code:

$$\lambda=\frac{0.693}{t_\frac{1}{2}}$$

Note that before the '=' on the left side of the equation you just and simply wrote \lambda and that was your only mistake, so I simply replaced \lambda with \frac{1}{\lambda} and that's all.

You already showed us in your question that you already know that underscore _ renders subscript text and symbols in mathjax by the way.

Upvotes: 3

Related Questions