Pandoc: How can I get numbered LaTeX equations to show up in both PDF and HTML output












17















To make a numbered equation in Pandoc, I defer to using pure LaTeX:



begin{equation}
a^2 + b^2 = c^2
end{equation}


In PDF form, it gives a nice numbered equation, however, this equation doesn't show up at all in the HTML output because the equation is within the begin environment and is ignored. I would like to keep the numbering in the PDF, but would like the equation to show up in the HTML, with or without the numbering.










share|improve this question





























    17















    To make a numbered equation in Pandoc, I defer to using pure LaTeX:



    begin{equation}
    a^2 + b^2 = c^2
    end{equation}


    In PDF form, it gives a nice numbered equation, however, this equation doesn't show up at all in the HTML output because the equation is within the begin environment and is ignored. I would like to keep the numbering in the PDF, but would like the equation to show up in the HTML, with or without the numbering.










    share|improve this question



























      17












      17








      17


      9






      To make a numbered equation in Pandoc, I defer to using pure LaTeX:



      begin{equation}
      a^2 + b^2 = c^2
      end{equation}


      In PDF form, it gives a nice numbered equation, however, this equation doesn't show up at all in the HTML output because the equation is within the begin environment and is ignored. I would like to keep the numbering in the PDF, but would like the equation to show up in the HTML, with or without the numbering.










      share|improve this question
















      To make a numbered equation in Pandoc, I defer to using pure LaTeX:



      begin{equation}
      a^2 + b^2 = c^2
      end{equation}


      In PDF form, it gives a nice numbered equation, however, this equation doesn't show up at all in the HTML output because the equation is within the begin environment and is ignored. I would like to keep the numbering in the PDF, but would like the equation to show up in the HTML, with or without the numbering.







      pandoc






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 2 '13 at 10:17







      user13907

















      asked May 2 '13 at 6:13









      user1027169user1027169

      186114




      186114






















          5 Answers
          5






          active

          oldest

          votes


















          11














          An extension exists on github: pandoc-crossref



          install it with



          cabal update
          cabal install pandoc-crossref


          or in archlinux using ArchHaskell



          pacman -Sy pandoc-crossref


          you can use it by doing



          $$ math $$ {#eq:label}
          [@eq:label]


          and compiling with



          pandoc file.md --filter pandoc-crossref -o file.pdf


          for more information see the documentation



          Alternatively, as described in https://github.com/jgm/pandoc/issues/1938#issuecomment-74011358 you can use --mathjax for HTML rendering



          if your equations are in math.txt



          $$ a^2 + b^2 = c^2 $$


          create a file header



          <script type="text/x-mathjax-config">
          MathJax.Hub.Config({ TeX: { equationNumbers: {autoNumber: "all"} } });
          </script>


          and compile with



          pandoc math.txt -t html -s -o test.html --mathjax=https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML -H header 





          share|improve this answer


























          • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.

            – Symbol 1
            Apr 1 '15 at 9:27



















          9














          In pandoc you can do:



          (@foo)  $a^2 + b^2 = c^2$

          As (@foo) says, ...

          (@bar) $e = x + y$


          This will give you running equation numbers in both PDF and HTML. However, the equations will not be centered or display-formatted. (You can use $$ for display math, but then the numbers probably won't be lined up right -- though maybe this can be fixed with CSS.)






          share|improve this answer
























          • Doing it this way, the equation ends up being placed on the left and slightly above the equation itself. Is there a way to have the equation number on the right just like in the regular latex format?

            – user1027169
            May 3 '13 at 20:11











          • No, there's no way to get the number on the right. You could probably fix alignment issues with display math using CSS.

            – John MacFarlane
            May 4 '13 at 2:06











          • I meant in the PDF output, the equation number gets moved to the left. As you mentioned, the HTML shouldn't be an issue with some CSS.

            – user1027169
            May 4 '13 at 16:25











          • @JohnMacFarlane just wondering if this (displaymath, right-aligned eqs) is something that might be addressed in later pandoc releases, or if explicit LaTeX environment remains the way to go for pdf output?

            – cboettig
            Jun 23 '14 at 18:20











          • Mathjax supports ref and eqref in plain HTML: cdn.mathjax.org/mathjax/latest/test/sample-eqrefs.html --- can Pandoc users get access to this functionality? (I'm converting multimarkdown to html.)

            – Ahmed Fasih
            Jun 29 '14 at 4:26



















          6














          Another option for equation numbers and references is the pandoc-eqnos filter.



          Install pandoc-eqnos as root using the bash command



          pip install pandoc-eqnos 


          To tag an equation with the label eq:description, use



          $$ y = mx + b $$ {#eq:description}


          The prefix #eq: is required whereas description can be replaced with any combination of letters, numbers, dashes, slashes and underscores.



          To reference the equation, use



          @eq:description


          To apply the filter, use the following option with pandoc:



          --filter pandoc-eqnos


          Full details and demos are given on the pandoc-eqnos Web page at github.






          share|improve this answer































            3














            If you use css styling you can add the following in your css file:



            /*create an equation counter variable */

            body {
            counter-reset: EQU_COUNT 0 ;
            }


            and:



            .MathJax_Display:after {
            content: " (" counter(EQU_COUNT) ")";
            counter-increment: EQU_COUNT;
            }


            This will automatically add a an incremented counter value after each equation.






            share|improve this answer

































              2














              If ConTeXt is used as the engine to produce the PDF output,
              then one can simply precede the LaTeX display formula with a placeformula ConTeXt command in the Pandoc Markdown input:



              placeformula
              $$ a^2 + b^2 = c^2 $$


              When multiple output formats are desired, it is better to use a GNU makefile containing a sed command:



              SHELL := /usr/bin/env bash
              NAME := $(basename $(wildcard *.md))

              all: $(NAME).pdf $(NAME).docx

              $(NAME).pdf: $(NAME).md
              pandoc
              <(sed 's/^$$$$.*/\placeformulan&/' $<)
              --smart --output=$(NAME).tex --to=context
              context $(NAME).tex

              $(NAME).docx: $(NAME).md
              pandoc $< --smart --output=$(NAME).docx





              share|improve this answer

























                Your Answer








                StackExchange.ready(function() {
                var channelOptions = {
                tags: "".split(" "),
                id: "85"
                };
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function() {
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled) {
                StackExchange.using("snippets", function() {
                createEditor();
                });
                }
                else {
                createEditor();
                }
                });

                function createEditor() {
                StackExchange.prepareEditor({
                heartbeatType: 'answer',
                autoActivateHeartbeat: false,
                convertImagesToLinks: false,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: null,
                bindNavPrevention: true,
                postfix: "",
                imageUploader: {
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                },
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                });


                }
                });














                draft saved

                draft discarded


















                StackExchange.ready(
                function () {
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f111868%2fpandoc-how-can-i-get-numbered-latex-equations-to-show-up-in-both-pdf-and-html-o%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                5 Answers
                5






                active

                oldest

                votes








                5 Answers
                5






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                11














                An extension exists on github: pandoc-crossref



                install it with



                cabal update
                cabal install pandoc-crossref


                or in archlinux using ArchHaskell



                pacman -Sy pandoc-crossref


                you can use it by doing



                $$ math $$ {#eq:label}
                [@eq:label]


                and compiling with



                pandoc file.md --filter pandoc-crossref -o file.pdf


                for more information see the documentation



                Alternatively, as described in https://github.com/jgm/pandoc/issues/1938#issuecomment-74011358 you can use --mathjax for HTML rendering



                if your equations are in math.txt



                $$ a^2 + b^2 = c^2 $$


                create a file header



                <script type="text/x-mathjax-config">
                MathJax.Hub.Config({ TeX: { equationNumbers: {autoNumber: "all"} } });
                </script>


                and compile with



                pandoc math.txt -t html -s -o test.html --mathjax=https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML -H header 





                share|improve this answer


























                • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.

                  – Symbol 1
                  Apr 1 '15 at 9:27
















                11














                An extension exists on github: pandoc-crossref



                install it with



                cabal update
                cabal install pandoc-crossref


                or in archlinux using ArchHaskell



                pacman -Sy pandoc-crossref


                you can use it by doing



                $$ math $$ {#eq:label}
                [@eq:label]


                and compiling with



                pandoc file.md --filter pandoc-crossref -o file.pdf


                for more information see the documentation



                Alternatively, as described in https://github.com/jgm/pandoc/issues/1938#issuecomment-74011358 you can use --mathjax for HTML rendering



                if your equations are in math.txt



                $$ a^2 + b^2 = c^2 $$


                create a file header



                <script type="text/x-mathjax-config">
                MathJax.Hub.Config({ TeX: { equationNumbers: {autoNumber: "all"} } });
                </script>


                and compile with



                pandoc math.txt -t html -s -o test.html --mathjax=https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML -H header 





                share|improve this answer


























                • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.

                  – Symbol 1
                  Apr 1 '15 at 9:27














                11












                11








                11







                An extension exists on github: pandoc-crossref



                install it with



                cabal update
                cabal install pandoc-crossref


                or in archlinux using ArchHaskell



                pacman -Sy pandoc-crossref


                you can use it by doing



                $$ math $$ {#eq:label}
                [@eq:label]


                and compiling with



                pandoc file.md --filter pandoc-crossref -o file.pdf


                for more information see the documentation



                Alternatively, as described in https://github.com/jgm/pandoc/issues/1938#issuecomment-74011358 you can use --mathjax for HTML rendering



                if your equations are in math.txt



                $$ a^2 + b^2 = c^2 $$


                create a file header



                <script type="text/x-mathjax-config">
                MathJax.Hub.Config({ TeX: { equationNumbers: {autoNumber: "all"} } });
                </script>


                and compile with



                pandoc math.txt -t html -s -o test.html --mathjax=https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML -H header 





                share|improve this answer















                An extension exists on github: pandoc-crossref



                install it with



                cabal update
                cabal install pandoc-crossref


                or in archlinux using ArchHaskell



                pacman -Sy pandoc-crossref


                you can use it by doing



                $$ math $$ {#eq:label}
                [@eq:label]


                and compiling with



                pandoc file.md --filter pandoc-crossref -o file.pdf


                for more information see the documentation



                Alternatively, as described in https://github.com/jgm/pandoc/issues/1938#issuecomment-74011358 you can use --mathjax for HTML rendering



                if your equations are in math.txt



                $$ a^2 + b^2 = c^2 $$


                create a file header



                <script type="text/x-mathjax-config">
                MathJax.Hub.Config({ TeX: { equationNumbers: {autoNumber: "all"} } });
                </script>


                and compile with



                pandoc math.txt -t html -s -o test.html --mathjax=https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML -H header 






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 5 mins ago









                JouleV

                2,499628




                2,499628










                answered Apr 1 '15 at 9:18









                PietroPietro

                21124




                21124













                • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.

                  – Symbol 1
                  Apr 1 '15 at 9:27



















                • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.

                  – Symbol 1
                  Apr 1 '15 at 9:27

















                Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.

                – Symbol 1
                Apr 1 '15 at 9:27





                Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.

                – Symbol 1
                Apr 1 '15 at 9:27











                9














                In pandoc you can do:



                (@foo)  $a^2 + b^2 = c^2$

                As (@foo) says, ...

                (@bar) $e = x + y$


                This will give you running equation numbers in both PDF and HTML. However, the equations will not be centered or display-formatted. (You can use $$ for display math, but then the numbers probably won't be lined up right -- though maybe this can be fixed with CSS.)






                share|improve this answer
























                • Doing it this way, the equation ends up being placed on the left and slightly above the equation itself. Is there a way to have the equation number on the right just like in the regular latex format?

                  – user1027169
                  May 3 '13 at 20:11











                • No, there's no way to get the number on the right. You could probably fix alignment issues with display math using CSS.

                  – John MacFarlane
                  May 4 '13 at 2:06











                • I meant in the PDF output, the equation number gets moved to the left. As you mentioned, the HTML shouldn't be an issue with some CSS.

                  – user1027169
                  May 4 '13 at 16:25











                • @JohnMacFarlane just wondering if this (displaymath, right-aligned eqs) is something that might be addressed in later pandoc releases, or if explicit LaTeX environment remains the way to go for pdf output?

                  – cboettig
                  Jun 23 '14 at 18:20











                • Mathjax supports ref and eqref in plain HTML: cdn.mathjax.org/mathjax/latest/test/sample-eqrefs.html --- can Pandoc users get access to this functionality? (I'm converting multimarkdown to html.)

                  – Ahmed Fasih
                  Jun 29 '14 at 4:26
















                9














                In pandoc you can do:



                (@foo)  $a^2 + b^2 = c^2$

                As (@foo) says, ...

                (@bar) $e = x + y$


                This will give you running equation numbers in both PDF and HTML. However, the equations will not be centered or display-formatted. (You can use $$ for display math, but then the numbers probably won't be lined up right -- though maybe this can be fixed with CSS.)






                share|improve this answer
























                • Doing it this way, the equation ends up being placed on the left and slightly above the equation itself. Is there a way to have the equation number on the right just like in the regular latex format?

                  – user1027169
                  May 3 '13 at 20:11











                • No, there's no way to get the number on the right. You could probably fix alignment issues with display math using CSS.

                  – John MacFarlane
                  May 4 '13 at 2:06











                • I meant in the PDF output, the equation number gets moved to the left. As you mentioned, the HTML shouldn't be an issue with some CSS.

                  – user1027169
                  May 4 '13 at 16:25











                • @JohnMacFarlane just wondering if this (displaymath, right-aligned eqs) is something that might be addressed in later pandoc releases, or if explicit LaTeX environment remains the way to go for pdf output?

                  – cboettig
                  Jun 23 '14 at 18:20











                • Mathjax supports ref and eqref in plain HTML: cdn.mathjax.org/mathjax/latest/test/sample-eqrefs.html --- can Pandoc users get access to this functionality? (I'm converting multimarkdown to html.)

                  – Ahmed Fasih
                  Jun 29 '14 at 4:26














                9












                9








                9







                In pandoc you can do:



                (@foo)  $a^2 + b^2 = c^2$

                As (@foo) says, ...

                (@bar) $e = x + y$


                This will give you running equation numbers in both PDF and HTML. However, the equations will not be centered or display-formatted. (You can use $$ for display math, but then the numbers probably won't be lined up right -- though maybe this can be fixed with CSS.)






                share|improve this answer













                In pandoc you can do:



                (@foo)  $a^2 + b^2 = c^2$

                As (@foo) says, ...

                (@bar) $e = x + y$


                This will give you running equation numbers in both PDF and HTML. However, the equations will not be centered or display-formatted. (You can use $$ for display math, but then the numbers probably won't be lined up right -- though maybe this can be fixed with CSS.)







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered May 3 '13 at 3:22









                John MacFarlaneJohn MacFarlane

                42825




                42825













                • Doing it this way, the equation ends up being placed on the left and slightly above the equation itself. Is there a way to have the equation number on the right just like in the regular latex format?

                  – user1027169
                  May 3 '13 at 20:11











                • No, there's no way to get the number on the right. You could probably fix alignment issues with display math using CSS.

                  – John MacFarlane
                  May 4 '13 at 2:06











                • I meant in the PDF output, the equation number gets moved to the left. As you mentioned, the HTML shouldn't be an issue with some CSS.

                  – user1027169
                  May 4 '13 at 16:25











                • @JohnMacFarlane just wondering if this (displaymath, right-aligned eqs) is something that might be addressed in later pandoc releases, or if explicit LaTeX environment remains the way to go for pdf output?

                  – cboettig
                  Jun 23 '14 at 18:20











                • Mathjax supports ref and eqref in plain HTML: cdn.mathjax.org/mathjax/latest/test/sample-eqrefs.html --- can Pandoc users get access to this functionality? (I'm converting multimarkdown to html.)

                  – Ahmed Fasih
                  Jun 29 '14 at 4:26



















                • Doing it this way, the equation ends up being placed on the left and slightly above the equation itself. Is there a way to have the equation number on the right just like in the regular latex format?

                  – user1027169
                  May 3 '13 at 20:11











                • No, there's no way to get the number on the right. You could probably fix alignment issues with display math using CSS.

                  – John MacFarlane
                  May 4 '13 at 2:06











                • I meant in the PDF output, the equation number gets moved to the left. As you mentioned, the HTML shouldn't be an issue with some CSS.

                  – user1027169
                  May 4 '13 at 16:25











                • @JohnMacFarlane just wondering if this (displaymath, right-aligned eqs) is something that might be addressed in later pandoc releases, or if explicit LaTeX environment remains the way to go for pdf output?

                  – cboettig
                  Jun 23 '14 at 18:20











                • Mathjax supports ref and eqref in plain HTML: cdn.mathjax.org/mathjax/latest/test/sample-eqrefs.html --- can Pandoc users get access to this functionality? (I'm converting multimarkdown to html.)

                  – Ahmed Fasih
                  Jun 29 '14 at 4:26

















                Doing it this way, the equation ends up being placed on the left and slightly above the equation itself. Is there a way to have the equation number on the right just like in the regular latex format?

                – user1027169
                May 3 '13 at 20:11





                Doing it this way, the equation ends up being placed on the left and slightly above the equation itself. Is there a way to have the equation number on the right just like in the regular latex format?

                – user1027169
                May 3 '13 at 20:11













                No, there's no way to get the number on the right. You could probably fix alignment issues with display math using CSS.

                – John MacFarlane
                May 4 '13 at 2:06





                No, there's no way to get the number on the right. You could probably fix alignment issues with display math using CSS.

                – John MacFarlane
                May 4 '13 at 2:06













                I meant in the PDF output, the equation number gets moved to the left. As you mentioned, the HTML shouldn't be an issue with some CSS.

                – user1027169
                May 4 '13 at 16:25





                I meant in the PDF output, the equation number gets moved to the left. As you mentioned, the HTML shouldn't be an issue with some CSS.

                – user1027169
                May 4 '13 at 16:25













                @JohnMacFarlane just wondering if this (displaymath, right-aligned eqs) is something that might be addressed in later pandoc releases, or if explicit LaTeX environment remains the way to go for pdf output?

                – cboettig
                Jun 23 '14 at 18:20





                @JohnMacFarlane just wondering if this (displaymath, right-aligned eqs) is something that might be addressed in later pandoc releases, or if explicit LaTeX environment remains the way to go for pdf output?

                – cboettig
                Jun 23 '14 at 18:20













                Mathjax supports ref and eqref in plain HTML: cdn.mathjax.org/mathjax/latest/test/sample-eqrefs.html --- can Pandoc users get access to this functionality? (I'm converting multimarkdown to html.)

                – Ahmed Fasih
                Jun 29 '14 at 4:26





                Mathjax supports ref and eqref in plain HTML: cdn.mathjax.org/mathjax/latest/test/sample-eqrefs.html --- can Pandoc users get access to this functionality? (I'm converting multimarkdown to html.)

                – Ahmed Fasih
                Jun 29 '14 at 4:26











                6














                Another option for equation numbers and references is the pandoc-eqnos filter.



                Install pandoc-eqnos as root using the bash command



                pip install pandoc-eqnos 


                To tag an equation with the label eq:description, use



                $$ y = mx + b $$ {#eq:description}


                The prefix #eq: is required whereas description can be replaced with any combination of letters, numbers, dashes, slashes and underscores.



                To reference the equation, use



                @eq:description


                To apply the filter, use the following option with pandoc:



                --filter pandoc-eqnos


                Full details and demos are given on the pandoc-eqnos Web page at github.






                share|improve this answer




























                  6














                  Another option for equation numbers and references is the pandoc-eqnos filter.



                  Install pandoc-eqnos as root using the bash command



                  pip install pandoc-eqnos 


                  To tag an equation with the label eq:description, use



                  $$ y = mx + b $$ {#eq:description}


                  The prefix #eq: is required whereas description can be replaced with any combination of letters, numbers, dashes, slashes and underscores.



                  To reference the equation, use



                  @eq:description


                  To apply the filter, use the following option with pandoc:



                  --filter pandoc-eqnos


                  Full details and demos are given on the pandoc-eqnos Web page at github.






                  share|improve this answer


























                    6












                    6








                    6







                    Another option for equation numbers and references is the pandoc-eqnos filter.



                    Install pandoc-eqnos as root using the bash command



                    pip install pandoc-eqnos 


                    To tag an equation with the label eq:description, use



                    $$ y = mx + b $$ {#eq:description}


                    The prefix #eq: is required whereas description can be replaced with any combination of letters, numbers, dashes, slashes and underscores.



                    To reference the equation, use



                    @eq:description


                    To apply the filter, use the following option with pandoc:



                    --filter pandoc-eqnos


                    Full details and demos are given on the pandoc-eqnos Web page at github.






                    share|improve this answer













                    Another option for equation numbers and references is the pandoc-eqnos filter.



                    Install pandoc-eqnos as root using the bash command



                    pip install pandoc-eqnos 


                    To tag an equation with the label eq:description, use



                    $$ y = mx + b $$ {#eq:description}


                    The prefix #eq: is required whereas description can be replaced with any combination of letters, numbers, dashes, slashes and underscores.



                    To reference the equation, use



                    @eq:description


                    To apply the filter, use the following option with pandoc:



                    --filter pandoc-eqnos


                    Full details and demos are given on the pandoc-eqnos Web page at github.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Jun 3 '15 at 19:50









                    tjdtjd

                    12621




                    12621























                        3














                        If you use css styling you can add the following in your css file:



                        /*create an equation counter variable */

                        body {
                        counter-reset: EQU_COUNT 0 ;
                        }


                        and:



                        .MathJax_Display:after {
                        content: " (" counter(EQU_COUNT) ")";
                        counter-increment: EQU_COUNT;
                        }


                        This will automatically add a an incremented counter value after each equation.






                        share|improve this answer






























                          3














                          If you use css styling you can add the following in your css file:



                          /*create an equation counter variable */

                          body {
                          counter-reset: EQU_COUNT 0 ;
                          }


                          and:



                          .MathJax_Display:after {
                          content: " (" counter(EQU_COUNT) ")";
                          counter-increment: EQU_COUNT;
                          }


                          This will automatically add a an incremented counter value after each equation.






                          share|improve this answer




























                            3












                            3








                            3







                            If you use css styling you can add the following in your css file:



                            /*create an equation counter variable */

                            body {
                            counter-reset: EQU_COUNT 0 ;
                            }


                            and:



                            .MathJax_Display:after {
                            content: " (" counter(EQU_COUNT) ")";
                            counter-increment: EQU_COUNT;
                            }


                            This will automatically add a an incremented counter value after each equation.






                            share|improve this answer















                            If you use css styling you can add the following in your css file:



                            /*create an equation counter variable */

                            body {
                            counter-reset: EQU_COUNT 0 ;
                            }


                            and:



                            .MathJax_Display:after {
                            content: " (" counter(EQU_COUNT) ")";
                            counter-increment: EQU_COUNT;
                            }


                            This will automatically add a an incremented counter value after each equation.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Sep 1 '16 at 14:45









                            samcarter

                            88.9k799285




                            88.9k799285










                            answered Sep 1 '16 at 14:10









                            jean-marc vollejean-marc volle

                            311




                            311























                                2














                                If ConTeXt is used as the engine to produce the PDF output,
                                then one can simply precede the LaTeX display formula with a placeformula ConTeXt command in the Pandoc Markdown input:



                                placeformula
                                $$ a^2 + b^2 = c^2 $$


                                When multiple output formats are desired, it is better to use a GNU makefile containing a sed command:



                                SHELL := /usr/bin/env bash
                                NAME := $(basename $(wildcard *.md))

                                all: $(NAME).pdf $(NAME).docx

                                $(NAME).pdf: $(NAME).md
                                pandoc
                                <(sed 's/^$$$$.*/\placeformulan&/' $<)
                                --smart --output=$(NAME).tex --to=context
                                context $(NAME).tex

                                $(NAME).docx: $(NAME).md
                                pandoc $< --smart --output=$(NAME).docx





                                share|improve this answer






























                                  2














                                  If ConTeXt is used as the engine to produce the PDF output,
                                  then one can simply precede the LaTeX display formula with a placeformula ConTeXt command in the Pandoc Markdown input:



                                  placeformula
                                  $$ a^2 + b^2 = c^2 $$


                                  When multiple output formats are desired, it is better to use a GNU makefile containing a sed command:



                                  SHELL := /usr/bin/env bash
                                  NAME := $(basename $(wildcard *.md))

                                  all: $(NAME).pdf $(NAME).docx

                                  $(NAME).pdf: $(NAME).md
                                  pandoc
                                  <(sed 's/^$$$$.*/\placeformulan&/' $<)
                                  --smart --output=$(NAME).tex --to=context
                                  context $(NAME).tex

                                  $(NAME).docx: $(NAME).md
                                  pandoc $< --smart --output=$(NAME).docx





                                  share|improve this answer




























                                    2












                                    2








                                    2







                                    If ConTeXt is used as the engine to produce the PDF output,
                                    then one can simply precede the LaTeX display formula with a placeformula ConTeXt command in the Pandoc Markdown input:



                                    placeformula
                                    $$ a^2 + b^2 = c^2 $$


                                    When multiple output formats are desired, it is better to use a GNU makefile containing a sed command:



                                    SHELL := /usr/bin/env bash
                                    NAME := $(basename $(wildcard *.md))

                                    all: $(NAME).pdf $(NAME).docx

                                    $(NAME).pdf: $(NAME).md
                                    pandoc
                                    <(sed 's/^$$$$.*/\placeformulan&/' $<)
                                    --smart --output=$(NAME).tex --to=context
                                    context $(NAME).tex

                                    $(NAME).docx: $(NAME).md
                                    pandoc $< --smart --output=$(NAME).docx





                                    share|improve this answer















                                    If ConTeXt is used as the engine to produce the PDF output,
                                    then one can simply precede the LaTeX display formula with a placeformula ConTeXt command in the Pandoc Markdown input:



                                    placeformula
                                    $$ a^2 + b^2 = c^2 $$


                                    When multiple output formats are desired, it is better to use a GNU makefile containing a sed command:



                                    SHELL := /usr/bin/env bash
                                    NAME := $(basename $(wildcard *.md))

                                    all: $(NAME).pdf $(NAME).docx

                                    $(NAME).pdf: $(NAME).md
                                    pandoc
                                    <(sed 's/^$$$$.*/\placeformulan&/' $<)
                                    --smart --output=$(NAME).tex --to=context
                                    context $(NAME).tex

                                    $(NAME).docx: $(NAME).md
                                    pandoc $< --smart --output=$(NAME).docx






                                    share|improve this answer














                                    share|improve this answer



                                    share|improve this answer








                                    edited Jun 19 '17 at 15:15

























                                    answered Jun 19 '17 at 9:47









                                    Serge StroobandtSerge Stroobandt

                                    2,63311937




                                    2,63311937






























                                        draft saved

                                        draft discarded




















































                                        Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid



                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.


                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f111868%2fpandoc-how-can-i-get-numbered-latex-equations-to-show-up-in-both-pdf-and-html-o%23new-answer', 'question_page');
                                        }
                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        Popular posts from this blog

                                        Accessing regular linux commands in Huawei's Dopra Linux

                                        Can't connect RFCOMM socket: Host is down

                                        Kernel panic - not syncing: Fatal Exception in Interrupt