我正在尝试重现恐怖电影预告片中常见的奇怪字体效果。在预告片中,屏幕上通常会闪现一个单词,单词周围会有“回声”或“阴影”。
我根本找不到一个例子,但是我制作了一张看起来像这样的效果的图像:
在一些版本中,阴影与单词重叠,而在其他版本中,阴影不接触单词;我并不挑剔。
我的问题是:如何使用 LaTeX 在几个单词或部分句子上实现这种效果?
加分项:是否可以实现阴影效果并且仍能保持周围的文字可读?
[编辑]进一步澄清:我确实指定了“LaTeX”,但在我看来,任何类型的 tex 都是 A-OK。
答案1
此解决方案使用嵌套堆栈插入,仍具有覆盖层的垂直高度/深度。插入的相对位置由长度参数控制(第 2 个和第 4 个参数是\stackinset
(x,y) 偏移)。
\documentclass{article}
\usepackage{stackengine}
\usepackage{xcolor}
\begin{document}
\def\MyText{not scary}
\newcommand\mytext[1][black]{\textcolor{#1}{\MyText}}
This is
\stackinset{c}{2ex}{c}{1.4ex}{\mytext[red!90]}{%
\stackinset{c}{-3ex}{c}{3.2ex}{\mytext[black!25]}{%
\stackinset{c}{-1ex}{c}{-1.7ex}{\mytext[black!40]}{%
\mytext%
}}}
text.
\end{document}
以额外的参数为代价,回声也可以缩放
\documentclass{article}
\usepackage{stackengine}
\usepackage{xcolor}
\usepackage{graphicx}
\begin{document}
\def\MyText{not scary}
\newcommand\mytext[2][black]{\scalebox{#2}{\textcolor{#1}{\MyText}}}
This is
\stackinset{c}{2ex}{c}{1.4ex}{\mytext[red!90]{.8}}{%
\stackinset{c}{-3ex}{c}{3.2ex}{\mytext[black!25]{.7}}{%
\stackinset{c}{-1ex}{c}{-1.7ex}{\mytext[black!40]{1.1}}{%
\mytext{1}%
}}}
text.
\end{document}
如果您希望消除垂直范围,以便遇到垂直相邻的文本,则\smash
可以使用 a 来处理:
\documentclass{article}
\usepackage{stackengine}
\usepackage{xcolor}
\usepackage[nopar]{lipsum}
\begin{document}
\def\MyText{not scary}
\newcommand\mytext[1][black]{\textcolor{#1}{\MyText}}
\lipsum[1]
This is
\smash{%
\stackinset{c}{2ex}{c}{1.4ex}{\mytext[red!90]}{%
\stackinset{c}{-3ex}{c}{3.2ex}{\mytext[black!25]}{%
\stackinset{c}{-1ex}{c}{-1.7ex}{\mytext[black!40]}{%
\mytext%
}}}}
text.
\lipsum[2]
\end{document}
在 ZothiqueDemo 字体中:
答案2
这只是为了演示目的。也就是说,它并不打算看起来像你可能会用到的东西,而是要表明如何实现一些你可能觉得有用的效果,以创建你想要使用的东西。我想我会尝试一下影子文本并利用这个借口安装翡翠字体。“恐怖”文本采用了该系列中的各种字体:IntimacyDeux、Teenspirit、Webster、Skeetch、TallPaul 和 Pookie。rotating
用于旋转一个样本而不占用空间。xcolor
用于当场混合阴影的颜色。
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{emerald,texnames,rotating,xcolor,shadowtext}
\begin{document}
\pagestyle{empty}
\noindent\Huge This is some fairly mundane, absolutely non-terrifying text which could not be less scary if it tried. Gentle as a lamb and good as gold.
\shadowoffsetx{3pt}%
\shadowoffsety{5pt}%
\shadowtext{%
\shadowoffsetx{-5pt}%
\shadowoffsety{-3pt}%
\shadowtext{%
\shadowoffsetx{15pt}%
\shadowoffsety{-12pt}%
\shadowtext{%
\Huge\ECFIntimacyDeux SCARY}}}
What in \shadowtext{\TeX}'s name was \emph{that}? Is this text trying to scare me or something? At the very least, it is making this page look a mess\dots
\vfill
\Large
This is some more non-frightening text. Friendly, approachable and keen to assist you whatever your needs.
\shadowoffsetx{-10pt}%
\shadowoffsety{-15pt}%
\shadowtext{%
\shadowcolor{red!60!black}%
\shadowoffsetx{3pt}%
\shadowoffsety{5pt}%
\shadowtext{\shadowtext{\shadowtext{\ECFTeenSpirit Be Afraid\dots Be Veeerrryyy Afraid\dots}}}}
\vfill
\LARGE\noindent This text is just minding its own business, doing no harm to anybody\dots
\begin{rotate}{45}%
\shadowtext{\ECFWebster Somethin' woz 'ere}
\end{rotate}
said somebody. `Go figure,' said Pooh.
\vfill
\noindent Harmless text for armless times\dots \shadowtext{\Huge\ECFSkeetch SCARY Are you scared yet?}
\vfill
\shadowoffsetx{7.5pt}%
\noindent\Large \shadowoffsety{10pt}%
\shadowtext{%
\shadowoffsetx{-10pt}%
\shadowoffsety{-15pt}%
\shadowtext{%
\shadowoffset{3pt}%
\shadowtext{\ECFTallPaul Maybe this is more SCARY\dots SCARIER\dots?}}} Perhaps, or perhaps not so much?
\vfill
\noindent\Huge Now for some decidedly ordinary text\dots
\shadowtext{%
\shadowoffsetx{-4pt}%
\shadowoffsety{-2pt}%
\shadowcolor{blue!40!black}%
\shadowtext{\ECFPookie SCARY!!! Or just WEIRD?}}
\end{document}
答案3
这里有一个tikz
实施底层使用“可怕的复制”atbegshi
,从而保留黑色覆盖的文本。
\documentclass{article}
\usepackage{tikz,atbegshi}
\usetikzlibrary{calc}
\newcounter{wordcount}
\newcommand{\scarymacro}[2][10]{%
\stepcounter{wordcount}%
\tikz[remember picture, baseline, inner sep = 0pt] \node[anchor = base] (scary\thewordcount) {#2};%
\begingroup\edef\x{\endgroup\noexpand\AtBeginShipout{\noexpand\AtBeginShipoutAddToBox{
\noexpand\begin{tikzpicture}[remember picture, overlay]
\noexpand\foreach \noexpand\x in {1,...,#1}{%
\noexpand\pgfmathparse{rand}\noexpand\edef\noexpand\xdir{\noexpand\pgfmathresult}% X-direction
\noexpand\pgfmathparse{rand}\noexpand\edef\noexpand\ydir{\noexpand\pgfmathresult}% Y-direction
\noexpand\pgfmathparse{100*(0.1+rnd*0.5)}\noexpand\edef\noexpand\scaryshade{\noexpand\pgfmathresult}% Shade
\noexpand\pgfmathparse{0.5+rnd*0.5}\noexpand\edef\noexpand\scaryscale{\noexpand\pgfmathresult}% Scale
\noexpand\node[color = red!\noexpand\scaryshade, scale = \noexpand\scaryscale]
at ($(scary\thewordcount)+\noexpand\xdir*(1cm,0)+\noexpand\ydir*(0,1cm)$) {#2};}
\noexpand\end{tikzpicture}
}}}\x%
}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis rhoncus cursus
mi in pretium. Duis faucibus, leo sit amet hendrerit tempor, urna risus elementum
leo, in tempus metus justo id nisl. Morbi adipiscing sapien venenatis est rutrum
\scarymacro{scary} egestas. Phasellus commodo odio diam. Aenean a euismod diam.
Maecenas lacinia tincidunt dolor nec posuere. Praesent accumsan consectetur luctus.
Maecenas ac lorem at elit egestas scelerisque. Quisque tristique ligula sed nulla
scelerisque, ut porta dolor faucibus. Sed et dui ac justo ultrices molestie. Sed
tempus vitae dolor in sodales. Cras molestie elementum turpis in pharetra. Nullam
turpis metus, iaculis nec \scarymacro[4]{scary} consectetur quis, adipiscing eleifend
massa. Quisque blandit nisl id nisl fringilla commodo. Phasellus non faucibus
tellus. Morbi non justo mauris.
\end{document}
...特写镜头,有些可怕:
使用 时,默认情况下会复制 10 次恐怖文本\scarymacro{<stuff>}
,但也可以使用可选参数来调整复制次数。复制品以 到 的颜色打印red!10
,red!60
缩放比例在 50% 到 100% 之间,并随机放置在 1cm x 1cm 的范围内<stuff>
。