2

I imported a symbol from STIX based on this answer (see MWE) to use it with my normal font lmodern. It works great, but there is a difference in the baseline of the \varnothing and \varnothingstix character.

Is it possible to get the same baseline alignment?

MWE

\documentclass{article}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{amssymb}
\DeclareFontEncoding{LS1}{}{}
\DeclareFontSubstitution{LS1}{stix}{m}{n}
\newcommand*\varnothingstix{%
  \text{%
  \fontencoding{LS1}%
  \fontfamily{stix}%
  \fontseries{\textmathversion}%
  \fontshape{n}%
  \selectfont\symbol{"C9}}}
\makeatletter
  % the current math version is saved in \math@version
  \newcommand*\textmathversion{\csname textmv@\math@version\endcsname}
  \newcommand*\textmv@normal{m}
  \newcommand*\textmv@bold{b}
\makeatother
\begin{document}
  $\varnothingstix$ Some text

    $\varnothing$ Some text


\end{document}
user2653422
  • 2,333

1 Answers1

2

You can raise the symbol:

\documentclass{article}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{amssymb}

\DeclareFontEncoding{LS1}{}{}
\DeclareFontSubstitution{LS1}{stix}{m}{n}

\newcommand*\varnothingstix{%
  \text{%
    \usefont{LS1}{stix}{\textmathversion}{n}\raisebox{.15ex}{\symbol{"C9}}%
  }
}
\makeatletter
% the current math version is saved in \math@version
\newcommand*\textmathversion{\csname textmv@\math@version\endcsname}
\newcommand*\textmv@normal{m}
\newcommand*\textmv@bold{b}
\makeatother

\begin{document}

$\varnothingstix$ Some text\llap{\vrule height0pt depth.1pt width 3cm}

$\varnothing$ Some text\llap{\vrule height0pt depth.1pt width 3cm}

\end{document}

enter image description here

egreg
  • 1,121,712