导数中的方程对齐

导数中的方程对齐

好的,到目前为止,我的乳胶文档中有以下推导:

\documentclass[a4paper,oneside,11pt]{report}

\usepackage[english]{babel} %francais, polish, spanish, ...
\usepackage[T1]{fontenc}
\usepackage[ansinew]{inputenc}
\usepackage[cm]{fullpage}
\usepackage{float}
\usepackage{lmodern} 
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{a4wide}
\setlength{\marginparwidth}{3cm}
\setlength{\topmargin}{0cm}
\setlength{\voffset}{0cm}
\setlength{\headsep}{0cm}

\usepackage{etoolbox}
\makeatletter
\patchcmd{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi}{}{}{}
\makeatother

\makeatletter
\def\@makechapterhead#1{%
  \vspace*{10\p@}%
  {\parindent \z@ \raggedright \normalfont
    %\ifnum \c@secnumdepth >\m@ne
    %    \huge\bfseries \@chapapp\space \thechapter
    %    \par\nobreak
    %    \vskip 20\p@
    %\fi
    \interlinepenalty\@M
    \Huge \thechapter \space \space \space \bfseries #1\par\nobreak
    \vskip 10\p@
  }}
  \makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% DOCUMENT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\begin{align}
    F_{x_t}(h-h_3) + (F_{z_t} + mgcos\phi - 2F_{z_1})a_2 - 2h(F_{x_1} + F_{x_2}) - 2F_{z_1}a_1 - F_{z_t}(a_2 + b_1) = 0 \nonumber 
\end{align} 
\begin{align}
    2F_{z_1}(a_1 + a_2) &= F_{x_t}(h - h_3) + (F_{z_t} + mgcos\phi)a_2 -2h(F_{x_1} + F_{x_2}) - F_{z_t}(a_2 + b_1) \nonumber \\
    &= A_2sin\phi(h - h_3) + mga_2cos\phi - 2hA_1sin\phi - b_1(A_3sin\phi + B_3cos\phi) \nonumber \\
    &= sin\phi\big(A_2(h - h_3) -2hA_1 -b_1A_3 \big) + cos\phi \big(mga_2 - b_1B_3 \big) \nonumber
\end{align}
\begin{align}
\therefore F_{z_1} = A_4sin\phi + B_4cos\phi
\end{align}
\end{document}

如您所见,推导中有 5 行(即\begin{align}\end{align}语句之间)。但是,中间的 3 行需要相对于等号对齐,并且顶部和底部的线应该居中。我已经设法通过这种方式实现了它,但我想要一种不使用 3 个对齐块的方法,这可能吗?

答案1

您可以使用普通的equationand/orequation*环境来表示第一个和最后一个方程。另外,如果环境中的每一行align都有一个\notag语句来隐藏方程编号,那么最好使用align*环境并删除所有这些\notag语句。

在此处输入图片描述

\documentclass[a4paper,oneside,11pt]{report}
\usepackage[cm]{fullpage}
\usepackage{lmodern,amsmath,amssymb}
\usepackage{a4wide}
\setlength{\marginparwidth}{3cm}
\setlength{\topmargin}{0cm}
\setlength{\voffset}{0cm}
\setlength{\headsep}{0cm}

\begin{document}

\begin{equation*}
F_{x_t}(h-h_3) + (F_{z_t} + mg\cos\phi - 2F_{z_1})a_2 - 2h(F_{x_1} + F_{x_2}) - 2F_{z_1}a_1 - F_{z_t}(a_2 + b_1) = 0
\end{equation*}    
\begin{align*}
2F_{z_1}(a_1 + a_2) &= F_{x_t}(h - h_3) + (F_{z_t} + mg\cos\phi)a_2 -2h(F_{x_1} + F_{x_2}) - F_{z_t}(a_2 + b_1) \\
&= A_2\sin\phi(h - h_3) + mga_2\cos\phi - 2hA_1\sin\phi - b_1(A_3\sin\phi + B_3\cos\phi) \\
&= \sin\phi\big(A_2(h - h_3) -2hA_1 -b_1A_3 \big) + \cos\phi \big(mga_2 - b_1B_3 \big)
\end{align*}         
\begin{equation}
\therefore F_{z_1} = A_4\sin\phi + B_4\cos\phi
\end{equation}
\end{document}

附录如果您想要消除方程组之间的多余空格,您可以继续使用split环境内的环境gather\notag对除最终表达式之外的所有表达式都使用指令):

在此处输入图片描述

\documentclass[a4paper,oneside,11pt]{report}
\usepackage[cm]{fullpage}
\usepackage{lmodern,amsmath,amssymb}
\usepackage{a4wide}
\setlength{\marginparwidth}{3cm}
\setlength{\topmargin}{0cm}
\setlength{\voffset}{0cm}
\setlength{\headsep}{0cm}
\begin{document}
\begin{gather}
F_{x_t}(h-h_3) + (F_{z_t} + mg\cos\phi - 2F_{z_1})a_2 - 2h(F_{x_1} + F_{x_2}) - 2F_{z_1}a_1 - F_{z_t}(a_2 + b_1) = 0\notag\\
\begin{split}
2F_{z_1}(a_1 + a_2) &= F_{x_t}(h - h_3) + (F_{z_t} + mg\cos\phi)a_2 -2h(F_{x_1} + F_{x_2}) - F_{z_t}(a_2 + b_1) \notag\\
&= A_2\sin\phi(h - h_3) + mga_2\cos\phi - 2hA_1\sin\phi - b_1(A_3\sin\phi + B_3\cos\phi) \notag\\
&= \sin\phi\big(A_2(h - h_3) -2hA_1 -b_1A_3 \big) + \cos\phi \big(mga_2 - b_1B_3 \big) \end{split} \notag\\ 
\therefore F_{z_1} = A_4\sin\phi + B_4\cos\phi
\end{gather}
\end{document}

答案2

也许

在此处输入图片描述

请注意,您应该始终使用\coscos和类似的多字母标识符。默认的数学斜体字体不是为多字母单词设计的。

\documentclass[a4paper,oneside,11pt]{report}

\usepackage[english]{babel} %francais, polish, spanish, ...
\usepackage[T1]{fontenc}
\usepackage[ansinew]{inputenc}
\usepackage[cm]{fullpage}
\usepackage{float}
\usepackage{lmodern} 
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{a4wide}
\setlength{\marginparwidth}{3cm}
\setlength{\topmargin}{0cm}
\setlength{\voffset}{0cm}
\setlength{\headsep}{0cm}

\usepackage{etoolbox}
\makeatletter
\patchcmd{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi}{}{}{}
\makeatother

\makeatletter
\def\@makechapterhead#1{%
  \vspace*{10\p@}%
  {\parindent \z@ \raggedright \normalfont
    %\ifnum \c@secnumdepth >\m@ne
    %    \huge\bfseries \@chapapp\space \thechapter
    %    \par\nobreak
    %    \vskip 20\p@
    %\fi
    \interlinepenalty\@M
    \Huge \thechapter \space \space \space \bfseries #1\par\nobreak
    \vskip 10\p@
  }}
  \makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% DOCUMENT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\begin{gather}
\begin{aligned}
                F_{x_t}(h-h_3) + (F_{z_t} + mg\cos\phi - 2F_{z_1})a_2 - 2h(F_{x_1} + F_{x_2}) - 2F_{z_1}a_1 - F_{z_t}(a_2 + b_1) = 0\\[\jot]
\begin{aligned}
                2F_{z_1}(a_1 + a_2) &= F_{x_t}(h - h_3) + (F_{z_t} + mg\cos\phi)a_2 -2h(F_{x_1} + F_{x_2}) - F_{z_t}(a_2 + b_1)  \\
                &= A_2\sin\phi(h - h_3) + mga_2\cos\phi - 2hA_1\sin\phi - b_1(A_3\sin\phi + B_3\cos\phi)  \\
                &= \sin\phi\big(A_2(h - h_3) -2hA_1 -b_1A_3 \big) + \cos\phi \big(mga_2 - b_1B_3 \big)
\end{aligned}\\[\jot]
                \therefore F_{z_1} = A_4\sin \phi + B_4\cos\phi 
\end{aligned}
\end{gather}
\end{document}

答案3

我建议将整个内容包装在一个中gather,用来aligned对中间三行进行分组,并\nonumber在第一行和之后的(显式)换行符之前使用\end{aligned},以便整个结构只出现一个数字。

\begin{gather}
  F_{x_t}(h-h_3) + (F_{z_t} + mg\cos\phi - 2F_{z_1})a_2 - 2h(F_{x_1} + F_{x_2}) - 2F_{z_1}a_1 - F_{z_t}(a_2 + b_1) = 0 \nonumber \\
  \begin{aligned}
    2F_{z_1}(a_1 + a_2) &= F_{x_t}(h - h_3) + (F_{z_t} + mg\cos\phi)a_2 -2h(F_{x_1} + F_{x_2}) - F_{z_t}(a_2 + b_1) \\
       &= A_2\sin\phi(h - h_3) + mga_2\cos\phi - 2hA_1\sin\phi - b_1(A_3\sin\phi + B_3\cos\phi) \\
       &= \sin\phi\big(A_2(h - h_3) -2hA_1 -b_1A_3 \big) + \cos\phi \big(mga_2 - b_1B_3 \big)
  \end{aligned} \nonumber \\
  \therefore F_{z_1} = A_4\sin\phi + B_4\cos\phi
\end{gather}

范围内的任何“线”gather都将居中;aligned为此,该块将被视为单个“线”。

正如 Mico 在评论中所建议的,“sin”和“cos”更适合使用命令\sin和设置为运算符\cos

答案4

在此处输入图片描述

您可以在没有align环境的情况下执行此操作,而是使用stackengine

\documentclass[a4paper,oneside,11pt]{report}
\usepackage[english]{babel} %francais, polish, spanish, ...
\usepackage[T1]{fontenc}
\usepackage{lmodern} 
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{a4wide}
\setlength{\marginparwidth}{3cm}
\setlength{\topmargin}{0cm}
\setlength{\voffset}{0cm}
\setlength{\headsep}{0cm}
\usepackage[usestackEOL]{stackengine}[2013-09-11]
\begin{document}
\stackMath\setstackgap{S}{1.5em}\setstackgap{L}{1.2\baselineskip}
\begin{equation}
\savestack{\temp}{\Longunderstack[l]{%
  = F_{x_t}(h - h_3) + (F_{z_t} + mg\cos\phi)a_2 -2h(F_{x_1} + F_{x_2}) - F_{z_t}(a_2 + b_1)\\
 = A_2\sin\phi(h - h_3) + mga_2\cos\phi - 2hA_1\sin\phi - b_1(A_3\sin\phi + B_3\cos\phi)\\
  = \sin\phi\big(A_2(h - h_3) -2hA_1 -b_1A_3 \big) + \cos\phi \big(mga_2 - b_1B_3 \big)}%
}
\Shortstack{%
F_{x_t}(h-h_3) + (F_{z_t} + mg\cos\phi - 2F_{z_1})a_2 - 2h(F_{x_1} + F_{x_2}) - 2F_{z_1}a_1 - F_{z_t}(a_2 + b_1) = 0\\
2F_{z_1}(a_2 + b_1)\mathrel{\temp}\\%
\therefore F_{z_1} = A_4\sin\phi + B_4\cos\phi%
}
\end{equation}
\end{document}

相关内容