5

I want to use Libertine Sans Serif numbers (only numbers) in math font. Can i get this result using a command like this:

    \DeclareSymbolFont{numbers}{T1}{libertine}{m}{n}
    \SetSymbolFont{numbers}{bold}{T1}{libertine}{bx}{n}
    \DeclareMathSymbol{0}\mathalpha{numbers}{"30}
    \DeclareMathSymbol{1}\mathalpha{numbers}{"31}
    .
    .

Example:

\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{libertine}
\renewcommand*\familydefault{\sfdefault} 
\usepackage[libertine,liby,libaltvw,vvarbb]{newtxmath}
\usepackage[T1]{fontenc}

%\DeclareSymbolFont{numbers}{T1}{libertine-SF}{m}{n}
%\SetSymbolFont{numbers}{bold}{T1}{libertine-SF}{bx}{n}
%\DeclareMathSymbol{0}\mathalpha{numbers}{"30}
%\DeclareMathSymbol{1}\mathalpha{numbers}{"31}
%\DeclareMathSymbol{2}\mathalpha{numbers}{"32}
%\DeclareMathSymbol{3}\mathalpha{numbers}{"33}
%\DeclareMathSymbol{4}\mathalpha{numbers}{"34}
%\DeclareMathSymbol{5}\mathalpha{numbers}{"35}
%\DeclareMathSymbol{6}\mathalpha{numbers}{"36}
%\DeclareMathSymbol{7}\mathalpha{numbers}{"37}
%\DeclareMathSymbol{8}\mathalpha{numbers}{"38}
%\DeclareMathSymbol{9}\mathalpha{numbers}{"39}

\begin{document}

\noindent 1234567890 TEXT\\
$1234567890$ MATH\\
is it possible to make numbers in math as in text.

\end{document}
  • Honestly, I don't know. But confront your line 2 with \SetSymbolFont{numbers}{bold}{T1}{phv}{bx}{n}: it may be necessary a 3-digit string like phv to identify the font (libertine in your case). – MattAllegro Jun 16 '14 at 19:37
  • Please, make a minimal working example (MWE); it's important to know how you load the Libertine fonts. – egreg Jun 16 '14 at 20:04
6

The internal font family name for the sans serif font is available as \biolinum@family. The string numbers would probably be good, but I prefer to call it sfnumbers.

Note that \familydefault is usually defined as \long, so \renewcommand should be used, not \renewcommand*.

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{libertine}
\renewcommand\familydefault{\sfdefault} % not *
\usepackage[libertine,liby,libaltvw,vvarbb]{newtxmath}

\makeatletter
\DeclareSymbolFont{sfnumbers}{T1}{\biolinum@family}{m}{n}
\SetSymbolFont{sfnumbers}{bold}{T1}{\biolinum@family}{b}{n}
\makeatother
\DeclareMathSymbol{0}\mathalpha{sfnumbers}{"30}
\DeclareMathSymbol{1}\mathalpha{sfnumbers}{"31}
\DeclareMathSymbol{2}\mathalpha{sfnumbers}{"32}
\DeclareMathSymbol{3}\mathalpha{sfnumbers}{"33}
\DeclareMathSymbol{4}\mathalpha{sfnumbers}{"34}
\DeclareMathSymbol{5}\mathalpha{sfnumbers}{"35}
\DeclareMathSymbol{6}\mathalpha{sfnumbers}{"36}
\DeclareMathSymbol{7}\mathalpha{sfnumbers}{"37}
\DeclareMathSymbol{8}\mathalpha{sfnumbers}{"38}
\DeclareMathSymbol{9}\mathalpha{sfnumbers}{"39}

\begin{document}

\noindent 1234567890 TEXT\\
$1234567890$ MATH\\
is it possible to make numbers in math as in text.

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.