如上图所示,当使用颜色突出显示文本时,我们会失去段落格式,所有文本都会变成一行。如果段落足够长,其余文本甚至会超出边距。我该如何解决这个问题,让文本保持正常格式(即实际段落)但突出显示?我的源代码:
\documentclass{IEEEtran}
\usepackage{blindtext}
\usepackage[svgnames]{xcolor}
\begin{document}
\Large
\colorbox{SkyBlue}{The text in colored box overlaps with neighboring column as seen here}
\normalsize
\Blindtext
\end{document}
答案1
在 LaTeX 中使用soul
包 (load xcolor
before soul
)。
\documentclass{article}
\usepackage{multicol}
\usepackage{blindtext}
\usepackage{xcolor}
\usepackage{soul}
\begin{document}
\begin{multicols}{2}
\hl{The text in colored box overlaps with neighboring column as seen here}
\blindtext
\end{multicols}
\end{document}
答案2
在 ConTeXt MKIV 中这非常简单。
% https://randomdeterminism.wordpress.com/2010/10/31/can-i-borrow-your-highlighter-please/
\definebar
[highlight]
[order=background,
rulethickness=2.5,
offset=1.25,
continue=yes,
color=yellow]
\starttext
\startcolumns[n=2]
\highlight{The text in colored box overlaps with neighboring column as seen here}
\input lorem
\stopcolumns
\stoptext