Commenting an equation with a vertical bar












8














I want to use a vertical bar to comment on solving a simple equation.



equation resolution with comment and a vertical bar



Do you know a way to do that with LaTeX ?










share|improve this question
























  • Welcome to TeX.SE!
    – Sebastiano
    Dec 17 at 21:40
















8














I want to use a vertical bar to comment on solving a simple equation.



equation resolution with comment and a vertical bar



Do you know a way to do that with LaTeX ?










share|improve this question
























  • Welcome to TeX.SE!
    – Sebastiano
    Dec 17 at 21:40














8












8








8


2





I want to use a vertical bar to comment on solving a simple equation.



equation resolution with comment and a vertical bar



Do you know a way to do that with LaTeX ?










share|improve this question















I want to use a vertical bar to comment on solving a simple equation.



equation resolution with comment and a vertical bar



Do you know a way to do that with LaTeX ?







equations line vertical bar






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 17 at 22:26

























asked Dec 17 at 21:36









gilhoo

485




485












  • Welcome to TeX.SE!
    – Sebastiano
    Dec 17 at 21:40


















  • Welcome to TeX.SE!
    – Sebastiano
    Dec 17 at 21:40
















Welcome to TeX.SE!
– Sebastiano
Dec 17 at 21:40




Welcome to TeX.SE!
– Sebastiano
Dec 17 at 21:40










3 Answers
3






active

oldest

votes


















11














Yes, it's possible:



documentclass{article}
usepackage{amsmath,array}

begin{document}

begin{equation*}
renewcommand{arraystretch}{1.2}
setlength{arraycolsep}{0pt}
begin{array}{
>{displaystyle}r % right aligned
>{displaystyle{}}l % left aligned
@{hspace{4em}} % spacing
| % vertical rule
@{hspace{2em}} % spacing
>{displaystyle}r % comments
}
2x+2 &= 7x+3 & -2 \
2x &= 7x+1 & -7x \
-5x &= 1 & div(-5) \
x &= boxed{-frac{1}{5}} & \
end{array}
end{equation*}

end{document}


enter image description here



If you're satisfied by the spacing, you can make this into an environment:



documentclass{article}
usepackage{amsmath,array}

newenvironment{solve}
{%
renewcommand{arraystretch}{1.2}%
setlength{arraycolsep}{0pt}%
begin{array}{
>{displaystyle}r % right aligned
>{displaystyle{}}l % left aligned
@{hspace{4em}} % spacing
| % vertical rule
@{hspace{2em}} % spacing
>{displaystyle}r % comments
}%
}%
{end{array}}

begin{document}

begin{equation*}
begin{solve}
2x+2 &= 7x+3 & -2 \
2x &= 7x+1 & -7x \
-5x &= 1 & div(-5) \
x &= boxed{-frac{1}{5}} & \
end{solve}
end{equation*}

end{document}





share|improve this answer





























    3














    It almost seems better to use a different format, which allows you easier control of numbering elements within a sequence if needed.



    enter image description here



    documentclass{article}

    usepackage{amsmath}

    newcommand{eqcomment}[1]{& triangleright~ & #1}

    begin{document}

    begin{align*}
    2x + 2 &= 7x + 3 eqcomment{-2} \
    2x &= 7x + 1 eqcomment{-7x} \
    -5x &= 1 eqcomment{div(-5)} \
    x &= boxed{-frac{1}{5}}
    end{align*}

    end{document}


    One can play around with the alignment and notation.






    share|improve this answer





























      3














      Two other possibilities:



      documentclass{article}
      usepackage{showframe}
      renewcommand{ShowFrameLinethickness}{0.3pt}
      usepackage{eqparbox}
      usepackage{amsmath,array}

      begin{document}

      begin{flalign*}
      qquad & & 2x+2 &= 7x+3 &smash{rule[-4.5baselineskip]{0.5pt}{5.5baselineskip}} quadeqmakebox[B][r]{$ -2 $} & \
      & & 2x &= 7x+1 &eqmakebox[B][r]{$ -7x $}& \
      & & -5x &= 1 & eqmakebox[B][r]{$ div(-5) $} & \
      & & x &= boxed{-frac{1}{5}} & &
      end{flalign*}

      begin{alignat*}{2}
      qquad2x+2 &= 7x+3 &hspace{6em}smash{rule[-5baselineskip]{0.5pt}{6baselineskip}} qquad-2 & \
      2x &= 7x+1 & -7 x & \
      -5x &= 1 &div(-5) & \
      x &= boxed{-frac{1}{5}} & &
      end{alignat*}

      end{document}


      enter image description here






      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%2f466276%2fcommenting-an-equation-with-a-vertical-bar%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        11














        Yes, it's possible:



        documentclass{article}
        usepackage{amsmath,array}

        begin{document}

        begin{equation*}
        renewcommand{arraystretch}{1.2}
        setlength{arraycolsep}{0pt}
        begin{array}{
        >{displaystyle}r % right aligned
        >{displaystyle{}}l % left aligned
        @{hspace{4em}} % spacing
        | % vertical rule
        @{hspace{2em}} % spacing
        >{displaystyle}r % comments
        }
        2x+2 &= 7x+3 & -2 \
        2x &= 7x+1 & -7x \
        -5x &= 1 & div(-5) \
        x &= boxed{-frac{1}{5}} & \
        end{array}
        end{equation*}

        end{document}


        enter image description here



        If you're satisfied by the spacing, you can make this into an environment:



        documentclass{article}
        usepackage{amsmath,array}

        newenvironment{solve}
        {%
        renewcommand{arraystretch}{1.2}%
        setlength{arraycolsep}{0pt}%
        begin{array}{
        >{displaystyle}r % right aligned
        >{displaystyle{}}l % left aligned
        @{hspace{4em}} % spacing
        | % vertical rule
        @{hspace{2em}} % spacing
        >{displaystyle}r % comments
        }%
        }%
        {end{array}}

        begin{document}

        begin{equation*}
        begin{solve}
        2x+2 &= 7x+3 & -2 \
        2x &= 7x+1 & -7x \
        -5x &= 1 & div(-5) \
        x &= boxed{-frac{1}{5}} & \
        end{solve}
        end{equation*}

        end{document}





        share|improve this answer


























          11














          Yes, it's possible:



          documentclass{article}
          usepackage{amsmath,array}

          begin{document}

          begin{equation*}
          renewcommand{arraystretch}{1.2}
          setlength{arraycolsep}{0pt}
          begin{array}{
          >{displaystyle}r % right aligned
          >{displaystyle{}}l % left aligned
          @{hspace{4em}} % spacing
          | % vertical rule
          @{hspace{2em}} % spacing
          >{displaystyle}r % comments
          }
          2x+2 &= 7x+3 & -2 \
          2x &= 7x+1 & -7x \
          -5x &= 1 & div(-5) \
          x &= boxed{-frac{1}{5}} & \
          end{array}
          end{equation*}

          end{document}


          enter image description here



          If you're satisfied by the spacing, you can make this into an environment:



          documentclass{article}
          usepackage{amsmath,array}

          newenvironment{solve}
          {%
          renewcommand{arraystretch}{1.2}%
          setlength{arraycolsep}{0pt}%
          begin{array}{
          >{displaystyle}r % right aligned
          >{displaystyle{}}l % left aligned
          @{hspace{4em}} % spacing
          | % vertical rule
          @{hspace{2em}} % spacing
          >{displaystyle}r % comments
          }%
          }%
          {end{array}}

          begin{document}

          begin{equation*}
          begin{solve}
          2x+2 &= 7x+3 & -2 \
          2x &= 7x+1 & -7x \
          -5x &= 1 & div(-5) \
          x &= boxed{-frac{1}{5}} & \
          end{solve}
          end{equation*}

          end{document}





          share|improve this answer
























            11












            11








            11






            Yes, it's possible:



            documentclass{article}
            usepackage{amsmath,array}

            begin{document}

            begin{equation*}
            renewcommand{arraystretch}{1.2}
            setlength{arraycolsep}{0pt}
            begin{array}{
            >{displaystyle}r % right aligned
            >{displaystyle{}}l % left aligned
            @{hspace{4em}} % spacing
            | % vertical rule
            @{hspace{2em}} % spacing
            >{displaystyle}r % comments
            }
            2x+2 &= 7x+3 & -2 \
            2x &= 7x+1 & -7x \
            -5x &= 1 & div(-5) \
            x &= boxed{-frac{1}{5}} & \
            end{array}
            end{equation*}

            end{document}


            enter image description here



            If you're satisfied by the spacing, you can make this into an environment:



            documentclass{article}
            usepackage{amsmath,array}

            newenvironment{solve}
            {%
            renewcommand{arraystretch}{1.2}%
            setlength{arraycolsep}{0pt}%
            begin{array}{
            >{displaystyle}r % right aligned
            >{displaystyle{}}l % left aligned
            @{hspace{4em}} % spacing
            | % vertical rule
            @{hspace{2em}} % spacing
            >{displaystyle}r % comments
            }%
            }%
            {end{array}}

            begin{document}

            begin{equation*}
            begin{solve}
            2x+2 &= 7x+3 & -2 \
            2x &= 7x+1 & -7x \
            -5x &= 1 & div(-5) \
            x &= boxed{-frac{1}{5}} & \
            end{solve}
            end{equation*}

            end{document}





            share|improve this answer












            Yes, it's possible:



            documentclass{article}
            usepackage{amsmath,array}

            begin{document}

            begin{equation*}
            renewcommand{arraystretch}{1.2}
            setlength{arraycolsep}{0pt}
            begin{array}{
            >{displaystyle}r % right aligned
            >{displaystyle{}}l % left aligned
            @{hspace{4em}} % spacing
            | % vertical rule
            @{hspace{2em}} % spacing
            >{displaystyle}r % comments
            }
            2x+2 &= 7x+3 & -2 \
            2x &= 7x+1 & -7x \
            -5x &= 1 & div(-5) \
            x &= boxed{-frac{1}{5}} & \
            end{array}
            end{equation*}

            end{document}


            enter image description here



            If you're satisfied by the spacing, you can make this into an environment:



            documentclass{article}
            usepackage{amsmath,array}

            newenvironment{solve}
            {%
            renewcommand{arraystretch}{1.2}%
            setlength{arraycolsep}{0pt}%
            begin{array}{
            >{displaystyle}r % right aligned
            >{displaystyle{}}l % left aligned
            @{hspace{4em}} % spacing
            | % vertical rule
            @{hspace{2em}} % spacing
            >{displaystyle}r % comments
            }%
            }%
            {end{array}}

            begin{document}

            begin{equation*}
            begin{solve}
            2x+2 &= 7x+3 & -2 \
            2x &= 7x+1 & -7x \
            -5x &= 1 & div(-5) \
            x &= boxed{-frac{1}{5}} & \
            end{solve}
            end{equation*}

            end{document}






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Dec 17 at 21:52









            egreg

            708k8618823164




            708k8618823164























                3














                It almost seems better to use a different format, which allows you easier control of numbering elements within a sequence if needed.



                enter image description here



                documentclass{article}

                usepackage{amsmath}

                newcommand{eqcomment}[1]{& triangleright~ & #1}

                begin{document}

                begin{align*}
                2x + 2 &= 7x + 3 eqcomment{-2} \
                2x &= 7x + 1 eqcomment{-7x} \
                -5x &= 1 eqcomment{div(-5)} \
                x &= boxed{-frac{1}{5}}
                end{align*}

                end{document}


                One can play around with the alignment and notation.






                share|improve this answer


























                  3














                  It almost seems better to use a different format, which allows you easier control of numbering elements within a sequence if needed.



                  enter image description here



                  documentclass{article}

                  usepackage{amsmath}

                  newcommand{eqcomment}[1]{& triangleright~ & #1}

                  begin{document}

                  begin{align*}
                  2x + 2 &= 7x + 3 eqcomment{-2} \
                  2x &= 7x + 1 eqcomment{-7x} \
                  -5x &= 1 eqcomment{div(-5)} \
                  x &= boxed{-frac{1}{5}}
                  end{align*}

                  end{document}


                  One can play around with the alignment and notation.






                  share|improve this answer
























                    3












                    3








                    3






                    It almost seems better to use a different format, which allows you easier control of numbering elements within a sequence if needed.



                    enter image description here



                    documentclass{article}

                    usepackage{amsmath}

                    newcommand{eqcomment}[1]{& triangleright~ & #1}

                    begin{document}

                    begin{align*}
                    2x + 2 &= 7x + 3 eqcomment{-2} \
                    2x &= 7x + 1 eqcomment{-7x} \
                    -5x &= 1 eqcomment{div(-5)} \
                    x &= boxed{-frac{1}{5}}
                    end{align*}

                    end{document}


                    One can play around with the alignment and notation.






                    share|improve this answer












                    It almost seems better to use a different format, which allows you easier control of numbering elements within a sequence if needed.



                    enter image description here



                    documentclass{article}

                    usepackage{amsmath}

                    newcommand{eqcomment}[1]{& triangleright~ & #1}

                    begin{document}

                    begin{align*}
                    2x + 2 &= 7x + 3 eqcomment{-2} \
                    2x &= 7x + 1 eqcomment{-7x} \
                    -5x &= 1 eqcomment{div(-5)} \
                    x &= boxed{-frac{1}{5}}
                    end{align*}

                    end{document}


                    One can play around with the alignment and notation.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Dec 17 at 22:14









                    Werner

                    437k649581648




                    437k649581648























                        3














                        Two other possibilities:



                        documentclass{article}
                        usepackage{showframe}
                        renewcommand{ShowFrameLinethickness}{0.3pt}
                        usepackage{eqparbox}
                        usepackage{amsmath,array}

                        begin{document}

                        begin{flalign*}
                        qquad & & 2x+2 &= 7x+3 &smash{rule[-4.5baselineskip]{0.5pt}{5.5baselineskip}} quadeqmakebox[B][r]{$ -2 $} & \
                        & & 2x &= 7x+1 &eqmakebox[B][r]{$ -7x $}& \
                        & & -5x &= 1 & eqmakebox[B][r]{$ div(-5) $} & \
                        & & x &= boxed{-frac{1}{5}} & &
                        end{flalign*}

                        begin{alignat*}{2}
                        qquad2x+2 &= 7x+3 &hspace{6em}smash{rule[-5baselineskip]{0.5pt}{6baselineskip}} qquad-2 & \
                        2x &= 7x+1 & -7 x & \
                        -5x &= 1 &div(-5) & \
                        x &= boxed{-frac{1}{5}} & &
                        end{alignat*}

                        end{document}


                        enter image description here






                        share|improve this answer


























                          3














                          Two other possibilities:



                          documentclass{article}
                          usepackage{showframe}
                          renewcommand{ShowFrameLinethickness}{0.3pt}
                          usepackage{eqparbox}
                          usepackage{amsmath,array}

                          begin{document}

                          begin{flalign*}
                          qquad & & 2x+2 &= 7x+3 &smash{rule[-4.5baselineskip]{0.5pt}{5.5baselineskip}} quadeqmakebox[B][r]{$ -2 $} & \
                          & & 2x &= 7x+1 &eqmakebox[B][r]{$ -7x $}& \
                          & & -5x &= 1 & eqmakebox[B][r]{$ div(-5) $} & \
                          & & x &= boxed{-frac{1}{5}} & &
                          end{flalign*}

                          begin{alignat*}{2}
                          qquad2x+2 &= 7x+3 &hspace{6em}smash{rule[-5baselineskip]{0.5pt}{6baselineskip}} qquad-2 & \
                          2x &= 7x+1 & -7 x & \
                          -5x &= 1 &div(-5) & \
                          x &= boxed{-frac{1}{5}} & &
                          end{alignat*}

                          end{document}


                          enter image description here






                          share|improve this answer
























                            3












                            3








                            3






                            Two other possibilities:



                            documentclass{article}
                            usepackage{showframe}
                            renewcommand{ShowFrameLinethickness}{0.3pt}
                            usepackage{eqparbox}
                            usepackage{amsmath,array}

                            begin{document}

                            begin{flalign*}
                            qquad & & 2x+2 &= 7x+3 &smash{rule[-4.5baselineskip]{0.5pt}{5.5baselineskip}} quadeqmakebox[B][r]{$ -2 $} & \
                            & & 2x &= 7x+1 &eqmakebox[B][r]{$ -7x $}& \
                            & & -5x &= 1 & eqmakebox[B][r]{$ div(-5) $} & \
                            & & x &= boxed{-frac{1}{5}} & &
                            end{flalign*}

                            begin{alignat*}{2}
                            qquad2x+2 &= 7x+3 &hspace{6em}smash{rule[-5baselineskip]{0.5pt}{6baselineskip}} qquad-2 & \
                            2x &= 7x+1 & -7 x & \
                            -5x &= 1 &div(-5) & \
                            x &= boxed{-frac{1}{5}} & &
                            end{alignat*}

                            end{document}


                            enter image description here






                            share|improve this answer












                            Two other possibilities:



                            documentclass{article}
                            usepackage{showframe}
                            renewcommand{ShowFrameLinethickness}{0.3pt}
                            usepackage{eqparbox}
                            usepackage{amsmath,array}

                            begin{document}

                            begin{flalign*}
                            qquad & & 2x+2 &= 7x+3 &smash{rule[-4.5baselineskip]{0.5pt}{5.5baselineskip}} quadeqmakebox[B][r]{$ -2 $} & \
                            & & 2x &= 7x+1 &eqmakebox[B][r]{$ -7x $}& \
                            & & -5x &= 1 & eqmakebox[B][r]{$ div(-5) $} & \
                            & & x &= boxed{-frac{1}{5}} & &
                            end{flalign*}

                            begin{alignat*}{2}
                            qquad2x+2 &= 7x+3 &hspace{6em}smash{rule[-5baselineskip]{0.5pt}{6baselineskip}} qquad-2 & \
                            2x &= 7x+1 & -7 x & \
                            -5x &= 1 &div(-5) & \
                            x &= boxed{-frac{1}{5}} & &
                            end{alignat*}

                            end{document}


                            enter image description here







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Dec 17 at 22:27









                            Bernard

                            166k769193




                            166k769193






























                                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.





                                Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                Please pay close attention to the following guidance:


                                • 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%2f466276%2fcommenting-an-equation-with-a-vertical-bar%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

                                Morgemoulin

                                Scott Moir

                                Souastre