Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to reference a set of equations that are placed within a alignat and subequations environments. I would like to reference them as Eq. 1 together, rather than Eqs. 1a and 1b separately. The MWE below does exactly this, yet leaves a small indentation in the paragraph just below the equations. Is there a way to circumvent this or use a different environment?

\documentclass{article}
 \usepackage{mathtools}
 \usepackage{lipsum}
 \begin{document}
  \lipsum[1]
  \begin{subequations}
   \begin{alignat}{1}
    \dot{\mathbf{u}}_{i} &= \frac{\mathbf{u}_{i+1} - \mathbf{u}_{i-1}}{2\Delta t} + \mathcal{O}(\Delta t^2) \\
    \ddot{\mathbf{u}}_{i} &= \frac{\mathbf{u}_{i+1} - 2\mathbf{u}_{i} + \mathbf{u}_{i-1}}{\Delta t^2} + \mathcal{O}(\Delta t^2)
   \end{alignat}
   \label{eq}
  \end{subequations}
  \lipsum[2]

  I'm referencing the equation here: \ref{eq}
 \end{document}
share|improve this question
add comment

2 Answers 2

up vote 7 down vote accepted
   \label{eq}% you need a percent here
share|improve this answer
    
Ah, I see. How does the % change this? This goes beyond my understanding of latex. –  Markus Mar 18 at 21:37
2  
@Markus a newline (if not hidden by a comment) is a word space and word spaces typically make space in the output. (I'd have put money on it being a % just from your title, without needing to actually go in and read the question:-) I haven't looked at the source but it probably protects against one word space before the close environment (eg \unskip to remove a space) but a \label on a line of its own like that produces an extra one. –  David Carlisle Mar 18 at 21:40
1  
add comment

You're placing the label in the wrong line; the reference is set by \begin{subequations}, so the best location is just after it (on the same line or not, it's immaterial).

\documentclass{article}
\usepackage{mathtools}
\usepackage{lipsum}
\begin{document}

\lipsum*[1]% *, or a paragraph is started
\begin{subequations}\label{eq}
\begin{alignat}{1}
\dot{\mathbf{u}}_{i}  &=
  \frac{\mathbf{u}_{i+1} - \mathbf{u}_{i-1}}{2\Delta t} + \mathcal{O}(\Delta t^2) \\
\ddot{\mathbf{u}}_{i} &=
  \frac{\mathbf{u}_{i+1} - 2\mathbf{u}_{i} + 
  \mathbf{u}_{i-1}}{\Delta t^2} + \mathcal{O}(\Delta t^2)
\end{alignat}
\end{subequations}
\lipsum[2]

I'm referencing the equation here: \ref{eq}

\end{document}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.