4

This question is very similar to Extendible equals sign but the solutions given there do not apply immediately.

At times I woud like to clarify the nature of a mathematical congruence. So I have defined in my preamble

\newcommand*\morph[1]{\underset{\mbox{\tiny #1}}{\cong}}

So I can write things like \morph{diff} and \morph{hom} to differentiate between different congruences. But even with the \mbox content set to \tiny, the text is still wider than the congruence sign. Any ideas?

2
  • Reducing the font size, although possible, would make the label almost illegible; on the other side, making an extended version of \cong will produce (IMO) inconsistent results. In this particular case (again, in my opinion) I'd rather stick to the behaviour exhibited by your current definition. Another option would be to select different symbols. Commented Apr 14, 2011 at 15:25
  • Sometimes, when I have this sort of issue with features not in LaTeX that I think I want, I realize after trying to produce them that they are absent because they are a bad idea. It looks to me like you want to label "congruences" which are isomorphisms, in which case perhaps you could use \xrightarrow[under]{over} and put a \sim in one position? You could also use \widetilde to some (probably limited) extent to place a tilde over an extendible equals sign, though I haven't tried it so I'll leave the suggestion here as a comment.
    – Ryan Reich
    Commented Apr 14, 2011 at 15:54

2 Answers 2

1

One could always use \resizebox to stretch the symbol.

\documentclass{article}
\usepackage{amsmath,graphicx}
\makeatletter
\newcommand*\morph[1]{%
    \setbox0=\hbox{\scriptsize#1}%
    \setbox2=\hbox{$\m@th{\cong}$}%
    \stackrel{\copy0}{%
        \ifdim\wd2<\wd0
            \resizebox{\wd0}{\ht2}{$\m@th{\cong}$}%
        \else
            \cong
        \fi
    }%
}
\begin{document}
\[X\morph{long text}Y\morph{i}Z\]
\end{document}
9
  • Hum, something's weird. It works if I invoke using latex test; dvipdf test; xpdf test.pdf. But it doesn't work if I invoke using pdflatex test; xpdf test.pdf. Any ideas? Commented Apr 15, 2011 at 13:11
  • Let me clarify: doesn't work means "where the symbol should display, there is nothing there." \resizebox works by itself with pdflatex: if I have something inline like \resizebox{3cm}{2cm}{test} or the same with something in mathmode inside the third argument, it gets displayed and scaled. But somehow not the command you gave above. Commented Apr 15, 2011 at 13:14
  • Hum, \scalebox however doesn't have the same problems. Looking at my use case, I am happy to now just scale the width of the symbol by 33%. Commented Apr 15, 2011 at 13:47
  • @Willie: I can't imagine why the code doesn't work for you with pdflatex. It is what I used.
    – TH.
    Commented Apr 15, 2011 at 14:44
  • @Willie: If \scalebox works, then so should \resizebox. They both end up using the same macro \Gscale@box.
    – TH.
    Commented Apr 15, 2011 at 14:47
3

Of course, whilst agreeing that this Not Recommended, it's also fairly similar to something I do: I like to make arrows and so forth a little more conspicuous in presentation by making them a bit bigger. So my method for doing that adapts reasonably well to this situation.

That method is to use ... TikZ!

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}

\newcommand{\xcong}[1]{%
\mathrel{\tikz[baseline=0pt] {
   \node[above] at (0,1.2ex) (a) {\(\scriptstyle #1\)};
   \draw[preaction={
      transform canvas={yshift=-.5ex},
      draw,
      decorate,
      decoration={lineto}},
     preaction={
      transform canvas={yshift=-1ex},
      draw,
      decorate,
      decoration={lineto}}]
    (a.south west) .. controls +(.25,.15) and +(-.25,-.15) .. (a.south east);
 }}}

\begin{document}
\(
A \cong B \quad A \xcong{a,b,c,d,e,f,g,h} B
\)
\end{document}

Okay, it's not going to win any design awards ...

extensible congruence sign

5
  • To save on preaction, you could use double, double equal sign distance (as I just found out for a similar problem).
    – Caramdir
    Commented Apr 14, 2011 at 21:25
  • 1
    Have you heard of the calligraphy library? (Just kidding.;-) I think this will allow one to produce an even nicer version thereof, which could also be used in packages like tikz-cd.
    – user194703
    Commented May 14, 2020 at 22:57
  • @Schrödinger'scat I'd have to check the dates, but my guess would be that this predates that library by a good year or so. Nice idea, though. Commented May 14, 2020 at 23:34
  • 1
    I think so, too. But it would make a great extensible wide tilde, I'd think.
    – user194703
    Commented May 14, 2020 at 23:38
  • Feel free to have a go! You'd get a guaranteed up-vote from me. Commented May 14, 2020 at 23:44

You must log in to answer this question.

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