1

Correct subscript size not taken using stackengine package, please find MWE file is as follows:

\documentclass{book}

\usepackage{stackengine}
\newcommand{\Utildesim}[1]{%
  \ensurestackMath{\stackengine{1pt}{#1}{\sim}{U}{c}{F}{F}{S}}\vphantom{#1}%
}

\begin{document}
\noindent{}${\Utildesim{\mathrm{A}}} (x )$and the symbol $\mu _{\Utildesim{\mathrm{A}}} (x )$ is the degree of membership of element \textit{x} in fuzzy set $\Utildesim{\mathrm{A}}$. Therefore, $\mu _{\Utildesim{\mathrm{A}}} (x )$ is a value on the unit interval that measures the degree to which element \textit{x} belongs to fuzzy set $\Utildesim{\mathrm{A}}$; equivalently, $\mu _{\Utildesim{\mathrm{A}}} (x )$ = degree to which $x\in \protect\Utildesim{\mathrm{A}}$.
\end{document}

enter image description here

6
  • 1
    Why don't you simply use the \undertilde command from accents? – Bernard Jul 13 '20 at 8:38
  • 1
    accents package not exactly centered to the character that why I choose stackengine package. – Rajesh N Jul 13 '20 at 8:39
  • Package used \usepackage{accents}\usepackage{stix} TeX code: \noindent{}${\underaccent{\sim}{\mathrm{A}}} (x )$ – Rajesh N Jul 13 '20 at 8:44
  • You can add a small correction, like this: ${\underaccent{\,sim}{\mathrm{A}}} (x )$. – Bernard Jul 13 '20 at 9:10
  • Is there any other option to control macro itself, in my books, there were almost ~1000 occurrences with different character. – Rajesh N Jul 13 '20 at 9:13
1

It is true that stackengine does not preserve the math style that is current at the time of invocation. One solution is to additionally use features of the scalerel package (namely \ThisStyle{...\SavedStyle...}) to save and restore the current math style where needed inside the stack.

Additionally, I set the stack gap to 1\LMpt, which, inside of a \ThisStyle, is set to a nominal value of 1pt, but scaled to the size of the current math style.

\documentclass{book}

\usepackage{stackengine,scalerel}
\newcommand{\Utildesim}[1]{\ThisStyle{%
  \ensurestackMath{\stackengine{1\LMpt}{\SavedStyle#1}{\SavedStyle\sim}
  {U}{c}{F}{F}{S}}\vphantom{#1}}}

\begin{document}
\noindent{}${\Utildesim{\mathrm{A}}} (x )$and the symbol $\mu _{\Utildesim{\mathrm{A}}} (x )$ is the degree of membership of element \textit{x} in fuzzy set $\Utildesim{\mathrm{A}}$. Therefore, $\mu _{\Utildesim{\mathrm{A}}} (x )$ is a value on the unit interval that measures the degree to which element \textit{x} belongs to fuzzy set $\Utildesim{\mathrm{A}}$; equivalently, $\mu _{\Utildesim{\mathrm{A}}} (x )$ = degree to which $x\in \protect\Utildesim{\mathrm{A}}$.
\end{document}

enter image description here

2
  • Excellent Answer, Thank you, Segletes. – Rajesh N Jul 14 '20 at 11:14
  • @RajeshN You are welcome. You will find the \ThisStyle approach can be very useful for importing the current math style into places where it is otherwise lost, such as boxes and stacks. I have a lot of answers on this site which use the scalerel/stackengine combination in this way. – Steven B. Segletes Jul 14 '20 at 11:17

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.