Getting errors while trying to box a colored text + math with less than 6 lines of code

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












First time Latex user here



I am trying to box a text plus math using the following code



documentclassarticle
usepackageamsmath
usepackageamsfonts
usepackagexcolor
begindocument

sectionSection Title

fbox
colorblue This is a text [x]


boxed
colorblue This is a text [x]


enddocument


Unfortunately, in doing so, I received 10 errors. enter image description here



Can anyone help me debug these mere 6 lines of code?










share|improve this question







New contributor




The man of your dream is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.























    up vote
    2
    down vote

    favorite












    First time Latex user here



    I am trying to box a text plus math using the following code



    documentclassarticle
    usepackageamsmath
    usepackageamsfonts
    usepackagexcolor
    begindocument

    sectionSection Title

    fbox
    colorblue This is a text [x]


    boxed
    colorblue This is a text [x]


    enddocument


    Unfortunately, in doing so, I received 10 errors. enter image description here



    Can anyone help me debug these mere 6 lines of code?










    share|improve this question







    New contributor




    The man of your dream is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      First time Latex user here



      I am trying to box a text plus math using the following code



      documentclassarticle
      usepackageamsmath
      usepackageamsfonts
      usepackagexcolor
      begindocument

      sectionSection Title

      fbox
      colorblue This is a text [x]


      boxed
      colorblue This is a text [x]


      enddocument


      Unfortunately, in doing so, I received 10 errors. enter image description here



      Can anyone help me debug these mere 6 lines of code?










      share|improve this question







      New contributor




      The man of your dream is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      First time Latex user here



      I am trying to box a text plus math using the following code



      documentclassarticle
      usepackageamsmath
      usepackageamsfonts
      usepackagexcolor
      begindocument

      sectionSection Title

      fbox
      colorblue This is a text [x]


      boxed
      colorblue This is a text [x]


      enddocument


      Unfortunately, in doing so, I received 10 errors. enter image description here



      Can anyone help me debug these mere 6 lines of code?







      boxes tcolorbox box






      share|improve this question







      New contributor




      The man of your dream is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      The man of your dream is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      The man of your dream is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 3 hours ago









      The man of your dream

      112




      112




      New contributor




      The man of your dream is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      The man of your dream is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      The man of your dream is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote













          Welcome to TeX.SX! The easiest way to do this is by using the framed package:



          documentclassarticle
          usepackageamsmath
          usepackageamsfonts
          usepackagexcolor
          usepackageframed
          begindocument

          sectionSection Title

          beginframed
          colorblueThis is a text [x]
          endframed

          enddocument


          framed




          You mentioned tcolorbox in one of your tags, so here is an alternative using the tcolorbox package:



          documentclassarticle
          usepackageamsmath
          usepackageamsfonts
          usepackagexcolor
          usepackagetcolorbox
          begindocument

          sectionSection Title

          begintcolorbox
          colorblueThis is a text [x]
          endtcolorbox

          enddocument


          tcolorbox






          share|improve this answer





























            up vote
            1
            down vote













            fbox is an hbox (LR-mode in the LaTeX book) which does not allow line breaks, and [ is (after error checking) $$so you end up (if you scroll past errors) with



            hbox text $$x$$


            In in restricted hmode $$ at the primitive level so this is just the same as two $ so it is



             hbox text $ empty math $ x $ empty math $


            so as always to get multi-line text into a single-line context you can use a parbox



            enter image description here



            documentclassarticle
            usepackageamsmath
            usepackageamsfonts
            usepackagexcolor
            begindocument

            sectionSection Title

            noindentfboxparboxdimexprtextwidth-2fboxsep-2fboxrule%
            textcolorblueThis is a text [x]%




            enddocument





            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',
              convertImagesToLinks: false,
              noModals: false,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );






              The man of your dream is a new contributor. Be nice, and check out our Code of Conduct.









               

              draft saved


              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f453269%2fgetting-errors-while-trying-to-box-a-colored-text-math-with-less-than-6-lines%23new-answer', 'question_page');

              );

              Post as a guest






























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              2
              down vote













              Welcome to TeX.SX! The easiest way to do this is by using the framed package:



              documentclassarticle
              usepackageamsmath
              usepackageamsfonts
              usepackagexcolor
              usepackageframed
              begindocument

              sectionSection Title

              beginframed
              colorblueThis is a text [x]
              endframed

              enddocument


              framed




              You mentioned tcolorbox in one of your tags, so here is an alternative using the tcolorbox package:



              documentclassarticle
              usepackageamsmath
              usepackageamsfonts
              usepackagexcolor
              usepackagetcolorbox
              begindocument

              sectionSection Title

              begintcolorbox
              colorblueThis is a text [x]
              endtcolorbox

              enddocument


              tcolorbox






              share|improve this answer


























                up vote
                2
                down vote













                Welcome to TeX.SX! The easiest way to do this is by using the framed package:



                documentclassarticle
                usepackageamsmath
                usepackageamsfonts
                usepackagexcolor
                usepackageframed
                begindocument

                sectionSection Title

                beginframed
                colorblueThis is a text [x]
                endframed

                enddocument


                framed




                You mentioned tcolorbox in one of your tags, so here is an alternative using the tcolorbox package:



                documentclassarticle
                usepackageamsmath
                usepackageamsfonts
                usepackagexcolor
                usepackagetcolorbox
                begindocument

                sectionSection Title

                begintcolorbox
                colorblueThis is a text [x]
                endtcolorbox

                enddocument


                tcolorbox






                share|improve this answer
























                  up vote
                  2
                  down vote










                  up vote
                  2
                  down vote









                  Welcome to TeX.SX! The easiest way to do this is by using the framed package:



                  documentclassarticle
                  usepackageamsmath
                  usepackageamsfonts
                  usepackagexcolor
                  usepackageframed
                  begindocument

                  sectionSection Title

                  beginframed
                  colorblueThis is a text [x]
                  endframed

                  enddocument


                  framed




                  You mentioned tcolorbox in one of your tags, so here is an alternative using the tcolorbox package:



                  documentclassarticle
                  usepackageamsmath
                  usepackageamsfonts
                  usepackagexcolor
                  usepackagetcolorbox
                  begindocument

                  sectionSection Title

                  begintcolorbox
                  colorblueThis is a text [x]
                  endtcolorbox

                  enddocument


                  tcolorbox






                  share|improve this answer














                  Welcome to TeX.SX! The easiest way to do this is by using the framed package:



                  documentclassarticle
                  usepackageamsmath
                  usepackageamsfonts
                  usepackagexcolor
                  usepackageframed
                  begindocument

                  sectionSection Title

                  beginframed
                  colorblueThis is a text [x]
                  endframed

                  enddocument


                  framed




                  You mentioned tcolorbox in one of your tags, so here is an alternative using the tcolorbox package:



                  documentclassarticle
                  usepackageamsmath
                  usepackageamsfonts
                  usepackagexcolor
                  usepackagetcolorbox
                  begindocument

                  sectionSection Title

                  begintcolorbox
                  colorblueThis is a text [x]
                  endtcolorbox

                  enddocument


                  tcolorbox







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 3 hours ago

























                  answered 3 hours ago









                  Ruixi Zhang

                  4,101318




                  4,101318




















                      up vote
                      1
                      down vote













                      fbox is an hbox (LR-mode in the LaTeX book) which does not allow line breaks, and [ is (after error checking) $$so you end up (if you scroll past errors) with



                      hbox text $$x$$


                      In in restricted hmode $$ at the primitive level so this is just the same as two $ so it is



                       hbox text $ empty math $ x $ empty math $


                      so as always to get multi-line text into a single-line context you can use a parbox



                      enter image description here



                      documentclassarticle
                      usepackageamsmath
                      usepackageamsfonts
                      usepackagexcolor
                      begindocument

                      sectionSection Title

                      noindentfboxparboxdimexprtextwidth-2fboxsep-2fboxrule%
                      textcolorblueThis is a text [x]%




                      enddocument





                      share|improve this answer
























                        up vote
                        1
                        down vote













                        fbox is an hbox (LR-mode in the LaTeX book) which does not allow line breaks, and [ is (after error checking) $$so you end up (if you scroll past errors) with



                        hbox text $$x$$


                        In in restricted hmode $$ at the primitive level so this is just the same as two $ so it is



                         hbox text $ empty math $ x $ empty math $


                        so as always to get multi-line text into a single-line context you can use a parbox



                        enter image description here



                        documentclassarticle
                        usepackageamsmath
                        usepackageamsfonts
                        usepackagexcolor
                        begindocument

                        sectionSection Title

                        noindentfboxparboxdimexprtextwidth-2fboxsep-2fboxrule%
                        textcolorblueThis is a text [x]%




                        enddocument





                        share|improve this answer






















                          up vote
                          1
                          down vote










                          up vote
                          1
                          down vote









                          fbox is an hbox (LR-mode in the LaTeX book) which does not allow line breaks, and [ is (after error checking) $$so you end up (if you scroll past errors) with



                          hbox text $$x$$


                          In in restricted hmode $$ at the primitive level so this is just the same as two $ so it is



                           hbox text $ empty math $ x $ empty math $


                          so as always to get multi-line text into a single-line context you can use a parbox



                          enter image description here



                          documentclassarticle
                          usepackageamsmath
                          usepackageamsfonts
                          usepackagexcolor
                          begindocument

                          sectionSection Title

                          noindentfboxparboxdimexprtextwidth-2fboxsep-2fboxrule%
                          textcolorblueThis is a text [x]%




                          enddocument





                          share|improve this answer












                          fbox is an hbox (LR-mode in the LaTeX book) which does not allow line breaks, and [ is (after error checking) $$so you end up (if you scroll past errors) with



                          hbox text $$x$$


                          In in restricted hmode $$ at the primitive level so this is just the same as two $ so it is



                           hbox text $ empty math $ x $ empty math $


                          so as always to get multi-line text into a single-line context you can use a parbox



                          enter image description here



                          documentclassarticle
                          usepackageamsmath
                          usepackageamsfonts
                          usepackagexcolor
                          begindocument

                          sectionSection Title

                          noindentfboxparboxdimexprtextwidth-2fboxsep-2fboxrule%
                          textcolorblueThis is a text [x]%




                          enddocument






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 40 mins ago









                          David Carlisle

                          469k3810981823




                          469k3810981823




















                              The man of your dream is a new contributor. Be nice, and check out our Code of Conduct.









                               

                              draft saved


                              draft discarded


















                              The man of your dream is a new contributor. Be nice, and check out our Code of Conduct.












                              The man of your dream is a new contributor. Be nice, and check out our Code of Conduct.











                              The man of your dream is a new contributor. Be nice, and check out our Code of Conduct.













                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f453269%2fgetting-errors-while-trying-to-box-a-colored-text-math-with-less-than-6-lines%23new-answer', 'question_page');

                              );

                              Post as a guest













































































                              Comments

                              Popular posts from this blog

                              What does second last employer means? [closed]

                              List of Gilmore Girls characters

                              Confectionery