# How to combine glyphs in a resizable way for formulas?

I want to glue two glyphs together in order to produce a new glyph because I ran out of letters for my formulas. For example, I combine H and K such that the right vertical part of H coincides with the left vertical of K:

\newcommand{\HK}{H\hspace*{-0.5em}K}


This looks quite good and even scales because of the em unit. But in formulas, namely fractions, it doesn't scale properly any more. Which trick solves this?

My minimal example

 \documentclass{article}
\usepackage[latin9]{luainputenc}
\begin{document}

\newcommand{\HK}{H\hspace*{-0.5em}K}

$\HK$

$HK$ for comparison.

{\Large{}$\HK${\Large{}$\HK$}}{\Large \par}

{\huge{}$\HK$}{\huge \par}

{\huge{}$\frac{\HK}{2}$}{\huge \par}

{$\frac{\HK}{2}$}{\par}

%{$\frac{\bsHK}{2}$}{\par}
\end{document}


produces

I want the new glyphs in the fractions to look like the preceding ones. By the way, this procedure would also offer a way to kludge bold glyphs if they do not exist.

\documentclass{article}
% \usepackage[latin9]{luainputenc}
\usepackage{scalerel}
\def\scriptstyleScaleFactor{0.75}
%\def\scriptscriptstyleScaleFactor{0.5}
\begin{document}

\newcommand{\HK}{\ThisStyle{H\hspace*{-1.15\LMex}K}}

$\HK$

$HK$ for comparison.

{\Large{}$\HK${\Large{}$\HK$}}{\Large \par}

{\huge{}$\HK$}{\huge \par}

{\huge{}$\frac{\HK}{2}$}{\huge \par}

{$\frac{\HK}{2}$}{\par}

%{$\frac{\bsHK}{2}$}{\par}
\end{document}


• What is the advantage of this solution with the scalerel package? Aug 9 '16 at 16:29
• @HorstGrünbusch None, given that egreg showed it was not needed. I probably should delete the answer. Aug 9 '16 at 16:53
• @HorstGrünbusch ...although his method does seem to have some issues with \huge$\HK$ unless my eyes deceive me. Aug 9 '16 at 17:04
• Please do not delete this answer. +1 for using scalerel on horizontal spacing. I'm still comparing the answers. Aug 9 '16 at 18:21

You want to use the em in the proper size:

\documentclass{article}
\usepackage{amsmath}

\newcommand{\HK}{H\text{\hspace*{-0.5em}}K}

\begin{document}

$\HK_{\HK}\frac{\HK}{2}$

\end{document}


• Why does \huge$\HK$ look so bad? Aug 9 '16 at 17:09