How can I draw a line around text, but open on one side?












3















I'd like to do something similar to boxed{whatever}, but with the box open one side. Something like the following.



documentclass{article}

begin{document}

[
overline{underline{abc |}}
]

end{document}


which results in the following output (ugly, but conceptually close to what I want):



result of using underline, overline, and '|'



I suppose there is a simple way to do what I need, but I couldn't find it.










share|improve this question























  • Duplicate: tex.stackexchange.com/questions/323986/…

    – Steven B. Segletes
    Mar 7 at 19:08
















3















I'd like to do something similar to boxed{whatever}, but with the box open one side. Something like the following.



documentclass{article}

begin{document}

[
overline{underline{abc |}}
]

end{document}


which results in the following output (ugly, but conceptually close to what I want):



result of using underline, overline, and '|'



I suppose there is a simple way to do what I need, but I couldn't find it.










share|improve this question























  • Duplicate: tex.stackexchange.com/questions/323986/…

    – Steven B. Segletes
    Mar 7 at 19:08














3












3








3


1






I'd like to do something similar to boxed{whatever}, but with the box open one side. Something like the following.



documentclass{article}

begin{document}

[
overline{underline{abc |}}
]

end{document}


which results in the following output (ugly, but conceptually close to what I want):



result of using underline, overline, and '|'



I suppose there is a simple way to do what I need, but I couldn't find it.










share|improve this question














I'd like to do something similar to boxed{whatever}, but with the box open one side. Something like the following.



documentclass{article}

begin{document}

[
overline{underline{abc |}}
]

end{document}


which results in the following output (ugly, but conceptually close to what I want):



result of using underline, overline, and '|'



I suppose there is a simple way to do what I need, but I couldn't find it.







math-mode formatting border box






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 7 at 18:35









JayJay

1,44811635




1,44811635













  • Duplicate: tex.stackexchange.com/questions/323986/…

    – Steven B. Segletes
    Mar 7 at 19:08



















  • Duplicate: tex.stackexchange.com/questions/323986/…

    – Steven B. Segletes
    Mar 7 at 19:08

















Duplicate: tex.stackexchange.com/questions/323986/…

– Steven B. Segletes
Mar 7 at 19:08





Duplicate: tex.stackexchange.com/questions/323986/…

– Steven B. Segletes
Mar 7 at 19:08










3 Answers
3






active

oldest

votes


















2














documentclass{article}

begin{document}

[
begin{array}{@{}|@{,}l@{}}
hline
abc\
hline
end{array}quadmbox{or}quad
begin{array}{@{}l@{,}|@{}}
hline
abc\
hline
end{array}
]

end{document}


enter image description here






share|improve this answer

































    1














    Like this ?



    With a tcolorbox:



    screenshot



    documentclass{article}
    usepackage{tcolorbox}

    newtcbox{boxed}{on line,colframe=black,colback=white,sharp corners,
    before upper={rule[-3pt]{0pt}{10pt}},boxrule=1pt,leftrule=0pt,
    boxsep=0pt,left=2pt,right=1pt,top=1pt,bottom=.5pt}

    begin{document}

    Quick brown fox boxed{jumped} over the lazy dog.

    end{document}





    share|improve this answer































      1














      An answer with tikz:



      documentclass{article}
      usepackage{tikz}
      usepackage{parskip}
      setlength{parskip}{15pt}
      newsavebox{mybox}
      newcommand{PutInsideOpenBox}[3][-,black]{ifdefinedextraxskiprelaxelsexdefextraxskip{1pt}fiifdefinedextrayskiprelaxelsexdefextrayskip{3.5pt}fisavebox{mybox}{vbox{hbox{#3}}}begin{tikzpicture}[outer sep=0,inner sep=0pt,baseline=#2]node at ({wdmybox/2},{(htmybox+dpmybox)/2}){usebox{mybox}};
      draw[#1]({-extraxskip},{-extrayskip})--({wdmybox+extraxskip},{-extrayskip})--({wdmybox+extraxskip},{(htmybox+dpmybox)+extrayskip})--({-extraxskip},{(htmybox+dpmybox)+extrayskip});end{tikzpicture}}
      begin{document}

      [
      PutInsideOpenBox{0pt}{
      abc
      }]

      In text: (PutInsideOpenBox[-,thick,red]{0pt}{AbcD}) that will expand in two lines and we will see that the baselineskip is slightly increased

      Increasing borders:
      defextraxskip{3pt}
      defextrayskip{6pt}

      In text: (PutInsideOpenBox[-,thick,red]{0pt}{AbcD}) that will expand in two lines and we will see that the baselineskip is enough increased

      An equation:

      [
      PutInsideOpenBox{2.5pt}{f(x)}=xcdot PutInsideOpenBox[-,blue]{2.5pt}{(y+1)}
      ]

      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%2f478262%2fhow-can-i-draw-a-line-around-text-but-open-on-one-side%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









        2














        documentclass{article}

        begin{document}

        [
        begin{array}{@{}|@{,}l@{}}
        hline
        abc\
        hline
        end{array}quadmbox{or}quad
        begin{array}{@{}l@{,}|@{}}
        hline
        abc\
        hline
        end{array}
        ]

        end{document}


        enter image description here






        share|improve this answer






























          2














          documentclass{article}

          begin{document}

          [
          begin{array}{@{}|@{,}l@{}}
          hline
          abc\
          hline
          end{array}quadmbox{or}quad
          begin{array}{@{}l@{,}|@{}}
          hline
          abc\
          hline
          end{array}
          ]

          end{document}


          enter image description here






          share|improve this answer




























            2












            2








            2







            documentclass{article}

            begin{document}

            [
            begin{array}{@{}|@{,}l@{}}
            hline
            abc\
            hline
            end{array}quadmbox{or}quad
            begin{array}{@{}l@{,}|@{}}
            hline
            abc\
            hline
            end{array}
            ]

            end{document}


            enter image description here






            share|improve this answer















            documentclass{article}

            begin{document}

            [
            begin{array}{@{}|@{,}l@{}}
            hline
            abc\
            hline
            end{array}quadmbox{or}quad
            begin{array}{@{}l@{,}|@{}}
            hline
            abc\
            hline
            end{array}
            ]

            end{document}


            enter image description here







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 7 at 18:45

























            answered Mar 7 at 18:37









            marmotmarmot

            109k5133251




            109k5133251























                1














                Like this ?



                With a tcolorbox:



                screenshot



                documentclass{article}
                usepackage{tcolorbox}

                newtcbox{boxed}{on line,colframe=black,colback=white,sharp corners,
                before upper={rule[-3pt]{0pt}{10pt}},boxrule=1pt,leftrule=0pt,
                boxsep=0pt,left=2pt,right=1pt,top=1pt,bottom=.5pt}

                begin{document}

                Quick brown fox boxed{jumped} over the lazy dog.

                end{document}





                share|improve this answer




























                  1














                  Like this ?



                  With a tcolorbox:



                  screenshot



                  documentclass{article}
                  usepackage{tcolorbox}

                  newtcbox{boxed}{on line,colframe=black,colback=white,sharp corners,
                  before upper={rule[-3pt]{0pt}{10pt}},boxrule=1pt,leftrule=0pt,
                  boxsep=0pt,left=2pt,right=1pt,top=1pt,bottom=.5pt}

                  begin{document}

                  Quick brown fox boxed{jumped} over the lazy dog.

                  end{document}





                  share|improve this answer


























                    1












                    1








                    1







                    Like this ?



                    With a tcolorbox:



                    screenshot



                    documentclass{article}
                    usepackage{tcolorbox}

                    newtcbox{boxed}{on line,colframe=black,colback=white,sharp corners,
                    before upper={rule[-3pt]{0pt}{10pt}},boxrule=1pt,leftrule=0pt,
                    boxsep=0pt,left=2pt,right=1pt,top=1pt,bottom=.5pt}

                    begin{document}

                    Quick brown fox boxed{jumped} over the lazy dog.

                    end{document}





                    share|improve this answer













                    Like this ?



                    With a tcolorbox:



                    screenshot



                    documentclass{article}
                    usepackage{tcolorbox}

                    newtcbox{boxed}{on line,colframe=black,colback=white,sharp corners,
                    before upper={rule[-3pt]{0pt}{10pt}},boxrule=1pt,leftrule=0pt,
                    boxsep=0pt,left=2pt,right=1pt,top=1pt,bottom=.5pt}

                    begin{document}

                    Quick brown fox boxed{jumped} over the lazy dog.

                    end{document}






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Mar 7 at 18:44









                    AndréCAndréC

                    1




                    1























                        1














                        An answer with tikz:



                        documentclass{article}
                        usepackage{tikz}
                        usepackage{parskip}
                        setlength{parskip}{15pt}
                        newsavebox{mybox}
                        newcommand{PutInsideOpenBox}[3][-,black]{ifdefinedextraxskiprelaxelsexdefextraxskip{1pt}fiifdefinedextrayskiprelaxelsexdefextrayskip{3.5pt}fisavebox{mybox}{vbox{hbox{#3}}}begin{tikzpicture}[outer sep=0,inner sep=0pt,baseline=#2]node at ({wdmybox/2},{(htmybox+dpmybox)/2}){usebox{mybox}};
                        draw[#1]({-extraxskip},{-extrayskip})--({wdmybox+extraxskip},{-extrayskip})--({wdmybox+extraxskip},{(htmybox+dpmybox)+extrayskip})--({-extraxskip},{(htmybox+dpmybox)+extrayskip});end{tikzpicture}}
                        begin{document}

                        [
                        PutInsideOpenBox{0pt}{
                        abc
                        }]

                        In text: (PutInsideOpenBox[-,thick,red]{0pt}{AbcD}) that will expand in two lines and we will see that the baselineskip is slightly increased

                        Increasing borders:
                        defextraxskip{3pt}
                        defextrayskip{6pt}

                        In text: (PutInsideOpenBox[-,thick,red]{0pt}{AbcD}) that will expand in two lines and we will see that the baselineskip is enough increased

                        An equation:

                        [
                        PutInsideOpenBox{2.5pt}{f(x)}=xcdot PutInsideOpenBox[-,blue]{2.5pt}{(y+1)}
                        ]

                        end{document}


                        enter image description here






                        share|improve this answer




























                          1














                          An answer with tikz:



                          documentclass{article}
                          usepackage{tikz}
                          usepackage{parskip}
                          setlength{parskip}{15pt}
                          newsavebox{mybox}
                          newcommand{PutInsideOpenBox}[3][-,black]{ifdefinedextraxskiprelaxelsexdefextraxskip{1pt}fiifdefinedextrayskiprelaxelsexdefextrayskip{3.5pt}fisavebox{mybox}{vbox{hbox{#3}}}begin{tikzpicture}[outer sep=0,inner sep=0pt,baseline=#2]node at ({wdmybox/2},{(htmybox+dpmybox)/2}){usebox{mybox}};
                          draw[#1]({-extraxskip},{-extrayskip})--({wdmybox+extraxskip},{-extrayskip})--({wdmybox+extraxskip},{(htmybox+dpmybox)+extrayskip})--({-extraxskip},{(htmybox+dpmybox)+extrayskip});end{tikzpicture}}
                          begin{document}

                          [
                          PutInsideOpenBox{0pt}{
                          abc
                          }]

                          In text: (PutInsideOpenBox[-,thick,red]{0pt}{AbcD}) that will expand in two lines and we will see that the baselineskip is slightly increased

                          Increasing borders:
                          defextraxskip{3pt}
                          defextrayskip{6pt}

                          In text: (PutInsideOpenBox[-,thick,red]{0pt}{AbcD}) that will expand in two lines and we will see that the baselineskip is enough increased

                          An equation:

                          [
                          PutInsideOpenBox{2.5pt}{f(x)}=xcdot PutInsideOpenBox[-,blue]{2.5pt}{(y+1)}
                          ]

                          end{document}


                          enter image description here






                          share|improve this answer


























                            1












                            1








                            1







                            An answer with tikz:



                            documentclass{article}
                            usepackage{tikz}
                            usepackage{parskip}
                            setlength{parskip}{15pt}
                            newsavebox{mybox}
                            newcommand{PutInsideOpenBox}[3][-,black]{ifdefinedextraxskiprelaxelsexdefextraxskip{1pt}fiifdefinedextrayskiprelaxelsexdefextrayskip{3.5pt}fisavebox{mybox}{vbox{hbox{#3}}}begin{tikzpicture}[outer sep=0,inner sep=0pt,baseline=#2]node at ({wdmybox/2},{(htmybox+dpmybox)/2}){usebox{mybox}};
                            draw[#1]({-extraxskip},{-extrayskip})--({wdmybox+extraxskip},{-extrayskip})--({wdmybox+extraxskip},{(htmybox+dpmybox)+extrayskip})--({-extraxskip},{(htmybox+dpmybox)+extrayskip});end{tikzpicture}}
                            begin{document}

                            [
                            PutInsideOpenBox{0pt}{
                            abc
                            }]

                            In text: (PutInsideOpenBox[-,thick,red]{0pt}{AbcD}) that will expand in two lines and we will see that the baselineskip is slightly increased

                            Increasing borders:
                            defextraxskip{3pt}
                            defextrayskip{6pt}

                            In text: (PutInsideOpenBox[-,thick,red]{0pt}{AbcD}) that will expand in two lines and we will see that the baselineskip is enough increased

                            An equation:

                            [
                            PutInsideOpenBox{2.5pt}{f(x)}=xcdot PutInsideOpenBox[-,blue]{2.5pt}{(y+1)}
                            ]

                            end{document}


                            enter image description here






                            share|improve this answer













                            An answer with tikz:



                            documentclass{article}
                            usepackage{tikz}
                            usepackage{parskip}
                            setlength{parskip}{15pt}
                            newsavebox{mybox}
                            newcommand{PutInsideOpenBox}[3][-,black]{ifdefinedextraxskiprelaxelsexdefextraxskip{1pt}fiifdefinedextrayskiprelaxelsexdefextrayskip{3.5pt}fisavebox{mybox}{vbox{hbox{#3}}}begin{tikzpicture}[outer sep=0,inner sep=0pt,baseline=#2]node at ({wdmybox/2},{(htmybox+dpmybox)/2}){usebox{mybox}};
                            draw[#1]({-extraxskip},{-extrayskip})--({wdmybox+extraxskip},{-extrayskip})--({wdmybox+extraxskip},{(htmybox+dpmybox)+extrayskip})--({-extraxskip},{(htmybox+dpmybox)+extrayskip});end{tikzpicture}}
                            begin{document}

                            [
                            PutInsideOpenBox{0pt}{
                            abc
                            }]

                            In text: (PutInsideOpenBox[-,thick,red]{0pt}{AbcD}) that will expand in two lines and we will see that the baselineskip is slightly increased

                            Increasing borders:
                            defextraxskip{3pt}
                            defextrayskip{6pt}

                            In text: (PutInsideOpenBox[-,thick,red]{0pt}{AbcD}) that will expand in two lines and we will see that the baselineskip is enough increased

                            An equation:

                            [
                            PutInsideOpenBox{2.5pt}{f(x)}=xcdot PutInsideOpenBox[-,blue]{2.5pt}{(y+1)}
                            ]

                            end{document}


                            enter image description here







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Mar 7 at 19:05









                            koleygrkoleygr

                            12.6k11038




                            12.6k11038






























                                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%2f478262%2fhow-can-i-draw-a-line-around-text-but-open-on-one-side%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

                                How to change which sound is reproduced for terminal bell?

                                Can I use Tabulator js library in my java Spring + Thymeleaf project?

                                Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents