How can I put a star on top of a less-than sign?

For the equals sign, there is eq.star. For the less than sign, there is not, I need to create it myself, but cannot figure out how. ChatGPT suggests using math.overlay or math.stack but neither seem to exist. How can I achieve this symbol?

Have a look at the documentation page of attach:

$ attach(lt, t: star) $
// short version
$ lt^star $

Thanks, @flokl. I was hoping to get a bit more control over the position of the star (bring it closer to the less-than sign), but I guess that would work.

You can use any Typst functions in math (like aforementioned stack), just make sure to switch to code mode with #. This way you can just use place or pad to move the star, depending on what size the resulting symbol should have:

#block(stroke: red)[
  // star doesn't modify size of lt sign
  $
    lt^#place(
      // default alignment
      bottom + center,
      // modify coordinates to move the star
      dx: -0.2em, dy: 0.4em,
      // script style to make star smaller than usual,
      // you could just use text(size: ...)
      $script(star)$)
  $
]

#block(stroke: red)[
  // star modifies the size of lt sign, 
  // coordinate change is achieved by adding margins to the star
  $
  a lt^#pad($star$, left: -0.3em) b
  $
]

The result

2 Likes