答案1
另外一个选择:
\documentclass{article}
\usepackage{tikz}
\usepackage{circledsteps}
\begin{document}
text text text
\Circled[outer color=blue,inner color=blue,fill color=lime]{texto}
text text text text text text text text text text text text text text text text text text text text text text text text
\end{document}
如果你设置,\tikzset{/csteps/inner ysep=20pt}
你将有
答案2
也许对于内联文本,您会更喜欢体育场形状(具有圆角的矩形),以避免当包围的文本太宽时增加行间空间与重叠文本的困境。
一个简单的方法是使用带有选项的\tcbox
(tcolorbox
包)on line
,其优点是高度可定制:
\documentclass[12pt]{article}
\usepackage{lipsum}
\usepackage[most]{tcolorbox}
\newtcbox{\myoval}{on line,arc=7pt,colback=yellow!50,colframe=orange!50,
boxrule=1pt, boxsep=1pt,left=1pt,right=1pt,top=1pt,bottom=1pt}
\begin{document}
\lipsum[1][1-6]
\lipsum[1][1] Ut purus elit, vestibulum ut, placerat ac,\myoval{adipiscing vitae}, felis
\lipsum[1][3-6]
\end{document}
答案3
这使用 tikz 来重叠椭圆和周围空间,但不重叠文本本身。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit, shapes.geometric}
\newcommand{\ellipted}[1]{% #1 = text
\begin{tikzpicture}[baseline=(A.base)]
\node[inner sep=0pt] (A) {#1};
\begin{pgfinterruptboundingbox}
\node[draw, red, ellipse, inner sep=1pt, fit=(A)] {};
\end{pgfinterruptboundingbox}
\end{tikzpicture}}
\begin{document}
\noindent
This is a line of text.\\
This is a line of text.\\
This is \ellipted{a line} of text.\\
This is a line of text.\\
This is a line of text.
\end{document}
答案4
这是一个使用 的选项tikzmark
。定义一个\encircle
接受两个参数的命令,其中一个是可选的。
\encircle[<tikz options>]{<text>}
可选的第一个参数可以包括颜色、线宽、变化inner xsep
等inner ysep
。
这是代码。您必须编译两次。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark, shapes.geometric, fit}
\newcommand{\encircle}[2][]{\tikzmarknode{A}{#2}\tikz[remember picture, overlay]
{\node[draw, ellipse, inner xsep=-.4em, inner ysep=3pt, fit=(A),#1]{};}}
\begin{document}
Here are a few lines of text. Here are a few lines of text. Here are a few lines of text.
Here are a few lines of text. Here are a few lines of text. Here are a few lines of text.
I want to circle \encircle[red, thick]{some text} in the middle without affecting line spacing.
Here are a few lines of text. Here are a few lines of text. Here are a few lines of text.
Here are a few lines of text. Here are a few lines of text.
\end{document}