17

My apologies for asking so many questions here. I want to introduce a sentence in between 2 subequations which is not in math mode. Here is the code that I am using:

   \documentclass[12pt,oneside,reqno]{amsart}
   \usepackage{amssymb}
    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
    \begin{document}
    \begin{subequations}
      \begin{align}
       x=1222222222222222\\
       Here x is an arbitrary constant\\
       y=2
      \end{align}
    \end{subequations}
    \end{document}​ 

In the output, the line Here x is an arbitrary constant appears in math mode. Also y=2 is aligned towards the right which is something I don't want. Is it possible to include the sentence inside the subequations not in math mode. Also how do I align y=2 along with x in the center?

David Carlisle
  • 757,742

2 Answers2

26

A look through the amsmath manual (texdoc amsmath) will be beneficial. The intertext command may be what you're after, alignment points are specified with &:

\documentclass[12pt,oneside,reqno]{amsart}
\usepackage{amssymb}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\begin{document}
\begin{subequations}
  \begin{align}
   x&=1222222222222222\\
 \intertext{Here $x$ is an arbitrary constant}
   y&=2
  \end{align}
\end{subequations}
\end{document}​

enter image description here

Torbjørn T.
  • 206,688
  • A quick follow-up note to the OP: in order for the \intertext command to work, you needn't be in the align environment; for instance, the gather environment, which (unsurprisingly) does not align the equations on some point, will also work. – Mico Oct 26 '11 at 12:12
6

As Torbjørn pointed out, the \intertext-command from amsmath allows to add normal text within an align-environment (or similar) while keeping the alignement points.

\documentclass{scrartcl}

\usepackage{amsmath}
\usepackage{mathtools}

\begin{document}

\begin{align}
  a &= b \\
  c &= d
\intertext{Some text}
  e &= f
\end{align}

intertext from amsmath

It should be mentioned, however, that Morten Hoegholm's package mathtools (which provides several corrections for and additions to amsmath), corrects a slight problem of \intertext and provides a new command \shortintertext with less spacing.

\begin{align}
  a &= b \\
  c &= d
\shortintertext{Some text}
  e &= f
\end{align}

shortintertext from mathtools

In addition to this, there are options to fine-tune spacing.

% (This works, in contrast to what can be found in the current version of the manual.)
\mathtoolsset{
  aboveshortintertextdim=20pt, % (default: 3pt)
  belowshortintertextdim=10pt, % (default: 3pt)
} 

\begin{align}
  a &= b \\
  c &= d
\shortintertext{Some text with excessive spacing}
  e &= f
\end{align}

\end{document}

shortintertext with adjusted spacing

David Carlisle
  • 757,742
One
  • 1,485