如何制作一组实数符号,但内部为空,就像图中这样?

如何制作一组实数符号,但内部为空,就像图中这样?

实数集

有人知道如何制作如图所示的实数符号吗?我的意思是相同的符号。它就像 R,但里面是空的。

答案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

欢迎!如果您在某个目录中找不到此符号,您可以随时使用contourtikz将任何字符或文本转换为此样式。为了方便起见,我将参数存储在键中。

\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}

在此处输入图片描述

相关内容