3

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?

6

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}

enter image description here

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}

enter image description here

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

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}

Libertinus Math sample

6

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:

enter image description here

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}
2
  • 1
    Your second code has the advantage that it uses up only one math family. But I had already upvoted...
    – campa
    Mar 12 at 21:46
  • @campa ahahahahahaha :-)...there is not problem...To me I like to know :-)))))))
    – Sebastiano
    Mar 12 at 21:47

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.