如何将方程式编号移至右边?

如何将方程式编号移至右边?

我正在写一篇数学文章,我想让方程式编号出现在右侧和行末,但它们目前出现在左侧方程式的下方。我该如何改变这种情况?

例子:

\documentclass{article} 
\usepackage[utf8]{inputenc}

\usepackage{natbib} 
\usepackage[section]{placeins} 
\usepackage{graphicx} 
\usepackage{wrapfig} 
\usepackage{float} 
\usepackage{mathtools} 
\usepackage{amsmath} 
\usepackage{geometry} 
\geometry{ a4paper, total={170mm,257mm}, left=20mm, top=20mm, }

\begin{document}
\maketitle

\section{Equations}
The horizontal and vertical links and network nodes can now be defined as the following matrices: \

\textbf{Horizonal Links} \newline

For 1 \leq i \leq m+1 \ $and$ \ 1 \leq j \leq n

\begin{description} 
\item[(a)]

\begin{equation} A_{ij}^X= \begin{cases} 1, & \text{if the link between ($i,j$) and ($i,j+1$) exists}\ \ 0, & \text{otherwise}\ \ \end{cases}

\end{equation} $$

\item[(b)]

\begin{equation} X_{ij} = l_{ij}

\end{equation}

where $l_{ij}$ is the length of the link between ($i,j$) and ($i,j+1$). If >there is no link between ($i,j$) and ($i,j+1$) then $l_{ij}$=0

\end{description}

\bibliographystyle{plain} 
\bibliography{references} 
\end{document}

答案1

您的编码风格,可以这么说,并不整洁。这里有一个极简主义的修复方法,应该可以让您继续前进,至少可以持续一段时间。好消息:代码清理后,方程式数字会显示在右侧边缘。

\documentclass{article} 

\usepackage[utf8]{inputenc}
\usepackage{natbib} 
\usepackage[section]{placeins} 
\usepackage{graphicx} 
\usepackage{wrapfig} 
\usepackage{float} 
\usepackage{mathtools} 
%%\usepackage{amsmath}  is loaded by 'mathtools' -- no need to load it explicitly
\usepackage{geometry} 
\geometry{ a4paper, total={170mm,257mm}, left=20mm, top=20mm}

\begin{document}

\section{Equations}

The horizontal and vertical links and network nodes can now be defined as the following matrices

\subsection*{Horizonal Links} 

For $1 \leq i \leq m+1$ and $1 \leq j \leq n$

\begin{description} 
\item[(a)]
\begin{equation} 
A_{ij}^X= 
\begin{cases} 
  1, & \text{if the link between ($i,j$) and ($i,j+1$) exists}\\ 
  0, & \text{otherwise}
\end{cases}
\end{equation}

\item[(b)]
\begin{equation} 
    X_{ij} = l_{ij}
\end{equation}
where $l_{ij}$ is the length of the link between ($i,j$) and ($i,j+1$). 
If there is no link between ($i,j$) and ($i,j+1$) then $l_{ij}$=0

\end{description}
\end{document}

相关内容