%%
%% The LaTeX Companion, 3ed
%%
%% Example 3-3-17 on page I-166 in "xfrac --- Customizable \protect \sfrac [hls-bf]{text}{fractions}".
%%
%% Copyright (C) 2022 Frank Mittelbach
%%
%% It may be distributed and/or modified under the conditions
%% of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%%
%% See https://www.latex-project.org/lppl.txt for details.
%%

\documentclass{tlc3exa}
\pagestyle{empty}
\setcounter{page}{6}
\setlength\textwidth{63.0pt}
\setlength\parindent{0pt}
\usepackage{xfrac}

%StartShownPreambleCommands
\usepackage{xfrac,lmodern}
\EditInstance{xfrac}{lmr} {slash-symbol-format=\textnormal{#1}}
\EditInstance{xfrac}{lmss}{slash-symbol-format=\textnormal{\sffamily #1}}
\EditInstance{xfrac}{lmtt}{slash-symbol-font  =lmss}
%StopShownPreambleCommands

\begin{document}
\rmfamily \sfrac{1}{2}  \itshape \sfrac{3}{4}  \bfseries \sfrac{5}{6}  \\
\sffamily \sfrac{7}{10} \upshape \sfrac{8}{15} \mdseries \sfrac{9}{23} \\
\ttfamily \sfrac{1}{25} \slshape \sfrac{1}{100} \bfseries \sfrac{1}{1000}
\end{document}