# How to remove space from mathematical formulas?

This almost looks like what I would like to have

but the space between, for example, $f_1($ and $v_1$ is too large.

How can I fix this?

I got this with

$$\begin{array}{llllll} f_1( & v_1, & v_2 & & & ) = 0 \\ f_2( & & v_2, & v_3 & & ) = 0 \\ f_3( & & v_2, & & v_4 & ) = 0 \\ f_4( & v_1, & & & v_4 & ) = 0 \end{array}$$


I also tried \mathtt and lots of \ but the alignment was always a little bit off (due to the subscript?) and LaTeX tips: Displayed Math says that I shouldn't insert spaces like that. The \quad proposed there inserted too much space.

-
On an unrelated topic: how can I get this site to display the right thing when I type $f_1($ ? – Ali Nov 21 '12 at 16:28
This site doesn't use MathJax, because we want to talk about TeX code. Just enclose inline code in backquotes  as I did in my edit. – egreg Nov 21 '12 at 16:33

One way to reduce the spacing between the columns is to use @{}

I've put @{} between every column, but of course you can use it just on the columns that you wish.

You can think of the @{<stuff>} operation as adding <stuff> to every element in that column.

\documentclass{article}

\begin{document}

Original
$$\begin{array}{llllll} f_1( & v_1, & v_2 & & & ) = 0 \\ f_2( & & v_2, & v_3 & & ) = 0 \\ f_3( & & v_2, & & v_4 & ) = 0 \\ f_4( & v_1, & & & v_4 & ) = 0 \end{array}$$

New
$$\begin{array}{@{}l@{}l@{}l@{}l@{}l@{}l@{}} f_1( & v_1, & v_2 & & & ) = 0 \\ f_2( & & v_2, & v_3 & & ) = 0 \\ f_3( & & v_2, & & v_4 & ) = 0 \\ f_4( & v_1, & & & v_4 & ) = 0 \end{array}$$

\end{document}


Suggested by @egreg: you can use this idea to put \, after columns 2, 3, and 4, which gives

$$\begin{array}{@{}l@{}l@{\,}l@{\,}l@{\,}l@{}l@{}} f_1( & v_1, & v_2 & & & ) = 0 \\ f_2( & & v_2, & v_3 & & ) = 0 \\ f_3( & & v_2, & & v_4 & ) = 0 \\ f_4( & v_1, & & & v_4 & ) = 0 \end{array}$$


As @barbarabeeton pointed out, it doesn't seem necessary to use 6 columns; 5 columns will work ok

$$\begin{array}{l@{\,}l@{\,}l@{\,}l@{}l@{}} f_1( v_1, & v_2 & & & ) = 0 \\ f_2( & v_2, & v_3 & & ) = 0 \\ f_3( & v_2, & & v_4 & ) = 0 \\ f_4( v_1, & & & v_4 & ) = 0 \end{array}$$


I assume you have the last column empty so that the closing ) will be aligned.

-
I'd add @{\,} after columns 2, 3 and 4 instead of @{}, to get the correct spacing after the commas. – egreg Nov 21 '12 at 16:38
@egreg Actually \begin{array}{@{}lllll@{}l@{}}` looks like exactly what I wanted. Awesome, thank you both! – Ali Nov 21 '12 at 16:40
@Ali The spacings you get are too large, in my opinion. – egreg Nov 21 '12 at 16:41
@egreg added it, thanks very much :) – cmhughes Nov 21 '12 at 16:43
@cmhughes -- i'm confused. why are 6 columns needed? (columns 1 and 6 are always empty.) why wouldn't just 4 do? – barbara beeton Nov 21 '12 at 16:48