![使用节标题的垂直间距不一致](https://linux22.com/image/310558/%E4%BD%BF%E7%94%A8%E8%8A%82%E6%A0%87%E9%A2%98%E7%9A%84%E5%9E%82%E7%9B%B4%E9%97%B4%E8%B7%9D%E4%B8%8D%E4%B8%80%E8%87%B4.png)
上周我读了一篇关于 LaTeX 的短文,现在我正在写我的第一篇文档。我已经在 Google 上搜索并解决了大多数问题,但这个问题我还没有找到任何可行的答案。这是一份数学作业,我只想写很多数学题,在每个解决方案中加上一些 \text{} 注释,所以我的文档看起来像:
\documentclass[11pt,twoside,a4paper,fleqn]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[swedish, english]{babel}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage[nodisplayskipstretch]{setspace}
\setstretch{1.5}
\lhead{Fredrik \qquad 2/5-2015}
\rhead{Inlämningsuppgift 2}
\setlength{\oddsidemargin}{15.5pt}
\setlength{\evensidemargin}{15.5pt}
\setlength{\headheight}{14pt}
\begin{document}
\section*{Uppgift 2.1}
\begin{equation*}
\begin{split}
& u(x,y)=\sqrt{x^2+y^2} \\
& u_{1}=\frac{2x}{2\sqrt{x^2+y^2}}=\frac{x}{\sqrt{x^2+y^2}}, \quad
u_{2}=\frac{2y}{2\sqrt{x^2+y^2}}=\frac{x}{\sqrt{x^2+y^2}} \\
& \nabla u(1,1)=\frac{1}{\sqrt{2}}i+\frac{1}{\sqrt{2}}j, \quad
|\nabla u|=\sqrt{\left( \frac{1}{\sqrt{2}}\right) ^2 + \left( \frac{1}{\sqrt{2}} \right)^2}=\sqrt{\frac{1}{2}+\frac{1}{2}}=1 \\
& v(x,y)=x+y+2\sqrt{xy} \\
& v_{1}=1+\frac{2y}{2\sqrt{xy}}=1+\frac{y}{\sqrt{xy}}, \quad
v_{2}=1+\frac{2x}{2\sqrt{xy}}=1+\frac{x}{\sqrt{xy}} \\
& \nabla v(1,1)=2i+2j, \quad
|\nabla v|=\sqrt{4+4}=2\sqrt{2} \\
& \text{Grader } \theta \text{ mellan \textbf{u} och \textbf{v}:} \\
& \theta = \arccos \frac{u\bullet v}{|u||v|} \\
& \theta = \arccos \left( \frac{\frac{2}{\sqrt{2}}+\frac{2}{\sqrt{2}}}{2\sqrt{2}} \right)=\arccos \left(\frac{4}{2\sqrt{2}\sqrt{2}} \right)=\arccos(1)=0
\end{split}
\end{equation*}
\section*{Uppgift 2.2}
\begin{equation*}
\begin{split}
& r=a+b, \quad |r|=\sqrt{a^2+b^2}, \quad \nabla r=ai+bj \\
& u=\sin \left( \sqrt{a^2+b^2} \right), \quad u_{1}=\frac{a \cdot \cos \left( \sqrt{a^2+b^2} \right) }{2\sqrt{a^2+b^2}}, \quad u_{2}=\frac{b \cdot \cos \left( \sqrt{a^2+b^2} \right) }{2\sqrt{a^2+b^2}} \\
& \nabla u=\frac{\cos \left( \sqrt{a^2+b^2} \right)}{\sqrt{a^2+b^2}}\left(ai+bj \right) \\
& \frac{ai+bj}{\sqrt{a^2+b^2}}\bullet \frac{\cos \left( \sqrt{a^2+b^2} \right)}{\sqrt{a^2+b^2}}(ai+bj)=\frac{\cos \left( \sqrt{a^2+b^2} \right)\cdot a^2}{a^2+b^2}+\frac{\cos \left( \sqrt{a^2+b^2} \right)\cdot b^2}{a^2+b^2}= \\
& \frac{\cos \left( \sqrt{a^2+b^2} \right)\cdot (a^2+b^2)}{a^2+b^2}= \cos \left( \sqrt{a^2+b^2} \right)=\cos (r)
\end{split}
\end{equation*}
\section*{Uppgift 2.3}
\begin{equation*}
\begin{split}
& z(x,y)=6x^2 y^3-6x^2-9y^2+1, \quad \nabla z=(12xy^3-12x, 18x^2 y^2-18y)\\
& \text{Letar efter nollställen}\\
& 12x(y^3-1)=0, \quad y=0, \quad x=0 \qquad \ \text{ger } (0,0)\\
& 18y(x^2y-1)=0, \quad y=0, \quad x=\pm 1 \quad \text{ger } (1,1) \text{ och } (-1,1)\\
& z_{xx}=12y^3-12, \quad z_{xy}=z_{yx}=36xy^2, \quad z_{yy}=36x^2y-8\\
& \mathcal{H}=
\begin{bmatrix}
z_{xx} & z_{xy}\\
z_{yx} & z_{yy}
\end{bmatrix}
=
\begin{bmatrix}
12y^3-12 & 36xy^2\\
36xy^2 & 36x^2 y-18
\end{bmatrix} \\
& (0,0): \mathcal{H} =
\begin{bmatrix}
-12 & 0\\
0 & -18
\end{bmatrix}
\quad det(\mathcal{H})=(-12)\cdot(-18)-0=126 \\
& \begin{rcases}
det(\mathcal{H}) & > 0\\
f_{xx} & < 0
\end{rcases}
\text{Maxpunkt} \\
& (1,1): \mathcal{H} =
\begin{bmatrix}
0 & 36\\
36 & 18
\end{bmatrix}
\quad det(\mathcal{H})=0-36 \cdot 36=-1296
&&\quad det(\mathcal{H}) < 0 \\
& (-1,1): \mathcal{H} =
\begin{bmatrix}
0 & -36\\
-36 & 18
\end{bmatrix}
\quad det(\mathcal{H})=0-(-36) \cdot (-36)=-1296
&&\quad det(\mathcal{H}) < 0
\end{split}
\end{equation*}
\section*{Uppgift 2.4}
\begin{equation*}
\begin{split}
& f(x,y)=2x+8y-x^2-4y^2-4, \quad \nabla f=(2-2x, 8-8y) \\
& (1,1): \quad
\begin{rcases}
f_{xx} & =-2 \\
det(\mathcal{H})& =16
\end{rcases}
\text{maxpunkt}
\end{split}
\end{equation*}
\section*{Uppgift 2.5}
\begin{equation*}
\begin{split}
& f(x,y)=\sqrt{2x^2+3y^2+4} \\
& 000\text{Första delen}000 \\
& f_1 = \frac{4x}{2\sqrt{2x^2+3y^2+4}}, \quad
f_2 = \frac{6y}{2\sqrt{2x^2+3y^2+4}}, \quad
f_{12}=f_{21}=\frac{-2x6y}{\left( \sqrt{2x^2+3y^2+4} \right)^2} \\
\\
& f_{11} = \frac{2\sqrt{2x^2+3y^2+4}-\frac{2x\cdot 4x}{2\sqrt{2x^2+3y^2+4}}}{\left( 2\sqrt{2x^2+3y^2+4} \right)^2}, \quad
f_{22}= \frac{3\sqrt{2x^2+3y^2+4}-\frac{3y\cdot 6y}{2\sqrt{2x^2+3y^2+4}}}{\left( 2\sqrt{2x^2+3y^2+4} \right)^2} \\ \\
& \text{Kollar värden för derivatorna i punkten $(0,0)$} \\
& f_1=\frac{0}{2}=0, \quad f_2=\frac{0}{2}=0, \quad f_{12}=0, \quad
f_{11}=\frac{2\cdot 2-0}{4}=1, \quad f_{22}=\frac{3\cdot 2-0}{4}=\frac{3}{2} \\
& P_2(x,y)= f(a,b)+f_1(a,b)(x-a)+f_2(a,b)(y-b)+\frac{1}{2} \left( f_{11}(x-a)^2+f_{22}(y-b)^2+2f_{12}(x-a)(y-b)\right) \\
\end{split}
\end{equation*}
\begin{equation*}
\begin{split}
& P_2(x,y)=2+0x+0y+\frac{1}{2}(x-0)^2+\frac{1}{2}\cdot\frac{3}{2}(y-0)^2+\frac{1}{2}\cdot2\cdot0(x-0)(y-0)=2+\frac{1}{2}x^2+\frac{3}{4}y^2 \\
& P_2(0,1;0,1)=2+\frac{1}{2}(0,1)^2+\frac{3}{4}(0,1)^2=2+\frac{1}{200}+\frac{3}{400}=\frac{805}{400}=2,0125 \\
& f(0,1;0,1)=\sqrt{2(0,1)^2+3(0,1)^2+4}=\sqrt{\frac{2}{100}+\frac{3}{100}+4}=\sqrt{\frac{405}{100}}=2,01246 \\
\end{split}
\end{equation*}
\section*{Uppgift 2.6}
\begin{equation*}
\begin{split}
& f(x,y)=2x+y, \quad g(x,y)=x^2+y^2-5=0 \\
& L(x,y,\lambda)=f(x,y)+\lambda g(x,y)=2x+y+\lambda (x^2+y^2-5) \\
& \frac{\partial L}{\partial x}=2+2x\lambda, \quad
\frac{\partial L}{\partial y}=1+2y\lambda, \quad
\frac{\partial L}{\partial \lambda}=x^2+y^2-5 \\
& \text{Söker efter nollställen genom att sätta derivatorna lika med 0} \\
& \begin{rcases} & \frac{\partial L}{\partial x}= 0=2(1+x\lambda) \Rightarrow \lambda=-\frac{1}{x} \\
& \frac{\partial L}{\partial y}=0=1+2y\lambda \Rightarrow \lambda =-\frac{1}{2y}
\end{rcases} \Rightarrow
-\frac{1}{x}=-\frac{1}{2y} \Rightarrow 2y=x \Rightarrow y=\frac{x}{2} \\
& \text{Sätter in resultatet i $\frac{\partial L}{\partial \lambda}=0$} \\
& 0=y^2+x^2-5 \Rightarrow \frac{x^2}{4}+x^2-5=0 \Rightarrow 0=5x^2-20 \Rightarrow
4=x^2 \Rightarrow x=\pm 2 \\
& \text{Det ger} \\
& y=\frac{\pm2}{2}=\pm1 \text{ och } \lambda=\pm \frac{1}{2} \\
& \text{Ur det får vi punkterna $(2,1)$ och $(-2,-1)$ vilket ger} \\
& f(2,1)=4+1=5 \quad \text{och} \quad f(-2,-1)=-4-1=-5 \\
\end{split}
\end{equation*}
\end{document}
这给了我一个输出,其中部分标题上方和下方的间距不同(它们的缩进也不同,但这并不重要):
答案1
这是一个解决方案。我使用包稍微简化了您的代码,geometry
并使用以下代码改进了十进制数的格式:siunitx
\documentclass[11pt, twoside, a4paper, fleqn]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[swedish,english]{babel}%
\usepackage[showframe, nomarginpar, headheight=14pt, hmargin=30mm]{geometry}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage[nodisplayskipstretch]{setspace}
\setstretch{1.5}
\lhead{Fredrik \qquad 2/5-2015}
\rhead{Inlämningsuppgift 2}
\usepackage{siunitx}
\sisetup{input-decimal-markers={,},output-decimal-marker={,}}
\raggedbottom
\allowdisplaybreaks
\begin{document}
\section*{Uppgift 2.1}
\vskip-\abovedisplayskip
\begin{align*}
& u(x,y)=\sqrt{x^2+y^2} \\
& u_{1}=\frac{2x}{2\sqrt{x^2+y^2}}=\frac{x}{\sqrt{x^2+y^2}}, \quad
u_{2}=\frac{2y}{2\sqrt{x^2+y^2}}=\frac{x}{\sqrt{x^2+y^2}} \\
& \nabla u(1,1)=\frac{1}{\sqrt{2}}i+\frac{1}{\sqrt{2}}j, \quad
|\nabla u|=\sqrt{\left( \frac{1}{\sqrt{2}}\right) ^2 + \left( \frac{1}{\sqrt{2}} \right)^2}=\sqrt{\frac{1}{2}+\frac{1}{2}}=1 \\
& v(x,y)=x+y+2\sqrt{xy} \\
& v_{1}=1+\frac{2y}{2\sqrt{xy}}=1+\frac{y}{\sqrt{xy}}, \quad
v_{2}=1+\frac{2x}{2\sqrt{xy}}=1+\frac{x}{\sqrt{xy}} \\
& \nabla v(1,1)=2i+2j, \quad
|\nabla v|=\sqrt{4+4}=2\sqrt{2} \\
& \text{Grader } \theta \text{ mellan \textbf{u} och \textbf{v}:} \\
& \theta = \arccos \frac{u\bullet v}{|u||v|} \\
& \theta = \arccos \left( \frac{\frac{2}{\sqrt{2}}+\frac{2}{\sqrt{2}}}{2\sqrt{2}} \right)=\arccos \left(\frac{4}{2\sqrt{2}\sqrt{2}} \right)=\arccos(1)=0
\end{align*}
\section*{Uppgift 2.2}
\vskip-\abovedisplayskip
\begin{align*}
& r=a+b, \quad |r|=\sqrt{a^2+b^2}, \quad \nabla r=ai+bj \\
& u=\sin \left( \sqrt{a^2+b^2} \right), \quad u_{1}=\frac{a \cdot \cos \left( \sqrt{a^2+b^2} \right) }{2\sqrt{a^2+b^2}}, \quad u_{2}=\frac{b \cdot \cos \left( \sqrt{a^2+b^2} \right) }{2\sqrt{a^2+b^2}} \\
& \nabla u=\frac{\cos \left( \sqrt{a^2+b^2} \right)}{\sqrt{a^2+b^2}}\left(ai+bj \right) \\
& \frac{ai+bj}{\sqrt{a^2+b^2}}\bullet \frac{\cos \left( \sqrt{a^2+b^2} \right)}{\sqrt{a^2+b^2}}(ai+bj)=\frac{\cos \left( \sqrt{a^2+b^2} \right) \cdot a^2}{a^2+b^2}+\frac{\cos \left( \sqrt{a^2+b^2} \right) \cdot b^2}{a^2+b^2} \\
& \qquad = \frac{\cos \left( \sqrt{a^2+b^2} \right) \cdot (a^2+b^2)}{a^2+b^2}= \cos \left( \sqrt{a^2+b^2} \right)=\cos (r)
\end{align*}
\section*{Uppgift 2.3}
\vskip-\abovedisplayskip
\begin{alignat*}{2}
& z(x,y)=6x^2 y^3-6x^2-9y^2+1, \quad \nabla z=(12xy^3-12x, 18x^2 y^2-18y)\\
& \text{Letar efter nollställen}\\
& 12x(y^3-1)=0, \quad y=0, \quad x=0 \qquad \ \text{ger } (0,0)\\
& 18y(x^2y-1)=0, \quad y=0, \quad x=\pm 1 \quad \text{ger } (1,1) \text{ och } (-1,1)\\
& z_{xx}=12y^3-12, \quad z_{xy}=z_{yx}=36xy^2, \quad z_{yy}=36x^2y-8\\
& \mathcal{H}=
\begin{bmatrix}
z_{xx} & z_{xy}\\
z_{yx} & z_{yy}
\end{bmatrix}
=
\begin{bmatrix}
12y^3-12 & 36xy^2\\
36xy^2 & 36x^2 y-18
\end{bmatrix} \\
& (0,0): \mathcal{H} =
\begin{bmatrix}
-12 & 0\\
0 & -18
\end{bmatrix}
\quad \det(\mathcal{H})=(-12) \cdot (-18)-0=126 \\
& \begin{rcases}
\det(\mathcal{H}) & > 0\\
f_{xx} & < 0
\end{rcases}
\text{Maxpunkt} \\
& (1,1): \mathcal{H} =
\begin{bmatrix}
0 & 36\\
36 & 18
\end{bmatrix}
\quad \det(\mathcal{H})=0-36 \cdot 36=-1296
& & \det(\mathcal{H}) < 0 \\
& (-1,1): \mathcal{H} =
\begin{bmatrix}
0 & -36\\
-36 & 18
\end{bmatrix}
\quad \det(\mathcal{H})=0-(-36) \cdot (-36)=-1296
& \enspace & \det(\mathcal{H}) < 0
\end{alignat*}
\section*{Uppgift 2.4}
\vskip-\abovedisplayskip
\begin{align*}
& f(x,y)=2x+8y-x^2-4y^2-4, \quad \nabla f=(2-2x, 8-8y) \\
& (1,1): \quad
\begin{rcases}
f_{xx} & =-2 \\
\det(\mathcal{H}) & =16
\end{rcases}
\text{maxpunkt}
\end{align*}
\section*{Uppgift 2.5}
\vskip-\abovedisplayskip
\begin{align*}
& f(x,y)=\sqrt{2x^2+3y^2+4} \\
& 000\text{Första delen}000 \\
& f_1 = \frac{4x}{2\sqrt{2x^2+3y^2+4}}, \quad f_2 = \frac{6y}{2\sqrt{2x^2+3y^2+4}}, \quad
f_{12}=f_{21}=\frac{-2x6y}{\left( \sqrt{2x^2+3y^2+4} \right)^2} \\
\\
& f_{11} = \frac{2\sqrt{2x^2+3y^2+4}-\frac{2x \cdot 4x}{2\sqrt{2x^2+3y^2+4}}}{\left( 2\sqrt{2x^2+3y^2+4} \right)^2}, \quad
f_{22}= \frac{3\sqrt{2x^2+3y^2+4}-\frac{3y \cdot 6y}{2\sqrt{2x^2+3y^2+4}}}{\left( 2\sqrt{2x^2+3y^2+4} \right)^2} \\ \\
& \text{Kollar värden för derivatorna i punkten $(0,0)$} \\
& f_1=\frac{0}{2}=0, \quad f_2=\frac{0}{2}=0, \quad f_{12}=0, \quad
f_{11}=\frac{2 \cdot 2-0}{4}=1, \quad f_{22}=\frac{3 \cdot 2-0}{4}=\frac{3}{2} \\
& \!\begin{aligned} P_2(x,y)= f(a,b) & +f_1(a,b)(x-a) +f_2(a,b)(y-b) \\
& +\frac{1}{2} \left( f_{11}(x-a)^2+f_{22}(y-b)^2+2f_{12}(x-a)(y-b)\right)
\end{aligned}\\[1ex]
& \!\begin{aligned} P_2(x,y) & =2+0x+0y+\frac{1}{2}(x-0)^2+\frac{1}{2} \cdot \frac{3}{2}(y-0)^2+\frac{1}{2}\cdot2\cdot0(x-0)(y-0) \\
& =2+\frac{1}{2}x^2+\frac{3}{4}y^2 \end{aligned}\\
& P_2(\num{0,1};\num{0,1})=2+\frac{1}{2}(\num{0,1})^2+\frac{3}{4}(\num{0,1})^2=2+\frac{1}{200}+\frac{3}{400}=\frac{805}{400}=\num{2,0125} \\
& f(\num{0,1};\num{0,1})=\sqrt{2(0,1)^2+3(\num{0,1})^2+4}=\sqrt{\frac{2}{100}+\frac{3}{100}+4}=\sqrt{\frac{405}{100}}=\num{2,01246} \end{align*}
\section*{Uppgift 2.6}%
\vskip-\abovedisplayskip
\begin{align*}
& f(x,y)=2x+y, \quad g(x,y)=x^2+y^2-5=0 \\
& L(x,y,\lambda)=f(x,y)+\lambda g(x,y)=2x+y+\lambda (x^2+y^2-5) \\
& \frac{\partial L}{\partial x}=2+2x\lambda, \quad
\frac{\partial L}{\partial y}=1+2y\lambda, \quad
\frac{\partial L}{\partial \lambda}=x^2+y^2-5 \\
& \text{Söker efter nollställen genom att sätta derivatorna lika med 0} \\
& \begin{drcases} & \frac{\partial L}{\partial x}= 0=2(1+x\lambda) \Rightarrow \lambda=-\frac{1}{x} \\
& \frac{\partial L}{\partial y}=0=1+2y\lambda \Rightarrow \lambda =-\frac{1}{2y}
\end{drcases} \Rightarrow
-\frac{1}{x}=-\frac{1}{2y} \Rightarrow 2y=x \Rightarrow y=\frac{x}{2} \\
& \text{Sätter in resultatet i $\frac{\partial L}{\partial \lambda}=0$} \\
& 0=y^2+x^2-5 \Rightarrow \frac{x^2}{4}+x^2-5=0 \Rightarrow 0=5x^2-20 \Rightarrow
4=x^2 \Rightarrow x=\pm 2 \\
& \text{Det ger} \\
& y=\frac{\pm2}{2}=\pm1 \text{ och } \lambda=\pm \frac{1}{2} \\
& \text{Ur det får vi punkterna $(2,1)$ och $(-2,-1)$ vilket ger} \\
& f(2,1)=4+1=5 \quad \text{och} \quad f(-2,-1)=-4-1=-5
\end{align*}
\end{document}
答案2
(不幸的是,我无法提供完整的示例,因为我遇到了编码问题。但由于 op 对他/她的输出感到满意,我将在这里提供主要细节。)
子split
环境,例如全部子环境始终被视为牢不可破的盒子。为了摆脱这一限制,
- 替换
equation*
为align*
, - 删除
\begin{split}
和\end{split}
,和 - 插入
\allowdisplaybreaks
你的序言中。
由于您已将每一行显示内容都以 开始&
,因此这将使每一行都保持左对齐。
当线条宽度超过声明的文本宽度时,您仍然会遇到很多问题。请仔细检查,以确保没有任何东西因超出纸张边缘而丢失。
amsmath
和的文档中描述了智能地(并且清晰地)断行的可能性mathtools
。