4

I'd like to have superscript terms (gt) on the same line in the whole equation, but after I write the equation:

$\mathbf{T}^{\mathrm gt}=\{\mathbf{T}^{\mathrm gt}_1,\mathbf{T}^{\mathrm gt}_2,\ldots,\mathbf{T}^{\operatorname{gt}}_k\}$

I receive this:

output

I know I can add _{\phantom{1}} term, but it is not elegant as for equations without subscripts - I would have to add this phantom to be consistent in a whole document. Also is there a need to use operatorname or simple mathrm is enough?

Wilk
  • 100
  • 3
    in ^{\mathrm gt} did you intend to get an upright g and italic t? the markup ^{\mathrm {g}t} would be clearer or ^{\mathrm{gt}} if you want an uprightt omitting braces from \mathrm isn't documented syntax at all – David Carlisle Feb 12 '24 at 10:41
  • 1
    See https://tex.stackexchange.com/a/576346/1090 – David Carlisle Feb 12 '24 at 10:45
  • 1
    The subscript k also seems to sit lower than the other subscripts. Or maybe that is just an illusion. – mickep Feb 12 '24 at 13:15
  • @mickep No illusion the k is put lower than the other subscripts for the presence of gt. – Sebastiano Feb 12 '24 at 13:21
  • @David Carlisle Thank You for spotting this error -- I intended using \mathrm{gt} – Wilk Feb 12 '24 at 15:32

2 Answers2

6

You might use subdepth. But I don't recommend it.

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

\newcommand{\gt}{\mathrm{gt}}

\begin{document}

[ %%% the following two lines are just to show the alignment \sbox0{$\displaystyle\mathbf{T}^{\gt}$} \rlap{\vrule height \dimeval{\ht0+0.1pt} depth -\ht0 width 4cm} %%% \mathbf{T}^{\gt}= {\mathbf{T}^{\gt}_1,\mathbf{T}^{\gt}_2,\ldots,\mathbf{T}^{\gt}_k} ] \begin{center} $%%% the following two lines are just to show the alignment \sbox0{$\displaystyle\mathbf{T}^{\gt}$} \rlap{\vrule height \dimeval{\ht0+0.1pt} depth -\ht0 width 4cm} %%% \mathbf{T}^{\gt}= {\mathbf{T}^{\gt}_1,\mathbf{T}^{\gt}_2,\ldots,\mathbf{T}^{\gt}_k} $\end{center}

\end{document}

enter image description here

Note that \mathrm gt is wrong under any respect. Also \operatorname isn't good in that context.


If you have just a couple of these constructs, it's easier to add a few \vphantom.

For several instances of the same structure,

\documentclass{article}
\usepackage{amsmath}

\ExplSyntaxOn \NewDocumentCommand{\tuple}{mm} {% #1 is the base symbol, #2 is the list of subscripts #1\sb{\vphantom{#2}} = { \seq_clear:N \l_tmpa_seq \clist_map_inline:nn { #2 } { \str_if_eq:nnTF { ##1 } { \dots } { \seq_put_right:Nn \l_tmpa_seq { \dotsc } } { \seq_put_right:Nn \l_tmpa_seq { #1\sb{##1\vphantom{#2}} } } } \seq_use:Nn \l_tmpa_seq { , } } }

\newcommand{\gt}{\mathrm{gt}}

\begin{document}

[ \tuple{\mathbf{T}^{\gt}}{1,2,\dots,k} ] \begin{center} $\tuple{\mathbf{T}^{\gt}}{1,2,\dots,k}$ \end{center}

[ \tuple{A}{1,2,3} \quad \tuple{B}{1,2,3,\dots} ]

\end{document}

enter image description here

egreg
  • 1,121,712
  • The subscript k still seems to sit lower than the 1 and the 2 subscripts. – mickep Feb 12 '24 at 14:52
  • @mickep Yes, because k is a bit higher than the digits; \smash{k} would do. But see the new code. – egreg Feb 12 '24 at 15:27
  • So basically, the best option is to use \vphantom? What is the reason of not using subdepth? Does it makes too many changes in the whole document? So I should use \mathrm{gt} with pharanthesis or just don't change the font at all? – Wilk Feb 12 '24 at 15:29
  • @Wilk Did you look at the added code? – egreg Feb 12 '24 at 15:33
  • @egreg Yes I had. I just wanted to be sure. Thank You :) – Wilk Feb 12 '24 at 15:39
2

I think that this code is between the good solutions:

\documentclass[12pt]{article}
\usepackage{amsmath, amssymb}

\begin{document} $\mathbf{T}^{\substack{\mathrm{gt}}}{\phantom{\substack{1}}}={\mathbf{T}^{\substack{\mathrm{gt}}}{\substack{1}},\mathbf{T}^{\substack{\mathrm{gt}}}{\substack{2}},\ldots,\mathbf{T}^{\substack{\mathrm{gt}}}{\substack{k}}}$ \end{document}

enter image description here

enter image description here

Sebastiano
  • 54,118