# Thread: Boxing and spacing problems

1. ## Boxing and spacing problems

Trying to set up the following magic square using boxing.

The square is: 16 02 03 13
....................05 11 10 08
....................09 07 06 12
....................04 14 15 01

The first problem is that I want to set up the entire square inside of one box using the \box function instead of using several boxes. Various things happen except what I want. For example when I try:

\boxed {16\ 02\ 03\ 13\
05\ 11\ 10\ 08}, I get:

$\boxed {16\ 02\ 03\ 13\
05\ 11\ 10\ 08}$

which isn't what I want and when I try:

\boxed {16\ 02\ 03\ 13\\
05\ 11\ 10\ 08}, I get:

$\boxed {16\ 02\ 03\ 13\\
05\ 11\ 10\ 08}$

The other problem is with the spacing as I can only get up to one space between the characters. Any suggestions?

2. I would use the table function then.

\begin{array}{|c|c|c|}\hline
16 & 02 & 03 \\ \hline
05 & 11 & 10 \\ \hline
09 & 07 & 06 \\ \hline
\end{array}

$\begin{array}{|c|c|c|}\hline
16 & 02 & 03 \\ \hline
05 & 11 & 10 \\ \hline
09 & 07 & 06 \\ \hline
\end{array}$

\begin{array} \end{array} mark the start and the end of the table.
{c} denotes the number of columns. In my example, I have 3 c's and hence, 3 columns
{|c|} would mean one column sandwiched between two vertical lines. If I put {|c} then, I would have only one vertical line on the left.
& switches column
\\ as you know changes row
\hline I think means headline or something similar which inserts an upper horizontal line above the row.

3. ## Much work remains to be done

Originally Posted by Unknown008
I would use the table function then.

\begin{array}{|c|c|c|}\hline
16 & 02 & 03 \\ \hline
05 & 11 & 10 \\ \hline
09 & 07 & 06 \\ \hline
\end{array}

$\begin{array}{|c|c|c|}\hline
16 & 02 & 03 \\ \hline
05 & 11 & 10 \\ \hline
09 & 07 & 06 \\ \hline
\end{array}$

\begin{array} \end{array} mark the start and the end of the table.
{c} denotes the number of columns. In my example, I have 3 c's and hence, 3 columns
{|c|} would mean one column sandwiched between two vertical lines. If I put {|c} then, I would have only one vertical line on the left.
& switches column
\\ as you know changes row
\hline I think means headline or something similar which inserts an upper horizontal line above the row.
I've discovered the array command before you reached me.

The horizontal and vertical lines are a nice touch which I also have to test out along with the box command.

The reason why I'm going through all this is that when I do a preview with Hotmail (which I use for testing purposes), I'm not getting wysiwig so I figured that boxing the numbers would hold them steady.

Thanks

4. ## Making progress

I've gotten this far:

$\boxed{{\begin{array}{cccc}16&02&03&13\\
05&11&10&08\\
09&07&06&12\\
04&14&15&01\end{array}}\\
Figure 1}$

I'm trying to get Figure 1 two spaces below the numbers (with a space between figure and 1) while keeping the rectangle around the numbers and Figure 1. What adjustment should I make?

5. Maybe insert it into another column?

$
\boxed{{\begin{array}{ccccc}16&02&03&13&\\
05&11&10&08&\\
09&07&06&12&\\
04&14&15&01&Figure\ 1\end{array}}\\}
$

Like this perhaps?

\boxed{{\begin{array}{ccccc}16&02&03&13&\\
05&11&10&08&\\
09&07&06&12&\\
04&14&15&01&Figure\ 1\end{array}}\\}

'\ ' leaves a space between two characters.

6. ## Getting closer

Originally Posted by Unknown008
Maybe insert it into another column?

$
\boxed{{\begin{array}{ccccc}16&02&03&13&\\
05&11&10&08&\\
09&07&06&12&\\
04&14&15&01&Figure\ 1\end{array}}\\}
$

Like this perhaps?

\boxed{{\begin{array}{ccccc}16&02&03&13&\\
05&11&10&08&\\
09&07&06&12&\\
04&14&15&01&Figure\ 1\end{array}}\\}

'\ ' leaves a space between two characters.
I've tried this:

$\boxed{{\begin{array}{cccc}16&02&03&13\\
05&11&10&08\\
09&07&06&12\\
04&14&15&01&\\Figure\ 1\end{array}}\\}
$

which creates an unwanted space between the first and second columns, but does move Figure 1 the desired two spaces below the numbers, but needs to be centered with respect to the numbers. This still needs some massaging and I'm confident a solution is at hand.

7. Oh! Now I get what you are wanting to do. Hm... maybe make another array, within the box.

That was not easy, but I'm satisfied! I used two tables, one into the other

\boxed{
\begin{array}{c}
\begin{array}{cccc}
16 & 02 & 03 & 13 \\
05 & 11 & 10 & 08 \\
09 & 07 & 06 & 12 \\
04 & 14 & 15 & 01 \end{array}
& Figure\ 1 \\
\end{array}}

$\boxed{\begin{array}{c}
\begin{array}{cccc}
16 & 02 & 03 & 13 \\
05 & 11 & 10 & 08 \\
09 & 07 & 06 & 12 \\
04 & 14 & 15 & 01 \end{array}
& Figure\ 1 \\
\end{array}}$

8. Originally Posted by wonderboy1953
The other problem is with the spacing as I can only get up to one space between the characters. Any suggestions?
Without spaces, from above

$\begin{array}{|c|c|c|}\hline
16 & 02 & 03 \\ \hline
05 & 11 & 10 \\ \hline
09 & 07 & 06 \\ \hline
\end{array}$

With spaces

$\begin{array}{|c|c|c|}\hline
\ \ 16\ \ & \ \ 02\ \ & \ \ 03\ \ \\ \hline
05 & 11 & 10 \\ \hline
09 & 07 & 06 \\ \hline
\end{array}$

another way

$\begin{array}{|c|c|c|}\hline
\hspace{1em} 16\hspace{1em} & \hspace{1em} 02\hspace{1em} & \hspace{1em} 03\hspace{1em} \\ \hline
05 & 11 & 10 \\ \hline
09 & 07 & 06 \\ \hline
\end{array}$

Some more options

Lesson 5:Typesetting Math in LaTeX

9. We can even introduce multiple columns, some of which we keep empty:

$\begin{array}{|ccc|ccc|ccc|}\hline
& 16 &&& 02 &&& 03 &\\ \hline
& 05 &&& 11 &&& 10 &\\ \hline
& 09 &&& 07 &&& 06 &\\ \hline
\end{array}$

I get my basics here:

mimetextutorial.html

Though it's a little different (I think some functions there don't work on here)