Unfortunately this does not work. It turns out that there is a simple fix between the copy and paste phase where one has to modiy the script used for MathJax on the webpage for \(\LaTeX\) to work.
Note that for my examples I have used examples from \(\LaTeX\) for Complete Novices by Nicola. L. C. Talbot.
Suppose this is the Latex text that I want to publish on Google Blogger. This is created in RStudio as a simple Rmd file.
-------------------------------------------
A linear equation in line $y = mx + c$
A linear equation with equation references
Equation ~\ref{eqn:linear} is a linear function
\begin{equation}
\label{eqn:linear}
f(x) = mx + c
\end{equation}
If you convert this to html using the knit2html function the resulting output does not translate the math equations at all. You will notice that the Latex symbol in the book reference above does not conver to Latex version.So the steps that need to be followed are:
- Run knit2html on the Rmd file knit2html(yourfile.Rmd)
- Edit the resulting html file.
- Find and replace this section of the code
<script type="text/javascript" src="https://c328740.ssl.cf1.rackcdn.com/mathjax/2.0-latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">with this
</script>
<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>
- Copy and paste the full html code now into the Google blogger interface. Preview to check if to your taste and zou should be done.
- You can see the results of the above code in this link
Comments
Post a Comment