我试图将所有公式对齐到文档左侧,而不是居中。我尝试过,flalign
但出于某种奇怪的原因,我得到了以下结果:
以下是代码:
\documentclass[11pt, french]{article} %article report book letter slides
\usepackage{blindtext}
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=20mm,
top=20mm,
}
\usepackage[french]{babel}
\selectlanguage{french}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{esint}
\begin{document}
\newcommand{\prt}[2]{\frac{\partial #1}{\partial #2}}
\begin{flalign}
C_x = C_{x_0} + k{C_z}^2 && \\
\prt{f}{C_z} = \frac{0.015+\frac{{C_z}^2}{20}-\frac{{C_z}^2}{10}}{\left( 0.015+{C_z}^2 \right)^2}&&\\
\prt{f}{C_z} = 0 \Leftrightarrow C_{x_0} + k{C_z}^2 - 2k{C_z}^2 = 0 \Leftrightarrow C_z = \sqrt{\frac{C_{x_0}}{k}} = 0,548 &&\\
C_x = 0.015 + \frac{1}{20} * 0.548^2 = 0.03&&\\
f = \frac{0.548}{0.03} = 18,26 &&
\end{flalign}
\end{document}
我该如何解决我的问题?
答案1
使用[fleqn]
使方程式左对齐,使用gather
not 是align
因为您没有对齐 =
\documentclass[11pt, french,fleqn]{article} %article report book letter slides
\usepackage{blindtext}
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=20mm,
top=20mm,
}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\selectlanguage{french}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{esint}
\begin{document}
\newcommand{\prt}[2]{\frac{\partial #1}{\partial #2}}
\begin{gather}
C_x = C_{x_0} + k{C_z}^2 \\
\prt{f}{C_z} = \frac{0.015+\frac{{C_z}^2}{20}-\frac{{C_z}^2}{10}}{\left( 0.015+{C_z}^2 \right)^2}\\
\prt{f}{C_z} = 0 \Leftrightarrow C_{x_0} + k{C_z}^2 - 2k{C_z}^2 = 0 \Leftrightarrow C_z = \sqrt{\frac{C_{x_0}}{k}} = 0,548 \\
C_x = 0.015 + \frac{1}{20} * 0.548^2 = 0.03\\
f = \frac{0.548}{0.03} = 18,26
\end{gather}
\end{document}
答案2
正如大卫·卡莱尔已经指出的那样他的回答,您需要指定选项fleqn
,可以在文档类阶段作为选项,也可以在加载amsmath
包时作为选项。
我将继续使用align
示例文档中五个问题的设置。
\documentclass[11pt,french,fleqn]{article}
\usepackage{geometry}
\geometry{a4paper,total={170mm,257mm},left=20mm,top=20mm}
\usepackage{babel}
\usepackage{amssymb}
\usepackage{amsmath}
\newcommand{\prt}[2]{\frac{\partial #1}{\partial #2}}
\usepackage{showframe}
\begin{document}
\begin{align}
C_x &= C_{x_0} + k{C_z}^2 \\
\prt{f}{C_z} &= \frac{0.015+C_z^2/20-C_z^2/10}{(0.015+C_z^2)^2}\\
\prt{f}{C_z} &= 0
\quad\Longleftrightarrow\quad
C_{x_0} + k{C_z}^2 - 2k{C_z}^2 = 0
\quad\Longleftrightarrow\quad
C_z = \sqrt{C_{x_0}/k} = 0.548 \\
C_x &= 0.015 + (1/20) \cdot 0.548^2 = 0.03\\
f &= 0.548/0.03 = 18.26
\end{align}
\end{document}