2

I want to write text above/below the subset/subset equal sign. Is there any way that I can do it without making an abomination? i.e. a long text above/below a small symbol!

6
  • 1
    Avoid it and place the text on the side
    – egreg
    Apr 19, 2022 at 17:24
  • Or consider using an extensible inclusion arrow: \lhook\joinrel\xrightarrow
    – Sigur
    Apr 19, 2022 at 17:25
  • There is no means to do that then? I mean it's disappointing since there is already such a tool for right arrows, equal sign, etc. with the same $\xrightarrow$, $xlongequal$, ... commands.
    – Master.AKA
    Apr 19, 2022 at 17:28
  • Well technically you can typeset whatever you want in TeX, it's just that (probably) nobody have made a LaTeX library to do exactly that for you...
    – user202729
    Apr 19, 2022 at 17:48
  • maybe look at stackengine package,
    – user202729
    Apr 19, 2022 at 17:49

2 Answers 2

4

You might reproduce the working of \xleftarrow by using a repeatable consisting of a clipped \subseteq symbol.

\documentclass{article}
\usepackage{amsmath}
\usepackage{trimclip}

\makeatletter
\newcommand{\joinsubseteq}{%
  \mathrel{\hbox{\clipbox{{0.45\width} 0 0 0}{$\m@th\subseteq$}}}%
}
\newcommand{\xsubseteq}[2][]{%
  \ext@arrow 3095 \subseteqfill@{#1}{#2}%
}
\newcommand{\subseteqfill@}{\arrowfill@\subseteq\joinsubseteq\joinsubseteq}
\newcommand{\joinsupseteq}{%
  \mathrel{\hbox{\clipbox{0 0 {0.45\width} 0}{$\m@th\supseteq$}}}%
}
\newcommand{\xsupseteq}[2][]{%
  \ext@arrow 0359 \supseteqfill@{#1}{#2}%
}
\newcommand{\supseteqfill@}{\arrowfill@\joinsupseteq\joinsupseteq\supseteq}
\makeatletter

\begin{document}

$A \xsubseteq{\text{some long text}} B$

$A \xsupseteq{\text{some long text}} B$

\end{document}

I'm afraid that the result is as ugly as it could be.

enter image description here

Some background

The \xleftarrow and \xrightarrow commands are built upon a generic command \ext@arrow that takes seven parameters. The first four are digits related to spacing: how much the “arrow” has to extend beyond the text above or below, plus corrections in order not to clash with the arrow tip; here I just copied them from the code for the arrows, because we don't want that the text sits above the curved part. The fifth argument is a command that builds the arrow from pieces, see later. The sixth and seventh arguments are the text to go below and above, respectively.

Next the task is to build the “arrows”. The standard ones are done with \rightarrowfill@ and \leftarrowfill@, so I looked at their definition. For instance, we find

% amsmath.sty, line 974:
\def\leftarrowfill@{\arrowfill@\leftarrow\relbar\relbar}

So this macro is built upon another generic macro, namely \arrowfill@

% amsmath.sty, line 968:
\def\arrowfill@#1#2#3#4{%
  $\m@th\thickmuskip0mu\medmuskip\thickmuskip\thinmuskip\thickmuskip
   \relax#4#1\mkern-7mu%
   \cleaders\hbox{$#4\mkern-2mu#2\mkern-2mu$}\hfill
   \mkern-7mu#3$%
}

Don't worry, we don't need to understand this, just to know that it does the right thing. \arrowfill@ requires four arguments, but the fourth will be supplied by \ext@arrow and is not of a concern. The important thing is that it must be followed by three main tokens: the start, the repeater and the end. It's \arrowfill@ that takes care of filling the required space with the repeater.

So a macro \xleftrightarrow would eventually call \arrowfill@\leftarrow\relbar\rightarrow, whereas \xleftarrow calls \arrowfill@\leftarrow\relbar\relbar.

The \relbar macro builds a relation symbol from the minus sign, which is used as an extender. In our case we need to clip the \subseteq symbol to remove the curved part; this will join appropriately with the starting symbol. To see what \clipbox does, look in the documentation for trimclip.

3
  • It actually seems pretty neat! The only thing is that I don't understand your code :(
    – Master.AKA
    Apr 20, 2022 at 2:29
  • @Master.AKA Well, TeX's learning curve is pretty steep. There are posts around on the site for learning TeX, but only if you want to put in lots of effort.
    – user202729
    Apr 20, 2022 at 7:18
  • 1
    @Master.AKA I added some background; but that's not “entry level” and a full explanation would require much more. The code of amsmath is very optimized and a bit cryptic at times.
    – egreg
    Apr 20, 2022 at 8:13
0

I found this hack for now. But I think if the text is going to be very long, it will still look ugly.

\resizebox{ 4ex }{ 2ex } { $\subseteq$ }

The \subseteq command should be between dollars (as I understood) even if the \resizebox command itself is part of a math mode environment!

You must log in to answer this question.

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