37

I want to superimpose two symbols, e.g. I want to superimpose \vee and \wedge and > and < symbols over each other (not above each other as in stackrel) and Q with a horizontal strike through like bar across it. I am using LyX 2.0.

0
35

\rlap and \llap can be used to print a symbol without a width. Similar, the mathtools package provides commands \mathrlap, \mathclap, \mathllap. These commands offer a quick way for overlapping symbols.

Example, overlapping \vee, \wedge and Q like desired in your question:

\documentclass{article}
\usepackage{mathtools}
\begin{document}
$\mathrlap{\vee}\wedge$
\rlap{Q}---
\end{document}

While \rlap produces a zero-width box where the content sticks out to the right, \llap does the same but to the left. \mathclap centers to the current position.

enter image description here

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

\newcommand{\veewedge}{\mathpalette\superimpose{{\vee}{\wedge}}}
\newcommand{\lessgreater}{\mathpalette\superimpose{{<}{>}}}
\newcommand{\strikeQ}{\mathpalette\superimpose{{\text{---}}{Q}}}

$\veewedge_{\veewedge}\lessgreater_{\lessgreater}\strikeQ_{\strikeQ}$

The wider symbol must go first in the argument to \superimpose, which must consist of two braced objects. Of course \text requires amsmath.

If, say, \veewedge is to be considered as a relation symbol, the definition should be

\newcommand{\veewedge}{\mathrel{\mathpalette\superimpose{{\vee}{\wedge}}}}
6
  • Does using \newcommand or \newcommand* make a difference here?
    – Mankka
    Aug 20 '20 at 15:29
  • 1
    @Mankka You could indeed use \newcommand*{\superimpose}[2]{...} in order to have a check for no end of paragraph in the argument. But as the macro is used as an auxiliary for defining other macros, it's not really important. For parameterless macros, * or no * makes no essential difference.
    – egreg
    Aug 20 '20 at 15:32
  • I created a new symbol \newcommand*{\at}{\mathpalette\superimpose{{\diamond}{|}}} and I wanted slightly more space around it, so I tried \newcommand*{\at}{\mskip 1mu\mathpalette\superimpose{{\diamond}{|}}\mskip 1mu}. The latter does not align the symbols in (for example) since \(x \at T_D\) is. My random attempts did not solve this, so I would be grateful if you could suggest a solution.
    – Mankka
    Aug 21 '20 at 9:24
  • @Mankka I think you want the symbol to be a relation symbol, so \newcommand{\at}{\mathrel{\mathpalette\superimpose{{\diamond}{|}}}} should do.
    – egreg
    Aug 21 '20 at 9:57
  • 1
    @Mankka I disagree. Anyway, I see no misalignment with 1mu at either side.
    – egreg
    Aug 21 '20 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.