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?

5
  • 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 Feb 12 at 10:41
  • 1
  • 1
    The subscript k also seems to sit lower than the other subscripts. Or maybe that is just an illusion.
    – mickep
    Feb 12 at 13:15
  • @mickep No illusion the k is put lower than the other subscripts for the presence of gt.
    – Sebastiano
    Feb 12 at 13:21
  • @David Carlisle Thank You for spotting this error -- I intended using \mathrm{gt}
    – Wilk
    Feb 12 at 15:32

2 Answers 2

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

5
  • The subscript k still seems to sit lower than the 1 and the 2 subscripts.
    – mickep
    Feb 12 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 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 at 15:29
  • @Wilk Did you look at the added code?
    – egreg
    Feb 12 at 15:33
  • @egreg Yes I had. I just wanted to be sure. Thank You :)
    – Wilk
    Feb 12 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

6
  • The superscripts aren't on the same line Feb 12 at 12:51
  • Now the superscripts are on the same line.
    – Sebastiano
    Feb 12 at 13:16
  • 2
    Do remember that \text is the wrong command to use (its contents is italic in an italic context which is not what you want in this case)
    – daleif
    Feb 12 at 13:39
  • 1
    @daleif I have corrected using \mathrm.
    – Sebastiano
    Feb 12 at 13:41
  • 1
    but I didn't wanted to use _{\phantom{1}}
    – Wilk
    Feb 12 at 14:45

You must log in to answer this question.

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