| 1 |
\documentclass{article} |
| 2 |
|
| 3 |
\usepackage{graphicx} |
| 4 |
\usepackage{lmodern} |
| 5 |
\usepackage[T1]{fontenc} |
| 6 |
\usepackage{amsmath} |
| 7 |
\usepackage{correctmathalign} |
| 8 |
|
| 9 |
\title{Correction Spacings: eqnarray(*), aligned, alignedat, and gathered} |
| 10 |
\author{Yuwsuke Kieda} |
| 11 |
\date{2017/04/04 v1.1} |
| 12 |
|
| 13 |
\renewcommand\labelitemi{\textendash} |
| 14 |
|
| 15 |
\begin{document} |
| 16 |
\maketitle |
| 17 |
|
| 18 |
\section{Descriptions} |
| 19 |
|
| 20 |
We will realignment some expression environments spacing. |
| 21 |
It is a correction in the horizontal spacing of the alignment. |
| 22 |
|
| 23 |
\section{Usage} |
| 24 |
|
| 25 |
\subsection{Preamble} |
| 26 |
|
| 27 |
\begin{verbatim} |
| 28 |
\usepackage{amsmath} |
| 29 |
\usepackage{correctmathalign} |
| 30 |
\end{verbatim} |
| 31 |
|
| 32 |
Remark: amsmath package is optional: if you use aligned, alignedat, or gathered environments. |
| 33 |
|
| 34 |
Remark: The problem with the amsmath package (2016/11/05 2.16a) was solved by the original. See the options \texttt{alignedleftspaceyes}, \texttt{alignedleftspaceno}, and \texttt{alignedleftspaceyesifneg}. |
| 35 |
We dealt with versions prior to 2016/03/10 v2.15b. |
| 36 |
|
| 37 |
\subsection{Options} |
| 38 |
|
| 39 |
\begin{itemize} |
| 40 |
\item \verb!latexorg!: original behavior of LaTeX/amsmath package |
| 41 |
\item \verb!fleqn!: corresponds to class file and/or amsmath package's fleqn option |
| 42 |
\end{itemize} |
| 43 |
|
| 44 |
\section{File with Original Definitions} |
| 45 |
|
| 46 |
\begin{itemize} |
| 47 |
\item \verb!eqnarray!: latex.ltx |
| 48 |
\item \verb!\start@aligned! and \verb!\gathered!: amsmath.sty (before 2016/03/10 v2.15b) |
| 49 |
\end{itemize} |
| 50 |
|
| 51 |
\section{License} |
| 52 |
|
| 53 |
BSD 2-Clause License |
| 54 |
|
| 55 |
\section{Samples} |
| 56 |
|
| 57 |
Cf.\ defaults of \LaTeX{}\ and \texttt{amsmath.sty} before 2016/03/10 v2.15b (Figures~\ref{fig1} and~\ref{fig2}). |
| 58 |
|
| 59 |
\setbox9\hbox{Figure 1: \texttt{eqnarray*} environment}% |
| 60 |
\setbox8\hbox{Figure 2: \texttt{aligned} environment}% |
| 61 |
\begin{figure} |
| 62 |
\centering |
| 63 |
\begin{minipage}[t]{\wd9} |
| 64 |
\centering |
| 65 |
\includegraphics{eqnarray-org.pdf} |
| 66 |
\caption{\texttt{eqnarray*} environment by \LaTeX{}\ default.} |
| 67 |
\label{fig1} |
| 68 |
\end{minipage}\qquad |
| 69 |
\begin{minipage}[t]{\wd8} |
| 70 |
\centering |
| 71 |
\includegraphics{aligned-org.pdf} |
| 72 |
\caption{\texttt{aligned} environment by \texttt{amsmath.sty} default (before 2016/03/10 v2.15b).} |
| 73 |
\label{fig2} |
| 74 |
\end{minipage} |
| 75 |
\end{figure} |
| 76 |
|
| 77 |
\noindent |
| 78 |
\begin{center} |
| 79 |
\makeatletter\@wholewidth0pt\makeatother |
| 80 |
\frame{% |
| 81 |
\begin{minipage}{\wd9} |
| 82 |
\[ |
| 83 |
\mathrm{I} = \mathrm{H}(x + 1) |
| 84 |
\] |
| 85 |
\begin{eqnarray*} |
| 86 |
\mathrm{I} &=& \mathrm{H}(x)\\ |
| 87 |
&=& \mathrm{H}(x + 1) |
| 88 |
\end{eqnarray*} |
| 89 |
\end{minipage}}\qquad |
| 90 |
\frame{% |
| 91 |
\begin{minipage}{\wd8} |
| 92 |
\begin{align*} |
| 93 |
\mathrm{I} & \begin{aligned}[t] |
| 94 |
&= \mathrm{H}(x)\\ |
| 95 |
&= \mathrm{H}(x + 1) |
| 96 |
\end{aligned}\\ |
| 97 |
\mathrm{I} &= \mathrm{H}(x)\\ |
| 98 |
&= \mathrm{H}(x + 1) |
| 99 |
\end{align*} |
| 100 |
\end{minipage}} |
| 101 |
\end{center} |
| 102 |
|
| 103 |
|
| 104 |
\subsection{Use \LaTeX{}\ code} |
| 105 |
|
| 106 |
\begin{verbatim} |
| 107 |
\[ |
| 108 |
\mathrm{I} = \mathrm{H}(x + 1) |
| 109 |
\] |
| 110 |
\begin{eqnarray*} |
| 111 |
\mathrm{I} &=& \mathrm{H}(x)\\ |
| 112 |
&=& \mathrm{H}(x + 1) |
| 113 |
\end{eqnarray*} |
| 114 |
|
| 115 |
\begin{align*} |
| 116 |
\mathrm{I} & \begin{aligned}[t] |
| 117 |
&= \mathrm{H}(x)\\ |
| 118 |
&= \mathrm{H}(x + 1) |
| 119 |
\end{aligned}\\ |
| 120 |
\mathrm{I} &= \mathrm{H}(x)\\ |
| 121 |
&= \mathrm{H}(x + 1) |
| 122 |
\end{align*} |
| 123 |
\end{verbatim} |
| 124 |
|
| 125 |
\end{document} |