在 latex 中对齐等号而不对每行进行编号

在 latex 中对齐等号而不对每行进行编号

假设我有类似的东西,

因此,我们有以下内容:

\begin{align}
2x + 7 &= 5x + 8 \\[0.1in]
&= 2x - 7 \\[0.1in]
&= 4 \\[0.1in]
\end{align}

我随意编了一些方程,但重点是我想将所有等号对齐。但是,当我执行此类操作时,它总是将对齐命令之间的所有内容一直移动到页面中心,而我只是想对齐等号而不移动整个方程。此外,当我这样做时,它会对每行进行编号,而我并不想这样做。有没有办法对齐等号而不对每行进行编号,也不移动太多所有内容?

模板:

\documentclass[12pt]{article}

\newcommand{\myname}{Name: -------}  
\newcommand{\course}{-------}                
\newcommand{\assignment}{-------}                  
\newcommand{\probs}{}                     

\usepackage{amsmath}            
\usepackage{amsthm}             
\usepackage{amssymb,latexsym}   
\usepackage{graphicx}         
\usepackage{verbatim}        
\usepackage{enumerate}        
\usepackage[left=1in,right=1in,top=0.75in,bottom=0.5in]{geometry}
\usepackage[dvipsnames,usenames]{color}    
\usepackage{ifthen} 
\usepackage{enumitem}

\newcommand{\mytitle}{
\begin{flushleft}
\bfseries
\assignment       \hspace*{\fill} \course \hspace*{\fill} \myname\\
\probs    \hspace*{\fill}              
\rule[10pt]{\linewidth}{1pt}
\end{flushleft}
}

\pagestyle{myheadings}
\markright{\course{} \assignment: \myname}
\newenvironment{exercise}[2][Exercise]
 {\begin{trivlist}\item[\hspace{0pt} \textbf{#1}~\textbf{#2.}]}
 {\end{trivlist}}

\newcommand{\checkname}
{
\ifthenelse{\equal{\myname}{}}
{
  \vspace*{\fill}
  \begin{center}
    {\LARGE \bf Your name is {\color{BrickRed} \myname}?\\[3pt]
    Please change \texttt{\color{BrickRed} \textbackslash myname} and re-process.}
  \end{center}
  \vspace*{\fill}
  \end{document}
  \newpage
}
{}
}

\begin{document}
\thispagestyle{empty}   
\mytitle                

\renewcommand{\qedsymbol}{}  

\end{document}

答案1

\documentclass{article}
\usepackage{amsmath,amssymb,showframe}     %% show frame just for demo
\begin{document}
  \noindent
  $\therefore$ we have the following:
  \begin{flalign*}
   & \begin{aligned}
       2x + 7 &= 5x + 8 \\[0.1in]
              &= 2x - 7 \\[0.1in]
              &= 4 %\\[0.1in]
     \end{aligned}
   &
\end{flalign*}
\end{document}

在此处输入图片描述

使用您的模板:

\documentclass[12pt]{article}

\newcommand{\myname}{Name: -------}
\newcommand{\course}{-------}
\newcommand{\assignment}{-------}
\newcommand{\probs}{}

\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb,latexsym}
\usepackage{graphicx}
\usepackage{verbatim}
\usepackage{enumerate}
\usepackage[left=1in,right=1in,top=0.75in,bottom=0.5in]{geometry}
\usepackage[dvipsnames,usenames]{color}
\usepackage{ifthen}
\usepackage{enumitem}

\newcommand{\mytitle}{
\begin{flushleft}
\bfseries
\assignment       \hspace*{\fill} \course \hspace*{\fill} \myname\\
\probs    \hspace*{\fill}
\rule[10pt]{\linewidth}{1pt}
\end{flushleft}
}

\pagestyle{myheadings}
\markright{\course{} \assignment: \myname}
\newenvironment{exercise}[2][Exercise]
 {\begin{trivlist}\item[\hspace{0pt} \textbf{#1}~\textbf{#2.}]}
 {\end{trivlist}}

\newcommand{\checkname}
{
\ifthenelse{\equal{\myname}{}}
{
  \vspace*{\fill}
  \begin{center}
    {\LARGE \bf Your name is {\color{BrickRed} \myname}?\\[3pt]
    Please change \texttt{\color{BrickRed} \textbackslash myname} and re-process.}
  \end{center}
  \vspace*{\fill}
  \end{document}
  \newpage
}
{}
}

\begin{document}
\thispagestyle{empty}
\mytitle

\renewcommand{\qedsymbol}{}

  \noindent
  $\therefore$ we have the following:
  \begin{flalign*}
   & \begin{aligned}
       2x + 7 &= 5x + 8 \\[0.1in]
              &= 2x - 7 \\[0.1in]
              &= 4 %\\[0.1in]
     \end{aligned}
   &
\end{flalign*}

\end{document}

在此处输入图片描述

相关内容