Adding a small colored rounded box around inline text [duplicate]

Clash Royale CLAN TAG#URR8PPP
This question already has an answer here:
How to add a small rounded rectangle around a word inline
2 answers
Is it possible to write a command using TikZ to produce a small rounded and colored box around a piece of text, inside sentence? I know the framedbox command gives a rectangle around a piece of text (but not a rounded rectangle as far as I know).
I guess one could also adjust the color of the background when using framebox (using tips from answers to this question), but I don't think it could help with other factors such as the box's edge-width, the amount of roundness, etc.
The following picture was produced with Inkscape for the purpose of the question.

tikz-pgf
marked as duplicate by AndréC, Kurt, Stefan Pinnow, Circumscribe, Troy Dec 29 '18 at 23:17
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
How to add a small rounded rectangle around a word inline
2 answers
Is it possible to write a command using TikZ to produce a small rounded and colored box around a piece of text, inside sentence? I know the framedbox command gives a rectangle around a piece of text (but not a rounded rectangle as far as I know).
I guess one could also adjust the color of the background when using framebox (using tips from answers to this question), but I don't think it could help with other factors such as the box's edge-width, the amount of roundness, etc.
The following picture was produced with Inkscape for the purpose of the question.

tikz-pgf
marked as duplicate by AndréC, Kurt, Stefan Pinnow, Circumscribe, Troy Dec 29 '18 at 23:17
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
2
How abouttcolorbox? Ortikzmark?
– marmot
Dec 29 '18 at 20:34
possible duplicate : tex.stackexchange.com/q/458864/138900
– AndréC
Dec 29 '18 at 20:51
add a comment |
This question already has an answer here:
How to add a small rounded rectangle around a word inline
2 answers
Is it possible to write a command using TikZ to produce a small rounded and colored box around a piece of text, inside sentence? I know the framedbox command gives a rectangle around a piece of text (but not a rounded rectangle as far as I know).
I guess one could also adjust the color of the background when using framebox (using tips from answers to this question), but I don't think it could help with other factors such as the box's edge-width, the amount of roundness, etc.
The following picture was produced with Inkscape for the purpose of the question.

tikz-pgf
This question already has an answer here:
How to add a small rounded rectangle around a word inline
2 answers
Is it possible to write a command using TikZ to produce a small rounded and colored box around a piece of text, inside sentence? I know the framedbox command gives a rectangle around a piece of text (but not a rounded rectangle as far as I know).
I guess one could also adjust the color of the background when using framebox (using tips from answers to this question), but I don't think it could help with other factors such as the box's edge-width, the amount of roundness, etc.
The following picture was produced with Inkscape for the purpose of the question.

This question already has an answer here:
How to add a small rounded rectangle around a word inline
2 answers
tikz-pgf
tikz-pgf
asked Dec 29 '18 at 20:32
smilingbuddhasmilingbuddha
89841016
89841016
marked as duplicate by AndréC, Kurt, Stefan Pinnow, Circumscribe, Troy Dec 29 '18 at 23:17
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by AndréC, Kurt, Stefan Pinnow, Circumscribe, Troy Dec 29 '18 at 23:17
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
2
How abouttcolorbox? Ortikzmark?
– marmot
Dec 29 '18 at 20:34
possible duplicate : tex.stackexchange.com/q/458864/138900
– AndréC
Dec 29 '18 at 20:51
add a comment |
2
How abouttcolorbox? Ortikzmark?
– marmot
Dec 29 '18 at 20:34
possible duplicate : tex.stackexchange.com/q/458864/138900
– AndréC
Dec 29 '18 at 20:51
2
2
How about
tcolorbox? Or tikzmark?– marmot
Dec 29 '18 at 20:34
How about
tcolorbox? Or tikzmark?– marmot
Dec 29 '18 at 20:34
possible duplicate : tex.stackexchange.com/q/458864/138900
– AndréC
Dec 29 '18 at 20:51
possible duplicate : tex.stackexchange.com/q/458864/138900
– AndréC
Dec 29 '18 at 20:51
add a comment |
2 Answers
2
active
oldest
votes
Either use TikZ directly or tcolorbox with tcbox and a lot configurable settings.
If such boxes should appear more than once, a newtcbox is appropiate, setting the options there and just saying inlineboxfoo etc.
As can be seen from the direct usage of tcbox that the margins are too wide, but the inlinebox has a nicer look, there the margins are set with left=... and right=... and boxsep=...

documentclassarticle
PassOptionsToPackagesvgnames,x11names,dvipsnamesxcolor
usepackage[most]tcolorbox
newtcboxinlinebox[1]enhanced,
box align=base,
nobeforeafter,
colback=cyan,
colframe=Green4,
size=small,
left=0pt,
right=0pt,
boxsep=2pt,
#1
begindocument
Hello tcbox[enhanced,box align=base,nobeforeafter,colback=cyan,colframe=Green4,size=small]World -- what do you expect from the year inlinebox2019?
enddocument
add a comment |
Another option is tikzmark, which less options than tcolorbox, but allows you to connect different boxes and also detect the mode you are in (text vs. math etc.).
documentclassarticle
usepackagetikz
usetikzlibrarytikzmark
begindocument
Here is some text and tikzmarknode[fill=cyan,fill
opacity=0.3,draw=green!60!black,thick,rounded corners,inner sep=2pt,text
opacity=1]testsomething about relativity.
[tikzmarknode[fill=cyan,fill
opacity=0.3,draw=green!60!black,thick,rounded corners,inner sep=2pt,text
opacity=1]testeqE~=~m,c^2
begintikzpicture[overlay,remember picture]
draw[thick,cyan,latex-latex] (test.-5) to[out=-90,in=0] (testeq.east);
endtikzpicture]
enddocument

add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Either use TikZ directly or tcolorbox with tcbox and a lot configurable settings.
If such boxes should appear more than once, a newtcbox is appropiate, setting the options there and just saying inlineboxfoo etc.
As can be seen from the direct usage of tcbox that the margins are too wide, but the inlinebox has a nicer look, there the margins are set with left=... and right=... and boxsep=...

documentclassarticle
PassOptionsToPackagesvgnames,x11names,dvipsnamesxcolor
usepackage[most]tcolorbox
newtcboxinlinebox[1]enhanced,
box align=base,
nobeforeafter,
colback=cyan,
colframe=Green4,
size=small,
left=0pt,
right=0pt,
boxsep=2pt,
#1
begindocument
Hello tcbox[enhanced,box align=base,nobeforeafter,colback=cyan,colframe=Green4,size=small]World -- what do you expect from the year inlinebox2019?
enddocument
add a comment |
Either use TikZ directly or tcolorbox with tcbox and a lot configurable settings.
If such boxes should appear more than once, a newtcbox is appropiate, setting the options there and just saying inlineboxfoo etc.
As can be seen from the direct usage of tcbox that the margins are too wide, but the inlinebox has a nicer look, there the margins are set with left=... and right=... and boxsep=...

documentclassarticle
PassOptionsToPackagesvgnames,x11names,dvipsnamesxcolor
usepackage[most]tcolorbox
newtcboxinlinebox[1]enhanced,
box align=base,
nobeforeafter,
colback=cyan,
colframe=Green4,
size=small,
left=0pt,
right=0pt,
boxsep=2pt,
#1
begindocument
Hello tcbox[enhanced,box align=base,nobeforeafter,colback=cyan,colframe=Green4,size=small]World -- what do you expect from the year inlinebox2019?
enddocument
add a comment |
Either use TikZ directly or tcolorbox with tcbox and a lot configurable settings.
If such boxes should appear more than once, a newtcbox is appropiate, setting the options there and just saying inlineboxfoo etc.
As can be seen from the direct usage of tcbox that the margins are too wide, but the inlinebox has a nicer look, there the margins are set with left=... and right=... and boxsep=...

documentclassarticle
PassOptionsToPackagesvgnames,x11names,dvipsnamesxcolor
usepackage[most]tcolorbox
newtcboxinlinebox[1]enhanced,
box align=base,
nobeforeafter,
colback=cyan,
colframe=Green4,
size=small,
left=0pt,
right=0pt,
boxsep=2pt,
#1
begindocument
Hello tcbox[enhanced,box align=base,nobeforeafter,colback=cyan,colframe=Green4,size=small]World -- what do you expect from the year inlinebox2019?
enddocument
Either use TikZ directly or tcolorbox with tcbox and a lot configurable settings.
If such boxes should appear more than once, a newtcbox is appropiate, setting the options there and just saying inlineboxfoo etc.
As can be seen from the direct usage of tcbox that the margins are too wide, but the inlinebox has a nicer look, there the margins are set with left=... and right=... and boxsep=...

documentclassarticle
PassOptionsToPackagesvgnames,x11names,dvipsnamesxcolor
usepackage[most]tcolorbox
newtcboxinlinebox[1]enhanced,
box align=base,
nobeforeafter,
colback=cyan,
colframe=Green4,
size=small,
left=0pt,
right=0pt,
boxsep=2pt,
#1
begindocument
Hello tcbox[enhanced,box align=base,nobeforeafter,colback=cyan,colframe=Green4,size=small]World -- what do you expect from the year inlinebox2019?
enddocument
edited Dec 29 '18 at 20:49
answered Dec 29 '18 at 20:37
Christian HupferChristian Hupfer
148k14193390
148k14193390
add a comment |
add a comment |
Another option is tikzmark, which less options than tcolorbox, but allows you to connect different boxes and also detect the mode you are in (text vs. math etc.).
documentclassarticle
usepackagetikz
usetikzlibrarytikzmark
begindocument
Here is some text and tikzmarknode[fill=cyan,fill
opacity=0.3,draw=green!60!black,thick,rounded corners,inner sep=2pt,text
opacity=1]testsomething about relativity.
[tikzmarknode[fill=cyan,fill
opacity=0.3,draw=green!60!black,thick,rounded corners,inner sep=2pt,text
opacity=1]testeqE~=~m,c^2
begintikzpicture[overlay,remember picture]
draw[thick,cyan,latex-latex] (test.-5) to[out=-90,in=0] (testeq.east);
endtikzpicture]
enddocument

add a comment |
Another option is tikzmark, which less options than tcolorbox, but allows you to connect different boxes and also detect the mode you are in (text vs. math etc.).
documentclassarticle
usepackagetikz
usetikzlibrarytikzmark
begindocument
Here is some text and tikzmarknode[fill=cyan,fill
opacity=0.3,draw=green!60!black,thick,rounded corners,inner sep=2pt,text
opacity=1]testsomething about relativity.
[tikzmarknode[fill=cyan,fill
opacity=0.3,draw=green!60!black,thick,rounded corners,inner sep=2pt,text
opacity=1]testeqE~=~m,c^2
begintikzpicture[overlay,remember picture]
draw[thick,cyan,latex-latex] (test.-5) to[out=-90,in=0] (testeq.east);
endtikzpicture]
enddocument

add a comment |
Another option is tikzmark, which less options than tcolorbox, but allows you to connect different boxes and also detect the mode you are in (text vs. math etc.).
documentclassarticle
usepackagetikz
usetikzlibrarytikzmark
begindocument
Here is some text and tikzmarknode[fill=cyan,fill
opacity=0.3,draw=green!60!black,thick,rounded corners,inner sep=2pt,text
opacity=1]testsomething about relativity.
[tikzmarknode[fill=cyan,fill
opacity=0.3,draw=green!60!black,thick,rounded corners,inner sep=2pt,text
opacity=1]testeqE~=~m,c^2
begintikzpicture[overlay,remember picture]
draw[thick,cyan,latex-latex] (test.-5) to[out=-90,in=0] (testeq.east);
endtikzpicture]
enddocument

Another option is tikzmark, which less options than tcolorbox, but allows you to connect different boxes and also detect the mode you are in (text vs. math etc.).
documentclassarticle
usepackagetikz
usetikzlibrarytikzmark
begindocument
Here is some text and tikzmarknode[fill=cyan,fill
opacity=0.3,draw=green!60!black,thick,rounded corners,inner sep=2pt,text
opacity=1]testsomething about relativity.
[tikzmarknode[fill=cyan,fill
opacity=0.3,draw=green!60!black,thick,rounded corners,inner sep=2pt,text
opacity=1]testeqE~=~m,c^2
begintikzpicture[overlay,remember picture]
draw[thick,cyan,latex-latex] (test.-5) to[out=-90,in=0] (testeq.east);
endtikzpicture]
enddocument

answered Dec 29 '18 at 20:44
marmotmarmot
90.6k4104195
90.6k4104195
add a comment |
add a comment |
2
How about
tcolorbox? Ortikzmark?– marmot
Dec 29 '18 at 20:34
possible duplicate : tex.stackexchange.com/q/458864/138900
– AndréC
Dec 29 '18 at 20:51