左對齊 3 個不同的方程

左對齊 3 個不同的方程

我想左對齊三個不同長度的三個不同方程式。截至目前我正在使用這段程式碼:

\begin{equation}
log_{10}M_{200} = (0.94\pm0.005)log_{10}N_{gal}+(12.11\pm0.009)\hspace{10mm} \left[for N_{gal}>20\right]
\label{equation:power_law_rich20}
\end{equation} 

\begin{equation}
log_{10}M_{200} = (0.74\pm0.003)log_{10}N_{gal}+(12.46\pm0.005)\hspace{10mm} \left[for M_{200}>2X10^{13}M_{\odot}\right]
\label{equation:power_law_mass2e13}
\end{equation} 

\begin{equation}
log_{10}M_{200} = (0.85\pm0.005)log_{10}N_{gal}+(12.28\pm0.008)\hspace{10mm} \left[for (N_{gal}>20+M_{200}>2X10^{13}M_{\odot})\right]
\label{equation:power_law_rich20_mass2e13}
\end{equation}

這給了我這個輸出: 在此輸入影像描述

我希望這三個方程式分別左對齊,換句話說,方程式編號(5)和(6)與方程式(7)對齊,因為它是最長的方程式。

答案1

您想要使用的align環境:

\documentclass{article}
\usepackage[margin=1cm,a4paper]{geometry}
\usepackage{amsmath}

\usepackage{lipsum} % just for the example

\begin{document}

\lipsum*[2]
\begin{align}
\log_{10}M_{200} &= (0.94\pm0.005)\log_{10}N_{\mathrm{gal}}+(12.11\pm0.009)
  &&\text{for $N_{\mathrm{gal}}>20$}
  \label{equation:power_law_rich20}
\\
\log_{10}M_{200} &= (0.74\pm0.003)\log_{10}N_{\mathrm{gal}}+(12.46\pm0.005)
  &&\text{for $M_{200}>2\times10^{13}M_{\odot}$}
  \label{equation:power_law_mass2e13}
\\
\log_{10}M_{200} &= (0.85\pm0.005)\log_{10}N_{\mathrm{gal}}+(12.28\pm0.008)
  &&\text{for $(N_{\mathrm{gal}}>20+M_{200}>2\times10^{13}M_{\odot})$}
  \label{equation:power_law_rich20_mass2e13}
\end{align}
\lipsum[3]

\end{document}

請注意,應使用;\log代替在這種情況下, logalso\times是產品的正確符號,而不是X

在此輸入影像描述

如果您有更嚴格的空間限制,您可以使用multlinedfrom mathtools

\documentclass{article}
%\usepackage[margin=1cm,a4paper]{geometry}
\usepackage{amsmath,mathtools}

\usepackage{lipsum} % just for the example

\begin{document}

\lipsum*[2]
\begin{gather}
\begin{multlined}[c][\dimexpr\displaywidth-5em]
\log_{10}M_{200} = (0.94\pm0.005)\log_{10}N_{\mathrm{gal}}+(12.11\pm0.009)
  \\\text{for $N_{\mathrm{gal}}>20$}
\end{multlined}
  \label{equation:power_law_rich20}
\\
\begin{multlined}[c][\dimexpr\displaywidth-5em]
\log_{10}M_{200} = (0.74\pm0.003)\log_{10}N_{\mathrm{gal}}+(12.46\pm0.005)
  \\\text{for $M_{200}>2\times10^{13}M_{\odot}$}
\end{multlined}
  \label{equation:power_law_mass2e13}
\\
\begin{multlined}[c][\dimexpr\displaywidth-5em]
\log_{10}M_{200} = (0.85\pm0.005)\log_{10}N_{\mathrm{gal}}+(12.28\pm0.008)
  \\\text{for $(N_{\mathrm{gal}}>20+M_{200}>2\times10^{13}M_{\odot})$}
\end{multlined}
  \label{equation:power_law_rich20_mass2e13}
\end{gather}
\lipsum[3]

\end{document}

在此輸入影像描述

相關內容