答案1
仅适用于 pdflatex,因为它使用 pdf 文字。
\documentclass{article}
\usepackage{xcolor}
\input pdf-trans
\newbox\qbox
\def\usecolor#1{\csname\string\color@#1\endcsname\space}
\newcommand\bordercolor[1]{\colsplit{1}{#1}}
\newcommand\fillcolor[1]{\colsplit{0}{#1}}
\newcommand\outline[1]{\leavevmode%
\def\maltext{#1}%
\setbox\qbox=\hbox{\maltext}%
\boxgs{Q q 2 Tr \thickness\space w \fillcol\space \bordercol\space}{}%
\copy\qbox%
}
\newcommand\colsplit[2]{\colorlet{tmpcolor}{#2}\edef\tmp{\usecolor{tmpcolor}}%
\def\tmpB{}\expandafter\colsplithelp\tmp\relax%
\ifnum0=#1\relax\edef\fillcol{\tmpB}\else\edef\bordercol{\tmpC}\fi}
\def\colsplithelp#1#2 #3\relax{%
\edef\tmpB{\tmpB#1#2 }%
\ifnum `#1>`9\relax\def\tmpC{#3}\else\colsplithelp#3\relax\fi
}
\newcommand\shadowfy[1]{\begingroup%
\ooalign{\kern.2pt\raisebox{-.1pt}{\outline{$#1$}}\cr\outline{$#1$}}\endgroup}
\begin{document}
\bordercolor{black}
\fillcolor{white}
\def\thickness{.25}
$f\colon\shadowfy{\textsf{R}} \rightarrow 0; \shadowfy{\alpha\textsf{Z}}$
\end{document}
答案2
欢迎!如果您在某个目录中找不到此符号,您可以随时使用contour
和tikz
将任何字符或文本转换为此样式。为了方便起见,我将参数存储在键中。
\documentclass{article}
\usepackage{tikz}
\usepackage{contour}
\tikzset{outlined/.cd,contour length/.initial=0.1pt,
shadow xshift/.initial=0.16ex,
shadow yshift/.initial=-0.08ex,
shadow color/.initial=black,
contour color/.initial=black,
font/.initial=\sffamily}
\newcommand\OutlinedWithShadow[2][]{\tikz[baseline={(X.base)},outlined/.cd,#1]{%
\contourlength{\pgfkeysvalueof{/tikz/outlined/contour length}}%
\path (\pgfkeysvalueof{/tikz/outlined/shadow xshift},%
\pgfkeysvalueof{/tikz/outlined/shadow yshift})
node[text=\pgfkeysvalueof{/tikz/outlined/shadow color},font=\pgfkeysvalueof{/tikz/outlined/font}]{#2}
(0,0) node[font=\pgfkeysvalueof{/tikz/outlined/font}] (X) {\contour{\pgfkeysvalueof{/tikz/outlined/contour color}}{\textcolor{white}{#2}}};}}
\begin{document}
\OutlinedWithShadow{R}
\end{document}
让我补充一下,这适用于任意字符,并给你一个按键如何工作的例子。
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{contour}
\tikzset{outlined/.cd,contour length/.initial=0.2pt,
shadow xshift/.initial=0.16ex,
shadow yshift/.initial=-0.08ex,
shadow color/.initial=black,
contour color/.initial=black,
font/.initial=\sffamily}
\newcommand\OutlinedWithShadow[2][]{\tikz[baseline={(X.base)},outlined/.cd,#1]{%
\contourlength{\pgfkeysvalueof{/tikz/outlined/contour length}}%
\path (\pgfkeysvalueof{/tikz/outlined/shadow xshift},%
\pgfkeysvalueof{/tikz/outlined/shadow yshift})
node[text=\pgfkeysvalueof{/tikz/outlined/shadow color},font=\pgfkeysvalueof{/tikz/outlined/font}]{#2}
(0,0) node[font=\pgfkeysvalueof{/tikz/outlined/font}] (X) {\contour{\pgfkeysvalueof{/tikz/outlined/contour color}}{\textcolor{white}{#2}}};}}
\begin{document}
$f:\OutlinedWithShadow{R}\ni x\mapsto \lfloor x\rfloor\in \OutlinedWithShadow{Z}$
or \OutlinedWithShadow{$\alpha\,\beta\,\gamma$}
\OutlinedWithShadow[shadow xshift=0.1ex,shadow yshift=0.08ex]{R}
\end{document}