我想要实现这样的效果,就像在图像编辑器中对文本应用发光效果一样。
由于我已经tikz
在文档中使用包,因此最好使用 tikz 的库。
我发现有shadows.blur
一个可以创建柔和阴影的插件。然后我会移动它,让它看起来像发光效果。
然而不幸的是,这次尝试生成的是一个矩形而不是文本的阴影。
\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{shadows.blur}
\begin{document}
\begin{tikzpicture}
\node[preaction={blur shadow={shadow xshift=-.5mm,shadow yshift=.5mm}}] at (1,1) {Test};
\end{tikzpicture}
\end{document}
答案1
您可以结合使用 tikz 和 contour 包。
\documentclass[12pt,border=12pt]{standalone}
\usepackage[outline]{contour}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{tikzpicture}
\def\mycontour#1{\textcolor{black}{\contour{green!20}{#1}}}
\node (1) at (0cm, 0cm) {};
\node (2) at (2cm,0cm) {};
\draw[
decoration={text effects along path,
text={Text},
text align=center,
text effects/.cd,
text along path, scale text to path,
characters={font=\Huge,character command=\mycontour},
},decorate,
] (1) to (2);
\end{tikzpicture}
\end{document}
要不就
\documentclass{article}
\usepackage{xcolor}
\usepackage[outline]{contour}
\contourlength{1pt}
\contournumber{27}
\newcommand{\mycontour}[2][green!20]{\textcolor{black}{\contour{#1}{#2}}}
\begin{document}
\Huge\mycontour{Text}
\end{document}
答案2
距离上一个答案仅一步之遥。这个答案使用了 线条褪色或模糊
\documentclass{article}
\usepackage{tikz}
\usepackage[outline]{contour}
\begin{document}
\Huge
Assume pdf\TeX
\def\exText{LIPSUM}
\makeatletter
Reverse engineer the contour package.
Here is an MWE
\leavevmode
\begingroup
\color{green}%
\con@coloroff
\pdfliteral{%
q % enter a scope
1 j % Set line join style
1 J % Set line cap style
1 Tr % Set text rendering mode
2.5 w % Set line width (in PostScript Point)
}%
\rlap{\exText}%
\pdfliteral{%
Q % leave the scope
}%
\endgroup
\mbox{\exText}
Now use TikZ.
\leavevmode
\pgfsys@beginscope% = pdf literal q
\pgfsetroundjoin% = 1 J
\pgfsetroundcap% = 1 j
\pdfliteral{1 Tr}% no pgf alternative
\foreach\ind in{10,...,1}{%
\pgfmathsetmacro\per{(11-\ind)*5}%
\color{green!\per}%
\pgfsetlinewidth{\ind/2}%
\rlap{\exText}%
}%
\pgfsys@endscope % = pdf literal Q
\exText
\makeatother
\end{document}