# Function restriction with Libertinus Math

The following code raises an error because \restriction is not defined (and neither is \upharpoonright):

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{libertine}
\usepackage{libertinust1math}
\begin{document}
$f \restriction A$
\end{document}


I understand that it is not wise to use amssymb in this case. Is there a recommended way to get a function restriction symbol nevertheless?

Sadly the libertinust1math fonts do not include that particular harpoon. Sebastiano has shown how to import it from the AMSa symbols. I propose here two further alternatives:

Instead of libertinust1math you can use newtxmath with the libertine option. This will use the Latin and Greek letters from libertine but otherwise the symbols from newtx, which contain more glyphs than libertinust1math. Of course, the output will change, so it's a matter of taste.

\documentclass{article}
\usepackage{libertine}
\usepackage[libertine]{newtxmath}
\begin{document}
$f \restriction A$
$\scriptstyle f \restriction A$
$\scriptscriptstyle f \restriction A$
\end{document}


Alternatively you can rotate \leftharpoonup

\documentclass{article}

\usepackage{graphicx}
\usepackage{libertine}
\usepackage{libertinust1math}

\makeatletter
\newcommand*{\upharpoonright}{\mathrel{\mkern-2mu\mathpalette\@upharpoonright\relax}}
\newcommand*{\@upharpoonright}[2]{\vcenter{\hbox{\rotatebox{-90}{$#1\leftharpoonup$}}}}
\makeatother
\let\restriction\upharpoonright

\begin{document}
$f \restriction A$
$\scriptstyle f \restriction A$
$\scriptscriptstyle f \restriction A$
\end{document}


• +1 to you for the comment and the answer. The same to @Davislor. THANKS. Mar 12 at 19:57

The OpenType version of Libertinus Math has ↾ (U+21BE), and unicode-math supports it as \upharpoonright. Output with LuaLaTeX:

\documentclass{article}
\usepackage{libertinus} % Load the OpenType fonts

\newcommand\restriction\upharpoonright

\begin{document}
$f \restriction A_{f \restriction A_{f \restriction A}}$
\end{document}


Looking in website you can declare or use one symbol. Hence it is very important to know the number of the slot {"16} for \upharpoonright symbol.

\DeclareMathSymbol{\upharpoonright}{\mathrel}{AMSa}{"16}


Using this MWE, for example, with \usepackage{amssymb} you have,

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\usepackage{libertine}
\usepackage{libertinust1math}
\begin{document}
$f \restriction A$
\end{document}


and you will have this output:

Or you can use this MWE without the use of amssymb package that have the same output of the previous image.

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{libertine}
\usepackage{libertinust1math}
\DeclareSymbolFont{AMSa}{U}{msa}{m}{n}
\DeclareMathSymbol{\upharpoonright}{\mathrel}{AMSa}{"16}
\global\let\restriction\upharpoonright
\begin{document}
$f \restriction A$
\end{document}

• Your second code has the advantage that it uses up only one math family. But I had already upvoted... Mar 12 at 21:46
• @campa ahahahahahaha :-)...there is not problem...To me I like to know :-))))))) Mar 12 at 21:47