setting the counter of equations to 1 in each post

211 views
Skip to first unread message

עופר מגד

unread,
Feb 24, 2015, 12:40:11 PM2/24/15
to mathja...@googlegroups.com
Does anyone know how to reset the counter of equations in the beginning of each post? Apparently, it continues to count-up when moving from one post to another. In other words, how do I implement the command \setcounter{equation}{0} within Mathjax? BTW, I am using the blogger dynamic template.
Thanks. 

Peter Krautzberger

unread,
May 1, 2015, 4:16:32 PM5/1/15
to mathja...@googlegroups.com
Hi,

This is currently not supported. I think the following should work

        <script type="text/x-mathjax-config">
            MathJax.Hub.Register.StartupHook("TeX AMSmath Ready", function() {
                MathJax.InputJax.TeX.Definitions.Add({
                    macros: {
                    setCounter: "setCounter"
                    }
                }, null, true);
                MathJax.InputJax.TeX.Parse.Augment({
                    setCounter: function(name) {
                    var num =  parseInt(this.GetArgument(name));
                    MathJax.Extension["TeX/AMSmath"].number = num;
                    }
                });
            });
        </script>

BEFORE MathJax.js is loaded. (Or add the contents to an existing configuration script.

Then you can use \setcounter{0} to reset (or set to any number).

Here's a live demo and a GIst.

Best wishes,
Peter

On Tue, Feb 24, 2015 at 6:40 PM, עופר מגד <meg...@gmail.com> wrote:
Does anyone know how to reset the counter of equations in the beginning of each post? Apparently, it continues to count-up when moving from one post to another. In other words, how do I implement the command \setcounter{equation}{0} within Mathjax? BTW, I am using the blogger dynamic template.
Thanks. 

--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

עופר מגד

unread,
May 2, 2015, 12:38:39 PM5/2/15
to mathja...@googlegroups.com
Thank you very much for your suggestion. 
I'll try it.

Vincent Nijs

unread,
Jul 10, 2015, 7:20:09 PM7/10/15
to mathja...@googlegroups.com
Works great Peter! Thanks for sharing. I used the code in the Gist script in an R/Shiny app that renders rmarkdown files. Equation numbering would start on the file/page was opened first which is probably not what you want. The only change I had to make was to use autoNumber: "all" rather than autoNumber: "AMS". Thanks again.
Reply all
Reply to author
Forward
0 new messages