我想让一些文字出现半透明的文字,但不以覆盖方式(最终变得牢固)只是永久性地透明的。使事情复杂化,所讨论的文本是 matrix:

$
\begin{matrix}
          & \{-2,3,5,0,8\} & \\
    \{-2,3,5,0\} & & \{-2,3,5,8\} \\
          & \{-2,3,5\} &
\end{matrix}
$

我希望矩阵中的第三行是半透明的。有没有办法做到这一点?

有帮助吗?

解决方案

编辑: 通过将其转换为具有可选参数的命令来改进解决方案。

好的,发现了如何做:

\newcommand{\semitransp}[2][35]{\color{fg!#1}#2}

...

$
\begin{matrix}
       & \{-2,3,5,0,8\} & \\
    \{-2,3,5,0\} & & \{-2,3,5,8\} \\
      & \semitransp{\{-2,3,5\}} &
\end{matrix}
$

可选参数控制透明度。所以 \semitransp[20]{text} 更轻,而且 \semitransp[60]{text} 更重。默认值35在我的计算机屏幕上看起来不错。尚未看到它的外观投影在墙上。

其他提示

Ari的答案可能对他有用(以及2010年),但是给定的命令将使以下所有文本透明,不仅是给定的文本。

改进的解决方案仅使给定文本透明:

\newcommand{\semitransp}[2][35]{\textcolor{fg!#1}{#2}}
% Swap \color with \textcolor and add another curly brackets pair.

...

$
\begin{matrix}
   & \{-2,3,5,0,8\} & \\
\{-2,3,5,0\} & & \{-2,3,5,8\} \\
  & \semitransp{\{-2,3,5\}} &
\end{matrix}
$

为了获得真正的半透明性,可以使用 \pgfsetfillopacity. 。与通过将前景颜色与背景混合在一起的伪造不透明度相比,这一优势是,如果有背景图像或其他彩色元素,这也将起作用。

\documentclass{beamer}

\begin{document}

\begin{frame}
$
\begin{matrix}
          & \{-2,3,5,0,8\} & \\
    \{-2,3,5,0\} & & \{-2,3,5,8\} \\
          & {\pgfsetfillopacity{0.2}\{-2,3,5\}} &
\end{matrix}
$

\end{frame} 


\setbeamertemplate{background canvas}{\includegraphics[width=\paperwidth]{example-grid-100x100bp}}


\begin{frame}
$
\begin{matrix}
          & \{-2,3,5,0,8\} & \\
    \{-2,3,5,0\} & & \{-2,3,5,8\} \\
          & {\pgfsetfillopacity{0.2}\{-2,3,5\}} &
\end{matrix}
$

\end{frame}     

\end{document}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top