# Alignedat environment - remove extra blank space

I'm dealing with a math system and the code is the following:

\documentclass{report}
\usepackage{mathtools}
\begin{document}
\chi_{_\mathrm{f}}=\mu^T \left\{ \begin{alignedat}{2} (R_{x_\mathrm{f}} - R_{x_\mathrm{fs}}) = 0 \;\xrightarrow{R_{x_\mathrm{fs}} =0} \; (R_{x_\mathrm{f}} = 0)\\ (R_{y_\mathrm{f}} - R_{y_\mathrm{fs}}) = 0 \;\xrightarrow{R_{y_\mathrm{fs}}=0} \; (R_{y_\mathrm{f}} = 0)\\ (R_{z_\mathrm{f}} - R_{z_\mathrm{fs}}) = 0 \;\xrightarrow{R_{z_\mathrm{fs}}=0} \; (R_{z_\mathrm{f}} = 0)\\ (V_{x_\mathrm{f}} - V_{x_\mathrm{fs}}) = 0 \;\xrightarrow{V_{x_\mathrm{fs}}=0} \; (V_{x_\mathrm{f}} = 0)\\ (V_{y_\mathrm{f}} - V_{y_\mathrm{fs}}) = 0 \;\xrightarrow{V_{y_\mathrm{fs}}=0} \; (V_{y_\mathrm{f}} = 0)\\ (V_{z_\mathrm{f}} - V_{z_\mathrm{fs}}) = 0 \;\xrightarrow{V_{z_\mathrm{fs}}=0} \; (V_{z_\mathrm{f}} = 0)\\ m_f \text{free}\\ \end{alignedat} \right.
\end{document}


The output is the following:

1. How could I remove the extra space that the code generate in the final line within the system? I have no clue why the last row starts there. It would be nice having it aligned on the left side like all the other rows or centered at least.

2. How can I correctly outdistance "m_f" and "free" each other?

Thank you!

• you have used alignedat{2} so it is expecting 3 alignment points (&) per row but you have specified no alignment at all. so everything is right aligned as the first cell before the first alignment point which is why they are all flush right. – David Carlisle Apr 13 at 18:24

I think gathered is preferable in this case to alignedat since there are no alignments per se. Then, I added a space at the beginning of \text{ free} to introduce the desired space. Finally, I led with an \mkern8mu and trailed with an \hfill on the last line to achieve left alignment of the final line (without them, the text is centered).

\documentclass{report}
\usepackage{mathtools}
\begin{document}
$$\chi_{_\mathrm{f}}=\mu^T \left\{ \begin{gathered} (R_{x_\mathrm{f}} - R_{x_\mathrm{fs}}) = 0 \;\xrightarrow{R_{x_\mathrm{fs}} =0} \; (R_{x_\mathrm{f}} = 0)\\ (R_{y_\mathrm{f}} - R_{y_\mathrm{fs}}) = 0 \;\xrightarrow{R_{y_\mathrm{fs}}=0} \; (R_{y_\mathrm{f}} = 0)\\ (R_{z_\mathrm{f}} - R_{z_\mathrm{fs}}) = 0 \;\xrightarrow{R_{z_\mathrm{fs}}=0} \; (R_{z_\mathrm{f}} = 0)\\ (V_{x_\mathrm{f}} - V_{x_\mathrm{fs}}) = 0 \;\xrightarrow{V_{x_\mathrm{fs}}=0} \; (V_{x_\mathrm{f}} = 0)\\ (V_{y_\mathrm{f}} - V_{y_\mathrm{fs}}) = 0 \;\xrightarrow{V_{y_\mathrm{fs}}=0} \; (V_{y_\mathrm{f}} = 0)\\ (V_{z_\mathrm{f}} - V_{z_\mathrm{fs}}) = 0 \;\xrightarrow{V_{z_\mathrm{fs}}=0} \; (V_{z_\mathrm{f}} = 0)\\ \mkern8mu m_f \text{ free}\hfill \end{gathered} \right.$$
\end{document}


Three possibilities. The various parts have different widths, so it's difficult to get sensible alignments, so I recommend the last one.

\documentclass{report}
\usepackage{mathtools}

\begin{document}

\chi_{_\mathrm{f}}=\mu^T \left\{ \begin{alignedat}{4} &(R_{x_\mathrm{f}} - R_{x_\mathrm{fs}}) &&= 0 &&\xrightarrow{R_{x_\mathrm{fs}} =0} (R_{x_\mathrm{f}} = 0)\\ &(R_{y_\mathrm{f}} - R_{y_\mathrm{fs}}) &&= 0 &&\xrightarrow{R_{y_\mathrm{fs}}=0} (R_{y_\mathrm{f}} = 0)\\ &(R_{z_\mathrm{f}} - R_{z_\mathrm{fs}}) &&= 0 &&\xrightarrow{R_{z_\mathrm{fs}}=0} (R_{z_\mathrm{f}} = 0)\\ &(V_{x_\mathrm{f}} - V_{x_\mathrm{fs}}) &&= 0 &&\xrightarrow{V_{x_\mathrm{fs}}=0} (V_{x_\mathrm{f}} = 0)\\ &(V_{y_\mathrm{f}} - V_{y_\mathrm{fs}}) &&= 0 &&\xrightarrow{V_{y_\mathrm{fs}}=0} (V_{y_\mathrm{f}} = 0)\\ &(V_{z_\mathrm{f}} - V_{z_\mathrm{fs}}) &&= 0 &&\xrightarrow{V_{z_\mathrm{fs}}=0} (V_{z_\mathrm{f}} = 0)\\[1ex] &\text{m_{\mathrm{f}} free} \end{alignedat} \right.

\chi_{_\mathrm{f}}=\mu^T \left\{ \begin{alignedat}{3} &(R_{x_\mathrm{f}} - R_{x_\mathrm{fs}}) = 0 &&\xrightarrow{R_{x_\mathrm{fs}} =0} (R_{x_\mathrm{f}} &= 0)\\ &(R_{y_\mathrm{f}} - R_{y_\mathrm{fs}}) = 0 &&\xrightarrow{R_{y_\mathrm{fs}}=0} (R_{y_\mathrm{f}} &= 0)\\ &(R_{z_\mathrm{f}} - R_{z_\mathrm{fs}}) = 0 &&\xrightarrow{R_{z_\mathrm{fs}}=0} (R_{z_\mathrm{f}} &= 0)\\ &(V_{x_\mathrm{f}} - V_{x_\mathrm{fs}}) = 0 &&\xrightarrow{V_{x_\mathrm{fs}}=0} (V_{x_\mathrm{f}} &= 0)\\ &(V_{y_\mathrm{f}} - V_{y_\mathrm{fs}}) = 0 &&\xrightarrow{V_{y_\mathrm{fs}}=0} (V_{y_\mathrm{f}} &= 0)\\ &(V_{z_\mathrm{f}} - V_{z_\mathrm{fs}}) = 0 &&\xrightarrow{V_{z_\mathrm{fs}}=0} (V_{z_\mathrm{f}} &= 0)\\[1ex] &\text{m_{\mathrm{f}} free} \end{alignedat} \right.

\chi_{_\mathrm{f}}=\mu^T \left\{ \begin{alignedat}{1} &(R_{x_\mathrm{f}} - R_{x_\mathrm{fs}}) = 0 \xrightarrow{R_{x_\mathrm{fs}} =0} (R_{x_\mathrm{f}} = 0)\\ &(R_{y_\mathrm{f}} - R_{y_\mathrm{fs}}) = 0 \xrightarrow{R_{y_\mathrm{fs}}=0} (R_{y_\mathrm{f}} = 0)\\ &(R_{z_\mathrm{f}} - R_{z_\mathrm{fs}}) = 0 \xrightarrow{R_{z_\mathrm{fs}}=0} (R_{z_\mathrm{f}} = 0)\\ &(V_{x_\mathrm{f}} - V_{x_\mathrm{fs}}) = 0 \xrightarrow{V_{x_\mathrm{fs}}=0} (V_{x_\mathrm{f}} = 0)\\ &(V_{y_\mathrm{f}} - V_{y_\mathrm{fs}}) = 0 \xrightarrow{V_{y_\mathrm{fs}}=0} (V_{y_\mathrm{f}} = 0)\\ &(V_{z_\mathrm{f}} - V_{z_\mathrm{fs}}) = 0 \xrightarrow{V_{z_\mathrm{fs}}=0} (V_{z_\mathrm{f}} = 0)\\[1ex] &\text{m_{\mathrm{f}} free} \end{alignedat} \right.

\end{document}


You appear to be missing the entire point of using an alignedat environment: It exists so you don't have to engage in (presumably tedious) visual formatting via spacing directives such as \;. But if you don't provide any & alignment markers, there's little or no reason for using alignedat (or align, aligned, flalign, etc.) to begin with.

Anyway, I'd get rid of the \; spacers and insert well-placed alignment markers instead.

\documentclass{report}
\usepackage{mathtools}
\newcommand\fs{\mathrm{fs}} % handy shortcut macro

\begin{document}
\chi^{}_{\mathrm{f}}=\mu^T \left\{ \begin{alignedat}{3} (R_{x_\mathrm{f}} - R_{x_{\fs}}) &= 0 \xrightarrow{R_{x_{\fs}}=0} &&(R_{x_\mathrm{f}} &= 0)\\ (R_{y_\mathrm{f}} - R_{y_{\fs}}) &= 0 \xrightarrow{R_{y_{\fs}}=0} &&(R_{y_\mathrm{f}} &= 0)\\ (R_{z_\mathrm{f}} - R_{z_{\fs}}) &= 0 \xrightarrow{R_{z_{\fs}}=0} &&(R_{z_\mathrm{f}} &= 0)\\ (V_{x_\mathrm{f}} - V_{x_{\fs}}) &= 0 \xrightarrow{V_{x_{\fs}}=0} &&(V_{x_\mathrm{f}} &= 0)\\ (V_{y_\mathrm{f}} - V_{y_{\fs}}) &= 0 \xrightarrow{V_{y_{\fs}}=0} &&(V_{y_\mathrm{f}} &= 0)\\ (V_{z_\mathrm{f}} - V_{z_{\fs}}) &= 0 \xrightarrow{V_{z_{\fs}}=0} &&(V_{z_\mathrm{f}} &= 0)\\ m_{\mathrm{f}} \text{ free}\qquad\\ \end{alignedat} \right.

• @Catarella - Actually, my thinking was that by making the start of the final row stand slightly to the left of the (nearly) vertical line established by the preceding line items, the final row would be less likely to be overlooked or ignored. Put differently, I violated a typographic rule of thumb ("keep things neatly aligned") in order to better achieve greater readability. However, if you value neat and tidy alignment more than I do, I suggest you replace \qquad in the final row with something like \kern1.6em. (\qquad is equivalent to \kern2em, and \quad is equivalent to 1em.) – Mico Apr 13 at 21:06