我想知道如何获取此代码
$\begin{enumerate}
\item $\begin{aligned}
\int\frac{dx}{\sin x\cos x}&=\int\frac{d(\sin x)}{\sin x(1-\sin^2 x)}\\
&=\int\left [\frac{1}{\sin x}-\frac12\left ( \frac1{1+\sin x}-\frac1{\sin x-1} \right ) \right ]d\sin x\\
&=\ln|\sin x|-\frac12\ln\left | \frac{1+\sin x}{1-\sin x} \right |+C
\end{aligned}$
\end{enumerate}$
像这样
虽然它看起来像这样
答案1
要将方程式aligned
环境对齐到顶部,请使用\begin{aligned}[t]
--,否则center
使用对齐。
\documentclass{article}
\usepackage{mathtools}
\newcommand{\dx}[1][x]{\mathrm{d}#1}
\begin{document}
\begin{enumerate}
\item $\begin{aligned}[t]
\int\dfrac{\dx}{\sin x\cos x} & = \int\dfrac{\dx[(\sin x)]}{\sin x (1-\sin^2 x)}\\
&=\int\left [\frac{1}{\sin x}-\frac{1}{2}\left ( \dfrac{1}{1+\sin x}-\dfrac{1}{\sin x-1} \right ) \right ]\dx[\sin x]\\
&=\ln|\sin x|-\dfrac{1}{2}\ln\left | \dfrac{1+\sin x}{1-\sin x} \right |+C
\end{aligned}$
\item $\begin{aligned}[t]
\int\frac{dx}{\sin x\cos x}&=\int\frac{d(\sin x)}{\sin x(1-\sin^2 x)}\\
&=\int\left [\frac{1}{\sin x}-\frac12\left ( \frac1{1+\sin x}-\frac1{\sin x-1} \right ) \right ]d\sin x\\
&=\ln|\sin x|-\frac12\ln\left | \frac{1+\sin x}{1-\sin x} \right |+C
\end{aligned}$
\end{enumerate}
\end{document}