If I try
\documentclass{article}
%\usepackage{kpfonts}
\usepackage{physics}
\begin{document}
$\vu{i}+\vu{j}$
\end{document}
(note that kpfonts
is commented out), I get
The dots are there and it's not surprising, because the package does
% Unit vector [star for Greek and italic Roman]
\DeclareDocumentCommand\vectorunit{ s m }{%
\IfBooleanTF{#1}
{\boldsymbol{\hat{#2}}}
{\mathbf{\hat{#2}}}%
}
% Shorthand for \vectorunit
\DeclareDocumentCommand\vu{}{\vectorunit}
(reformatted for clarity).
Here's a way out (not only for kpfonts
):
\documentclass{article}
\usepackage{kpfonts}
\usepackage{physics}
\makeatletter
\ifkp@sfmath
\DeclareSymbolFont{boldletters}{OT1}{jkpss\kp@fligm\kp@stylem}{b}{n}
\SetSymbolFont{boldletters}{bold}{OT1}{jkpss\kp@fligm\kp@stylem}{b}{n}
\else
\DeclareSymbolFont{boldletters}{OT1}{jkp\kp@famillem\kp@fligm\kp@stylem}{b}{n}
\SetSymbolFont{boldletters}{bold}{OT1}{jkp\kp@famillem\kp@fligm\kp@stylem}{b}{n}
\fi
\SetSymbolFont{boldletters}{rm}{OT1}{jkp\kp@famillem\kp@fligm\kp@stylem}{b}{n}
\SetSymbolFont{boldletters}{boldrm}{OT1}{jkp\kp@famillem\kp@fligm\kp@stylem}{b}{n}
\SetSymbolFont{boldletters}{sf}{OT1}{jkpss\kp@fligm\kp@stylem}{b}{n}
\SetSymbolFont{boldletters}{boldsf}{OT1}{jkpss\kp@fligm\kp@stylem}{b}{n}
\DeclareSymbolFontAlphabet{\mathbf}{boldletters}
\makeatother
\DeclareMathSymbol{\bi}{\mathord}{boldletters}{"10}
\DeclareMathSymbol{\bj}{\mathord}{boldletters}{"11}
\begin{document}
$\vu{\bi}+\vu{\bj}$
\textbf{i j \^{\i} \^{\j}}
i j
\end{document}
A “self-fixing" approach, so you can input \vu{i}
and \vu{j}
.
\documentclass{article}
\usepackage{kpfonts}
\usepackage{physics}
\makeatletter
\ifkp@sfmath
\DeclareSymbolFont{boldletters}{OT1}{jkpss\kp@fligm\kp@stylem}{b}{n}
\SetSymbolFont{boldletters}{bold}{OT1}{jkpss\kp@fligm\kp@stylem}{b}{n}
\else
\DeclareSymbolFont{boldletters}{OT1}{jkp\kp@famillem\kp@fligm\kp@stylem}{b}{n}
\SetSymbolFont{boldletters}{bold}{OT1}{jkp\kp@famillem\kp@fligm\kp@stylem}{b}{n}
\fi
\SetSymbolFont{boldletters}{rm}{OT1}{jkp\kp@famillem\kp@fligm\kp@stylem}{b}{n}
\SetSymbolFont{boldletters}{boldrm}{OT1}{jkp\kp@famillem\kp@fligm\kp@stylem}{b}{n}
\SetSymbolFont{boldletters}{sf}{OT1}{jkpss\kp@fligm\kp@stylem}{b}{n}
\SetSymbolFont{boldletters}{boldsf}{OT1}{jkpss\kp@fligm\kp@stylem}{b}{n}
\DeclareSymbolFontAlphabet{\mathbf}{boldletters}
\makeatother
\DeclareMathSymbol{\bi}{\mathord}{boldletters}{"10}
\DeclareMathSymbol{\bj}{\mathord}{boldletters}{"11}
\ExplSyntaxOn
\RenewDocumentCommand\vectorunit{ s m }
{
\IfBooleanTF{#1}
{\boldsymbol{\hat{#2}}}
{\mathbf{\hat{\fixphysics_replace:n{#2}}}}
}
\cs_new:Nn \fixphysics_replace:n
{
\str_case:nnF { #1 }
{
{ i } { \bi }
{ j } { \bj }
}
{ #1 }
}
\ExplSyntaxOff
\begin{document}
$\vu{i}+\vu{j}$
\textbf{i j \^{\i} \^{\j}}
i j
\end{document}