2

I want to make a latex symbol that contains a resized math symbol using \scriptscriptsize. However, when the scope containing the symbol is subject to a font resize, the \scriptscriptsize-ed symbol is not resized appropriately.

Please see this image, and note that the rightarrow size doesn't change as much as the tilde: Incorrect resize

Here is a snippet that demonstates the problem:

\documentclass{article}
\newcommand{\isoeq}{ 
\kern-0em\mathrel{\raisebox{0.13em}{${\sim}$}}
\kern-0.75em\mathrel{\raisebox{-0.13em}{${\scriptscriptstyle \to}$}}  
}

\begin{document}
{\normalsize $A \isoeq B$}, \quad {\Large $A \isoeq B$}
\end{document}

Could you explain how this is done correctly such that the rightarrow $\to$ above respects resizing.

1

I would define the symbol differently, with \scalebox:

\documentclass{article}
\usepackage{amsmath,graphicx}

\makeatletter
\newcommand{\isoeq}{\mathrel{\mathpalette\@isoeq\rightarrow}}
\newcommand{\qeosi}{\mathrel{\mathpalette\@isoeq\leftarrow}}
\newcommand{\@isoeq}[2]{%
  \ooalign{%
    \raisebox{0.2\height}{$\m@th#1\sim$}\cr
    \hidewidth\raisebox{-\height}{\scalebox{0.6}{$\m@th#1#2$}}\hidewidth\cr
  }%
}
\makeatother

\begin{document}

$A \isoeq B$ \quad {\Large $A \isoeq B$}

$X_{A\isoeq B}$ $A\qeosi B$

\end{document}

enter image description here

  • That is too sexy. Thank you. – Mikkel Rev May 6 at 20:58
1

The arrow is affected by the size change. If you add \showoutput you will see that the first one is at 5pt and the second is 7pt

.......\OMS/cmsy/m/n/5 !

and

.......\OMS/cmsy/m/n/7 !

Note however that the relative size of scriptscriptsyle compared to textstyle is not the same for all sizes, in particular to stop them becoming too small at small sizes, so as you are stacking a scriptscript character over a textstyle character the relative sizes is not constant, it would be easier to take both characters from the same style.

tilde over rightarrow is U+2972 and some fonts have it as a single glyph eg:

enter image description here

\documentclass{article}

\usepackage{stix2}

\begin{document}

$ A \similarrightarrow B$

\Large 
$ A \similarrightarrow B$

\end{document}
  • Is there a way to set the macro for each fontsize? If you would address this, it would be very helpful – Mikkel Rev May 6 at 19:20
  • @MikkelRev yes \DeclareMathSizes{text font size}{text math size}{script size}{script script size} but if you are using the default cm fonts then for historical reasons they are forced to a fixed set of sizes, but you can disable that by adding \RequirePackage{fix-cm} at the start of the document – David Carlisle May 6 at 19:26
  • I apologize, I suppose I wasn't precise: Suppose I want to use define one \newcommand{\isoeq}{ ... } when the surrounding text is \normalsize redefine it differently: \newcommand{\isoeq}{ *** } when the text is \footnotesize for example. Thanks for taking the time to help out! – Mikkel Rev May 6 at 19:34
  • @MikkelRev actually If you want to do this I would probably just define it at one size but then define your macro to be \resizebox{!}{1.2ex}{.....your macro} so it automatically scales to 1.2ex high or whatever size you want so changes with the font size without distorting – David Carlisle May 6 at 19:39

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.