All posts

ยท Antonio Godoy Pellini

LaTeX in Moodle: write math formulas in real time

How LaTeX works in Moodle today with the TeX and MathJax filters, and how to write formulas live inside a Moodle activity with DTeach.

You can write LaTeX in Moodle today by enabling the TeX notation filter or the MathJax filter and typing formulas between delimiters in the text editor. If you want formulas that render as you type, in a course your colleagues edit with you and your students question line by line, add DTeach as an activity in your Moodle course. Students and teachers open it with their Moodle account, and every formula lives in real-time courses next to student Q&A and shared diagrams.

How do you write LaTeX in Moodle today?

Moodle has handled math for a long time, and it does the basics well.

The TeX notation and MathJax filters

Moodle ships with two filters for math. The TeX notation filter turns TeX into images on the server. The MathJax filter renders formulas in the browser. A Moodle administrator enables one of them under the site filter settings, and from then on any text area in Moodle can hold a formula.

A teacher then types something like this in a page, a quiz question, or a forum post:

$$ \int_0^1 x^2 \, dx = \frac{1}{3} $$

The editor (Atto or TinyMCE, depending on your Moodle version) also offers an equation button that helps build the TeX.

Where it gets hard

The filters render formulas. They don't give you a place to write math together.

  • You write in one place and see the result in another. The formula renders when the page is displayed, so long derivations turn into a loop of edit, save, check.
  • One author at a time. Two teachers preparing the same lesson end up passing a file back and forth.
  • Questions land far from the formula. A student stuck on line four of a proof writes in a forum, and the teacher has to work out which line they mean.
  • Diagrams live elsewhere. A graph or a sketch next to the equation usually means a screenshot from another tool.

None of this is a bug in Moodle. Moodle is the place that holds your courses, your enrolments, and your gradebook. The writing itself is a different job.

How does DTeach handle LaTeX inside a Moodle activity?

DTeach is a collaborative teaching platform that plugs into Moodle with a plugin you install yourself. Each DTeach activity in a Moodle course opens a DTeach course. People who open it are signed in from Moodle, with no second password, and their Moodle role decides what they can do: teachers and teaching assistants edit, everyone else opens it as a student.

Formulas rendered as you type

Inside a DTeach document, type / and insert a math block. You write LaTeX and the formula renders as you type. There is no save button: documents sync live, so what you write appears for everyone reading.

f'(x) = \lim_{h \to 0} \frac{f(x+h) - f(x)}{h}

Colleagues who edit the course with you work in the same document at the same time, and you see their cursors as they type.

Students ask on the passage they are stuck on

With student Q&A, a question is anchored to the paragraph it is about. A student hovers the passage with the formula, presses Ask a question, and the question sits right there. The teacher gets an email, answers in a thread under the same passage, and marks it resolved. Students can ask even in a section they cannot edit.

Every block also has its own link. Copy it and point the class to the exact formula or exercise you mean.

Math beyond the lesson text

  • Notes. Students write private notes under a paragraph of the course, formulas included. The teacher does not see them.
  • Shared diagrams. Drop an Excalidraw whiteboard into the page with /excalidraw and draw the graph next to the equation, with everyone who edits the document on the same board.
  • Student editing. Open one section to students and they write LaTeX in it with the same editor, for an exercise sheet the class fills in together.

How to set up LaTeX in Moodle with DTeach

You need administrator rights on a Moodle 4.2 or later, and a DTeach licence key. The Moodle connection is a paid offer for your whole Moodle site; see pricing.

  1. Install the plugin. Download the DTeach plugin. In Moodle, go to Site administration โ†’ Plugins โ†’ Install plugins, drop in the ZIP file, and press Upgrade Moodle database now.
  2. Activate your licence. Open Site administration โ†’ Plugins โ†’ Local plugins โ†’ DTeach โ†’ Connection, paste your licence key, and press Activate. The page shows Active and your plan.
  3. Add the activity. In a Moodle course, turn editing on, then Add an activity or resource โ†’ DTeach.
  4. Pick the course. Press Select content, then Create a new course, or Link one you already built. Save the activity.
  5. Write your first formula. Open the activity, create a document from the sidebar, type /, and insert a math block.
  6. Check it as a student. Open the activity with a student account. They land in the course, signed in, with read access.

The full walkthrough, with videos, is in Install the Moodle plugin.

Where to go from here

LaTeX in Moodle works with the filters for a formula in a quiz or a page. For a math course you write with colleagues and teach live, DTeach puts LaTeX, student Q&A, and shared diagrams inside the Moodle activity your students already open. Read Teaching from Moodle for what happens on every launch, and Inside a course for everything a document can hold.

FAQ

Do students need a separate account to see the formulas?

No. Students click the DTeach activity in Moodle and land in the course, already signed in. DTeach creates their account on the first launch, bound to your Moodle site, and adds them to the course with their Moodle role.

Can I reuse the same LaTeX course in several Moodle courses?

Yes. Several activities can point at one DTeach course, so a correction made once shows up in every class. Classes that share a course also share its questions. See Reuse a course in several places.

Can I write LaTeX in DTeach without Moodle?

Yes. Any teacher can create an account, write a course with LaTeX, and publish it on the web for free. Readers open the link without an account. See Publish a course.