H5P: Unknown environment 'table'

417 views Asked by At

I try to add a table in my H5P exercise using latex. As mentioned here I am using the '$$' notation in front of the latex code but I also tried the '( ... )' notation. However, I always get the following error:

Unknown environment 'table'

This is the code I am adding to the exercise body:

Question 1

\( f(x) = \frac{A_0}{2} + \sum \limits_{n=1}^{\infty} A_n \cos \left( \frac{2 n \pi x}{\nu} - \alpha_n \right) \)

$$\begin{table}[] \begin{tabular}{|l|c|} 1 & 2 \end{tabular} \end{table} \)$$

The first part (the function) is working fine and shown correctly. However, for the table I just get the error.

Can somebody help me out here?

1

There are 1 answers

0
Oliver Tacke On BEST ANSWER

The H5P.MathDisplay library is based on MathJax, and MathJax only implements the macros used for math layout, not text layout. There's no support for commands such as \begin{table} or \begin{tabular} or \begin{center}.

Without amending the MathJax configuration, you could use an array environment.

\[
\begin{array}{|c|c|c|}
\hline
  \text{Set} & \text{Operation} & \text{Identity} \\ 
\hline
   \mathbb{Z} & + & 0 \\
\hline
   \mathbb{Q} & + & 0 \\
\hline
   \mathbb{R} & + & 0 \\ 
\hline
   \mathbb{Z} & \times & 1 \\
\hline
   \mathbb{Q} & \times & 1 \\
\hline
   \mathbb{R} & \times & 1 \\ 
\hline
\end{array}
\]