# How do I write a vertically-stacked definition of a sequence?

I'm trying to reproduce this notation in LaTex but to no avail.

This means $e_j$ has the value of $0$ in all other coordinates except for the j-th one.

I can only do the part without $(j)$: $e_{j} :=(0, \ldots, 0,1,0, \ldots, 0) \in K^{m}$

Please shed me some light! Thank you so much!

• Note that this is not a please_do_this_for_meservice. Please provide what you have do far. You should at least be able to provide the contents of the image without the $(j)$ part, having that code will make it a lot easier for others to help – daleif Sep 5 '19 at 14:25
• Thank you @daleif! I will do it now. – LAD Sep 5 '19 at 14:27
• I'm leaving this as a comment and not an answer because it doesn't do what you want to do, but I think that (\underbrace{0, \dots, 0}_{j-1}, 1, \underbrace{0, \dots, 0}_{m-j}) is more clear than your notation. – Misha Lavrov Sep 6 '19 at 16:49

For example:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{stackengine}
% these are from https://www.tug.org/TUGboat/tb22-4/tb72perlS.pdf
\def\clap#1{\hbox to 0pt{\hss#1\hss}}
\begin{document}
$(0,\dots,0,\ensurestackMath{\stackunder{1}{\clap{$(i)$}}},0,\dots,0)$
\end{document}


(The \clap is a bit harsh; see the linked article for a better way)

• Nice (+1). If, in the preamble, you use \renewcommand\useanchorwidth{T}, you can eliminate the \clap. – Steven B. Segletes Sep 5 '19 at 14:31
• @StevenB.Segletes thanks, one never stops learning... – Rmano Sep 5 '19 at 14:37
• That being said, mathtools  defines \clap and \mathclap. – Bernard Sep 5 '19 at 15:15

I propose two variants, with mathtools and old-arrows:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{old-arrows} %

\begin{document}

$e_j = (0,\dots,0,\underset{\mathclap{(j)}\strut}{1},0,\dots,0)$

$e_j = (0,\dots,0,\underset{\substack{\uparrow\\ j}\strut}{1},0,\dots,0)$

\end{document}


Here's a solution which employs the amssymb and mathtools packages.

If you would like to push the (j) term a bit lower than in the picture shown above, simply change {1} to {1\mathstrut}.

\documentclass{article}
\usepackage{mathtools,amssymb}
\begin{document}
Let $m\in\mathbb{N}^{\times}$. For $j=1,\dots,m$ define
$e_j := (0,\dots,0,\underset{\mathclap{(j)}}{1},0,\dots,0) \in K^m$
\end{document}

• Yep, cleaner than mine. – Rmano Sep 5 '19 at 15:50

Here is an example:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$E_j := \underset{(j)}{(0,\dots,0,1,0,\dots,0)}$
\end{document}


EDIT:

For asymmetric case:

e_j := (0,\dots,\underset{(j-1)}{0},\underset{(j)}{1},0,\dots,0)


My proposal, as alternative to the best answers, is the use the package blkarray.

\documentclass[12pt]{article}
\usepackage{mathtools,blkarray}
\begin{document}
$\begin{blockarray}{ccccccccc} \begin{block}{c(ccccccc)c} e_{j} \coloneqq \mkern-5mu& 0, & \ldots, & 0, & 1, & 0, & \ldots, & 0 & \mkern-5mu \in K^{m}\\ \end{block} & & & & (j) \end{blockarray}$
\end{document}


Using, appropriately the package nicematrix using the due spacings (\mkern), you can obtain a similar result.

\documentclass{article}
\usepackage{amssymb}
\usepackage{nicematrix}
\NiceMatrixOptions{code-for-last-row=\scriptstyle}
\begin{document}
Let $m\in\mathbb{N}^{\times}$. For $j=1,\ldots,m,$ define

$e_j\mathrel{\mathop:}=\mkern-10mu \begin{pNiceArray}{CCCCCCC}[last-row,first-col,last-col] & 0, &\mkern-10mu\ldots, &\mkern-10mu 0, &\mkern-15mu 1, &\mkern-15mu 0, & \mkern-15mu\ldots,&\mkern-15mu 0 &\\ & & & & \mkern-23mu (j) & & & \end{pNiceArray}\mkern-10mu \in K^{m}$
\end{document}