davidcarlisle / dpctex

Assorted TeX packages
93 stars 30 forks source link

hook for font setup in bm.sty #24

Closed u-fischer closed 3 years ago

u-fischer commented 4 years ago

The sansmathaccent package (used by beamer) wants to setup some math fonts as late as possible (to be able not to do it if the preamble changed the settings) but before bm (as it doesn't work later). Currently is used the filehook package and its \AtBeginOfFile command, but this breaks in some documents due to an incompability with scrlfile.

Couldn't bm add some hook for font setup so that filehook is no longer needed in such cases?

\RequirePackage{filehook}
\def\AtBeginOfFile#1#2{}%disable filehook command in sansmathaccent
\documentclass{beamer}
%\usepackage{bm} %doesn't work, accent wrong
% how to activate this only if bm is loaded?
\DeclareSymbolFont{pureletters}{OT1}{mathkerncmss}{m}{sl}
\SetSymbolFont    {pureletters}{bold}{OT1}{mathkerncmss}{bx}{sl}

\usepackage{bm}
\begin{document}
\begin{frame}
$\tilde{M} \bm{\tilde{M}}$
\end{frame}
\end{document}
davidcarlisle commented 3 years ago

@u-fischer do you think bm should have a custom hook here or (now) can we use the standard package hooks?

u-fischer commented 3 years ago

Probably the incompatibility is gone now anyway, I can check later. But it should be also possible now to do it with the package hooks. I will write to the package author and suggest it.

u-fischer commented 3 years ago

Well I had forgotten but sansmathaccent dropped filehook and switched to scrlfile, and scrlfile is based on the new hooks, so it uses the new hooks. I think that is good enough.