[Tex/LaTex] Change the font of number in section


I need to change the font of the number of the sections without changing the font of the name of section.


The result is:

  1. section A

in the same font of FZzzh

The ideal output should be 1.(Arial) section A(FZzzh)

Best Answer

Here's a solution that doesn't make use of any particular LaTeX package. The code assumes that either XeLaTeX or LuaLaTeX is in use. I didn't make use of the \FZzzh instruction that's in your example code, though, as I don't have the font in question on my system.

The point of this method is that cross-references to section numbers, elsewhere in the document, will continue to be typeset in the ambient text font, rather than in the particular sans-serif font and color that's desired for the sectioning number in the section headers.

enter image description here




\makeatletter  % see, e.g., p. 26 of "The LaTeX Companion"
     {\csname the#1\endcsname\quad}%   default setting
     {\csname #1@cntformat\endcsname}% individual control

\section{In the beginning} \label{sec:beginning}

\section{Later on the same day}

As we showed in section \ref{sec:beginning}, \dots