我在 overleaf latex 环境中有以下代码:
\begin{equation}
\centering
h_+ = \frac{G}{rc^4}[\ddot{M}_{11}(cos^2\phi - sin^2\phi cos^2\theta)+ \\
+ \ddot{M}_{22}(sin^2\phi - cos^2\phi cos^2\theta )- \ddot{M}_{33}sin^2\theta -\ddot{M}_{12}sin2\phi (1+cos^2\theta)+\ddot{M}_{13}sin\phi sin2\theta +\ddot{M}_{23}cos\phi sin2\theta ]
\caption{h+ for arbitrary direction with quadrupole moment analysis}
\label{h+m}
\end{equation}
我需要将它放入页面中。所以我需要在某个地方打破它。但无论我怎么尝试,改变行都会导致“吃掉”它,\ddot{M}
只留下它的索引(22)。
答案1
从修复错误开始:
- 数学显示内不允许有空行;
\centering
没有任何效果;- 里面不能换行
equation
; \caption
不能成为 的一部分equation
。
你得到
- 六个错误
Missing $ inserted
- 两个错误
Display math should end with $$
- 一个错误
You can't use `\eqno' in vertical mode
- 一个错误
There's no line here to end
- 一个错误
\caption outside float
1、2 和 3 中的错误是由于公式中的空行造成的;4 和 5 中的错误应该是不言自明的。永远不要忽视错误消息:您得到的输出本质上是 TeX 尝试恢复错误的任意垃圾。
正弦和余弦函数应为\sin
和\cos
。您还需要更多线条。
\documentclass{article}
\usepackage{amsmath}
\begin{document}
The standard way would be to present the equation for
$h+$ for arbitrary direction with quadrupole moment analysis
\begin{equation}\label{eq:h+m}
\begin{aligned}
h_+ = \frac{G}{rc^4}[
& \ddot{M}_{11}(\cos^2\phi - \sin^2\phi \cos^2\theta)
+ \ddot{M}_{22}(\sin^2\phi - \cos^2\phi \cos^2\theta)
\\
&- \ddot{M}_{33}\sin^2\theta
- \ddot{M}_{12}\sin2\phi (1+\cos^2\theta)
\\
&+ \ddot{M}_{13}\sin\phi \sin2\theta
+ \ddot{M}_{23}\cos\phi \sin2\theta ]
\end{aligned}
\end{equation}
with the text announcing what the equation is about
when the equation is presented.
If you really want, you can use a caption in the
\texttt{figure} environment. In this case an equation
number is just confusing.
\begin{figure}[!htp]
\begin{equation*}
\begin{aligned}
h_+ = \frac{G}{rc^4}[
& \ddot{M}_{11}(\cos^2\phi - \sin^2\phi \cos^2\theta)
+ \ddot{M}_{22}(\sin^2\phi - \cos^2\phi \cos^2\theta)
\\
&- \ddot{M}_{33}\sin^2\theta
- \ddot{M}_{12}\sin2\phi (1+\cos^2\theta)
\\
&+ \ddot{M}_{13}\sin\phi \sin2\theta
+ \ddot{M}_{23}\cos\phi \sin2\theta ]
\end{aligned}
\end{equation*}
\caption{$h+$ for arbitrary direction with quadrupole moment analysis}
\label{h+m}
\end{figure}
\end{document}
请注意数字可能会浮动,因此我推荐第一种方法。