# Two vertical lines with expressions spanning a few rows between them (math)

I'm pretty new to Latex, learning it while doing. I mainly use doc and latex wiki, but there are occasions when I can't find something. I am doing some math. I need to have some math formulas followed by vertical lines and formulas spanning some rows between those vertical lines. Something like a notation of variable substitution in integrals. My explanation isn't perfect, so I made a picture of what I basically need.

Would be thankful for your advices on how I can achieve similar output.

UPD. Made this post hastily. Found the answer myself.

The easiest thing with ordinary latex I had to do was this code:

y= $$\left \rVert \begin{split} a = 2 \\ b = c \\ d = g \end{split} \right \rVert$$ = gosdfds

-

## 2 Answers

I'd define my own environment for this.

\documentclass{article}
\usepackage{amsmath}
\newcommand{\diff}{\mathop{}\!d}

\newenvironment{subst}
{\renewcommand{\arraystretch}{1.2}%
\left\|\begin{array}{l}}
{\end{array}\right\|}

\begin{document}

\begin{equation*}
\int x\sqrt{x-1}\diff x
\begin{subst}
t=\sqrt{x-1}, t^2=x-1,\\
x=t^2+1, \diff x=2t\diff t
\end{subst}
=\int(t^2+1)\cdot t\cdot 2t\diff t
\end{equation*}

\end{document}


The advantage is that you can freely change the definition of subst and this will be reflected in all instances thereof.

-
Readability would be enhanced by having a bit more whitespace after the commas in the middle part of this equation, i.e., right before t^2= and \diff x=. –  Mico Jul 26 at 18:36
@Mico Maybe. In any case I prefer a comma or a semicolon instead of the arrow. –  egreg Jul 26 at 18:54
Why don't you just use the Vmatrix env? –  daleif Jul 27 at 6:13
@daleif It's not a matrix; removing the padding, like Vmatrix does, didn't seem right (I tried, of course). –  egreg Jul 27 at 7:58

It may be nice for your readers if you state the substitution steps one by one. Using the idea suggested in @egreg's answer to use a dedicated environment -- called substitutions, say -- that lists the steps one at a time, one might typeset your equation as follows:

\documentclass{article}
\usepackage{amsmath} % provides 'aligned' environment
\newcommand{\dee}{\,\mathrm{d}}

\newenvironment{substitutions}{%
\quad\left\lVert\begin{aligned}}{%
\end{aligned}\,\right\rVert\quad}

\begin{document}
$\int \!x\sqrt{x-1}\dee x \begin{substitutions} t&=\sqrt{x-1}\\ t^2&=x-1\\ x&=t^2+1\\ \dee x&=2t\dee t \end{substitutions} =\int(t^2+1)\cdot t\cdot 2t\dee t =2\int \! t^2(t^2+1)\dee t$
\end{document}

-