2

I want to write some text with a semi-transparent color.

I have tried the transparent package but it seems to be in conflict with some other package. In a MWE, it works BUT in my real case, it does not work (I load a lot of packages)

So, my question is: How to make a text semi-transparent, without the transparent package?


Remark

\tikz\node[opacity=0.5]{Hello}; does the work but it adds some space after Hello.

If you think of another possible solution, I would be interested.


PS: Here is image of what I want to achieve.

enter image description here

PPS: I need a transparent color and not a plain gray.

  • 2
    Maybe building a Minimal Not-Working Example would help to define which package is clashing with transparent and maybe lead to a solution (order of loading? option to activate while loading package? etc.)... – ebosi May 13 '16 at 13:08
  • Yep but I am sure they are easy workarounds! – Colas May 13 '16 at 13:12
  • 1
    \tikz\node[opacity=0.5]{Hello}; might work. But to really know, we need your MWE, as already mentioned by @ebo. – Daniel May 13 '16 at 13:12
  • Yep but I load approximately 40 packages... \tikz\node[opacity=0.5]{Hello}; does the work but it adds some space after Hello. – Colas May 13 '16 at 13:22
  • 2
    @Colas Try \tikz\node[inner sep=0pt,opacity=0.5]{Hello};... – Paul Gaborit May 13 '16 at 13:40
5

EDITED to use Daniel's comment to make the undertext transparent, using a tikz node. The OP mentions in his/her comment to Daniel the presence of "some space after Hello", but I'm not sure how that applies to this solution (since the \stackunder is centered).

EDITED to take OP's suggestions. However, I would note that the horizontal alignment of this solution is impervious to inner sep, since the underset is automatically centered. However, the inner sep will slightly alter the vertical position of the underset.

\documentclass{article}
\usepackage{stackengine,tikz}
\begin{document}
\[
\pagecolor{blue!10}
\stackunder[8pt]{$\displaystyle \int_0^1 f(t)dt$}{%
  \tikz\node[inner sep=0pt, opacity=0.5]{Hello};}
\]
\end{document}

enter image description here

  • Nope, I need transparent. – Colas May 13 '16 at 13:26
  • @Colas So I edited to use Daniel's suggestion. Does that suffice? – Steven B. Segletes May 13 '16 at 13:31
  • I don't have stackengine in my distribution it seems. – Colas May 13 '16 at 13:36
  • @Colas You can go to https://www.ctan.org/pkg/stackengine and download the .sty file to your working directory to test. Later, you can figure out how to add it to your installation. – Steven B. Segletes May 13 '16 at 13:38
  • It works well. I suggest you remove the black!30 and add \node[inner sep=0pt, opacity=0.5] – Colas May 13 '16 at 13:42
5

A solution with a tcbox from tcolorbox.

\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{lmodern}

\newtcbox{\mybox}{blank, on line, opacitytext=0.5}

\begin{document}
\pagecolor{blue!10}
\begin{tabular}{cc}
$\displaystyle \int_0^1 f(t) dt$\\
\mybox{Hello} Hello \\
Hello Hello \\
\end{tabular}
\end{document}

![enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.