0

I like mathdesign package, but spacing between some letters looks pretty awful, for example, look at the letter A:

enter image description here

I've found the solution here: Make Characters Active via Macro in Math Mode. So, with this code

\makeatletter
\newcommand{\DeclareMathActive}[2]{%
    % #1 is the character, #2 is the definition
    \expandafter\edef\csname keep@#1@code\endcsname{\mathchar\the\mathcode`#1 }
    \begingroup\lccode`~=`#1\relax
    \lowercase{\endgroup\def~}{#2}%
    \AtBeginDocument{\mathcode`#1="8000}%
}
\newcommand{\std}[1]{\csname keep@#1@code\endcsname}
\makeatother
\DeclareMathActive{A}{\mkern+1.5mu\std{A}\mkern+1.5mu}

the spacing became much better:

enter image description here

But I still have some questions regarding this code:

  1. Is there a way to keep original subscript/superscript spacing for this letter? It would be logical if superscript was a bit more to the left than subscript.

  2. Since I wasn't sure about the answer to the previous question, I've decided to find the way how to define this spacing myself, and here is the answer: Kerning super- and subscripts "semantically". But sometimes I need to use this character as sub/superscript itself, and I want to be able to write this: X_A. Right now I can just add a pair of brackets in the definition: \DeclareMathActive{A}{{\mkern+1.5mu\std{A}\mkern+1.5mu}}. But futurelet won't work after that.

  3. Is there any other drawback in making characters active in math mode?

  4. Does exist any other way to adjust spacing for a character in math mode?
4
  • 1
    Welcome to TeX SX! In math mode you can use \mkern. For instance, for a superscript which needs to be adjusted, you can use A^{\! n}$ (\! is a negative kerning equal to -3 mu (mathematical unit equal ti 1/18 em), or, slightly more adjusted A^{\mkern -5mu n}$
    – Bernard
    Mar 7 '20 at 19:27
  • @Bernard, yes, I know that. What I'm interested in is how can I get right adjustment automatically (by writing something in preamble).
    – Kumquat
    Mar 7 '20 at 19:58
  • I'm afraid this would imply writing a special macro for exponent. As I see it, only the letters $A$ and $L$ would be involved. Maybe it would be more of an editor macro to automatically add a negative kerning under conditions?
    – Bernard
    Mar 7 '20 at 20:04
  • @Bernard, writing a macro is not a problem for me -- and by the way, in the second link there is a code (I don't understand what relation does it have to letters A and L). That's just not my question.
    – Kumquat
    Mar 7 '20 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.