如何将整个文档中的所有大写字母(数学样式)转换为 \mathsf 样式?

如何将整个文档中的所有大写字母(数学样式)转换为 \mathsf 样式?
\documentclass[14pt]{memoir}
\usepackage{ragged2e}
\usepackage{amssymb}
\usepackage{lipsum}  
\usepackage{titlesec}
\usepackage{microtype}
\usepackage{setspace}%espace bin stora
\renewcommand{\baselinestretch}{1.2}% 
\usepackage{lmodern}
\usepackage{amsfonts}
\usepackage{amstext}
\usepackage{uncial}
%\usepackage[OT1,euler-digits,euler-hat-accent,OT1,T1]{eulervm}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{amsthm}
\usepackage{mathtools}
\usepackage{hyperref}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}
\usepackage{enumitem}
\usepackage{csquotes}
\usepackage[x11names]{xcolor}
\usepackage{framed, etoolbox}
\colorlet{framecolor}{VioletRed4}
\colorlet{shadecolor}{LavenderBlush2!60}
\usepackage{thmtools} %




\makeatletter
\define@key{thmdef}{frame}[{}]{%
 \thmt@trytwice{}{%
 \RequirePackage{framed}%
 \RequirePackage{thm-patch}%
    \def\FrameCommand{\fcolorbox{framecolor}{shadecolor}}
 \addtotheorempreheadhook[\thmt@envname]{%
 \begin{framed}}%
 \addtotheorempostfoothook[\thmt@envname]{\end{framed}}%
 }%
}
\makeatother




\usepackage{thmtools}
\declaretheoremstyle[
    spaceabove=-6pt, 
    spacebelow=6pt, 
    headfont=\normalfont\bfseries, 
    bodyfont = \normalfont,
    postheadspace=1em, 
    qed=$\blacksquare$, 
    headpunct={:}]{myproofstyle} %<---- change this name
\declaretheorem[name={Proof}, style=myproofstyle, unnumbered]{Proof}

\declaretheoremstyle[
    spaceabove=3pt, 
    spacebelow=3pt, 
    headfont=\bfseries,
    notefont=\normalfont, 
    notebraces={(}{)}, 
    bodyfont=\itshape,
    postheadspace=1em,
    headpunct={:}]{mystyle}

    \declaretheoremstyle[
    spaceabove=6pt, 
    spacebelow=6pt, 
    headfont=\normalfont\bfseries,
    notefont=\mdseries\bfseries, 
    notebraces={({)}}, 
    bodyfont=\normalfont,
    postheadspace=1em,
    postheadhook = {\hspace{0mm}},%
    headpunct={:},]{myst}

\declaretheorem[frame,name={Théorème}, style=mystyle,numberwithin=section]{thm}
\declaretheorem[frame,name={Lemme}, style=mystyle,numberwithin=section]{lema}
\declaretheorem[frame,name={Définition}, style=mystyle,numberwithin=section]{defi}
\declaretheorem[frame,name={Corollaire}, style=mystyle,numberwithin=section]{coro}
\declaretheorem[frame,name={Proposition}, style=mystyle,numberwithin=section]{props}
\declaretheorem[frame,name={Vocabulaire}, style=mystyle,numberwithin=section]{voc}
\declaretheorem[name={Preuve}, style=myst,numbered=no]{preuve}
\declaretheorem[name={Remarque}, style=myst,numberwithin=section]{remark}
\declaretheorem[name={Remarques}, style=myst,numberwithin=section]{remarks}
\declaretheorem[name={Exemple}, style=myst,numberwithin=section]{exemple}
\declaretheorem[name={Exemples}, style=myst,numberwithin=section]{exemples}
\declaretheorem[name={Méthode}, style=mystyle,numberwithin=section]{methode}
\declaretheorem[name={Méthodes}, style=mystyle,numbered=no]{methodes}
\declaretheorem[name={Notation}, style=mystyle,numbered=no]{notation}






\AtBeginEnvironment{defi}{\colorlet{framecolor}{black}
    \colorlet{shadecolor}{orange!15}}
\newcommand{\myarrow}[1][1cm]{\mathrel{%
   \hbox{\rule[\dimexpr\fontdimen22\textfont2-.2pt\relax]{#1}{.4pt}}%
   \mkern-4mu\hbox{\usefont{U}{lasy}{m}{n}\symbol{41}}}}
   \AtBeginEnvironment{voc}{\colorlet{framecolor}{black}
    \colorlet{shadecolor}{LightSkyBlue2!25}}
    \AtBeginEnvironment{props}{\colorlet{framecolor}{black}
    \colorlet{shadecolor}{Yellow1!15}}
     \AtBeginEnvironment{coro}{\colorlet{framecolor}{black}
    \colorlet{shadecolor}{Yellow1!15}}
    \AtBeginEnvironment{lema}{\colorlet{framecolor}{black}
    \colorlet{shadecolor}{Yellow1!15}}
    \AtBeginEnvironment{thm}{\colorlet{framecolor}{black}
    \colorlet{shadecolor}{Yellow1!15}}

\makeatletter

%\setbox0\hbox{$\xdef\scriptratio{\strip@pt\dimexpr
  %  \numexpr(\sf@size*65536)/\f@size sp}$}

\newcommand{\myscriptarrow}[1][1cm]{{%
    \hbox{\rule[\scriptratio\dimexpr\fontdimen22\textfont2-.2pt\relax]
               {\scriptratio\dimexpr#1\relax}{\scriptratio\dimexpr.4pt\relax}}%
   \mkern-4mu\hbox{\let\f@size\sf@size\usefont{U}{lasy}{m}{n}\symbol{41}}}}

\makeatother
\newcommand*{\QED}{\hfill\ensuremath{\blacksquare}}%Heron
\usepackage{dsfont}
\usepackage{enumitem}
\usepackage{textcomp}
\usepackage{tikz, tikz-cd}
\usepackage{amssymb}


\begin{document}

\end{document}

目标是: 在此处输入图片描述

答案1

将相关部分添加fontmath.ltx到文档前言中,并进行一些修改。

\documentclass{article}

\DeclareSymbolFont{sansletters}{\encodingdefault}{\sfdefault}{m}{n}
\SetSymbolFont{sansletters}{bold}{\encodingdefault}{\sfdefault}{bx}{n}
\DeclareSymbolFontAlphabet{\mathsf}{sansletters}

\DeclareMathSymbol{A}{\mathalpha}{sansletters}{`A}
\DeclareMathSymbol{B}{\mathalpha}{sansletters}{`B}
\DeclareMathSymbol{C}{\mathalpha}{sansletters}{`C}
\DeclareMathSymbol{D}{\mathalpha}{sansletters}{`D}
\DeclareMathSymbol{E}{\mathalpha}{sansletters}{`E}
\DeclareMathSymbol{F}{\mathalpha}{sansletters}{`F}
\DeclareMathSymbol{G}{\mathalpha}{sansletters}{`G}
\DeclareMathSymbol{H}{\mathalpha}{sansletters}{`H}
\DeclareMathSymbol{I}{\mathalpha}{sansletters}{`I}
\DeclareMathSymbol{J}{\mathalpha}{sansletters}{`J}
\DeclareMathSymbol{K}{\mathalpha}{sansletters}{`K}
\DeclareMathSymbol{L}{\mathalpha}{sansletters}{`L}
\DeclareMathSymbol{M}{\mathalpha}{sansletters}{`M}
\DeclareMathSymbol{N}{\mathalpha}{sansletters}{`N}
\DeclareMathSymbol{O}{\mathalpha}{sansletters}{`O}
\DeclareMathSymbol{P}{\mathalpha}{sansletters}{`P}
\DeclareMathSymbol{Q}{\mathalpha}{sansletters}{`Q}
\DeclareMathSymbol{R}{\mathalpha}{sansletters}{`R}
\DeclareMathSymbol{S}{\mathalpha}{sansletters}{`S}
\DeclareMathSymbol{T}{\mathalpha}{sansletters}{`T}
\DeclareMathSymbol{U}{\mathalpha}{sansletters}{`U}
\DeclareMathSymbol{V}{\mathalpha}{sansletters}{`V}
\DeclareMathSymbol{W}{\mathalpha}{sansletters}{`W}
\DeclareMathSymbol{X}{\mathalpha}{sansletters}{`X}
\DeclareMathSymbol{Y}{\mathalpha}{sansletters}{`Y}
\DeclareMathSymbol{Z}{\mathalpha}{sansletters}{`Z}

\begin{document}

$ABCDEF$ $\mathrm{A}$ $\mathnormal{A}$

\end{document}

大写字母被声明为属于sansletters数学符号字体​​。在特定情况下,您仍然可以使用或类似方法覆盖排版\mathrm

如果需要粗体无衬线字母,则不能使用\mathbf。而是加载bm包(之后amsmath)并使用\bm{A}粗体无衬线 A。

在此处输入图片描述

相关内容