Solution 1:

You would use the same gender that the object's name has. For example, one could say:

Ceci n'est pas un $\triangle$ beside the picture of a square, but one could say

"Voici la $\mathscr{L}(cos(t))$" besides the expression of $\cos(t)'s$ Laplace transform.

Solution 2:

Espace and K both take "un".$\quad$