13

I need a character in plain TeX that combines a plus with a quadrilateral whose corners are the four endpoints of the plus. Is there a way to create such a thing?

I apologize for editing the question; I could not figure out how to enter an answer. I was able to construct the character using gpic, put the resulting specials in a box, and define \gjoin to copy from that box. I will use this character in the third edition of my graph theory textbook to denote the join of two graphs, for a variety of reasons. I believe it is a useful and natural character.

The suggested overstrike using \ooalign did not do the job for me. Drawing the character as lines that join four specified points should avoid spacing difficulties due to overstrikes.

Here is the answer I found:

\expandafter\ifx\csname dplus\endcsname\relax \csname newbox\endcsname\dplus\fi
\expandafter\ifx\csname dplustemp\endcsname\relax
\csname newdimen\endcsname\dplustemp\fi

\setbox\dplus=\vtop{\vskip -7pt\hbox{%  
    \kern .021in%  
    \special{pn 11}%  
    \special{pa 0 50}%  
    \special{pa 50 100}%  
    \special{fp}%  
    \special{pa 50 100}%  
    \special{pa 100 50}%  
    \special{fp}%  
    \special{pa 100 50}%  
    \special{pa 50 0}%  
    \special{fp}%  
    \special{pa 50 100}%  
    \special{pa 50 0}%  
    \special{fp}%  
    \special{pa 50 0}%  
    \special{pa 0 50}%  
    \special{fp}%  
    \special{pa 0 50}%  
    \special{pa 100 50}%  
    \special{fp}%  
    \hbox{\vrule depth0.100in width0pt height 0pt}%  
    \kern 0.110in  
  }%  
}%  

\def\gjoin{\copy\dplus}

$G\gjoin H$ and $G_1\gjoin G_2$
3
  • It might help if you have a sample and post it in your question.
    – topskip
    Commented Feb 10, 2012 at 8:28
  • is this standard notation, or a symbol you're defining yourself? it isn't in unicode. if it is standard notation, and examples published by "recognized" publishers can be provided, a case can be made for adding it to unicode. you can submit such a request by sending it to [email protected]. Commented Feb 10, 2012 at 13:46
  • We'd like to keep answers separate from questions, so you should write a separate answer instead of editing your answer into the question. Self-answers are perfectly admissible, and a well-written answer may earn you additional reputation.
    – Werner
    Commented Feb 10, 2012 at 19:34

4 Answers 4

8

There would basically be at least three obvious ways to accomplish this:

  1. Make the plus sign smaller so it fits inside the diamond, and
  2. Make the diamond sign bigger, so the plus sign fits inside, and
  3. Both of above, just not so much

each of which could be defined as

\font\Bigmath=cmsy10 scaled \magstep2
\font\bigmath=cmsy10 scaled \magstep1
\def\diamondplus{\mathrel{%
  \ooalign{\raise.29ex\hbox{$\scriptscriptstyle+$}\cr\hss$\diamond$\hss}}}
\def\diamondplustwo{\mathrel{%
  \ooalign{$+$\cr\hss\lower.255ex\hbox{\Bigmath\char5}\hss}}}
\def\diamondplusthree{\mathrel{%
  \ooalign{$\scriptstyle+$\cr\hss\lower.29ex\hbox{\bigmath\char5}\hss}}}
$$\displaylines{
  a \diamondplus b \cr
  a \diamondplustwo b \cr
  a \diamondplusthree b \cr
}$$
\bye

enter image description here

(don't mind the way they look on screen here, because depending on the zoom-level, the superimposed glyphs can drift a little on screen)

Note that the ex values used here are font face design dependant, so even changing to another Computer Modern optical size would break the positioning.

For more information on \ooalign, see this egreg's answer

9
  • .3ex seems a little off. How about .29ex? Commented Feb 10, 2012 at 9:18
  • @ToddLehman: you are absolutely right, I'll correct the answer. Thanks!
    – morbusg
    Commented Feb 10, 2012 at 9:23
  • Picture is still off, however. (That's how I noticed it orginally—it's about 1 pixel.) Commented Feb 10, 2012 at 9:39
  • @todd: You're right, I forgot to update the image. Thanks.
    – morbusg
    Commented Feb 10, 2012 at 9:53
  • 2
    if this is used in a footnote or a title (i.e., at a different size), the "other" size won't look as good. i'm intrigued by the problem of creating a size-independent technique, and will put it on my list of things to look into when time is available. Commented Feb 10, 2012 at 13:59
6

you can scale it by setting the unit.

\input pstricks
\def\gjoin{\psset{unit=0.15ex,linewidth=0.4pt}%
 \mathrel{\pspicture(10,10)
 \psline(5,0)(5,10)
 \psline(0,5)(10,5)
 \pspolygon(0,5)(5,10)(10,5)(5,0)
\endpspicture}}

$G \gjoin H$ and $G_1\gjoin G_2$

\bye

enter image description here

it should also take different font sizes into account.

2
  • on my screen, this shows up with the vertical rule a bit to the right, and the horizontal rule a bit low. the relative positioning doesn't change with changes in browser magnification (firefox). but it looks spot on when tex'ed and printed. so there's some roundoff problem in the conversion to e-pixels. Commented Feb 10, 2012 at 20:32
  • that depends on the magnification of the viewer. With xpdf it looks also a bit different for 600% and 400%. However, printing it should alsways be ok
    – user2478
    Commented Feb 10, 2012 at 20:38
2

Without pstricks or \ooalign, one can use \boxtimes as provided by amssym and the LaTeX graphics features with graphicx.

\input graphicx
\input amssym

\catcode`@=11
\def\diamondplus{\mathbin{\mathpalette\diamondplus@\relax}}
\def\diamondplus@#1#2{%
  \vcenter{%
    \hbox{%
      \setbox\z@=\hbox{$\m@th#1\oplus$}%
      \dimen@=\ht\z@ \advance\dimen@ \dp\z@
      \resizebox{!}{\dimen@}{%
        \rotatebox[origin=c]{45}{$\m@th#1\boxtimes$}%
      }% resizebox
    }% hbox
  }% vcenter
}
\catcode`@=12

$a\diamondplus b \oplus c$

$\scriptstyle a\diamondplus b$

\bye

enter image description here

1

You can rotate a \boxtimes:

\newcommand{\diamondplus}{\rotatebox[origin=c]{45}{$\boxtimes$}}
1
  • 2
    The question is about plain TeX. But one might use miniltx for importing \rotatebox.
    – egreg
    Commented Nov 13, 2022 at 0:17

You must log in to answer this question.

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