MWE:
\documentclass{article}
\begin{document}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
&\multicolumn{2}{|c|}{1} & \multicolumn{2}{|c|}{2} & \multicolumn{2}{|c|}{3} & \multicolumn{2}{|c|}{4} & \multicolumn{2}{|c|}{5} & \multicolumn{2}{|c|}{6} & \multicolumn{2}{|c|}{7} & \multicolumn{2}{|c|}{8}\\
\hline
\(f(x)\)&a&\multicolumn{2}{|c|}{b}&\multicolumn{2}{|c|}{c}&\multicolumn{2}{|c|}{d}&\multicolumn{2}{|c|}{e}&\multicolumn{2}{|c|}{f}&\multicolumn{2}{|c|}{g}&\multicolumn{2}{|c|}{h}&i\\
\hline
a&b&c&d&e&f&g&h&j&i&k&l&m&n&o&p&q\\
\hline
\end{tabular}
\end{document}
Note that the cell borders are perfectly centered:
Unfortunately, inserting (longer) formulas will destroy the layout:
% excerpt
&\multicolumn{2}{|c|}{\(-\frac{5}{4}\pi - \frac{1}{2}\)} & \multicolumn{2}{|c|}{\(-\frac{5}{4}\pi - \frac{1}{2}\)} &
Questions:
1.) Is there any better way to achieve my tabular layout?
2.) If not, how can I resolve the layout problem?
(3.) Removing the last row (a – q) also causes an incorrect layout. If this behavior can be corrected in any (easy) way (maybe as a side effect of choosing another way), I'd be glad to hear about it. Otherwise, I will probably ask another question.)
I've drawn a quick sketch in Word, maybe it helps to understand my problem:
It's not perfect, but you should get the very idea.