Are matrix commands broken?

10 views
Skip to first unread message

phario

unread,
Aug 26, 2025, 8:05:13 AM (10 days ago) Aug 26
to PreTeXt support
I'm unable to compile a document with this: 

<?xml version="1.0" encoding="UTF-8"?>
<chapter xml:id="ch-chapter00-introduction" xmlns:xi="http://www.w3.org/2001/XInclude">
  <title>Introduction</title>

  <introduction>
    <p> Text before the first section. </p>
  </introduction>

  <section xml:id="sec-Test">
    <title>Test</title>
    <p>
      <me>
        \begin{pmatrix}
        0 & 1 \\
        1 & 8
        \end{pmatrix}
      </me>
    </p>
  </section>

  <!-- include sections -->
  <!-- <xi:include href="sec-section-name.ptx" /> -->
</chapter>

But when I replace the pmatrix command with this (no ampersands): 

      <me>
        \begin{pmatrix}
        0 \\
        1 
        \end{pmatrix}
      </me>

It then compiles just fine. 

Can anyone comment on this issue? Seems very strange. Looking through documentation, it suggests that pmatrix should work with MathJax right out of the box.

Mitch Keller

unread,
Aug 26, 2025, 8:10:05 AM (10 days ago) Aug 26
to pretext...@googlegroups.com
& is a special character for XML. You need to use \amp anywhere you’d type & in math mode in LaTeX when writing PreTeXt. 
-- 
Mitch Keller

On Aug 26, 2025, at 07:05, phario <phil...@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-support/18016af7-4eaf-416f-8dc0-1f74eafd8853n%40googlegroups.com.

Charilaos Skiadas

unread,
Aug 26, 2025, 8:11:09 AM (10 days ago) Aug 26
to pretext...@googlegroups.com
Take a look at section 3.14 of the guide: https://pretextbook.org/doc/guide/html/overview-exceptional-characters.html
In short, the ampersand is a special character in XML and needs to be escaped and written as "&amp;”
  
Charilaos Skiadas
Department of Mathematics
Hanover College


phario

unread,
Aug 26, 2025, 12:07:56 PM (10 days ago) Aug 26
to PreTeXt support
Hi,

Thanks for this. 

I guess Sec 3.14 is discussing the use of & in regular text mode. So I guess you should replace with &amp; Thanks!

Trying this in Math mode did not work; so then I understand Mitch Keller's advice that you need to use \amp

Reading the documentation more closely, I see it is mentioned in sec. 4.9.5


Thanks!
Reply all
Reply to author
Forward
0 new messages