
Я пытаюсь достичь того же шрифта во всех возможных местах в пределах графика pgf. После многих часов на этом форуме и попыток написанных решений я понятия не имею.
Заранее большое спасибо за помощь.
С уважением, Т.
\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$}]