12
$\begingroup$

I wanted to rotate $\Box$ $45^\circ$ clockwise to make a diamond. At the time, I did not know there was a diamond command $\diamond$ and $\Diamond$ and $\diamondsuit$ and even things like $\not\diamondsuit$. But I then wondered to myself, is there a command to rotate symbols? For instance, say I had the letter $\Psi$. I can rotate this, only $180^\circ$ but not with some fancy rotating command. Simply, I use \pitchfork and this generates $\pitchfork$. A bit like a flip. I can also flip curved lines. For instance, take the curve $\frown$. I can flip it $180^\circ$ but with an entirely seperate command, \smile to generate $\smile$.

The examples that I mentioned however, are only certain examples where I can flip them. For example, I can flip arrows. $\downarrow$ $\leftarrow$ $\uparrow$ $\rightarrow$ $\wedge$ $>$ $\lor$ $<$, but none of these uses a rotating command; only directions. But say I want to flip the curve $\smile$ only $90^\circ$. Then how would I do that? I can write the command, \between but this generates $\between$ which is both curves flipped $90^\circ$, not one. I would simply have to use brackets $()$. And if I wanted to rotate a symbol like $\gtrless$ then what command do I use now? I would have to use two commands to generate $\land\lor$ and $\lor\land$ but I won't be able to flip $\gtrless$ sideways.

Essentially, I am asking if there is some kind of rotating command, and if not, is it ok to feature some kind of command like that?

Thank you in advance.

$\endgroup$
0

1 Answer 1

14
$\begingroup$

This is possible using the HTML extension

$$\require{HTML} \style{display: inline-block; transform: rotate(45deg)}{\Box}$$

$$\require{HTML}\style{display: inline-block; transform: rotate(45deg)}{\Box}$$

$\endgroup$
9
  • $\begingroup$ @user477343 I knew this could be accomplished in $\mathrm{\LaTeX}$ using \rotatebox so that was the first thing I looked for in the documentation. Since that wasn't there, my next thought was that this could be done with CSS. When I looked through the MathJax extensions, I found the HTML extension and all that was left to do is see if I could use it on StackExchange. $\endgroup$
    – Sera Gunn
    Commented Jan 28, 2018 at 1:55
  • 4
    $\begingroup$ Note that CSS transforms don't affect the bounding box of the content, so if you have a short width character, its bounding box will not become a tall this character. E.g., $\bbox[red]{\style{display:inline-block; transform:rotate(90deg)}{\longrightarrow}}\Rule{0px}{1em}{.25em}$. This has implications when the rotated character is used between two others. $\endgroup$ Commented Jan 28, 2018 at 12:29
  • 1
    $\begingroup$ It also means that in HTML-CSS output, which is clipped to the bounding box, part of the character might be clipped: $\bbox[red]{\style{display:inline-block; transform:rotate(90deg)}{\longrightarrow}}$ (I added spacing above to prevent that, though it only affects HTML-CSS output, not CommonHTML output). $\endgroup$ Commented Jan 28, 2018 at 12:30
  • 1
    $\begingroup$ This technique only works for HTML-CSS, CommonHTML, and NativeMML output (in particular, not for SVG output), so some users (those who have selected SVG output) will not see what you expect them to. $\endgroup$ Commented Jan 28, 2018 at 12:32
  • 3
    $\begingroup$ Note that this only affects the visual representation, so users with assistive technology (like screen readers) will get the wrong output. E.g., in the arrow example above, they will be told it is a right arrow, not a down arrow. So while such hacks are possible, they are not recommended if you are interested in supporting all your readers. $\endgroup$ Commented Jan 28, 2018 at 12:34
  • 5
    $\begingroup$ Finally, note that the HTML extension is loaded automatically when needed, so there is no need for the explicit \require{HTML}. $\endgroup$ Commented Jan 28, 2018 at 12:35
  • 1
    $\begingroup$ @mr_e_man It's a CSS feature, not MathJax. See w3schools.com/cssref/css3_pr_transform.asp (either a scale or a matrix will work). But you should seek a solution that doesn't require CSS for the reasons Davide has outlined. $\endgroup$
    – Sera Gunn
    Commented Jul 28, 2020 at 17:32
  • 1
    $\begingroup$ Oh, I didn't notice that "scale" could have two parameters. $F\mapsto\;\style{display: inline-block; transform: scale(-1,1)}{F}$ $\endgroup$
    – mr_e_man
    Commented Jul 28, 2020 at 17:39
  • $\begingroup$ This is gonna generate lot of crazy/ interesting symbols (like the comment by @mr_e_man) :) $\endgroup$
    – Paramanand Singh Mod
    Commented Jul 30, 2020 at 6:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .