Here is an update to your code which should solve both your issues:
Code: Select all
\begin{table}[h!]
\centering
\begin{tabular}{c|cccc}
$\cdot$ & 1 & a & b & c \\ \hline
1 & 1 & a & b & c \\
a & a & c & 1 & b \\
b & b & 1 & c & a \\
c & c & b & a & 1
\end{tabular}
\end{table}
Re: Table placement. The \begin{table} macro creates a 'float' which encompasses everything until the \end{table} macro. LaTeX tries to find an optimal place for each float using its own algorithms unless you tell it to do something else. The [h!] option tells LaTeX to put the table float right where it appears in your document.
You can accomplish the same thing in LyX by right clicking the gray box that says "float: Table" and selecting 'Settings ...' Then, unclick 'use default placement' and select 'Here definitely' instead.
Re: Centering. Put the \centering command inside the table float environment, and everything inside will be center-aligned.
You can accomplish the same thing in LyX by putting your cursor directly to the left of the table and right clicking. Select 'Paragraph Settings' from the pop-up menu and then choose 'Center' under 'Alignment'.