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.
2 Answers
\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.

- 88,848
- 231,401
You can define a generic \superimpose macro and then use it for various purposes. Add also the desired math atom class for the built symbol.
Note, however, that \superimpose only makes sense in the context of \mathpalette.
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\newcommand{\superimpose}[2]{{%
\ooalign{%
\hfil$\m@th#1@firstoftwo#2$\hfil\cr
\hfil$\m@th#1@secondoftwo#2$\hfil\cr
}%
}}
\makeatother
\newcommand{\veewedge}{\mathbin{\mathpalette\superimpose{{\vee}{\wedge}}}}
\newcommand{\lessgreater}{\mathrel{\mathpalette\superimpose{{<}{>}}}}
\newcommand{\strikeQ}{\mathpalette\superimpose{{\textnormal{---}}{Q}}}
\newcommand{\dotineq}{\mathrel{\mathpalette\superimpose{{=}{\cdot}}}}
\begin{document}
$\veewedge_{\veewedge}\lessgreater_{\lessgreater}\strikeQ_{\strikeQ}$
$A\dotineq B$ $\scriptstyle A\dotineq B$
\end{document}
With a different and perhaps more intuitive syntax:
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\newcommand{\superimpose}[3][\mathord]{#1{\mathpalette\superimpose@{{#2}{#3}}}}
\newcommand{\superimpose@}[2]{\superimpose@@{#1}#2}
\newcommand{\superimpose@@}[3]{%
\ooalign{%
\hfil$\m@th#1#2$\hfil\cr
\hfil$\m@th#1#3$\hfil\cr
}%
}
\makeatother
\newcommand{\veewedge}{\superimpose[\mathbin]{\vee}{\wedge}}
\newcommand{\lessgreater}{\superimpose[\mathrel]{<}{>}}
\newcommand{\strikeQ}{\superimpose{\textnormal{---}}{Q}}
\newcommand{\dotineq}{\superimpose[\mathrel]{=}{\cdot}}
\begin{document}
$\veewedge_{\veewedge}\lessgreater_{\lessgreater}\strikeQ_{\strikeQ}$
$A\dotineq B$ $\scriptstyle A\dotineq B$
\end{document}
- 1,121,712

\newcommandor\newcommand*make a difference here? – Mankka Aug 20 '20 at 15:29\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\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 09:24\newcommand{\at}{\mathrel{\mathpalette\superimpose{{\diamond}{|}}}}should do. – egreg Aug 21 '20 at 09:571muis just right. :) – Mankka Aug 21 '20 at 12:17\superimpose@@, which seems to be called only with two by\superimpose@? – Aubergine Oct 31 '22 at 20:34