# h5p math latex

Hello! I was so glad to see the release of math formulas in h5p. Thank you very much.

I had installed the library for it. I had learned the basics of latex.

But I don't understand where and how should I use latex "code".

When I insert it into the h5p editor in the process of content creation it is not shown right on the page

1)I create latex code in the editor with all the commands like \documentclass[a4paper,12pt]{article}

or just for the formula

(like \begin{equation}\label{eq:fourierrow}

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

\end{equation})

2)I create contenet "fill in the blanks" or drag and drop types on my Drupal7 site page on the page with the url

node/add/h5p-content

3)In the task desription page block I insert all the code from the editor or its part

But it is nt working

See screenshoots.

E.g. I had created the code

"

\documentclass[a4paper,12pt]{article}

\usepackage{cmap}

\usepackage[T2A]{fontenc}

\usepackage[utf8]{inputenc}

\usepackage[english]{babel}

\begin{document}

\maketitle

\begin{equation}\label{eq:fourierrow}

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

\end{equation}

\end{document}

"

Where should I insert this code?

ksen-pol

Tue, 04/23/2019 - 12:40

Permalink

## While waiting for the answer

While waiting for the answer I had the idea how to do it.

I just needed to insert it like in the example on https://h5p.org/mathematical-expressions

after changing "some LaTeX" for my text in the phrase

"\( some LaTeX \)"

so it became e.g.

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

BV52

Wed, 04/24/2019 - 04:42

Permalink

## Hi ksen-pol,If I'm not

Hi ksen-pol,

If I'm not mistaken this is already working for you. If you have any other questions feel free to post in the forums.

-BV52

ksen-pol

Mon, 06/10/2019 - 16:54

Permalink

## Thank you. I can use Latex

Thank you. I can use Latex with h5p now but have problems with some symbols and settings.

I work on the Drupal7 site now.

E.g. after adding some commands and saving new pages I have messages like "Misplaced &", or Undefined control sequence \cdota

(see screenshoots)

I test commands before using them on writelatex.com online (or overleaf.com). And Commands work well there.

How can I fix this problem on my site with h5p?

Can I add some packages

(like "\usepackage{amsmath,amsthm,amssymb}" )

by editing some files of the module? In what files can I add packages and make setting for latex?

otacke

Tue, 06/11/2019 - 11:12

Permalink

## Привет ksen-pol!H5P does not

Привет ksen-pol!

H5P does not provide a full LaTeX implementation, but uses MathJax to render mathematical formula. In consequence, you cannot add your packages to broaden the functionality.

If you want to check what H5P can render, you should use the live demo of MathJax. For your examples, e.g.

works just fine.

ksen-pol

Wed, 06/26/2019 - 22:19

Permalink

## Thank you! It works!

Thank you very much! It works.

Can you recommend a good tutorial about mathjax syntaxes?

E.g. how can I use images, image references and hierarchy (like section, subsection and etc) commands?

otacke

Thu, 06/27/2019 - 00:14

Permalink

## Hi ksen-pol!As I mentioned:

Hi ksen-pol!

As I mentioned: "H5P does not provide a full LaTeX implementation, but uses MathJax to render mathematical formula." Don't confuse MathJax with a fully fledged LaTeX interpreter. It does solely support mathematical expressions.

Best,

Oliver

ksen-pol

Mon, 07/01/2019 - 16:46

Permalink

## Thank you

Thank you. I think I understand now. Can you give me a link to the tutorial to the rules of syntaxes for my formula to be displayed on h5p-mathjax site?

And I see here that I can edit some settings. Can I edit it for mathjaх to show not only LateX but also Asciimath?

e.g. with mathjax I can use

<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/latest.js?config=AM..."></script>

and the formula:

`sum_(i=1)^n i^3=((n(n+1))/2)^2`

otacke

Tue, 07/02/2019 - 08:14

Permalink

## Hi ksen-pol!I am sure, if you

Hi ksen-pol!

I am sure, if you use

math latex tutorialin a search engine of your choice, you will find some tutorial. There's none in particular that I can recommend.You can configure MathJax the way you want. If you need AsciiMath support, you need to add it to the list of input processors (see http://docs.mathjax.org/en/latest/options/input-processors/AsciiMath.html):

Best,

Oliver

ksen-pol

Tue, 07/02/2019 - 13:44

Permalink

## Thank you

Sure I had found a lot of math LaTex tutorials. But mathjax does not show all Latex formulas and I could not find in mathjax documentation any information about Latex that particulary suits mathjax. So if you also can not recommend special tutorials may be I should look for this infromation on Mathjax forums. I'll do so.

But how did you know that

"\( S = \frac{1}{2} \cdot a \cdot b \cdot \sin(\alpha) \) "

will work

instead of

"S=\frac{1}{2}\cdot&a\cdot&b\cdot&\sin\alpha"

that did not work with Mathjax but worked in other Latex readers.

About Ascii: I see that I can include a

`AsciiMath`

section in`MathJax.Hub.Config()`

But can you help me to find the answer,

where should I use the needed code (of

`AsciiMath`

section in`MathJax.Hub.Config`

) for it to work in h5p interactive content?otacke

Wed, 07/03/2019 - 08:41

Permalink

## Hi ksen-pol!I knew that my

Hi ksen-pol!

I knew that my version would work, because the ampersand inside yours is a reserved symbol for alignment commands - and well again, MathJax is meant for rendering formula, not for supporting layouting, etc. It may simply be very strict when interpreting the input while other LaTeX interpreters are not. You could also ask: Why do browsers render pages differently ...

The documentation page for mathematical expressions within H5P holds configuration examples for Drupal, WordPress and moodle. If you have a look at the property

config, you will notice that it's exactly the same as what's calledMathJax.Hub.Configin MathJax's documentation. The only transfer that's needed is to define the properties in PHP instead of JavaScript/JSON, e.g.would need to become

Best,

Oliver