如何在图表中将普通文本和数学标签设置为 Helvetica?

如何在图表中将普通文本和数学标签设置为 Helvetica?

我需要知道为什么此图中的字符未全部设置为同一种字体。我希望所有文本都设置为 Helvetica,就像“cm”一样。

\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,arrows.meta}




    % \usepackage{pgf,tikz}
    % \usetikzlibrary{arrows}
     \pagestyle{empty}
     \newcommand{\degre}{\ensuremath{^\circ}}
   \renewcommand{\rmdefault}{phv}





\definecolor{uququq}{rgb}{0.25098039215686274,0.25098039215686274,0.25098039215686274}

\tikzset{
    quote/.style={{|[width=2mm]}-{|[width=2mm]}}
}

\begin{document}
\definecolor{qqwuqq}{rgb}{0.0,0.39215686274509803,0.0}
\definecolor{aqaqaq}{rgb}{0.6274509803921569,0.6274509803921569,0.6274509803921569}
\definecolor{cqcqcq}{rgb}{0.7529411764705882,0.7529411764705882,0.7529411764705882}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\draw [color=cqcqcq, dash pattern=on 2pt off 2pt, xstep=1.0cm,ystep=1.0cm](-7.0,-5.0) grid (7.0,0.0);



\draw [color=aqaqaq,fill=yellow,fill opacity=0.2, line width=2.1pt,dash pattern=on 12pt off 12pt] (4.0,-2.0)-- (-4.0,-2.0);



\draw[quote] (-4.0,-4.0) --
node[above] {\Large $85$ cm} (4.0,-4.0);


\begin{scriptsize}


%\draw[color=black] (-4,2.0) node {\textbf{\Huge\textbf{$+$}}};
\draw[color=black] (-4,-2.0) node {\textbf{\Huge\textbf{$A$}}};
;
\draw[color=black] (4,-2.0) node {\textbf{\Huge\textbf{$B$}}};









\draw[color=black] (-5.0,-1.6) node {\Large $h_A$};


\end{scriptsize}
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案1

sansmath.sty有帮助:

\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,arrows.meta}
\pagestyle{empty}
\newcommand{\degre}{\ensuremath{^\circ}}
% \renewcommand{\rmdefault}{phv}
\renewcommand{\sfdefault}{phv}

\usepackage{sansmath}

\definecolor{uququq}{rgb}{0.25098039215686274,0.25098039215686274,0.25098039215686274}
\tikzset{
    quote/.style={{|[width=2mm]}-{|[width=2mm]}}
}

\begin{document}
\definecolor{qqwuqq}{rgb}{0.0,0.39215686274509803,0.0}
\definecolor{aqaqaq}{rgb}{0.6274509803921569,0.6274509803921569,0.6274509803921569}
\definecolor{cqcqcq}{rgb}{0.7529411764705882,0.7529411764705882,0.7529411764705882}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
  \sffamily\sansmath
  \draw [color=cqcqcq, dash pattern=on 2pt off 2pt,
  xstep=1.0cm,ystep=1.0cm](-7.0,-5.0) grid (7.0,0.0);

  \draw [color=aqaqaq,fill=yellow,fill opacity=0.2, line
  width=2.1pt,dash pattern=on 12pt off 12pt] (4.0,-2.0)-- (-4.0,-2.0);

  \draw[quote] (-4.0,-4.0) -- node[above] {\Large $85$ cm} (4.0,-4.0);

  \scriptsize

  \draw[color=black] (-4,-2.0) node {\textbf{\Huge\textbf{$A$}}};
  \draw[color=black] (4,-2.0) node {\textbf{\Huge\textbf{$B$}}};
  \draw[color=black] (-5.0,-1.6) node {\Large $h_A$};
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容