3

I am trying to align the text beside an equation to the left, but I didn't have any success, I tried using just one align ambient but this happened enter image description here

The text is aligned to the left as I wanted, but the equations aren't organized, so I decided to create an align environment for each equation, but the text aren't organized to the left, here is the code:

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[bottom=2cm,top=3cm,left=3cm,right=2cm]{geometry}
\usepackage[onehalfspacing]{setspace}
\usepackage[T1]{fontenc}
\usepackage[brazil]{babel}
% Pacotes Essenciais
\usepackage{graphics,comment,enumerate,multirow,multicol,indentfirst}
\usepackage[table,xcdraw]{xcolor}
\usepackage{setspace}
\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=black,
    filecolor=magenta,      
    urlcolor=blue,
}
\urlstyle{same}

% Pacotes de Matemática
\usepackage{graphicx,amsmath,amsthm,amsfonts,amssymb,dsfont,mathtools,blindtext,bm, tensor,natbib,,amssymb,array,float,natbib,esint}
\usepackage[makeroom]{cancel}

% Novos comandos
\newcommand{\RR}{\mathds{R}}% escrever o simbolo dos reais
\newcommand{\QQ}{\mathds{Q}}% escrever o simbolo dos racionais
\newcommand{\ZZ}{\mathds{Z}}% escrever o simbolo dos inteiros
\newcommand{\NN}{\mathds{N}}% escrever o simbolo dos naturais
\newcommand{\MM}{\mathds{M}}% escrever o simbolo dos 
\newcommand{\CC}{\mathds{C}}% escrever o simbolo dos complexos

%limite
\newcommand{\limit}[3]
{\ensuremath{\lim_{#1 \rightarrow #2} #3}}

%para escrever a lagrangiana
\usepackage{calrsfs}
\DeclareMathAlphabet{\pazocal}{OMS}{zplm}{m}{n} 

%derivada com barra
\newcommand{\dbar}{d\hspace*{-0.08em}\bar{}\hspace*{0.1em}}

%notação braket
\DeclarePairedDelimiter\bra{\langle}{\rvert}
\DeclarePairedDelimiter\ket{\lvert}{\rangle}
\DeclarePairedDelimiterX\braket[2]{\langle}{\rangle}{#1 \delimsize\vert #2}

%´Família Griffiths

\def\rcurs{{\mbox{$\resizebox{.09in}{.08in}{\includegraphics[trim= 1em 0 14em 0,clip]{ScriptR}}$}}}
\def\brcurs{{\mbox{$\resizebox{.09in}{.08in}{\includegraphics[trim= 1em 0 14em 0,clip]{BoldR}}$}}}


\newcommand{\angstrom}{\textup{\AA}}
\begin{document}
\begin{align*}
&\text{Gradient:} &\nabla t = \frac{\partial t}{\partial r} \hat{\mathbf{r}} + \frac{1}{r}\frac{\partial t}{\partial \theta} \hat{\bm{\theta}} + \frac{1}{r \operatorname{sin}\theta}\frac{\partial t}{\partial \phi} \hat{\bm{\phi}}\\
\end{align*}
\vspace{-1.6cm}
\begin{align*}
&\text{Divergent:} &\nabla \cdot \mathbf{v} = \frac{1}{r^2}\frac{\partial}{\partial r}(r^2v_r)+\frac{1}{r\operatorname{sin}\theta}\frac{\partial \theta}{\partial \theta}(\operatorname{sin}\theta v_{\theta}) + \frac{1}{r\operatorname{sin}\theta}\frac{\partial v_{\phi}}{\partial \phi}\\
\end{align*}
\vspace{-1.6 cm}
\begin{align*}
&\text{Curl:} &\nabla \times v = \frac{1}{r\operatorname{sin}\theta}\left[\frac{\partial }{\partial \theta}(\operatorname{sin}\theta v_{\phi}) - \frac{\partial v_{\theta}}{\partial \phi}\right]\hat{\mathbf{r}} + \frac{1}{r}\left[\frac{1}{\operatorname{sin}\theta}\frac{\partial v_r}{\partial \phi} - \frac{\partial}{\partial r}(rv_{\phi})\right]\hat{\bm{\theta}} + \frac{1}{r}\left[\frac{\partial }{\partial r}(rv_{\theta}) - \frac{v_r}{\partial \theta}\right]\hat{\bm{\phi}}\\
\end{align*}
\vspace{-1.6cm}
\begin{align*}
&\text{Laplacian:} &\nabla^2t = \frac{1}{r^2}\left(r^2\frac{\partial t}{\partial r}\right) + \frac{1}{r^2\operatorname{sin}\theta}\frac{\partial}{\partial \theta} \left(\operatorname{sin \theta}\frac{\partial t}{\partial \theta}\right) + \frac{1}{r^2\operatorname{sin^2}\theta}\frac{\partial^2 t}{\partial \phi^2}
\end{align*}
\end{document}
2
  • every single equation it aligned to the left, i want the small equations to be align with each other, because i want the same space between the small equations and the text beside.
    – Gusklin
    Jul 20, 2021 at 23:08
  • Shouldn't the second line be tagged “Divergence” rather than “Divergent”?
    – egreg
    Jul 21, 2021 at 12:15

3 Answers 3

4

(updated the answer with an additional example, of how to provide an extra line break in order to avoid creating an overfull line)

I suggest you use a single alignat* environment instead of four independent align* environments.

Whatever else you do, please change all ten [10!] instances of \operatorname{sin} to \sin.

The Curl equation is just a bit too long to fit on a single line without some of the material jutting into the right-hand margin. If judged necessary, it's straightforward to insert a line break before the third additive term. The following code shows how this may be accomplished.

enter image description here

\documentclass[12pt]{article}
%% Remark: I've reduced the preamble to the bare mininum needed to
%%         make the code compilable.
%\usepackage[utf8]{inputenc} % 'utf8' is the default nowadays
\usepackage[T1]{fontenc}
\usepackage[brazil]{babel}
\usepackage[top=3cm,bottom=2cm,left=3cm,right=2cm]{geometry}
\usepackage[onehalfspacing]{setspace}
\usepackage{mleftright} \mleftright % <-- optional
\usepackage{amsmath,amssymb,bm,array}

\begin{document}

\begin{alignat*}{2}
&\text{Gradient} &\nabla t 
   &= \frac{\partial t}{\partial r} \hat{\mathbf{r}} 
     + \frac{1}{r}\frac{\partial t}{\partial \theta} \hat{\bm{\theta}} 
     + \frac{1}{r \sin\theta}\frac{\partial t}{\partial \phi} \hat{\bm{\phi}}\\[1.5ex]
&\text{Divergent} &\nabla \cdot \mathbf{v} 
   &= \frac{1}{r^2}\frac{\partial}{\partial r}(r^2v_r)
     +\frac{1}{r\sin\theta}\frac{\partial \theta}{\partial \theta}(\sin\theta v_{\theta}) 
     + \frac{1}{r\sin\theta}\frac{\partial v_{\phi}}{\partial \phi}\\[1.5ex]
&\text{Curl} &\nabla \times v 
   &= \frac{1}{r\sin\theta}\left[\frac{\partial }{\partial \theta}(\sin\theta v_{\phi}) 
        - \frac{\partial v_{\theta}}{\partial \phi}\right]\hat{\mathbf{r}} 
     + \frac{1}{r}\left[\frac{1}{\sin\theta}\frac{\partial v_r}{\partial \phi} 
        - \frac{\partial}{\partial r}(rv_{\phi})\right]\hat{\bm{\theta}} 
     + \frac{1}{r}\left[\frac{\partial }{\partial r}(rv_{\theta}) 
        - \frac{v_r}{\partial \theta}\right]\hat{\bm{\phi}}\\[1.5ex]
&\text{Laplacian} &\nabla^2t 
   &= \frac{1}{r^2}\left(r^2\frac{\partial t}{\partial r}\right) 
     + \frac{1}{r^2\sin\theta}\frac{\partial}{\partial \theta} 
        \left(\sin\theta\,\frac{\partial t}{\partial \theta}\right) 
     + \frac{1}{r^2\sin^2\theta}\frac{\partial^2 t}{\partial \phi^2}
\end{alignat*}

\begin{alignat*}{2}
&\text{Gradient} &\nabla t 
   &= \frac{\partial t}{\partial r} \hat{\mathbf{r}} 
     + \frac{1}{r}\frac{\partial t}{\partial \theta} \hat{\bm{\theta}} 
     + \frac{1}{r \sin\theta}\frac{\partial t}{\partial \phi} \hat{\bm{\phi}}\\[1.5ex]
&\text{Divergent} &\nabla \cdot \mathbf{v} 
   &= \frac{1}{r^2}\frac{\partial}{\partial r}(r^2v_r)
     +\frac{1}{r\sin\theta}\frac{\partial \theta}{\partial \theta}(\sin\theta v_{\theta}) 
     + \frac{1}{r\sin\theta}\frac{\partial v_{\phi}}{\partial \phi}\\[1.5ex]
&\text{Curl} &\nabla \times v 
   &= \frac{1}{r\sin\theta}\left[\frac{\partial }{\partial \theta}(\sin\theta v_{\phi}) 
         - \frac{\partial v_{\theta}}{\partial \phi}\right]\hat{\mathbf{r}} 
     + \frac{1}{r}\left[\frac{1}{\sin\theta}\frac{\partial v_r}{\partial \phi} 
         - \frac{\partial}{\partial r}(rv_{\phi})\right]\hat{\bm{\theta}}\\[1ex]
   &&&\quad+ \frac{1}{r}\left[\frac{\partial }{\partial r}(rv_{\theta}) 
         - \frac{v_r}{\partial \theta}\right]\hat{\bm{\phi}}\\[1.5ex]
&\text{Laplacian}\quad &\nabla^2t 
   &= \frac{1}{r^2}\left(r^2\frac{\partial t}{\partial r}\right) 
     + \frac{1}{r^2\sin\theta}\frac{\partial}{\partial \theta} 
         \left(\sin\theta\,\frac{\partial t}{\partial \theta}\right) 
     + \frac{1}{r^2\sin^2\theta}\frac{\partial^2 t}{\partial \phi^2}
\end{alignat*}

\end{document}
3

You can use the fleqn environment from nccmath with a single align*. I simplified a bit your code, loading the esdiff package for partial derivatives, and removing inputenc (nowadays the expected encoding is precisely utf8), amsmath (loaded by mathtools) and amsfonts (loaded by amssymb).

\documentclass{article}
\usepackage[bottom=2cm, top=3cm, left=3cm, right=2cm]{geometry}
\usepackage[onehalfspacing]{setspace}
\usepackage[T1]{fontenc}
\usepackage[brazil]{babel}
% Pacotes Essenciais
\usepackage{graphics,comment,enumerate,multirow,multicol,indentfirst}
\usepackage[table,xcdraw]{xcolor}
\usepackage{setspace}
\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=black,
    filecolor=magenta,
    urlcolor=blue,
}
\urlstyle{same}

% Pacotes de Matemática
\usepackage{graphicx, amsthm, amssymb, nccmath, dsfont,mathtools,blindtext,bm, tensor,natbib,,array,float,natbib,esint, esdiff}
\usepackage[makeroom]{cancel}

% Novos comandos
\newcommand{\RR}{\mathds{R}}% escrever o simbolo dos reais
\newcommand{\QQ}{\mathds{Q}}% escrever o simbolo dos racionais
\newcommand{\ZZ}{\mathds{Z}}% escrever o simbolo dos inteiros
\newcommand{\NN}{\mathds{N}}% escrever o simbolo dos naturais
\newcommand{\MM}{\mathds{M}}% escrever o simbolo dos
\newcommand{\CC}{\mathds{C}}% escrever o simbolo dos complexos

%limite
\newcommand{\limit}[3]
{\ensuremath{\lim_{#1 \rightarrow #2} #3}}

%para escrever a lagrangiana
\usepackage{calrsfs}
\DeclareMathAlphabet{\pazocal}{OMS}{zplm}{m}{n}

%derivada com barra
\newcommand{\dbar}{d\hspace*{-0.08em}\bar{}\hspace*{0.1em}}

%notação braket
\DeclarePairedDelimiter\bra{\langle}{\rvert}
\DeclarePairedDelimiter\ket{\lvert}{\rangle}
\DeclarePairedDelimiterX\braket[2]{\langle}{\rangle}{#1 \delimsize\vert #2}

%´Família Griffiths

\def\rcurs{{\mbox{$\resizebox{.09in}{.08in}{\includegraphics[trim= 1em 0 14em 0,clip]{ScriptR}}$}}}
\def\brcurs{{\mbox{$\resizebox{.09in}{.08in}{\includegraphics[trim= 1em 0 14em 0,clip]{BoldR}}$}}}


\newcommand{\angstrom}{\textup{\AA}}

\begin{document}

\begin{fleqn}
\begin{align*}
&\text{Gradient:} &\nabla t & = \diffp{t}{r} \hat{\mathbf{r}} + \frac{1}{r}\diffp{ t}{\theta} \hat{\bm{\theta}} + \frac{1}{r \sin\theta}\diffp{t}{\phi} \hat{\bm{\phi}}\\[1ex]
&\text{Divergent:} &\nabla \cdot \mathbf{v} & = \frac{1}{r^2}\diffp{}{r}(r^2v_r) + \frac{1}{r\sin \theta}\diffp{\theta}{\theta}(\sin\theta v_{\theta}) + \frac{1}{r\sin \theta}\diffp{ v_{\phi}}{\phi}\\[1ex]
&\text{Curl:} &\nabla \times v & = \frac{1}{r\sin\theta}\left[\diffp{ }{ \theta}(\sin\theta v_{\phi}) - \diffp{ v_{\theta}}{\phi}\right]\hat{\mathbf{r}} + \frac{1}{r}\left[\frac{1}{\sin\theta}\diffp{v_r}{ \phi} - \diffp{}{r}(rv_{\phi})\right]\hat{\bm{\theta}} + \frac{1}{r}\left[\diffp{}{r}(rv_{\theta}) - \frac{v_r}{\theta}\right]\hat{\bm{\phi}}\\[1ex]
&\text{Laplacian:} &\nabla^2t & = \frac{1}{r^2}\left(r^2\diffp{t}{r}\right) + \frac{1}{r^2\sin\theta}\diffp{}{\theta} \left(\sin \theta\diffp{t}{\theta}\right) + \frac{1}{r^2\sin^2\theta}\diffp[2]{t}{\phi}
\end{align*}
\end{fleqn}

\end{document} 

enter image description here

2
  • My first language is Portuguese, i have to write words with special characters, i believe that is the name, utf8 already do this? i am new at LaTeX, so i don't much about the packages.
    – Gusklin
    Jul 20, 2021 at 23:58
  • Yes, most LaTeX editors nowadays use utf8 by default, so it's been unnecessary to load inputenc for 3 years, if I remember well. Just check your editor indeed uses utf8 (which is compatible with unicode, btw).
    – Bernard
    Jul 21, 2021 at 8:24
2

This solution uses flalign. Note that I aligned the equals signs instead of the \nablas. I added an extra blank column to take up space to the right.

Every second & becomes a gap between columns of aligned math.

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[bottom=2cm,top=3cm,left=3cm,right=2cm]{geometry}
\usepackage[onehalfspacing]{setspace}
\usepackage[T1]{fontenc}
\usepackage[brazil]{babel}
% Pacotes Essenciais
\usepackage{graphics,comment,enumerate,multirow,multicol,indentfirst}
\usepackage[table,xcdraw]{xcolor}
\usepackage{setspace}
\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=black,
    filecolor=magenta,      
    urlcolor=blue,
}
\urlstyle{same}

% Pacotes de Matemática
\usepackage{graphicx,amsmath,amsthm,amsfonts,amssymb,dsfont,mathtools,blindtext,bm, tensor,natbib,,amssymb,array,float,natbib,esint}
\usepackage[makeroom]{cancel}

% Novos comandos
\newcommand{\RR}{\mathds{R}}% escrever o simbolo dos reais
\newcommand{\QQ}{\mathds{Q}}% escrever o simbolo dos racionais
\newcommand{\ZZ}{\mathds{Z}}% escrever o simbolo dos inteiros
\newcommand{\NN}{\mathds{N}}% escrever o simbolo dos naturais
\newcommand{\MM}{\mathds{M}}% escrever o simbolo dos 
\newcommand{\CC}{\mathds{C}}% escrever o simbolo dos complexos

%limite
\newcommand{\limit}[3]
{\ensuremath{\lim_{#1 \rightarrow #2} #3}}

%para escrever a lagrangiana
\usepackage{calrsfs}
\DeclareMathAlphabet{\pazocal}{OMS}{zplm}{m}{n} 

%derivada com barra
\newcommand{\dbar}{d\hspace*{-0.08em}\bar{}\hspace*{0.1em}}

%notação braket
\DeclarePairedDelimiter\bra{\langle}{\rvert}
\DeclarePairedDelimiter\ket{\lvert}{\rangle}
\DeclarePairedDelimiterX\braket[2]{\langle}{\rangle}{#1 \delimsize\vert #2}

%´Família Griffiths

\def\rcurs{{\mbox{$\resizebox{.09in}{.08in}{\includegraphics[trim= 1em 0 14em 0,clip]{ScriptR}}$}}}
\def\brcurs{{\mbox{$\resizebox{.09in}{.08in}{\includegraphics[trim= 1em 0 14em 0,clip]{BoldR}}$}}}


\newcommand{\angstrom}{\textup{\AA}}
\begin{document}
\begin{flalign*}
&\text{Gradient:} &\nabla t &= \frac{\partial t}{\partial r} \hat{\mathbf{r}} + \frac{1}{r}\frac{\partial t}{\partial \theta} \hat{\bm{\theta}} + \frac{1}{r \operatorname{sin}\theta}\frac{\partial t}{\partial \phi} \hat{\bm{\phi}} &&\\[1ex]
%
&\text{Divergent:} &\nabla \cdot \mathbf{v} &= \frac{1}{r^2}\frac{\partial}{\partial r}(r^2v_r)+\frac{1}{r\operatorname{sin}\theta}\frac{\partial \theta}{\partial \theta}(\operatorname{sin}\theta v_{\theta}) + \frac{1}{r\operatorname{sin}\theta}\frac{\partial v_{\phi}}{\partial \phi}\\[1ex]
%
&\text{Curl:} &\nabla \times v &= \frac{1}{r\operatorname{sin}\theta}\left[\frac{\partial }{\partial \theta}(\operatorname{sin}\theta v_{\phi}) - \frac{\partial v_{\theta}}{\partial \phi}\right]\hat{\mathbf{r}} + \frac{1}{r}\left[\frac{1}{\operatorname{sin}\theta}\frac{\partial v_r}{\partial \phi} - \frac{\partial}{\partial r}(rv_{\phi})\right]\hat{\bm{\theta}}\\
&&&\quad + \frac{1}{r}\left[\frac{\partial }{\partial r}(rv_{\theta}) - \frac{v_r}{\partial \theta}\right]\hat{\bm{\phi}}\\[1ex]
%
&\text{Laplacian:} &\nabla^2t &= \frac{1}{r^2}\left(r^2\frac{\partial t}{\partial r}\right) + \frac{1}{r^2\operatorname{sin}\theta}\frac{\partial}{\partial \theta} \left(\operatorname{sin \theta}\frac{\partial t}{\partial \theta}\right) + \frac{1}{r^2\operatorname{sin^2}\theta}\frac{\partial^2 t}{\partial \phi^2}
\end{flalign*}
\end{document}

demo

You must log in to answer this question.

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