有没有比这更好的方法来输入大方程式?IEEEtrans

有没有比这更好的方法来输入大方程式?IEEEtrans

我正在用 IEEEtrans 模板写一篇日志。我有多行方程,无法放在一列中。因此,我做了以下事情:

\documentclass[final]{IEEEtran}
\IEEEoverridecommandlockouts

% \overrideIEEEmargins                      
\setlength{\textheight}{237mm}
\usepackage{multirow}
\usepackage{amssymb,amsmath,amsthm}
\usepackage{color}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{epstopdf}
\usepackage{romannum}
\usepackage{algorithm}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{float}
\usepackage{multicol}
\usepackage[noend]{algpseudocode}
\usepackage{romannum}
\def\m{\tilde{m}}
\begin{document}
\begin{align}
    m & =  2^{\m} - 1 = 2^4 ( 2^{\m/2 - 2})^2 - 1 = 16 k^2 -1, \label{eq:92} \\
    n & = (2^{2\m - 1} + 2^{3\m/2 -2} - 2^{\m - 2} + 2^{\m/2} + 1) (2^{\m/2} - 1) \nonumber \\
    \begin{split}
        & = \Big( 2^7 (2^{\m/2 - 2})^4 + 2^4 (2^{\m/2 - 2} )^3 - 2^2 (2^{\m/2 - 2})^2 \\
        & \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad + 2^2 \cdot 2^{\m/2 - 2} + 1 \Big)\\
        & \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \times (2^2 \cdot 2^{\m/2 - 2} - 1)\\
        & = (2^7 k^4 + 2^4 k^3 - 2^2 k^2 + 2^2 k + 1) (2^2 k - 1) \\
        & = 2^9 k^5 - 2^6 k^4 - 2^5 k^3 + 20 k^2 - 1.
    \end{split} 
\end{align}
\end{document}

但正如您在图片中看到的,我的结果看起来不太好。此外,最后一个方程的方程编号 (2) 远低于最后一个方程。有人能帮我找到输入方程的正确方法吗? 在此处输入图片描述

答案1

也许

在此处输入图片描述

\documentclass[final]{IEEEtran}
\IEEEoverridecommandlockouts

% \overrideIEEEmargins                      
\setlength{\textheight}{237mm}

\usepackage{amssymb,mathtools,amsthm}

\def\m{\tilde{m}}
\begin{document}
\begin{align}
    m & =  2^{\m} - 1 = 2^4 ( 2^{\m/2 - 2})^2 - 1 = 16 k^2 -1, \label{eq:92} \\
    n & = (2^{2\m - 1} + 2^{3\m/2 -2} - 2^{\m - 2} + 2^{\m/2} + 1) (2^{\m/2} - 1) \nonumber \\
      &=
        \begin{multlined}[t]
          \Bigl( 2^7 (2^{\m/2 - 2})^4 + 2^4 (2^{\m/2 - 2} )^3 - 2^2 (2^{\m/2 - 2})^2 \\
          + 2^2 \cdot 2^{\m/2 - 2} + 1 \Bigr) (2^2 \cdot 2^{\m/2 - 2} - 1)
          \end{multlined}\nonumber\\
        & = (2^7 k^4 + 2^4 k^3 - 2^2 k^2 + 2^2 k + 1) (2^2 k - 1) \nonumber\\
        & = 2^9 k^5 - 2^6 k^4 - 2^5 k^3 + 20 k^2 - 1.
\end{align}
\end{document}

我认为将显式\times+内部项对齐没有帮助,不这样做也可以节省一行。另请\Big[lr]注意\Big

答案2

我不认为它“小”。

下面我添加了lipsum仅用于显示被文本包围的公式。

其理念是, 中的第一列aligned与右对齐,这样我们就可以避免手动添加空格。aligned是“顶部对齐”,因此其第一行与等号齐平。

还要注意\bigl(\bigr)。你可能想要\Big大小(我不会),但它们应该是\Bigl(\Bigr)

\documentclass[final]{IEEEtran}
\IEEEoverridecommandlockouts

% \overrideIEEEmargins                      
%\setlength{\textheight}{237mm}% don't change the class defaults

\usepackage{multirow}
\usepackage{amssymb,amsmath,amsthm}
\usepackage{color}
\usepackage{graphicx}
\usepackage{tikz}
%\usepackage{epstopdf}% not needed
\usepackage{romannum}
\usepackage{algorithm}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{float}
\usepackage{multicol}
\usepackage[noend]{algpseudocode}
%\usepackage{romannum}% twice?

\usepackage{lipsum}% to see in context

\newcommand{\m}{\tilde{m}}% not \def

\begin{document}

\lipsum*[1][1-3]
\begin{align}
  m & =  2^{\m} - 1 = 2^4 ( 2^{\m/2 - 2})^2 - 1 = 16 k^2 -1, \label{eq:92} \\
  n & = (2^{2\m - 1} + 2^{3\m/2 -2} - 2^{\m - 2} + 2^{\m/2} + 1) (2^{\m/2} - 1) \nonumber \\
    & =  \begin{aligned}[t]
         \bigl( 2^7 (2^{\m/2 - 2})^4 + 2^4 (2^{\m/2 - 2} )^3 - 2^2 (2^{\m/2 - 2})^2 \\
         {}+ 2^2 \cdot 2^{\m/2 - 2} + 1 \bigr)\\
         {} \times (2^2 \cdot 2^{\m/2 - 2} - 1)
         \end{aligned} \nonumber \\
    & = (2^7 k^4 + 2^4 k^3 - 2^2 k^2 + 2^2 k + 1) (2^2 k - 1) \nonumber \\
    & = 2^9 k^5 - 2^6 k^4 - 2^5 k^3 + 20 k^2 - 1.
\end{align}
\lipsum

\end{document}

在此处输入图片描述

如果我添加

\usepackage{newtxtext,newtxmath}

(您需要删除amssymb,因为newtx包无论如何都会覆盖符号集)。我建议这样做,以便您的数学公式具有与文本相同的字体系列。

\documentclass[final]{IEEEtran}
\IEEEoverridecommandlockouts

% \overrideIEEEmargins                      
%\setlength{\textheight}{237mm}% don't change the class defaults


\usepackage{multirow}
\usepackage{amsmath,amsthm}
\usepackage{newtxtext,newtxmath}
\usepackage{color}
\usepackage{graphicx}
\usepackage{tikz}
%\usepackage{epstopdf}% not needed
\usepackage{romannum}
\usepackage{algorithm}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{float}
\usepackage{multicol}
\usepackage[noend]{algpseudocode}
%\usepackage{romannum}% twice?

\usepackage{lipsum}% to see in context

\newcommand{\m}{\tilde{m}}% not \def

\begin{document}

\lipsum*[1][1-3]
\begin{align}
  m & =  2^{\m} - 1 = 2^4 ( 2^{\m/2 - 2})^2 - 1 = 16 k^2 -1, \label{eq:92} \\
  n & = (2^{2\m - 1} + 2^{3\m/2 -2} - 2^{\m - 2} + 2^{\m/2} + 1) (2^{\m/2} - 1) \nonumber \\
    & =  \begin{aligned}[t]
         \bigl( 2^7 (2^{\m/2 - 2})^4 + 2^4 (2^{\m/2 - 2} )^3 - 2^2 (2^{\m/2 - 2})^2 \\
         {}+ 2^2 \cdot 2^{\m/2 - 2} + 1 \bigr)\\
         {} \times (2^2 \cdot 2^{\m/2 - 2} - 1)
         \end{aligned} \nonumber \\
    & = (2^7 k^4 + 2^4 k^3 - 2^2 k^2 + 2^2 k + 1) (2^2 k - 1) \nonumber \\
    & = 2^9 k^5 - 2^6 k^4 - 2^5 k^3 + 20 k^2 - 1.
\end{align}
\lipsum

\end{document}

在此处输入图片描述

相关内容