1

I am trying to insert symbols into $\Box$ and $\Diamond$.

I do it in the following way.

First I define commands for blank operators for future and past:

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

Then I define command to superimpose operators with symbols:

\makeatletter
  \newcommand{\superimpose}[2]
              {%
                {\ooalign{$#1\@firstoftwo#2$\cr\hfil$#1\@secondoftwo#2$\hfil\cr}}
              }
  \makeatother

Then I use the aboce commands to insert the symbols F, S and f inside the operators:

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

What I have received is the following:

Result

But I suspect I do it in a wrong way. I am sure It must be very heavy weight code to compile.

May I receive the same result in more correct way, with some kind of more lighter code?

2

1 Answer 1

2

Here's a possibly better approach:

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

This assumes you don't want to use these symbols in subscripts or superscripts. You may want to define commands instead of using \PF directly.

image

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .