4

What is the easiest way to typeset a symbol like \looparrowright, but without the arrow?

Is there a solution as easy as the answer to this question? I don't know where to look up the definition of \looparrowright, to see for myself whether I could achieve my desired symbol.

frabala
  • 373
  • It's a different case: \hookrightarrow is composed with two gliphs, but \looprightarrow isn't. You can clip the symbol, though. – egreg Jul 08 '20 at 15:00
  • 1
    Just a info: \DeclareMathSymbol{\looparrowright} {\mathrel}{AMSa}{"23} found in amssymb.dtx at https://ctan.org/tex-archive/fonts/amsfonts. No idea what that means, though. – Dr. Manuel Kuehner Jul 08 '20 at 15:03
  • Consider to accept one of the provided answers, I recommend to accept egreg's answer since it covers more situations. – Dr. Manuel Kuehner Jul 08 '20 at 21:15

2 Answers2

6

You can clip the symbol:

\documentclass{article}
\usepackage{amssymb}
\usepackage{trimclip}

\makeatletter \DeclareRobustCommand{\leftloop}{% \mathrel{\mathpalette\left@loop\relax}% } \newcommand{\left@loop}[2]{% \vphantom{\looparrowright} \smash{\clipbox{0 {-.1\height} {.35\width} {-.1\height}}{$\m@th#1{\looparrowright}$}}% } \makeatother

\begin{document}

$a\leftloop b_{c\leftloop d}$

\end{document}

enter image description here

Code borrowed from https://tex.stackexchange.com/a/395049/4427

This means “cut nothing on the left, add a negative clip on the bottom, clip 35% of the width from the right, add a negative clip on the top”. Why negative clipping? Because the glyph slightly overshoots its bounding box. So I also smash the clipped symbol and set the height with the help of \vphantom.

Can we keep the round cap? Yes, by adding a clipped minus sign.

\documentclass{article}
\usepackage{amssymb}
\usepackage{trimclip}

\makeatletter \DeclareRobustCommand{\leftloop}{% \mathrel{\mathpalette\left@loop\relax}% } \newcommand{\left@loop}[2]{% \smash{\clipbox{0 {-.1\height} {.4\width} {-.1\height}}{$\m@th#1{\looparrowright}$}}% \clipbox{{0.8\width} 0 0 0}{$\m@th#1-$}% \mkern-1mu } \makeatother

\begin{document}

\fboxrule=0.1pt\fboxsep=0pt\fbox{$\leftloop$}% just to see the bounding box

$a\leftloop b_{c\leftloop d}$

\end{document}

enter image description here

No need to add a phantom, because the minus sign has the right height and depth.

egreg
  • 1,121,712
5
  • Please go with eger's answer - I just was inspired by his comment and tried it myself.
  • I use the adjustbox package.
  • @pros Please indicate if my solution has some problems (apart from being too simplistic).
  • This is a trial-and-error approach :).

\documentclass{article}
\usepackage{adjustbox}
\usepackage{amssymb}

\begin{document}

\begin{itemize} \item \adjustbox{trim = 0 0 1 0, clip}{\fbox{Test $a$}} \fbox{Test $a$} \item \adjustbox{trim = 0 0 7 0, clip}{\fbox{$\looparrowright$}} \fbox{$\looparrowright$} \item \adjustbox{trim = 0 0 4 0, clip}{$\looparrowright$} \end{itemize}

\newcommand{\myLoop}{\adjustbox{trim = 0 0 4 0, clip}{\ensuremath{\looparrowright}}}

\myLoop

\end{document}

enter image description here

  • Why go for egreg's answer only? It's a good solution indeed, but I'm looking for the simplest one and yours looks more simple in terms of latex coding. Are there technical reasons to prefer egreg's solution over yours? – frabala Jul 08 '20 at 15:34
  • @frabala I am not sure, therefore I put "@pros Please indicate if my solution has some problems (apart from being too simplistic)." in the answer :). – Dr. Manuel Kuehner Jul 08 '20 at 15:48
  • I think you forgot $...$ in the definition of \myLoop. @frabala This answer looks simpler but won't scale according to the current math style. The \mathpalette "complication" in egreg's answer does this. Of course, one could easily adapt this answer. – campa Jul 08 '20 at 15:54
  • @campa I did not use $$ in \newcommand on purpose. I just assum that teh commadn will be used in myth mode. Maybe I should add a \ensuremath command :). – Dr. Manuel Kuehner Jul 08 '20 at 17:47
  • *math mode, typo in my previous comment. – Dr. Manuel Kuehner Jul 08 '20 at 18:49
  • Uhm, my comment was due to the fact that your code throws an error on my system. But I can't check now, I'll look into it again tomorrow... – campa Jul 08 '20 at 21:56
  • @campa Ahhh. I did not see the error message. On my system the output looked good. I have changed the code (\ensuremath). Thx for the hint. – Dr. Manuel Kuehner Jul 09 '20 at 08:43