如何将公式旁边的文本左对齐

如何将公式旁边的文本左对齐

我试图将方程式旁边的文本向左对齐,但没有成功,我尝试只使用一个对齐环境,但发生了这种情况 在此处输入图片描述

文本按照我想要的方式左对齐,但是方程式没有组织好,所以我决定为每个方程式创建一个对齐环境,但是文本没有组织到左边,下面是代码:

\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}

答案1

(通过附加示例更新了答案,说明如何提供额外的换行符以避免创建过满的行)

我建议您使用单一alignat*环境,而不是四个独立的align*环境。

无论您做什么,请将所有十个 [10!] 个实例更改\operatorname{sin}\sin

Curl 方程有点太长了,无法放在一行中,因为有些内容会突出到右侧边缘。如果认为有必要,可以直接在第三个加法项前插入换行符。以下代码显示了如何实现这一点。

在此处输入图片描述

\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}

答案2

您可以使用单个 的fleqn 环境。我简化了您的代码,加载了偏导数包,并删除了 (现在预期的编码正是)、(由 加载)和(由 加载)。nccmathalign*esdiffinputencutf8amsmathmathtoolsamsfontsamssymb

\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} 

在此处输入图片描述

答案3

此解决方案使用flalign。请注意,我对齐了等号而不是 s \nabla。我添加了一个额外的空白列来占据右侧的空间。

每一秒都&成为排列整齐的数学列之间的空隙。

\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}

演示

相关内容