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 24 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
    26 mins ago

















up vote
4
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

section*Some basic examples

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

bigskip

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

section*Some more elaborate examples

As it is well known,
[ sumlimits_tikzmarknode[rounded corners,fill=blue!30,inner sep=1pt]k1k=1^infty
k~=~-frac112;,]
where $tikzmarknode[rounded corners,fill=blue!30,inner sep=2pt]k2k$ is a summation index.

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

enddocument


enter image description here






share|improve this answer


















  • 1




    Wow cool! Thanks!
    – smilingbuddha
    25 mins ago










  • So tikzmark allows you to connect one or more marked positions on the page, is that correct?
    – smilingbuddha
    12 mins ago










  • @smilingbuddha You're welcome. Let me also mention that tikzmark does actually much more than what I showed. I add some more info. One particularly nice feature is that it detects whether or not you are in math mode, and if you are in math mode, in which style. So it always gives you the right fonts and sizes, things that, sorry to say that so openly, AndrèC's proposal fails to achieve. And given how complicated it is to achieve this, I am deeply impressed by what LoopSpace has done.
    – marmot
    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
    26 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
    26 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 1 hour ago









AndréC

5,2821937




5,2821937











  • Works great! Thanks!
    – smilingbuddha
    26 mins ago
















  • Works great! Thanks!
    – smilingbuddha
    26 mins ago















Works great! Thanks!
– smilingbuddha
26 mins ago




Works great! Thanks!
– smilingbuddha
26 mins ago










up vote
4
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

section*Some basic examples

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

bigskip

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

section*Some more elaborate examples

As it is well known,
[ sumlimits_tikzmarknode[rounded corners,fill=blue!30,inner sep=1pt]k1k=1^infty
k~=~-frac112;,]
where $tikzmarknode[rounded corners,fill=blue!30,inner sep=2pt]k2k$ is a summation index.

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

enddocument


enter image description here






share|improve this answer


















  • 1




    Wow cool! Thanks!
    – smilingbuddha
    25 mins ago










  • So tikzmark allows you to connect one or more marked positions on the page, is that correct?
    – smilingbuddha
    12 mins ago










  • @smilingbuddha You're welcome. Let me also mention that tikzmark does actually much more than what I showed. I add some more info. One particularly nice feature is that it detects whether or not you are in math mode, and if you are in math mode, in which style. So it always gives you the right fonts and sizes, things that, sorry to say that so openly, AndrèC's proposal fails to achieve. And given how complicated it is to achieve this, I am deeply impressed by what LoopSpace has done.
    – marmot
    4 mins ago














up vote
4
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

section*Some basic examples

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

bigskip

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

section*Some more elaborate examples

As it is well known,
[ sumlimits_tikzmarknode[rounded corners,fill=blue!30,inner sep=1pt]k1k=1^infty
k~=~-frac112;,]
where $tikzmarknode[rounded corners,fill=blue!30,inner sep=2pt]k2k$ is a summation index.

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

enddocument


enter image description here






share|improve this answer


















  • 1




    Wow cool! Thanks!
    – smilingbuddha
    25 mins ago










  • So tikzmark allows you to connect one or more marked positions on the page, is that correct?
    – smilingbuddha
    12 mins ago










  • @smilingbuddha You're welcome. Let me also mention that tikzmark does actually much more than what I showed. I add some more info. One particularly nice feature is that it detects whether or not you are in math mode, and if you are in math mode, in which style. So it always gives you the right fonts and sizes, things that, sorry to say that so openly, AndrèC's proposal fails to achieve. And given how complicated it is to achieve this, I am deeply impressed by what LoopSpace has done.
    – marmot
    4 mins ago












up vote
4
down vote










up vote
4
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

section*Some basic examples

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

bigskip

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

section*Some more elaborate examples

As it is well known,
[ sumlimits_tikzmarknode[rounded corners,fill=blue!30,inner sep=1pt]k1k=1^infty
k~=~-frac112;,]
where $tikzmarknode[rounded corners,fill=blue!30,inner sep=2pt]k2k$ is a summation index.

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

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

section*Some basic examples

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

bigskip

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

section*Some more elaborate examples

As it is well known,
[ sumlimits_tikzmarknode[rounded corners,fill=blue!30,inner sep=1pt]k1k=1^infty
k~=~-frac112;,]
where $tikzmarknode[rounded corners,fill=blue!30,inner sep=2pt]k2k$ is a summation index.

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

enddocument


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited 8 mins ago

























answered 31 mins ago









marmot

72.4k477153




72.4k477153







  • 1




    Wow cool! Thanks!
    – smilingbuddha
    25 mins ago










  • So tikzmark allows you to connect one or more marked positions on the page, is that correct?
    – smilingbuddha
    12 mins ago










  • @smilingbuddha You're welcome. Let me also mention that tikzmark does actually much more than what I showed. I add some more info. One particularly nice feature is that it detects whether or not you are in math mode, and if you are in math mode, in which style. So it always gives you the right fonts and sizes, things that, sorry to say that so openly, AndrèC's proposal fails to achieve. And given how complicated it is to achieve this, I am deeply impressed by what LoopSpace has done.
    – marmot
    4 mins ago












  • 1




    Wow cool! Thanks!
    – smilingbuddha
    25 mins ago










  • So tikzmark allows you to connect one or more marked positions on the page, is that correct?
    – smilingbuddha
    12 mins ago










  • @smilingbuddha You're welcome. Let me also mention that tikzmark does actually much more than what I showed. I add some more info. One particularly nice feature is that it detects whether or not you are in math mode, and if you are in math mode, in which style. So it always gives you the right fonts and sizes, things that, sorry to say that so openly, AndrèC's proposal fails to achieve. And given how complicated it is to achieve this, I am deeply impressed by what LoopSpace has done.
    – marmot
    4 mins ago







1




1




Wow cool! Thanks!
– smilingbuddha
25 mins ago




Wow cool! Thanks!
– smilingbuddha
25 mins ago












So tikzmark allows you to connect one or more marked positions on the page, is that correct?
– smilingbuddha
12 mins ago




So tikzmark allows you to connect one or more marked positions on the page, is that correct?
– smilingbuddha
12 mins ago












@smilingbuddha You're welcome. Let me also mention that tikzmark does actually much more than what I showed. I add some more info. One particularly nice feature is that it detects whether or not you are in math mode, and if you are in math mode, in which style. So it always gives you the right fonts and sizes, things that, sorry to say that so openly, AndrèC's proposal fails to achieve. And given how complicated it is to achieve this, I am deeply impressed by what LoopSpace has done.
– marmot
4 mins ago




@smilingbuddha You're welcome. Let me also mention that tikzmark does actually much more than what I showed. I add some more info. One particularly nice feature is that it detects whether or not you are in math mode, and if you are in math mode, in which style. So it always gives you the right fonts and sizes, things that, sorry to say that so openly, AndrèC's proposal fails to achieve. And given how complicated it is to achieve this, I am deeply impressed by what LoopSpace has done.
– marmot
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













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?