# Using horizontal fill to center doesn't work

I want to use the symbol for logical disjunction (the 'V'), but I want this to be in the center of the two 'x = ..'.

Right now it's like this:

This is the code I'm using:

\paragraph{a)}
\begin{aligned}[t] &D=b^2-4ac=5^2-4\cdot-2\cdot3=49 \\ &x=\dfrac{-5+\sqrt{49}}{2\cdot-2}=-\dfrac{1}{2} &\hfill &\vee &\hfill &x=\dfrac{-5-\sqrt{49}}{2\cdot-2}=3 \end{aligned}

• Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – Thruston Nov 24 '14 at 18:59
• Inside the environments of the amsmath package, the command \hfill doesn't work like it does in "ordinary" material. – Mico Nov 24 '14 at 19:00
• I think this would be better handled by a gathered environment rather than an aligned... – Thruston Nov 24 '14 at 19:00
• @Thruston The 'gathered' gives an error, I'm using documentclass{article} and I'm using the package 'amsmath' – user3024879 Nov 24 '14 at 19:03

Here is version using tabular or array (saves you having to go into and out of math mode for each cell) :

## Code:

\documentclass{article}
\usepackage{amsmath}
\usepackage{array}
\usepackage{showframe}

\newcommand*{\Length}{\dimexpr0.45\linewidth-1.0em\relax}% Adjustment for the paragraph label.

\begin{document}
\paragraph{a)}
\begin{tabular}[t]{@{}p{\Length} @{}p{0.10\linewidth}<{\centering}@{} >{\hfill}p{\Length}@{}}
$D=b^2-4ac=5^2-4\cdot-2\cdot3=49$ \\
$x=\dfrac{-5+\sqrt{49}}{2\cdot-2}=-\dfrac{1}{2}$ & $\vee$  & $x=\dfrac{-5-\sqrt{49}}{2\cdot-2}=3$ \\
\end{tabular}
\paragraph{b)}
$\begin{array}[t]{@{}>{$}p{\Length}<{$} @{}>{\centering$}p{0.10\linewidth}<{$}@{} >{\hfill$}p{\Length}<{$}@{}} D=b^2-4ac=5^2-4\cdot-2\cdot3=49 \\ x=\dfrac{-5+\sqrt{49}}{2\cdot-2}=-\dfrac{1}{2} & \vee & x=\dfrac{-5-\sqrt{49}}{2\cdot-2}=3 \\ \end{array}$
\end{document}


For simple lists of equations like this all you really need is an array with a single column that you can align left, center, or right.

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\paragraph{a)}
$\begin{array}[t]{l} D=b^2-4ac=5^2-4\cdot-2\cdot3=49 \\ x=\dfrac{-5+\sqrt{49}}{2\cdot-2}=-\dfrac{1}{2} \qquad\text{or}\qquad x=\dfrac{-5-\sqrt{49}}{2\cdot-2}=3 \end{array}$
\end{document}


Use \quad or \qquad to make space in a line, where there's no need to line things up.

• Your code is like this:i.imgur.com/3ZOJbdO.png – user3024879 Nov 24 '14 at 19:40
• But I want to have this: i.imgur.com/43p70Wa.png – user3024879 Nov 24 '14 at 19:41
• can't you do it with the 'aligned'? – user3024879 Nov 24 '14 at 19:51
• @user3024879 No not really - aligned is for lining things up on a specific character, usually the = sign. What you want is a simple array, with a single left-aligned column. – Thruston Nov 24 '14 at 23:12
\documentclass{article}
\usepackage{amsmath,showframe}
\begin{document}
\paragraph{a)}
\begin{aligned}[t] &D=b²-4ac=5²-4\cdot-2\cdot3=49 \\ &x=\dfrac{-5+√{49}}{2\cdot-2}=-\dfrac{1}{2} & \vee \qquad\qquad\qquad & &x=\dfrac{-5-√{49}}{2\cdot-2}=3 \end{aligned}
\end{document}