5

How can I left-justify inside substack?

\documentclass{standalone}
\usepackage{amsmath}

\begin{document}

$L_{\textrm{disk}} = L_{ \substack{\textrm{disk} \\ \textrm{orbital} } } + L_{ \substack{\textrm{disk} \\ \textrm{spin} } }#$

\end{document}

yields

enter image description here

I tried using \raggedright inside the \substack, but this failed.

1
  • 2
    Use \begin{subarray}{l}\textrm{disk}\\\textrm{orbital}\end{subarray}
    – egreg
    Jul 10 '14 at 14:21
4

You can use \begin{subarray}{l}, but perhaps it's better to define a new command based on subarray (just like \substack is based on subarray).

\documentclass[border=2bp]{standalone}
\usepackage{amsmath}

\makeatletter
\newenvironment{tsubarray}[1]{%
  \vcenter\bgroup
  \Let@ \restore@math@cr \default@tag
  \baselineskip\fontdimen10 \scriptfont\tw@
  \advance\baselineskip\fontdimen12 \scriptfont\tw@
  \lineskip\thr@@\fontdimen8 \scriptfont\thr@@
  \lineskiplimit\lineskip
  \check@mathfonts
  \ialign\bgroup\ifx c#1\hfil\fi
    \normalfont\fontsize\sf@size\z@\selectfont\ignorespaces##\unskip\hfil\crcr
}{%
  \crcr\egroup\egroup
}
\makeatother
\newcommand{\tsub}[1]{\begin{tsubarray}{l}#1\end{tsubarray}}

\begin{document}

$L_{\tsub{disk}} = L_{\tsub{disk \\ orbital}} + L_{\tsub{disk \\ spin}}$

\end{document}

You have the advantage of not needing \textrm and also this avoids the subscripts being typeset in italic if the formula appears in an italic context like a theorem statement, because \normalfont takes care of selecting the default upshape font.

The argument to tsubarray can be c or l.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.