TeX - LaTeX Asked on June 29, 2021
I think the best way to celebrate trans pride week would be to place the trans pride flag behind words that contain "trans" (eg transform, transport) in some of my papers. I know about the package xcolor that makes it very easy to set a background color for some text, but it seems to only support one color.
Does anyone know how I can put a 5-layer stripe of color behind some letters? Thanks!
With tcolorbox
it is easy. This code is based on this post. Of course, you can combine this with other tcolorbox
features. Here is a basic variant.
documentclass{article}
usepackage{tcolorbox}
tcbuselibrary{skins}
usetikzlibrary{calc}
definecolor{pride1}{RGB}{136,205,248}
definecolor{pride2}{RGB}{226,168,182}
tcbset{pride/.style={enhanced,hbox,colback=white,
underlay={begin{tcbclipinterior}
fill[pride1] let p1=($(interior.north)-(interior.south)$) in
foreach X in {1,5}
{([yshift={X*y1/5}]interior.south west) rectangle
([yshift={(X-1)*y1/5}]interior.south east)};
fill[pride2] let p1=($(interior.north)-(interior.south)$) in
foreach X in {2,4}
{([yshift={X*y1/5}]interior.south west) rectangle
([yshift={(X-1)*y1/5}]interior.south east)};
end{tcbclipinterior}}}}
begin{document}
begin{tcolorbox}[fontupper=sffamilybfseries,pride]
hello world
end{tcolorbox}
end{document}
Here is an example that uses additional options.
documentclass{article}
usepackage{tcolorbox}
tcbuselibrary{skins}
usetikzlibrary{calc}
definecolor{pride1}{RGB}{136,205,248}
definecolor{pride2}{RGB}{226,168,182}
tcbset{pride/.style={enhanced,hbox,colback=white,
underlay={begin{tcbclipinterior}
fill[pride1] let p1=($(interior.north)-(interior.south)$) in
foreach X in {1,5}
{([yshift={X*y1/5}]interior.south west) rectangle
([yshift={(X-1)*y1/5}]interior.south east)};
fill[pride2] let p1=($(interior.north)-(interior.south)$) in
foreach X in {2,4}
{([yshift={X*y1/5}]interior.south west) rectangle
([yshift={(X-1)*y1/5}]interior.south east)};
end{tcbclipinterior}}},
tight/.style={on
line,boxsep=0pt,left=#1,right=#1,top=#1,bottom=#1,arc=0pt,boxrule=0pt},
tight/.default=0pt}
begin{document}
the heat
begin{tcolorbox}[tight,pride]
trans
end{tcolorbox}fer coefficient is yadda yadda yadda
end{document}
Answered by user228539 on June 29, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP