
나는 pgf 플롯 내의 가능한 모든 위치에서 동일한 글꼴을 얻으려고 노력합니다. 이 포럼에서 많은 시간을 보내고 서면 솔루션을 시험해 본 후에도 전혀 모르겠습니다.
미리 도움을 주셔서 감사드립니다.
감사합니다, Th.
\documentclass{scrartcl}
\usepackage{fontspec}
\setmainfont{Arial}
\usepackage{etoolbox}
% change fonts to sans serif then `tikzpicture' environment is started
\BeforeBeginEnvironment{tikzpicture}{
\begingroup
\changeFonts
}
% end scope (for font change)
\AfterEndEnvironment{tikzpicture}{
\endgroup
}
\usepackage{sansmath}
% create a command to switch fonts in `tikzpicture' environments to a
% sans serif font
\newcommand*\changeFonts{
\sffamily\sansmath
}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
10 <> $\mathsf 10$!
\begin{figure}[htbp]
\centering
\begin{tikzpicture}
\begin{axis}[xlabel={Abscissa, $x_\mathsf{10}$}, ylabel={Ordinate, $y$}]
\addplot {x^2};
\end{axis}
\end{tikzpicture}
\caption{A figure with a \texttt{pgfplots} axis.}
\end{figure}
\end{document}
답변1
다음을 사용하여 모든 틱 레이블 글꼴을 sansserif로 변경할 수 있습니다.
\pgfplotsset{my style/.append style={xticklabel={$\mathsf{\pgfmathprintnumber{\tick}}$},
yticklabel={$\mathsf{\pgfmathprintnumber{\tick}}$} } }
그런 다음 my style
축 옵션에 추가합니다.
begin{axis}[my style, xlabel={Abscissa, $x_\mathsf{10}$}, ylabel={Ordinate, $y$}]