# Nicer alignment of x^*/2

I'm trying to typeset $\frac{x^*}{2}$, but I can't find a (simple) way to make the alignment look nice. So far, I've tried the following:

\documentclass{article}
\begin{document}

\begin{equation}
\end{equation}

\end{document}


With the following output: In the left one, it looks odd because the x is very off-center, and in the right example the fraction bar is extended way more to the right than what's really necessary.

Is there a nicer (and still simple enough) way to typeset this fraction?

• The left hand side version is correct. Feb 28, 2013 at 14:47
• @egreg: I still think it looks odd - perhaps even more so in inline fractions (i.e. $\frac{x^*}{2}$). Feb 28, 2013 at 14:51
• I would definitely write $x^{*}/2$. Feb 28, 2013 at 15:00
• @HendrikVogt: I think your link is broken (at least it points to a topic that's not even vaguely related...). Would you mind double-checking? Feb 28, 2013 at 15:14
• Strongly related Subscripts in partial derivatives. Feb 28, 2013 at 15:23

\begin{equation*}
\frac{x\rlap{$^*$}}{\,2\,}
\end{equation*}


The correct one is the first one, as the ugly syntax of the other two demonstrates :-) However, I have to admit that the third one is the best looking one: # Update

As egreg noted in a comment, the problem with the third solution is that it is not clear if the * applies only to x, or to the whole fraction. Thiking about this, I've found another solution which avoids this problem, has a cleaner syntax, and still (imho) looks better than the first one.

The following MWE shows first the standard way, second my first attempt, and third my new proposed solution. I put them in the context of a bigger expression, and aligned them vertically at the right bar, for easier comparison:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
\Big|\frac{x^*}{2}               \Big|&=y \\
\Big|\frac{x\rlap{$^*$}}{\,2\,}  \Big|&=y \\
\Big|\frac{x^*\!}{2}             \Big|&=y
\end{align*}
\end{document} • Thanks, I did not know about \rlap :) Feb 28, 2013 at 15:00
• Did you try adding a symbol after \frac{x\rlap{$^*$}}{\,2\,}? It will be pushed below the asterisk. I'm still convinced that \frac{x^*}{2} is the best: with your \rlap (by the way \mathrlap from mathtools should be used) it's ambiguous whether the asterisk applies to x or to the whole fraction. Feb 28, 2013 at 15:04

How about using \mathrlap from the mathtools-package?

\documentclass{article}
\usepackage{mathtools}
\begin{document}

\begin{equation}
\end{equation}

\end{document}


This inserts the asterisk without adding additional space and thus keeping the fraction line as long as in the first example: Aligning things that should not be aligned is a bad idea. Very similar example to yours is adding \phantom{-} in front of 0 and 1 in matricis comprising only 0, 1 and -1. You align the numbers, but you lose the visual distinction between 1 and -1.

Here, it is a bit different but still valid: I, as a reader, would really get the impression that there's a missing symbol after 2, just because the whole denominator is not centered, whereas I expect it to be centered.

Conclusion: Two options are correct: \frac{x^*}{2} and x^*/2.

• Today, we are fated to disagree about phantom minus signs :) I right-align all my matrices by default, specifically for this purpose. Feb 28, 2013 at 17:24
• TBH, I can't say I don't consider it nicer looking, I just have the bad readability experience.
– yo'
Feb 28, 2013 at 17:33
• @RyanReich -- matrices aren't fractions. for matrices, aligning so that the numerical value of comparable elements is parallel is appropriate, and there, the phantom minus sign or right-alignment (in the absence of non-matching decimal places) is the proper thing to do. likewise for tabular material. Feb 28, 2013 at 18:48