How can I draw a line around text, but open on one side?
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):
I suppose there is a simple way to do what I need, but I couldn't find it.
math-mode formatting border box
add a comment |
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):
I suppose there is a simple way to do what I need, but I couldn't find it.
math-mode formatting border box
Duplicate: tex.stackexchange.com/questions/323986/…
– Steven B. Segletes
Mar 7 at 19:08
add a comment |
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):
I suppose there is a simple way to do what I need, but I couldn't find it.
math-mode formatting border box
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):
I suppose there is a simple way to do what I need, but I couldn't find it.
math-mode formatting border box
math-mode formatting border box
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
add a comment |
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
add a comment |
3 Answers
3
active
oldest
votes
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}
add a comment |
Like this ?
With a tcolorbox:
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}
add a comment |
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}
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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}
add a comment |
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}
add a comment |
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}
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}
edited Mar 7 at 18:45
answered Mar 7 at 18:37
marmotmarmot
109k5133251
109k5133251
add a comment |
add a comment |
Like this ?
With a tcolorbox:
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}
add a comment |
Like this ?
With a tcolorbox:
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}
add a comment |
Like this ?
With a tcolorbox:
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}
Like this ?
With a tcolorbox:
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}
answered Mar 7 at 18:44
AndréCAndréC
1
1
add a comment |
add a comment |
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}
add a comment |
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}
add a comment |
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}
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}
answered Mar 7 at 19:05
koleygrkoleygr
12.6k11038
12.6k11038
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Duplicate: tex.stackexchange.com/questions/323986/…
– Steven B. Segletes
Mar 7 at 19:08