1

I would like to combine accents, indices, and superscripts, but I am a bit confused :)

Regarding x_k, I want that x_k^\top has the k at the same vertical position. The solution {x_k}^\top is sufficient for me, apart from the fact that the \top is positioned further to the right, but I can live with it.

When adding a \hat accent to my x, the above solution does not work any more. Why??

My MWE:

\documentclass{minimal}
\begin{document}
    without accent:
    \begin{equation}
        x_k\quad x_k^\top\quad {x_k}^\top
    \end{equation}
    with accent:
    \begin{equation}
        \hat{x}_k\quad \hat{x}_k^\top\quad {\hat{x}_k}^\top
    \end{equation}
\end{document}

Can someone perhaps explain this to me?

Thank you :)

2 Answers 2

2

Some general facts about TeX:

  1. when there is a superscript, the subscript is always moved down;

  2. depending on the size of the superscript, the subscript could be moved further down;

  3. constructions such as \hat{x}_{k} and {\hat{x}_{k}} are completely equivalent, because by rule the braces around an Acc atom (something with a math accent attached) are stripped off.

Regarding typesetting, I'd avoid things such as {x_{k}}^{\top}, because the superscript is too far away from the symbol.

What would I do? If I need to typeset “the transpose of xk multiplied by xk” I'd resort to

x_{k}^{T}x_{k}^{}

with a dummy superscript, but with “the vector xk” I'd just use x_{k}. Personally, I'd not use \top for the transpose, but I acknowledge it's frequently used.

If you want to automate the lower placement of subscripts, you can use subdepth. (Not that I recommend it.)

\documentclass{article}
\usepackage{amsmath}
\usepackage{subdepth}

\begin{document}
without accent:
\begin{equation}
  x_{k}\quad x_{k}^{\top}\quad {x_{k}}^{\top}
\end{equation}

with accent:
\begin{equation}
  \hat{x}_{k}\quad \hat{x}_{k}^{\top}\quad {\hat{x}_{k}}^{\top}
\end{equation}

\end{document}

enter image description here

If you really want the detached \top, the last item should be

{{}\hat{x}_{k}}^{\top}

but the output is not what I'd like to get.

enter image description here

5
  • Thank you for the kind and helpful response, wow! :) Can you explain why you prefer ^T instead of ^\top? Is it just your intuition, or are there specific reasons for that?
    – Annika
    Mar 1 at 15:39
  • @Annika Just personal preference: \top usually means something completely unrelated to matrices.
    – egreg
    Mar 1 at 15:45
  • and what about ^\intercal?
    – Annika
    Mar 1 at 15:50
  • @Annika Even worse, but that's up to your taste. I'd recommend defining a command, say \newcommand{\tp}{\top} and use ^{\tp} for the transpose, so you can experiment with different choices without changing the code in the document, but only in the definition.
    – egreg
    Mar 1 at 15:58
  • That's a fantastic idea! Thank you so much, I'll do it exactly like that :)
    – Annika
    Mar 1 at 16:06
0

For subscript and superscript I suggest to use the curly brackets {}.

\documentclass{article}
\begin{document}
    without accent:
    \begin{equation}
        x_{k}\quad x_{k}^{{\top}}\quad {x_{k}}^{\top}
    \end{equation}
    with accent:
    \begin{equation}
        \hat{x}_{k}\quad \hat{x}_{k}^{{\top}}\quad {\hat{x}_{k}}^{\top}\quad \hat{x}_{{k}}^{\top}
    \end{equation}
\end{document}

enter image description here

2
  • Thank you for the answer :) If I understand you correctly, would you then accept that the index k shifts further downwards?
    – Annika
    Feb 28 at 9:19
  • @Annika I see that the index k shifts further downwards only with without accent in 3th case.
    – Sebastiano
    Feb 28 at 13:06

You must log in to answer this question.

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