How to add a small rounded rectangle around a word inline

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











up vote
4
down vote

favorite












I want to add a box with a very light pink background and red border around a word but inline and within a sentence.



i.e. something like this (drawn with inkscape)



enter image description here



I know the mdframed package can be used for placing boxes around paragraphs, but it does not seem to work inline and also give colored boxes.



Possibly TikZ is a solution? From the little I know of TikZ, it can be used to draw pictures inline inside a sentence.










share|improve this question























  • See tcolorbox package documentation at the bottom of page 16.
    – CarLaTeX
    1 hour ago














up vote
4
down vote

favorite












I want to add a box with a very light pink background and red border around a word but inline and within a sentence.



i.e. something like this (drawn with inkscape)



enter image description here



I know the mdframed package can be used for placing boxes around paragraphs, but it does not seem to work inline and also give colored boxes.



Possibly TikZ is a solution? From the little I know of TikZ, it can be used to draw pictures inline inside a sentence.










share|improve this question























  • See tcolorbox package documentation at the bottom of page 16.
    – CarLaTeX
    1 hour ago












up vote
4
down vote

favorite









up vote
4
down vote

favorite











I want to add a box with a very light pink background and red border around a word but inline and within a sentence.



i.e. something like this (drawn with inkscape)



enter image description here



I know the mdframed package can be used for placing boxes around paragraphs, but it does not seem to work inline and also give colored boxes.



Possibly TikZ is a solution? From the little I know of TikZ, it can be used to draw pictures inline inside a sentence.










share|improve this question















I want to add a box with a very light pink background and red border around a word but inline and within a sentence.



i.e. something like this (drawn with inkscape)



enter image description here



I know the mdframed package can be used for placing boxes around paragraphs, but it does not seem to work inline and also give colored boxes.



Possibly TikZ is a solution? From the little I know of TikZ, it can be used to draw pictures inline inside a sentence.







tikz-pgf boxes






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 4 mins ago

























asked 1 hour ago









smilingbuddha

6754915




6754915











  • See tcolorbox package documentation at the bottom of page 16.
    – CarLaTeX
    1 hour ago
















  • See tcolorbox package documentation at the bottom of page 16.
    – CarLaTeX
    1 hour ago















See tcolorbox package documentation at the bottom of page 16.
– CarLaTeX
1 hour ago




See tcolorbox package documentation at the bottom of page 16.
– CarLaTeX
1 hour ago










2 Answers
2






active

oldest

votes

















up vote
4
down vote



accepted










Yes, it is possible with TikZ. You can do this in two ways:



  • by including the code directly in the text.

  • by creating a LaTeX command named autour which contains the TikZ code.

Here is an example of two possibilities that have different parameters in order to visually show their effects.



autour



documentclassarticle
usepackagetikz
newcommandautour[1]tikz[baseline=(X.base)]node [draw=red,fill=gray!40,semithick,rectangle,inner sep=2pt, rounded corners=3pt] (X) #1;

begindocument

Quick brown fox tikz[baseline=(X.base)]node [draw=black,fill=cyan!20,thick,rectangle,inner sep=3pt, rounded corners=4pt] (X) jumped; over the lazy dog.
bigskip

Quick brown fox autourjumped over the lazy dog.
enddocument





share|improve this answer




















  • Works great! Thanks!
    – smilingbuddha
    5 mins ago

















up vote
3
down vote













This is a bit similar to AndréC's answer but to point out that there so some extent tikzmarknode, which comes with the really cool tikzmark library, got reinvented. And tikzmark allows you to do much more, of course.



documentclassarticle
usepackagetikz
usetikzlibrarytikzmark

begindocument

The quick brown fox tikzmarknode[draw,inner sep=1pt,rounded corners,fill=cyan!30]Ajumped over the lazy dog.

bigskip

The quick brown fox tikzmarknode[draw,inner sep=1pt,rounded corners,fill=red!30]Bjumped over the lazy dog.

tikz[overlay,remember picture]draw[latex-latex] (B) to[bend left] (A);
enddocument


enter image description here






share|improve this answer




















  • Wow cool! Thanks!
    – smilingbuddha
    4 mins ago










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: 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%2f458864%2fhow-to-add-a-small-rounded-rectangle-around-a-word-inline%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
4
down vote



accepted










Yes, it is possible with TikZ. You can do this in two ways:



  • by including the code directly in the text.

  • by creating a LaTeX command named autour which contains the TikZ code.

Here is an example of two possibilities that have different parameters in order to visually show their effects.



autour



documentclassarticle
usepackagetikz
newcommandautour[1]tikz[baseline=(X.base)]node [draw=red,fill=gray!40,semithick,rectangle,inner sep=2pt, rounded corners=3pt] (X) #1;

begindocument

Quick brown fox tikz[baseline=(X.base)]node [draw=black,fill=cyan!20,thick,rectangle,inner sep=3pt, rounded corners=4pt] (X) jumped; over the lazy dog.
bigskip

Quick brown fox autourjumped over the lazy dog.
enddocument





share|improve this answer




















  • Works great! Thanks!
    – smilingbuddha
    5 mins ago














up vote
4
down vote



accepted










Yes, it is possible with TikZ. You can do this in two ways:



  • by including the code directly in the text.

  • by creating a LaTeX command named autour which contains the TikZ code.

Here is an example of two possibilities that have different parameters in order to visually show their effects.



autour



documentclassarticle
usepackagetikz
newcommandautour[1]tikz[baseline=(X.base)]node [draw=red,fill=gray!40,semithick,rectangle,inner sep=2pt, rounded corners=3pt] (X) #1;

begindocument

Quick brown fox tikz[baseline=(X.base)]node [draw=black,fill=cyan!20,thick,rectangle,inner sep=3pt, rounded corners=4pt] (X) jumped; over the lazy dog.
bigskip

Quick brown fox autourjumped over the lazy dog.
enddocument





share|improve this answer




















  • Works great! Thanks!
    – smilingbuddha
    5 mins ago












up vote
4
down vote



accepted







up vote
4
down vote



accepted






Yes, it is possible with TikZ. You can do this in two ways:



  • by including the code directly in the text.

  • by creating a LaTeX command named autour which contains the TikZ code.

Here is an example of two possibilities that have different parameters in order to visually show their effects.



autour



documentclassarticle
usepackagetikz
newcommandautour[1]tikz[baseline=(X.base)]node [draw=red,fill=gray!40,semithick,rectangle,inner sep=2pt, rounded corners=3pt] (X) #1;

begindocument

Quick brown fox tikz[baseline=(X.base)]node [draw=black,fill=cyan!20,thick,rectangle,inner sep=3pt, rounded corners=4pt] (X) jumped; over the lazy dog.
bigskip

Quick brown fox autourjumped over the lazy dog.
enddocument





share|improve this answer












Yes, it is possible with TikZ. You can do this in two ways:



  • by including the code directly in the text.

  • by creating a LaTeX command named autour which contains the TikZ code.

Here is an example of two possibilities that have different parameters in order to visually show their effects.



autour



documentclassarticle
usepackagetikz
newcommandautour[1]tikz[baseline=(X.base)]node [draw=red,fill=gray!40,semithick,rectangle,inner sep=2pt, rounded corners=3pt] (X) #1;

begindocument

Quick brown fox tikz[baseline=(X.base)]node [draw=black,fill=cyan!20,thick,rectangle,inner sep=3pt, rounded corners=4pt] (X) jumped; over the lazy dog.
bigskip

Quick brown fox autourjumped over the lazy dog.
enddocument






share|improve this answer












share|improve this answer



share|improve this answer










answered 53 mins ago









AndréC

5,2821937




5,2821937











  • Works great! Thanks!
    – smilingbuddha
    5 mins ago
















  • Works great! Thanks!
    – smilingbuddha
    5 mins ago















Works great! Thanks!
– smilingbuddha
5 mins ago




Works great! Thanks!
– smilingbuddha
5 mins ago










up vote
3
down vote













This is a bit similar to AndréC's answer but to point out that there so some extent tikzmarknode, which comes with the really cool tikzmark library, got reinvented. And tikzmark allows you to do much more, of course.



documentclassarticle
usepackagetikz
usetikzlibrarytikzmark

begindocument

The quick brown fox tikzmarknode[draw,inner sep=1pt,rounded corners,fill=cyan!30]Ajumped over the lazy dog.

bigskip

The quick brown fox tikzmarknode[draw,inner sep=1pt,rounded corners,fill=red!30]Bjumped over the lazy dog.

tikz[overlay,remember picture]draw[latex-latex] (B) to[bend left] (A);
enddocument


enter image description here






share|improve this answer




















  • Wow cool! Thanks!
    – smilingbuddha
    4 mins ago














up vote
3
down vote













This is a bit similar to AndréC's answer but to point out that there so some extent tikzmarknode, which comes with the really cool tikzmark library, got reinvented. And tikzmark allows you to do much more, of course.



documentclassarticle
usepackagetikz
usetikzlibrarytikzmark

begindocument

The quick brown fox tikzmarknode[draw,inner sep=1pt,rounded corners,fill=cyan!30]Ajumped over the lazy dog.

bigskip

The quick brown fox tikzmarknode[draw,inner sep=1pt,rounded corners,fill=red!30]Bjumped over the lazy dog.

tikz[overlay,remember picture]draw[latex-latex] (B) to[bend left] (A);
enddocument


enter image description here






share|improve this answer




















  • Wow cool! Thanks!
    – smilingbuddha
    4 mins ago












up vote
3
down vote










up vote
3
down vote









This is a bit similar to AndréC's answer but to point out that there so some extent tikzmarknode, which comes with the really cool tikzmark library, got reinvented. And tikzmark allows you to do much more, of course.



documentclassarticle
usepackagetikz
usetikzlibrarytikzmark

begindocument

The quick brown fox tikzmarknode[draw,inner sep=1pt,rounded corners,fill=cyan!30]Ajumped over the lazy dog.

bigskip

The quick brown fox tikzmarknode[draw,inner sep=1pt,rounded corners,fill=red!30]Bjumped over the lazy dog.

tikz[overlay,remember picture]draw[latex-latex] (B) to[bend left] (A);
enddocument


enter image description here






share|improve this answer












This is a bit similar to AndréC's answer but to point out that there so some extent tikzmarknode, which comes with the really cool tikzmark library, got reinvented. And tikzmark allows you to do much more, of course.



documentclassarticle
usepackagetikz
usetikzlibrarytikzmark

begindocument

The quick brown fox tikzmarknode[draw,inner sep=1pt,rounded corners,fill=cyan!30]Ajumped over the lazy dog.

bigskip

The quick brown fox tikzmarknode[draw,inner sep=1pt,rounded corners,fill=red!30]Bjumped over the lazy dog.

tikz[overlay,remember picture]draw[latex-latex] (B) to[bend left] (A);
enddocument


enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered 11 mins ago









marmot

72.4k477153




72.4k477153











  • Wow cool! Thanks!
    – smilingbuddha
    4 mins ago
















  • Wow cool! Thanks!
    – smilingbuddha
    4 mins ago















Wow cool! Thanks!
– smilingbuddha
4 mins ago




Wow cool! Thanks!
– smilingbuddha
4 mins ago

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f458864%2fhow-to-add-a-small-rounded-rectangle-around-a-word-inline%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

Long meetings (6-7 hours a day): Being “babysat” by supervisor

Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

Confectionery