如何将等式的不同部分左对齐或右对齐?

如何将等式的不同部分左对齐或右对齐?

我的家庭作业要求我复制(除其他外)以下等式:

我能够使用以下方法实现此目的align

\begin{align*}
    some stuff with & \tag{15} \\
            & some  other stuff & \qquad \qquad \qquad \quad \; 0 < x < 1. 
\end{align*}

但我不得不使用 4 ,\qquad因为右边的部分不会在右边!这很难看,但更让我困扰的是,align这个等式以前也有效:

我在这里使用了以下代码:

\begin{align*}
    foo &= bar \tag{15} \\
        &baz \\
    foo &= bar \\
        & baz & 0 < x < 1,
\end{align*} 

你可以看到右边的部分正好位于它应该在的位置,而没有使用令人尴尬的\quads。

如何让这些等式正确对齐?如何让一条线的一部分向右对齐?

仅供参考,这是我的 PDF 使用上述代码的样子(来自贝特曼手稿项目高等超越函数 卷我,第 23 页):


这是我的完整代码:

\documentclass[12pt,leqno]{article} %leqno is to align equation labels to left

\usepackage[bottom=0in, top=0.4in, left=1.2in, right=1.2in]{geometry} % set margins to look like the original
\usepackage{xfrac, relsize,fancyhdr} % for slanted fractions, bigger integral signs, and some other things
\usepackage[fleqn]{amsmath} % for equations flushed to left, among other things
\usepackage[nice]{nicefrac} % for nice slanted fractions

\DeclareMathOperator{\csch}{csch}

\pagestyle{fancy}
\fancyhf{} % removes default page number
\renewcommand{\headrulewidth}{0pt} % removes the top line

\headheight=15pt % smaller header height was yielding warnings in pdflatex compiler
\fancyhead[C]{GAMMA FUNCTION} % adds header
\voffset=0.15in % header position


\begin{document}

\rhead{23} % ads page number as a header
\lhead{\textbf{1.9.1}} 

\noindent \textbf{1.9.1. \; Kummer's series for } \textbf{$\log \Gamma (z)$} \\

The function $\log \Gamma (x)$, $0 < x < 1$, can be expanded in a Fourier series. We shall use the known Fourier expansions (Bromwich, 1947, pp. 356, 393, and 370 respectively):
\begin{align*}
    & \log(\sin\pi x) =  -  \log 2  -  \sum_{n=1}^{\infty} \, (1/n) \cos (2\pi n x), \\
    & \csch (\nicefrac{1}{2} \, t) \, \sinh (\nicefrac{1}{2}-x)t = 8 \pi \, \sum_{n=1}^{\infty} [n \; \sin(2\pi n x)]/(t^2 + 4{\pi}^2 n^2), \\
    & \pi (1 - 2x) = 2 \sum_{n=1}^{\infty} (1/n) \sin(2 \pi nx).
\end{align*}

If these are substituted in (7) with $z=x$, we have to evaluate the integral 

\[\mathlarger{\int_0^{\infty}} \left(\frac{2\pi n}{t^2 + 4{\pi}^2 \, n^2)} - \frac{e^{-t}}{2\pi n} \right)\frac{dt}{t} = \frac{1}{2\pi n} \mathlarger{\int_0^{\infty}} \left(\frac{1}{1+t^2} - e^{-2 \pi n t}\right)\frac{dt}{t}\]

\[= \frac{1}{2 \pi n} \left[ \mathlarger{\int_0^\infty} \left( \frac{1}{1+t^2}-\cos t \right) \frac{dt}{t} + \mathlarger{\int_0^\infty} \frac{e^{-t}-e^{-2 \pi n t}}{t}dt + \mathlarger{\int_0^\infty}(\cos t - e^{-t})\frac{dt}{t}\right]\] \\

\noindent and by means of 1.7(21) and 1.7(18) this is $(2 \pi n)^{-1}[\gamma + \log(2 \pi n)]$ since we have for the third integral: \\

$\lim \limits_{\delta \, \to \, 0} \, \int_\delta^{\, \infty} \, (\cos t - e^{-t}) \, t^{-1} dt = \lim \limits_{\delta \to 0} \; [\, \text{Ei}(- \delta) - \text{Ci} (\delta) \,] = 0.$ \\

\noindent Thus we have
\begin{align*}
    \log \, \Gamma(x) &= \nicefrac{1}{2} \log(2 \pi) \tag{14}\\
                      &+ \sum_{n=1}^\infty [(2 \pi)^{-1} \, \cos(2 \pi n x) + (\gamma + \log 2 \pi n) \, (\pi n)^{-1} \, \sin(2 \pi n x)], \\
    \log \, \Gamma(x) &= (\nicefrac{1}{2}-x)(\gamma + \log 2) + (1-x) \, \log \pi - \nicefrac{1}{2} \log(\sin \pi x)\\
                      &+ \sum_{n=1}^\infty (\pi n)^{-1} \log n \, \sin(2 \pi n x) & 0 < x < 1,
\end{align*} 

\noindent which is Kummer's series.

A similar representation for $\psi (x)$ is due to Lerch (Nielsen, 1906, p. 204),
\begin{align*}
    \psi (x)&  \, \sin(\pi x) = - \nicefrac{1}{2} \pi \cos(\pi x) - (\gamma + \log 2 \pi) \sin \pi x \tag{15} \\
            &+ \sum_{n=1}^\infty \log \left( \frac{n}{n+1} \right) \sin(2 \pi + 1) \pi x & \, & \; 0 < x < 1.
\end{align*}

\end{document}

答案1

这是另一次尝试。请注意,我已尝试通过使用诸如和之类的指令\subsubsection让 LaTeX 放置左对齐的方程式数字,使代码更具“LaTeX 风格”。我已经摆脱了指令\mathlarger(它们不是必需的)以及大多数\,(thinspace)实例——让 TeX 负责数学运算符前后的适当间距。我已经用\lim\limitsjust \lim\limits不需要指令)替换了两个实例。我认为\nicefrac{1}{2}看起来不太好,至少在 Computer Modern 中不是这样;我建议改用\tfrac。我已经用和替换了所有\left和实例,\right分别。我已经摆脱了超级笨拙的指令,而是添加了加载时选项。消除几乎所有的空白行也允许省略大多数指令。最后,我使用指令来定位术语。\biggl\biggr\voffset=0.15inincludeheadgeometry\noindent\mkern0<x<1

在此处输入图片描述

\documentclass[12pt,leqno]{article}
\usepackage[bottom=0in,top=0.4in,hmargin=1.2in,
   includehead]{geometry} 
\usepackage[fleqn]{amsmath}
   \DeclareMathOperator{\csch}{csch}
\usepackage{fancyhdr,indentfirst} 
   \pagestyle{fancy}
   \fancyhf{} 
   \renewcommand{\headrulewidth}{0pt} 
   \headheight=15pt 
   \chead{GAMMA FUNCTION} 
   \rhead{\arabic{page}}  % page number 
   \lhead{\thesubsubsection} 


\setcounter{section}{1}
\setcounter{subsection}{9}
\setcounter{page}{23}
\setcounter{equation}{13}

\begin{document}
% insert `\boldmath` directive in arg. of '\subsubsection` if '\log\Gamma' should be bolded 
\subsubsection{Kummer's series for $\log \Gamma (z)$} 

The function $\log \Gamma (x)$, $0 < x < 1$, can be expanded in 
a Fourier series. We shall use the known Fourier expansions 
(Bromwich, 1947, pp.\ 356, 393, and 370 respectively):
\begin{align*}
    & \log(\sin\pi x) =  -\log2 -\sum_{n=1}^{\infty}(1/n)\cos(2\pi nx), \\
    & \csch(\tfrac{1}{2}t)\sinh(\tfrac{1}{2}-x)t 
      = 8\pi\sum_{n=1}^{\infty} [n\sin(2\pi nx)]/(t^2 + 4\pi^2 n^2), \\
    & \pi(1-2x) = 2\sum_{n=1}^{\infty}(1/n)\sin(2\pi nx).
\end{align*}

If these are substituted in (7) with $z=x$, we have to evaluate 
the integral 
\begin{multline*}
\int_0^{\infty} \biggl( \frac{2\pi n}{t^2 + 4\pi^2 n^2} - \frac{e^{-t}}{2\pi n} \biggr)\frac{dt}{t} 
= \frac{1}{2\pi n} \int_0^{\infty} \biggl(\frac{1}{1+t^2} - e^{-2 \pi nt}\biggr)\frac{dt}{t}\\
= \frac{1}{2 \pi n} \Biggl[ \int_0^\infty \biggl( \frac{1}{1+t^2}-\cos t \biggr) \frac{dt}{t} 
+ \int_0^\infty \frac{e^{-t}-e^{-2\pi nt}}{t}\,dt 
+ \int_0^\infty(\cos t - e^{-t})\frac{dt}{t}\Biggr]
\end{multline*}
and by means of 1.7(21) and 1.7(18) this is 
$(2\pi n)^{-1}[\gamma+\log(2\pi n)]$ 
since we have for the third integral: 
\[
\lim_{\delta\to 0} \int_\delta^{\infty}  (\cos t-e^{-t}) t^{-1}\, dt = 
\lim_{\delta\to 0} \,[ \text{Ei}(-\delta) - \text{Ci}(\delta)] = 0\,.
\]
Thus we have 
\begin{align}
\log\Gamma(x) &= \tfrac{1}{2} \log(2 \pi) \\
\notag    &+ \sum_{n=1}^\infty [(2\pi)^{-1}\cos(2\pi n x) 
          + (\gamma+\log2\pi n)(\pi n)^{-1}\sin(2\pi nx)], \\
\log\Gamma(x) &= (\tfrac{1}{2}-x)(\gamma+\log2)+(1-x)  
           \log\pi-\tfrac{1}{2}\log(\sin\pi x)\notag\\
\notag   &+ \sum_{n=1}^\infty(\pi n)^{-1}\log n  \sin(2\pi nx) &  \mkern16mu 0 < x < 1, 
\end{align} 
which is Kummer's series.

A similar representation for $\psi(x)$ 
is due to Lerch (Nielsen, 1906, p.\ 204),
\begin{align}
\psi (x)& \sin(\pi x) = -\tfrac{1}{2} \pi\cos(\pi x) 
          - (\gamma+\log2\pi)\sin\pi x \\
\notag  &+ \sum_{n=1}^\infty \log \biggl( \frac{n}{n+1} \biggr) 
          \sin(2\pi+1) \pi x & \mkern145mu 0 < x < 1. 
\end{align}
\end{document}

答案2

这是我的(诚实的)建议。我不确定我是否完全理解了你想要获得的内容,但我做了一些看似合理的事。特别是,我删除了大多数手动间距,并为较大的积分定义了一个宏,它不包括边界,但需要手动校正下限的位置。注意,我为方程 14 和方程 15 中的第二行给出了不同的对齐方式,以显示可能性。

 \documentclass[12pt, leqno]{article} %leqno is to allgn equation labels to left

\usepackage[bottom=0in, top=0.55in,hmargin=1.2in, headheight=15pt, showframe]{geometry} % set margins to look like the original
\usepackage{xfrac, relsize,fancyhdr} % for slanted fractions, bigger integral signs, and some other things
\usepackage[fleqn]{mathtools, nccmath} % for equations flushed to left, among other things
\usepackage[nice]{nicefrac} % for nice slanted fractions

\DeclareMathOperator{\csch}{csch}

\pagestyle{fancy} % I'm not really sure what this does, but the internet guys said to use it ¯ \ _ (ツ) _ / ¯
\fancyhf{} % removes default page number
\renewcommand{\headrulewidth}{0pt} % removes the top line


\fancyhead[C]{GAMMA FUNCTION} % adds header

\newcommand\lint{\mathop{\mathlarger{\int}}\nolimits}

\begin{document}

\rhead{23} % adds page number as a header
\lhead{\textbf{1.9.1}}

\noindent \textbf{1.9.1. \; Kummer's series for \boldmath$\log \Gamma (z)$}\bigskip

The function $\log \Gamma (x)$, $0 < x < 1$, can be expanded in a Fourier series. We shall use the known Fourier expansions (Bromwich, 1947, pp. 356, 393, and 370 respectively):
\begin{align*}
    & \log(\sin\pi x) = - \log 2 - \sum_{n=1}^{\infty} \, (1/n) \cos (2\pi n x), \\
    & \csch (\mfrac{1}{2} \, t) \, \sinh (\mfrac{1}{2}-x)t = 8 \pi \, \sum_{n=1}^{\infty} [n \; \sin(2\pi n x)]/(t^2 + 4{\pi }^2 n^2), \\
    & \pi (1 - 2x) = 2 \sum_{n=1}^{\infty} (1/n) \sin(2 \pi nx).
\end{align*}

If these are substituted in (7) with $z=x$, we have to evaluate the integral
%
\begin{multline*}
    \lint_{\mkern-15mu 0}^{\infty} \biggl(\frac{2\pi n}{t^2 + 4{\pi }^2 \, n^2)} - \frac{e^{-t}}{2\pi n} \biggr)\frac{dt}{t} = \frac{1}{2\pi n} \lint_{\mkern-15mu 0}^{\infty}\biggl(\frac{1}{1+t^2} - e^{-2 \pi n t}\biggr)\frac{dt}{t} \\
     = \frac{1}{2 \pi n} \left[ \lint_{\mkern-15mu 0}^\infty \biggl( \frac{1}{1+t^2}-\cos t \biggr) \frac{dt}{t}
     + \lint_{\mkern-15mu 0}^\infty \frac{e^{-t}-e^{-2 \pi n t}}{t}dt %
     + \lint_{\mkern-15mu 0}^\infty (\cos t - e^{-t})\frac{dt}{t}\right]
\end{multline*}%
and by means of 1.7(21) and 1.7(18) this is $(2 \pi n)^{-1}[\gamma + \log(2 \pi n)]$ since we have for the third integral:
%
\[ \lim_{\delta \to 0} \int_\delta^{\infty}(\cos t - e^{-t}) \, t^{-1} dt = \lim_{\delta \to 0} \bigl [\text{Ei}(- \delta ) - \text{Ci} (\delta ) \bigr] = 0. \]
%
 Thus we have
\begin{flalign} \tag{14}
\log \Gamma (x) &= \begin{aligned}[t] & \nicefrac{1}{2} \log(2 \pi ) & \\
& \mathrlap{+ \sum_{n=1}^\infty [(2 \pi )^{-1} \, \cos(2 \pi n x) + (\gamma + \log 2 \pi n) \, (\pi n)^{-1} \, \mathrlap{\sin(2 \pi n x)]},}
\end{aligned} &
\\
\notag
\log \Gamma (x) &= \begin{aligned}[t] & (\nicefrac{1}{2}-x)(\gamma + \log 2) + { (1-x) \, \log \pi -\nicefrac{1}{2} \log(\sin \pi x)}\\
&+ \sum_{n=1}^\infty (\pi n)^{-1} \log n \, \sin(2 \pi n x)
\end{aligned} %
& & \begin{aligned}[t]
& \mbox{}\\[2ex] 0 < x < 1, \end{aligned}
\end{flalign}
%
which is Kummer's series.

A similar representation for $\psi (x)$ is due to Lerch (Nielsen, 1906, p. 204),%
\begin{flalign}\tag{15}%
    \psi (x)\sin(\pi x)&= - \nicefrac{1}{2} \pi \cos(\pi x) - (\gamma + \log 2 \pi ) \sin \pi x \\
     & + \sum_{n=1}^\infty \log \left( \frac{n}{n+1} \right) \sin(2 \pi + 1) \pi x % This is ugly, but there's nothing I could do
     & & 0 < x < 1.\notag
\end{flalign}

\end{document}

在此处输入图片描述

相关内容