6

I want to have the right side of the equation surrounded by square brackets with appropriate size.

How do I make the brackets contain many lines without ruining the alignment?

Minimal code that won't compile:

\documentclass[
paper=a4,                    
oneside,                        
fontsize=13pt,              
headsepline=.5pt,          
numbers=noenddot,         
parskip=half,            
captions=tableheading,  
DIV=12,                      
toc=bibliography,           
final       
]{scrartcl}
\usepackage{amsmath, amsfonts}
\begin{document}
\begin{equation} 
\begin{aligned}
\vec{\nabla} =  \left[  &\frac{\partial}{\partial x_1} \\
                    &\frac{\partial}{\partial x_2}  \\
                    &\frac{\partial}{\partial x_3} \right] 
\end{aligned}
\end{equation} 
\end{document}

This gives following errors:

! Extra }, or forgotten \right.
<template> }
            $\endtemplate 
l.17 \vec{\nabla}    \left[  &
                              \frac{\partial}{\partial x_1} \\
? 
! Missing \right. inserted.
<inserted text> 
                \right .
l.17 \vec{\nabla}    \left[  &
                              \frac{\partial}{\partial x_1} \\
? 
! Missing } inserted.
<inserted text> 
                }
l.17 \vec{\nabla}    \left[  &
                              \frac{\partial}{\partial x_1} \\
? 
! Missing } inserted.
<inserted text> 
                }
l.19 ...     &\frac{\partial}{\partial x_3} \right
                                                  ]
? 
! Extra \right.
l.19 ...    &\frac{\partial}{\partial x_3} \right]

? 
! Missing { inserted.
<inserted text> 
                {
l.20 \end{aligned}

? 
1
  • Please provide a bit more information about the object you're trying to typeset. E.g., are you trying to typeset an elaborate version of a gradient vector? Please advise.
    – Mico
    Commented Jun 6, 2019 at 17:16

1 Answer 1

6

You should place \left. and \right] outside the aligned environment.

enter image description here

\documentclass[paper=a4,oneside,fontsize=13pt,
   headsepline=.5pt,numbers=noenddot,parskip=half,
   captions=tableheading,DIV=12,toc=bibliography,
   final]{scrartcl}
\usepackage{amsmath, amssymb}

\begin{document}
\begin{equation} 
\left.
\begin{aligned}
\vec{\nabla}   &\frac{\partial}{\partial x_1} \\
               &\frac{\partial}{\partial x_2} \\
               &\frac{\partial}{\partial x_3} 
\end{aligned}
\right] 
\end{equation} 
\end{document}

However, I suspect that you don't actually wan't to use an aligned environment at all. Aren't you just trying to typeset a column vector, surrounded by square brackets? If so, a bmatrix environment is the way to go.

enter image description here

\documentclass[paper=a4,oneside,fontsize=13pt,
   headsepline=.5pt,numbers=noenddot,parskip=half,
   captions=tableheading,DIV=12,toc=bibliography,
   final]{scrartcl}
\usepackage{amsmath, amssymb}

\begin{document}
\begin{equation} 
\renewcommand\arraystretch{1.25}
\vec{\nabla}=
\begin{bmatrix}
   \frac{\partial}{\partial x_1} \\
   \frac{\partial}{\partial x_2} \\
   \frac{\partial}{\partial x_3} 
\end{bmatrix}
\end{equation} 
\end{document}

You must log in to answer this question.

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