Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
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. –  Gonzalo Medina Apr 14 '11 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 Apr 14 '11 at 15:54
add comment

2 Answers

up vote 1 down vote accepted

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}
share|improve this answer
    
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? –  Willie Wong Apr 15 '11 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. –  Willie Wong Apr 15 '11 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%. –  Willie Wong Apr 15 '11 at 13:47
    
@Willie: I can't imagine why the code doesn't work for you with pdflatex. It is what I used. –  TH. Apr 15 '11 at 14:44
    
@Willie: If \scalebox works, then so should \resizebox. They both end up using the same macro \Gscale@box. –  TH. Apr 15 '11 at 14:47
show 4 more comments

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

share|improve this answer
    
To save on preaction, you could use double, double equal sign distance (as I just found out for a similar problem). –  Caramdir Apr 14 '11 at 21:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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