\amp vs &

32 views
Skip to first unread message

Jean-Sébastien Turcotte

unread,
Jun 11, 2020, 2:01:38 PM6/11/20
to PreTeXt support
Has anything changed recently? It seems that my \amp s inside matrices are not compiling now. If I replace them with &amp s all is good. Maybe I messed up something somewhere else too.

Rob Beezer

unread,
Jun 11, 2020, 2:27:41 PM6/11/20
to pretext...@googlegroups.com
I did have to fix a stray "<" (\lt) in the middle of the braille conversion,
which is partially public. This is in the vicinity of the definition of \amp.
So possible.

Which conversion? LaTeX or HTML?

Look towards the top of the file (either way) and see if there is a

\newcommand{\amp}{\&}

or similar. Off-duty this afternoon, so it may be Friday before I can follow-up
carefully.

If comfortable with git, try

1. git checkout d6528d319354133d1c33bec8884b3d42f0932211

2. Now a few days back in time, so see if error goes away.

3. git checkout dev
to go back to the way you were.

Rob

Alex Jordan

unread,
Jun 11, 2020, 2:30:04 PM6/11/20
to pretext...@googlegroups.com
There was a place within WeBWorK processing where I did something
recently that might matter. But only if you are seeing this within a WW
problem.

--
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 on the web visit https://groups.google.com/d/msgid/pretext-support/7d5b7d8b-2ebf-1feb-d386-23da7bbf5e0c%40ups.edu.

Jean-Sébastien Turcotte

unread,
Jun 11, 2020, 4:23:43 PM6/11/20
to PreTeXt support
So after I checked that the htlm conversion has a \newcommand{\amp}{&amp;} like Rob suggested (it was there), I tried to compile from my master branch (first two chapters of my book) and it works fine. So I probably did something in my chap3 branch. I'll investigate and report my findings if worthwhile.

Thanks to the both of you.

Jean-Sébastien Turcotte

unread,
Jun 12, 2020, 3:31:30 PM6/12/20
to PreTeXt support
So I found the culprit, but I don't understand why. The command \amp stopped working when compiling htlm from my chap3 branch. As I said above, compiling html from master branch still works. I managed to find that the new macros I had defined for chapter 3 caused to problem, but I am not sure why. As soon as one of the macro below is present in <docinfo> <macros> ... </macros> </docinfo>, \amp do not work.

\newcommand{\matsimil1}[2]{\stackrel{\scriptsize L_{#1}\leftrightarrow L_{#2}}{\sim}}
\newcommand{\matsimil2}[2]{\stackrel{\scriptsize #2L_{#1}\rightarrow L_{#1}}{\sim}}
\newcommand{\matsimil3}[3]{\stackrel{\scriptsize #2L_{#1}+L_{#3}\rightarrow L_{#3}}{\sim}}

When used, those macros work fine.

David Farmer

unread,
Jun 12, 2020, 3:35:33 PM6/12/20
to PreTeXt support

In LaTeX, macro names are only allowed to have letters.
You cannot put numbers in a macro name.

Once MathJax encounters an error, it stops processing.
So any later macro definitions are not read.
> --
> 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 on the web visit https://groups.google.com/d/msgid/pretext-support/2e5c5d7d-8ebd-406f-b36c-978512656ac7o%40googlegroups.com.
>

Jean-Sébastien Turcotte

unread,
Jun 12, 2020, 3:48:04 PM6/12/20
to PreTeXt support
That fixed it. So the added \newcommand Rob was talking about was not processed by mathjax. Thank you

Rob Beezer

unread,
Jun 12, 2020, 3:50:12 PM6/12/20
to pretext...@googlegroups.com
Thanks, David! I'd forgotten that MathJax sort of just silently shuts down at
this point.

Once confirmed, it sounds like I should add that to the documentation of
"docinfo/macros". Unless, of course, Jean-Sébastien wants to do penance and
fashion a pull request. ;-)

Rob

Rob Beezer

unread,
Jun 12, 2020, 3:59:20 PM6/12/20
to pretext...@googlegroups.com
Thanks for following through on this one! That was little subtle, but we'll
know next time.

Jean-Sébastien Turcotte

unread,
Jun 12, 2020, 4:00:43 PM6/12/20
to PreTeXt support
Where in the documentation would you add this? Maybe I can cook up something. I added

%Macro names can't have any number in them, otherwise mathjax stops processing further command.

Do you want me to add that line to the sample article? Or is there another place where docinfo is documented that I forget?

Rob Beezer

unread,
Jun 12, 2020, 4:16:14 PM6/12/20
to pretext...@googlegroups.com
The Guide, for authors, at Subsection 4.8.11 "Your Macros"

https://pretextbook.org/doc/guide/html/topic-mathematics.html#subsection-27

Just a short paragraph reminding people not to use numbers, and saying HTML will
"silently" fail, and maybe that *subsequent* macros will stop working, including
built-in \amp.

Thanks for pitching in!

Rob

Rob Beezer

unread,
Jun 12, 2020, 6:22:40 PM6/12/20
to pretext...@googlegroups.com
Thanks, Jean-Sébastien, for the (first-time) contribution! You are a PreTeXt
developer now. ;-)

https://github.com/rbeezer/mathbook/pull/1311

Rob
Reply all
Reply to author
Forward
0 new messages