Boondox calligraphic math font and Arev math font do not have the same height for their upper-case letters and their lower-case letters.
Adapting the answer of Fake small caps with XeTeX/fontspec?, I used scalebox
to define and correct the heights so that they match for upper-case and lower-case letters. See below the implementation of the new macro \mathcalbd
that includes the height correction and the basic macro \mathcalbdnocorr
that excludes the correction.
Two problems occur:
- subscripts and superscripts are not supported
- there is a conflict with package
bm
\documentclass{article}
\usepackage{graphicx}
\usepackage{arevmath}
\usepackage{amsmath}
% \usepackage{bm}
\DeclareFontFamily{U}{BOONDOX-calo}{\skewchar\font=45}
\DeclareFontShape{U}{BOONDOX-calo}{m}{n}{<-> BOONDOX-r-calo}{}
\DeclareFontShape{U}{BOONDOX-calo}{b}{n}{<-> BOONDOX-b-calo}{}
\makeatletter
\DeclareMathAlphabet{\m@thcalbd}{U}{BOONDOX-calo}{m}{n}
\SetMathAlphabet{\m@thcalbd}{bold}{U}{BOONDOX-calo}{b}{n}
% https://tex.stackexchange.com/questions/55664/
\def\calfont@helper#1 #2\relax{%
\@calfont@helper#1\relax\relax%
\if\relax#2\relax\else\ \@calfont@helper#2\relax\fi}
\def\@calfont@helper#1#2\relax{%
\ifcat\relax#1#1% for escape sequences
\else%
\ifnum`#1=\lccode`#1\relax%
\mathchoice%
{\scalebox{1.20529}{$\m@th\m@thcalbd{#1}$}}%
{\scalebox{1.20529}{$\m@th\m@thcalbd{#1}$}}%
{\scalebox{.90396}{$\m@th\mkern-1.5mu\m@thcalbd{#1}$}}%
{\scalebox{.70308}{$\m@th\mkern-1.1mu\m@thcalbd{#1}$}}%
\else\m@thcalbd{#1}\fi%
\fi%
\ifx\relax#2\relax\else\@calfont@helper#2\relax\fi}
\newcommand*{\mathcalbd}[1]{\bgroup\calfont@helper#1 \relax\relax\egroup}
\newcommand*{\mathcalbdnocorr}[1]{\m@thcalbd{#1}}
\makeatother
\begin{document}
Without height correction: $A\mathcalbdnocorr{A} a\mathcalbdnocorr{a}$
With height correction: $A\mathcalbd{A} a\mathcalbd{a}$
\bigskip
Two problems with the \verb+\mathcalbd+ macro:
\begin{enumerate}
\item \verb+\mathcalbd{A_a}+ does not work while
\verb+\mathcalbdnocorr{A_a}+ does ($\mathcalbdnocorr{A_a}$). Same is
true for superscripts.
\item \verb+\boldsymbol{\mathcalbd{A}}+ ($\boldsymbol{\mathcalbd{A}}$)
does not work if package \texttt{bm} is loaded
\end{enumerate}
\end{document}