How to add a small rounded rectangle around a word inline

Clash 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)

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
add a comment |Â
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)

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
Seetcolorboxpackage documentation at the bottom of page 16.
â CarLaTeX
1 hour ago
add a comment |Â
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)

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
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)

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
tikz-pgf boxes
edited 24 mins ago
asked 1 hour ago
smilingbuddha
6754915
6754915
Seetcolorboxpackage documentation at the bottom of page 16.
â CarLaTeX
1 hour ago
add a comment |Â
Seetcolorboxpackage 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
add a comment |Â
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
autourwhich contains theTikZcode.
Here is an example of two possibilities that have different parameters in order to visually show their effects.

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
Works great! Thanks!
â smilingbuddha
26 mins ago
add a comment |Â
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

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 thattikzmarkdoes 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
add a comment |Â
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
autourwhich contains theTikZcode.
Here is an example of two possibilities that have different parameters in order to visually show their effects.

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
Works great! Thanks!
â smilingbuddha
26 mins ago
add a comment |Â
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
autourwhich contains theTikZcode.
Here is an example of two possibilities that have different parameters in order to visually show their effects.

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
Works great! Thanks!
â smilingbuddha
26 mins ago
add a comment |Â
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
autourwhich contains theTikZcode.
Here is an example of two possibilities that have different parameters in order to visually show their effects.

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
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
autourwhich contains theTikZcode.
Here is an example of two possibilities that have different parameters in order to visually show their effects.

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
answered 1 hour ago
AndréC
5,2821937
5,2821937
Works great! Thanks!
â smilingbuddha
26 mins ago
add a comment |Â
Works great! Thanks!
â smilingbuddha
26 mins ago
Works great! Thanks!
â smilingbuddha
26 mins ago
Works great! Thanks!
â smilingbuddha
26 mins ago
add a comment |Â
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

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 thattikzmarkdoes 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
add a comment |Â
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

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 thattikzmarkdoes 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
add a comment |Â
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

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

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 thattikzmarkdoes 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
add a comment |Â
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 thattikzmarkdoes 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
add a comment |Â
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
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
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
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
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
See
tcolorboxpackage documentation at the bottom of page 16.â CarLaTeX
1 hour ago