LaTeX math symbol macro
I've long had a dream of creating a "consistent comparison" operator to use in开发者_JAVA技巧 my homework (in LaTeX). That is, in some long derivation, we might want to know how $a$ compares to $b$, and although this is totally contrived, an example might read
\begin{align*}
a &? b \\
f(a) &? f(b) \\
f(a) &= f(b) \text{by assumption} \\
\implies a &= b
\end{align*}
That is, we start by saying, "this comparison should be consistent throughout the derivation", and then we later see that ? (the comparison operator) can be replaced with =. This notation is clearly crappy, and now that I'm doing more group work, it'd be nice to have something that's a bit more graphically intuitive.
I've got a pipe dream of a little circle with a question mark inside or on top of it. Trouble is, I have no idea how to do individual character sizing/alignment in LaTeX macros. So far, I've come up with
\def\mycomparator{\circ^{\!\!\!?}\,}
$a \mycomparator b$
(that is, a small circle with a superscript question mark, backshifted three places, then some right padding to get the left-hand side of the comparator properly placed)
While this functions, it's not exactly what I'm looking for and (even worse) is a talentless, disgusting hack.
How can I achieve this goal?
Thanks!
Try the following (not tested):
\newcommand{\mycomparator}{\stackrel{?}{\circ}}
Also look up \mathrel, it can be used to make arbitrary symbolds into a relation for correct math spacing.
Mathematically your idea is not so brilliant, as different relations obey different rules. For an example, multiply both sides of an inequation by a negative number.
Actually, standard practice would use an uppercase R for a general relation, i.e. \mathrel{R} for proper spacing. You can use subsequent letters or indices if you need more than one.
For a general transitive relation I'd use some nonstandard comparison symbol like \preceq or \prec, depending on whether it is reflexive or not.
\circ is normally used for a general binary operation, or for function composition.
According to The Comprehensive LaTeX Symbol List, you can use \textcircled{?}
for this symbol.
If you want a symbol that actually looks nice, then I'm guessing you will need to properly design something, with proper scaling, say working with the font representation of the question mark, and incorporating the circle.
Take a look at metapost or spiro.
精彩评论