I want to put vertical text in my equation, like in this example:
I got
\begin{equation}
Dir(\alpha) \xrightarrow{iid}
\end{equation}
and tried to put in linebreaks, but that does not work. How can I do this?
Try
\begin{equation}
Dir(\alpha)\xrightarrow{iid}
\begin{matrix}
q^{(1)}\\
q^{(2)}\\
\vdots\\
q^{(L)}
\end{matrix},
\end{equation}
That said, you should also put \DeclareMathOperator{\Dir}{Dir}
in your preamble and use \Dir
instead of writing Dir
directly.
If you need the spacing gap between the items of the stack to be customized, you can use this approach. The inter-item gap is set by the second argument to the \setstackgap
macro. Two examples shown below.
\documentclass{article}
\usepackage{amsmath}
\usepackage[usestackEOL]{stackengine}[2013-09-11]
\stackMath
\newsavebox{\tempbox}
\parskip 2em
\begin{document}
\setstackgap{S}{9pt}
\begin{equation}
Dir(\alpha)\xrightarrow{iid}
\sbox{\tempbox}{\Shortstack[l]{%
q^{(1)}\\
q^{(2)}\\
\vdots\\
q^{(L)}
}}%
\abovebaseline[-.5\ht\tempbox+.5\ht\strutbox]{\usebox{\tempbox}},
\end{equation}
\setstackgap{S}{1pt}
\begin{equation}
Dir(\alpha)\xrightarrow{iid}
\sbox{\tempbox}{\Shortstack[l]{%
q^{(1)}\\
q^{(2)}\\
\vdots\\
q^{(L)}
}}%
\abovebaseline[-.5\ht\tempbox+.5\ht\strutbox]{\usebox{\tempbox}},
\end{equation}
\end{document}