Saturday 20 October 2012

LaTeX in Blogger

Recently I found about MathJax, a tool that enables use of LaTeX in blogs and other web platforms. It's an excellent tool! At the Irreducible representations blog there is a nice and simple explanation how to add this feature to your own blog. I copy the explanation here:

To get MathJax to work in Blogger, just go to your Blogger account, click "Design" (top right of the page), and then "Edit HTML". After the first <head> you see, paste
<script src='http://cdn.mathjax.org/mathjax/latest/MathJax.js' type='text/javascript'>    
    MathJax.Hub.Config({
        HTML: ["input/TeX","output/HTML-CSS"],
        TeX: { extensions: ["AMSmath.js","AMSsymbols.js"], 
               equationNumbers: { autoNumber: "AMS" } },
        extensions: ["tex2jax.js"],
        jax: ["input/TeX","output/HTML-CSS"],
        tex2jax: { inlineMath: [ ['$','$'], ["\\(","\\)"] ],
                   displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
                   processEscapes: true },
        "HTML-CSS": { availableFonts: ["TeX"],
                      linebreaks: { automatic: true } }
    });
</script>


And that's all! Now you can use standard LaTeX commands to format mathematical text. For example, the radiative transfer equation along a ray (e.g. see the lecture notes of Rob Rutten, Eq.2.24) can be written as:

\frac{\mathrm{d}I_{\nu}}{\alpha_{\nu}\mathrm{d} s} = S_{\nu} - I_{\nu}

and appears as: $$ \frac{\mathrm{d}I_{\nu}}{\alpha_{\nu}\mathrm{d} s} = S_{\nu} - I_{\nu} $$

9 comments:

  1. Thank you so much! This is really useful!

    ReplyDelete
    Replies
    1. I'm glad that you find it helpful. The credits goes to the Irreducible representations blog.

      Delete
  2. Correcto! $$
    \frac{\mathrm{d}I_{\nu}}{\alpha_{\nu}\mathrm{d} s} = S_{\nu} - I_{\nu}
    $$

    ReplyDelete
  3. Nikola:
    Te saludo desde Tucumán al Norte de Argentina.
    Estoy empezando a escribir un blog para dejar plasmadas mis experiencias en el mismo.
    El contenido del mismo será de artículos de Ingeniería Eléctrica, circuitos eléctricos con lógica analógica, música para descansar y tablas.
    Con tus instrucciones incluí en el gadget HTML el script sugerido y ahora puedo escribir correctamente las expresiones matemáticas.
    Me faltan dos pasos mas:
    a) poder dibujar funciones por ejemplo i=f(t)
    b) dibujar los circuitos
    Se pueden realizar estas dos tareas en LaTex para HTML?
    En caso afirmativo, me podrías enviar las instrucciones correspondientes.
    Agradezco tu atención
    Rubén
    04/06/13

    ReplyDelete
    Replies
    1. Dear Rubén,
      I'm glad you find this tip useful. For plotting functions I use IDL from which I export png, jpeg or any other graphical format. I haven't draw any electrical circuits since my bachelor studies, however for drawing various diagrams I normally use Inkscape that is available for Linux (and again export figures to some common format).
      Best, N.

      Delete
  4. Nicola:
    Agradezco infinitamente tu respuesta.
    Me reconforta saber que estas usando Inkscape, ya que hace unos meses me propuse aprender a usarlo para dibujar los circuitos o sea no estaba tan desorientado.
    En relación a los gráficos, retomaré el manejo de MATLAB, ya que la Facultad tiene licencia y los docentes lo podemos utilizar sin problemas.
    Un abrazo y que disfrutes los últimos días de la primavera.
    Rubén
    05/06/13

    ReplyDelete
  5. This comment has been removed by a blog administrator.

    ReplyDelete
  6. This comment has been removed by a blog administrator.

    ReplyDelete