"using tabular with MathJax" tutorial

2,384 views
Skip to first unread message

Dirk

unread,
Jun 13, 2012, 11:14:21 AM6/13/12
to mathja...@googlegroups.com

Dear colleagues,

I have the following code.  It renders very fine on a regular TeX installation,
but MathJax does not do anything with it.  It just shows the code!  Any ideas?  Just pointing me to the
"using tabular with MathJax" tutorial would be fine!  Thanks!
Dirk

+++++++++++++++++++++++++++

<div style="display:none">
 \(
  \newcommand\T{\rule{0pt}{2.9ex}}
   \newcommand\B{\rule[-1.1ex]{0pt}{0pt}}
 \)
 </div>
 $$
 \begin{tabular}{|c|c|}
 \hline $X$ \T \B & $P( X = i)$ \\\hline
   1 \T \B & $1/6$ \\\hline
   2 \T \B &  $1/6$ \\\hline
   3 \T \B &  $1/6$ \\\hline
   4 \T \B & $1/6$ \\\hline
   5 \T \B & $1/6$ \\\hline
   6 \T \B & $1/6$ \\\hline
   \end{tabular}
$$

Davide P. Cervone

unread,
Jun 13, 2012, 11:26:55 AM6/13/12
to mathja...@googlegroups.com
MathJax doesn't implement tabular, because it is really a text-mode environment.  You can use the array environment as a replacement.  E.g.

\newcommand\T{\Rule{0pt}{1em}{.3em}} \begin{array}{|c|c|} \hline X & P(X = i) \T \\\hline 1 \T & 1/6 \\\hline 2 \T & 1/6 \\\hline 3 \T & 1/6 \\\hline 4 \T & 1/6 \\\hline 5 \T & 1/6 \\\hline 6 \T & 1/6 \\\hline \end{array}
should get what you are looking for.

Davide

Dirk Bollaerts

unread,
Jun 15, 2012, 4:41:50 AM6/15/12
to mathja...@googlegroups.com
Dear Sir,

Thank you for your answer!

Maybe you can help me with the following.  I placed MathJax on my local disk (windows 7) in the dir/folder "d:\mathjax ".

I try now to develop on my local disks instead of involving servers far away.  I checked all the test files and they are working alright!

I included in my html file:

 <script type="text/x-mathjax-config">
   MathJax.Hub.Config({
     extensions: ["tex2jax.js"],
     jax: ["input/TeX", "output/HTML-CSS"],
     tex2jax: {
       inlineMath: [ ['$','$'], ["\\(","\\)"] ],
       displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
       processEscapes: true
     },
     "HTML-CSS": { availableFonts: ["TeX"] }
   });
 </script>

<script type="text/javascript" src=" D:/MathJax /MathJax.js?config=TeX-AMS_HTML-full">
</script>

I do not understand what is going wrong, but it does not work.  I only see my source code.  I guess that I can say that I read the installation tutorials but did not found any clues!

Yours,

Dirk

++

Davide P. Cervone

unread,
Jun 15, 2012, 6:09:51 AM6/15/12
to mathja...@googlegroups.com
I believe that the URL for MathJas should be 


not
d:/MathJax/MathJax.js

Davide

rumaisa...@gmail.com

unread,
Jun 3, 2020, 12:23:18 PM6/3/20
to MathJax Users
Hi,

Thank you for the answer. This solution also works fine in overleaf. but my Learning management system is still not showing the required table. IN my LMS the syntax is [latex]\begin{array}{|c|c|}
\hline X & P(X = i) \T \\\hline
  1 \T & 1/6 \\\hline
  2 \T & 1/6 \\\hline
  3 \T & 1/6 \\\hline
  4 \T & 1/6 \\\hline
  5 \T & 1/6 \\\hline
  6 \T & 1/6 \\\hline
\end{array}[/latex]

Davide Cervone

unread,
Jun 3, 2020, 12:50:13 PM6/3/20
to mathja...@googlegroups.com
You don't give any information about what is going wrong ("is still not showing the required table" is informative enough), so we can't really help you.

It may be that your LMS requires you to double the backslashes, so try 

[latex]
\\newcommand\\T{\\Rule{0pt}{1em}{.3em}}
\\begin{array}{|c|c|}
\\hline X & P(X = i) \\T \\\\\\hline
  1 \\T & 1/6 \\\\\\hline
  2 \\T & 1/6 \\\\\\hline
  3 \\T & 1/6 \\\\\\hline
  4 \\T & 1/6 \\\\\\hline
  5 \\T & 1/6 \\\\\\hline
  6 \\T & 1/6 \\\\\\hline
\\end{array}
[/latex]

Or you might only have to double some of them, like the ones for \\\hline.  Try viewing the page source to see how many backslashes are actually in the page.

Davide


--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/e92f6b2f-e6f6-4d0b-954d-882f99ebcb4a%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages