我正在尝试将符号插入到$\Box$和$\Diamond$中。
我按照下列方式进行。
首先,我定义用于将来和过去的空白运算符的命令:
\newcommand{\pastDiamond}
{
\text{\raisebox{-.37em}{
\topinset{$\rule{.3em}{.8pt}$}
{$\mathlarger{\mathlarger{\mathlarger{\mathlarger\Diamond}}}$}
{3.8pt}
{-4pt}}
}
}%
\newcommand{\futureDiamond}
{
\text{\raisebox{-.37em}{
\topinset{$\rule{.3em}{.8pt}$}
{$\mathlarger{\mathlarger{\mathlarger{\mathlarger\Diamond}}}$}
{3.8pt}
{4pt}}
}
}%
\newcommand{\pastBox}
{
\text{\raisebox{-.19em}{
\topinset{$\rule{.25em}{.8pt}$}
{$\mathlarger{\mathlarger{\mathlarger{\mathlarger\Box}}}$}
{4.5pt}
{-3.5pt}}
}
}%
\newcommand{\futureBox}
{
\text{\raisebox{-.19em}{
\topinset{$\rule{.25em}{.8pt}$}
{$\mathlarger{\mathlarger{\mathlarger{\mathlarger\Box}}}$}
{4.5pt}
{3.5pt}}
}
}%
然后我定义命令来将运算符与符号叠加:
\makeatletter
\newcommand{\superimpose}[2]
{%
{\ooalign{$#1\@firstoftwo#2$\cr\hfil$#1\@secondoftwo#2$\hfil\cr}}
}
\makeatother
然后我使用上面的命令插入符号F,年代和F在操作符内部:
\newcommand{\FFutureDiamond}{\!\!\!\!\mathpalette\superimpose{{\futureDiamond}{{\mathsmaller{F}}}}}
\newcommand{\FPastDiamond}{\!\!\!\!\mathpalette\superimpose{{\pastDiamond}{{\mathsmaller{F}}}}}
\newcommand{\SFutureDiamond}{\!\!\!\!\mathpalette\superimpose{{\futureDiamond}{{\mathsmaller{S}}}}}
\newcommand{\SPastDiamond}{\!\!\!\!\mathpalette\superimpose{{\pastDiamond}{{\mathsmaller{S}}}}}
\newcommand{\fFutureDiamond}{\!\!\!\!\mathpalette\superimpose{{\futureDiamond}{\mathsmaller{f}}}}
\newcommand{\fPastDiamond}{\!\!\!\!\mathpalette\superimpose{{\pastDiamond}{\mathsmaller{f}}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\FFutureBox}{\!\!\!\!\mathpalette\superimpose{{\futureBox}{{\mathsmaller{F}}}}}
\newcommand{\FPastBox}{\!\!\!\!\mathpalette\superimpose{{\pastBox}{{\mathsmaller{F}}}}}
\newcommand{\SFutureBox}{\!\!\!\!\mathpalette\superimpose{{\futureBox}{{\mathsmaller{S}}}}}
\newcommand{\SPastBox}{\!\!\!\!\mathpalette\superimpose{{\pastBox}{{\mathsmaller{S}}}}}
\newcommand{\fFutureBox}{\!\!\!\!\mathpalette\superimpose{{\futureBox}{\mathsmaller{f}}}}
\newcommand{\fPastBox}{\!\!\!\!\mathpalette\superimpose{{\pastBox}{\mathsmaller{f}}}}
我收到的信息如下:
但我怀疑我的方法不对。我确信这肯定是编译起来很繁重的代码。
我是否可以使用某种更轻量的代码,以更正确的方式获得相同的结果?
答案1
这是一个可能更好的方法:
\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{graphicx}
\makeatletter
\newcommand{\BigBox}{\scalebox{1.7}{$\m@th\Box$}}
\newcommand{\BigDiamond}{\rotatebox[origin=c]{45}{\BigBox}}
\newcommand{\PF}[3]{\mathord{% ensure math mode
\vphantom{#1}%
\ooalign{$\m@th\vcenter{\hbox{#1}}$\cr#2\cr\hidewidth$\m@th\mathop{#3}$\hidewidth\cr}%
}}
\newcommand{\Past}{$\m@th\mskip2mu\vcenter{\hrule width 0.25em height 0.2ex}$\hidewidth}
\newcommand{\Future}{\hidewidth$\m@th\vcenter{\hrule width 0.25em height 0.2ex}\,$}
\makeatother
\begin{document}
$\PF{\BigBox}{\Past}{S}$
$\PF{\BigBox}{\Past}{F}$
$\PF{\BigBox}{\Past}{f}$
$\PF{\BigBox}{\Future}{S}$
$\PF{\BigBox}{\Future}{F}$
$\PF{\BigBox}{\Future}{f}$
$\PF{\BigDiamond}{\Past}{S}$
$\PF{\BigDiamond}{\Past}{F}$
$\PF{\BigDiamond}{\Past}{f}$
$\PF{\BigDiamond}{\Future}{S}$
$\PF{\BigDiamond}{\Future}{F}$
$\PF{\BigDiamond}{\Future}{f}$
\end{document}
假设您不想在下标或上标中使用这些符号。您可能希望定义命令而不是\PF
直接使用。