# how to unalign some equations and center them

I have this code

\documentclass{article}
\usepackage{amsmath,amssymb,geometry}

\geometry{
paper=a4paper,
left=2cm,
right=2cm,
vmargin=2cm,
}

\begin{document}
\begin{align}
D_x &= \mathbb{R}, &D_y &= \mathbb{R} \symbol{92} \{0\} \notag\\
\implies D_f &= \mathbb{R} \symbol{92} \{0\}\notag\\
dx &= 8tdt, &dy &= \left(3t^2 - \frac{14}{t}\right)dt,\label{eq3}\\
\implies\frac{dy}{dx} &= \frac{3t^3-14}{8t^2}
\implies d\left(\frac{dy}{dx}\right)
= \left(\frac{3}{8} + \frac{7}{2t^3}\right)dt \label{eqf''}\\
\lim_{t \to 0} x &= -3, &\lim_{t \to 0} y &= +\infty,\label{eq2}\\
\end{align}
\end{document}


which produces this

However I want this, where line 2 and 4 is centered

• Please always show a minimal working example starting with \documentclass, loading all required packages and ending with \end{document}. Code snippets always need guessing and therefore easily can result in not useful answers. And code snippets often need extra effort to get a working example that is needed to reproduce the problem and the shown result. Nov 21, 2023 at 8:02
• I'd suggest to rethink the way of presenting things. Alignment here is the less important part: you want to add words that describe what you're doing. Nov 21, 2023 at 8:18
• Off-topic: (a) Don't use \symbol{92} directly, as it won't generate the proper spacing. Instead, use \setminus. (b) left=2cm, right=2cm, vmargin=2cm may be expressed more succinctly as margin=2cm.
– Mico
Nov 21, 2023 at 11:36

Create a third column and use \mathclap (or \mathmakebox[2in][c]), from the mathtools package

\begin{align}
D_x &= \mathbb{R}, &&&D_y &= \mathbb{R} \symbol{92} \{0\} \notag\\
&&\mathmakebox[2in][c]{
\implies D_f = \mathbb{R} \symbol{92} \{0\}
}\notag\\
dx &= 8tdt, &&&dy &= \left(3t^2 - \frac{14}{t}\right)dt,\label{eq3}\\
&&\mathmakebox[2in][c]{
\implies\frac{dy}{dx} = \frac{3t^3-14}{8t^2}
\implies d\left(\frac{dy}{dx}\right)
= \left(\frac{3}{8} + \frac{7}{2t^3}\right)dt
}\\
\lim_{t \to 0} x &= -3, &&&\lim_{t \to 0} y &= +\infty,\label{eq2}
\end{align}


This gives the following output

The command \mathclap puts its argument in a zero width box and centers it. [2, 3.1.1]

The \mathmakebox[width][alignment]{content} command makes a box and puts content inside it. It takes an optional argument width and another (additional) optional argument alignment which could be l, r or c.

See also: \shoveright and \shoveleft.

• can the distance between each 2 expressions be not so wide? Nov 21, 2023 at 10:12
• Adjust the width argument of mathmakebox to a smaller value like 0in. Alternatively, replace \mathmakebox[2in][c] with \mathclap. Nov 21, 2023 at 10:27

Ugly hack:

\documentclass{article}

\usepackage{mathtools}
\usepackage{amsfonts}

\begin{document}
\begin{align}
D_x &= \mathbb{R}, &D_y &= \mathbb{R} \symbol{92} \{0\} \notag\\
\intertext{\centerline{$\displaystyle\implies D_f = \mathbb{R} \symbol{92} \{0\}$}}
dx &= 8tdt, &dy &= \left(3t^2 - \frac{14}{t}\right)dt,\label{eq3}\\
\intertext{\centerline{$\displaystyle\implies\frac{dy}{dx} = \frac{3t^3-14}{8t^2} \implies d\left(\frac{dy}{dx}\right) = \left(\frac{3}{8} + \frac{7}{2t^3}\right)dt$}} \notag\\[-43pt]\label{eqf''}\\[14pt]
\lim_{t \to 0} x &= -3, &\lim_{t \to 0} y &= +\infty,\label{eq2}
\end{align}

\end{document}


• can the spacing between the lines be not so wide? Nov 21, 2023 at 10:11
• @Le_Square You can always use the optional argument of \\  to change the vertical spaces manually. To change it globally for all align environment, please ask a new question (if there isn't already one). But I wouldn't reduce it. This would have negative influence to the readability. It is already hard to read now. Nov 21, 2023 at 10:40

I would like to recommend that you apply a radical visual simplification and go for a single-column, left-aligned "look".

\documentclass{article}
\usepackage{amsmath,amssymb,geometry}

\counterwithin{equation}{section} % just for this example

\begin{document}
\setcounter{section}{1} % just for this example
\stepcounter{equation}

\begin{align}
& D_x = \mathbb{R}, \quad D_y = \mathbb{R} \setminus \{0\} \notag\\[2\jot]
\implies & D_f = \mathbb{R} \setminus \{0\}\notag\\
& dx = 8t\,dt, \quad dy = \Bigl(3t^2 - \frac{14}{t} \Bigr)dt,\label{eq3}\\
\implies & \frac{dy}{dx} = \frac{3t^3-14}{8t^2}
\implies d\biggl(\frac{dy}{dx}\biggr)
= \biggl(\frac{3}{8} + \frac{7}{2t^3}\biggr)dt \label{eqf''} \\[\jot]
& \lim_{t \to 0} x = -3, \quad \lim_{t \to 0} y = +\infty,\label{eq2}
\end{align}
\end{document}