Changing Fonts in Moodle Formulas

Changing Fonts in Moodle Formulas

av Ton Boerkoel -
Antal svar: 11

Hi,

How do I change fonts in Moodle Formulas?

TeX uses the Computer Modern font. But the default font of Moodle is quite different in version 3.8.3

How can I change the font of non-TeX text to match the TeX formulas font?  (and its size)

Or how can I change the text to e.g. Times New Roman font?

[I don't want to change the default font for all Moodle users at our school, just for my quizzes]

Thanks!

Medeltalet av utvärderingarna: -
Som svar till Ton Boerkoel

Re: Changing Fonts in Moodle Formulas

av AL Rachels -
Bild av Core developers Bild av Particularly helpful Moodlers Bild av Plugin developers Bild av Testers
Latex and MathJax both have a bunch of fonts that you can use. There is also a Font family plugin available for the Atto editor. Getting it to actually give what you expect, in my experience can be problematic and seems to depend on the browser and fonts available on the client.

And here is from a page of my notes in Moodle:

There are a number of different types of charsets available, not just Maths but also scientific sets but these need to be installed to your Moodle if you want additional charsets. Unfortunately, TeX Notation is designed for use in Maths, not science, so it may struggle using non-Maths charsets.

To use a particular font you need to access the font using the following syntax.

A blackboard bold font:

\mathbb{AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz}

gives this: \( \mathbb{AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz}\)

A math boldface for upper and lower case font:

\mathbf{AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz}

gives this: \( \mathbf{AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz}\)

A math calligraphic upper and lower case font:

\mathcal{AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz}

gives this: \( \mathcal{AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz}\)

A fraktur font for upper and lower case:

\mathfrak{AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz}

gives this: \( \mathfrak{AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz}\)

A math itallic for upper and lower case font:

\mathit{AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz}

gives this: \( \mathit{AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz}\)

A math roman for upper and lower case font:

\mathrm{AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz}

gives this: \( \mathrm{AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz}\)

A math script for upper and lower case font:

\mathscr{AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz}

gives this: \( \mathscr{AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz}\)

A math sans serir for upper and lower case font:

\mathsf{AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz}

gives this: \( \mathsf{AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz}\)

A math typewriter typestyle for upper and lower case font:

\mathtt{AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz}

gives this: \( \mathtt{AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz}\)

____________________________________________________________________________________

A math calligraphic font:

\mathcal{ABCDEFGHIJKLMNOPQRSTUVXYZ} gives this: \( \mathcal{ABCDEFGHIJKLMNOPQRSTUVXYZ}\)

A Castellar type font:

\mathbb{ABCDEFGHIJKLMNOPQRSTUVXYZ} gives this: \( \mathbb{ABCDEFGHIJKLMNOPQRSTUVXYZ}\)

An Old English type font:

or

\mathfrak{ABCDEFGHIJKLMNOPQRSTUVXYZ} gives this \( \mathfrak{ABCDEFGHIJKLMNOPQRSTUVXYZ}\)

This is different in Tex Notation in Moodle than it is for other, full, TeX packages.

An italic font:

ABCDEFGHIJKLMNOPQRSTUVXYZ

or

\mathi{ABCDEFGHIJKLMNOPQRSTUVXYZ} gives this: \( \mathi{ABCDEFGHIJKLMNOPQRSTUVXYZ} \)

A bold-face font:

or

\mathbf{ABCDEFGHIJKLMNOPQRSTUVXYZ} gives this: \( \mathbf{ABCDEFGHIJKLMNOPQRSTUVXYZ} \)

 


Medeltalet av utvärderingarna: -
Som svar till AL Rachels

Re: Changing Fonts in Moodle Formulas

av Ton Boerkoel -

Hi Al,

Thanks for your response. 

The actual problem for me is not on the TeX side. All my notes, and HW problems etc are in LaTeX. And of course the math formulas in Moodle are in TeX.

What I would like to fix is the fonts of the default Moodle text. It really annoys me that these fonts do not match the fonts used in the math formulas. So I would like to change the Moodle text to match the TeX text, not the other way around.

How does one make the fonts of Moodle text e.g Times New Roman (that is somewhat similar to the TeX font.) 

I do not want to change it for all users at my school ... just for my fonts in my Moodle quizzes (i.e. I don't want to change it at the server (which I do not have access too), just for my quiz questions)

I would have expected a script that set type="times new roman" or something like that would do it. I cannot find it on the Moodle website.

Again thanks for your response. 

ps

Right now I am using the fix:  \ ( \ text{This creates text in TeX} \ )

Medeltalet av utvärderingarna:Useful (1)
Som svar till Ton Boerkoel

Re: Changing Fonts in Moodle Formulas

av AL Rachels -
Bild av Core developers Bild av Particularly helpful Moodlers Bild av Plugin developers Bild av Testers
Hi Ton,
There is a plugin, Atto: Font family, for the Atto editor. It lets you alter font families and may allow you to match text the way you want. It is currently listed as being a plugin for up to Moodle 3.6, but I am also using it in Moodle 3.8.6+, Moodle 3.9.3+, and 3.10+, without any apparent problems.

When you install the plugin, don't forget to go add the plugin listing, fontfamily, into the Atto, Toolbar config setting.

For me, this plugin seems to only work on previously typed text. In other words, type and save your text, then go back and edit it, select the text you want to change, then select the font family toolbutton and select the font you want to use on the text.
Medeltalet av utvärderingarna:Useful (1)
Som svar till AL Rachels

Re: Changing Fonts in Moodle Formulas

av Ton Boerkoel -

Hi Al,

Cool, I'll ask our IT to install the plugin. We just upgraded to 3.8.3. Thanks for the help! 

Greetings,

Ton 

Medeltalet av utvärderingarna: -
Som svar till AL Rachels

Re: Changing Fonts in Moodle Formulas

av Dominique Bauer -
Bild av Documentation writers Bild av Particularly helpful Moodlers Bild av Plugin developers
Hello Al and Ton,

Your discussion brings out a point that should not be ignored by those just starting to use Moodle. (Al, please correct me if what I am saying is not correct.) The fact is that there is no way to integrate LaTeX text into Moodle, much of which is usually in (LaTeX) 'paragraph' mode. In Moodle you can only insert LaTeX content that is in (LaTeX) 'math' mode. Although you can insert text in math mode, this use is limited. Writing full paragraphs inserted in math mode is not the right method.

As Moodle is a web application, the bulk of the text is written in HTML and the formatting of the text is done with HTML tags. In Moodle, only equations and symbols should be written in LaTeX (or MathML or AsciiMath).

If you want to match the font of the HTML text with the default font of the LaTeX equations, you can use for the text the Times New Roman font, which I think is the best match. The font size of the LaTeX equations automatically adjusts to its HTML environment, although you may sometimes want to make a slight adjustment.
Medeltalet av utvärderingarna:Useful (1)
Som svar till Dominique Bauer

Re: Changing Fonts in Moodle Formulas

av Ton Boerkoel -

Hi Dominique,

Yes, that's why I asked how to get HTML to write in Times New Roman font. 

Al suggested a plugin which as of yet my school has to add to Moodle. I don't have administrative privileges, and our IT at times doesn't want to add plugins (e.g. they don't want to add STACK) or take a long time to get to it. 

I really hate the way HTML default font looks compared to TeX. All my work is in LaTeX, and I would like the quizzes, and HWs and Tests I give on Moodle to my students to look the same. So far I have just used  \ text{ }.  I know you don't like that Dominique, but it gives me beautiful looking problems, where all fonts are the same (text and formulas). 

As soon as I get the plugin I will stop using \ text{ }   .... or if you (Dominique) know another way of getting Moodle to write text in Times New Roman font (?)

btw I haven't yet had time to respond to your other detailed message---which I appreciated tremendously!---Dominique. I will do so in a few days.

Happy Holidays and best wishes for 2021! 

Medeltalet av utvärderingarna: -
Som svar till Ton Boerkoel

Re: Changing Fonts in Moodle Formulas

av Dominique Bauer -
Bild av Documentation writers Bild av Particularly helpful Moodlers Bild av Plugin developers
Hello Ton,

The "Atto: Font family" plugin is installed on more than four thousand sites and is 100% translated into twenty-three languages. Suffice to say that it is very popular and, if it is not already installed on your site, it would be a good idea to have it installed for the benefit of all the teachers at your school.

Although it is convenient, the plugin only adds style to the various tags of a text in Moodle. In the Atto editor, click the HTML button, </>, to see the tags. For an ordinary paragraph, the tag is <p>. To have the paragraph in Times New Roman, just add style="font-family:'Times New Roman';" to the tag. In other words, just replace <p> with <p style="font-family:'Times New Roman';">. The "Atto: Font family" plugin can do this for you, but you can just as easily do it yourself. The result will be exactly the same. There are a few tags you will need to modify: <p> for paragraph, <div> for division or section, <span> for an inline container, <li> for list items, and a few more. It's not very complicated. Note that all tags beginning with /, for example </p>, are closing tags and should not be changed.

Happy Holidays and best wishes for 2021!


Medeltalet av utvärderingarna: -
Som svar till Dominique Bauer

Re: Changing Fonts in Moodle Formulas

av Ton Boerkoel -

That works! Thanks, Dominique.  I did have to change the font size of the math text (It didn't match automatically).


Medeltalet av utvärderingarna: -
Som svar till Dominique Bauer

Re: Changing Fonts in Moodle Formulas

av AL Rachels -
Bild av Core developers Bild av Particularly helpful Moodlers Bild av Plugin developers Bild av Testers

"The fact is that there is no way to integrate LaTeX text into Moodle, ...", not sure as I have not played with it much for the past few years, but you actually might be able to do something with the Generico filter.

Medeltalet av utvärderingarna:Useful (1)
Som svar till Dominique Bauer

Re: Changing Fonts in Moodle Formulas

av Tim Hunt -
Bild av Core developers Bild av Documentation writers Bild av Particularly helpful Moodlers Bild av Peer reviewers Bild av Plugin developers
Som svar till Tim Hunt

Re: Changing Fonts in Moodle Formulas

av Dominique Bauer -
Bild av Documentation writers Bild av Particularly helpful Moodlers Bild av Plugin developers

Hello Tim,

Yes, but this is the TeX math-mode.

Here is what MathJax says:

First and foremost, the TeX input processor implements only the math-mode macros of TeX and LaTeX, not the text-mode macros. MathJax expects that you will use standard HTML tags to handle formatting the text of your page; it only handles the mathematics. So, for example, MathJax does not implement \emph or \begin{enumerate}...\end{enumerate} or other text-mode macros or environments. You must use HTML to handle such formatting tasks. If you need a LaTeX-to-HTML converter, you should consider other options.

https://docs.mathjax.org/en/v2.7-latest/tex.html

Medeltalet av utvärderingarna: -