I have created a command to generate a table with 7 arguments since I need to repeat it many times with different content. The problem I have is that when I create the table using this command, it is always placed at the top of the page. I have loaded the floats package, I have added H in the table header, I have also tried with !H but it returns an error ... I cannot find the cause of this Latex behavior regarding the position of a table with respect to the page. I add the definition code of the command:
\newcommand{\PTgen}[7]{
\begin{table}[htbp]
\extrarowheight = -0.5ex
\renewcommand{\tabcolsep}{6pt}
\renewcommand{\arraystretch}{3}
\renewcommand {\tabcolsep}{3pt}
\renewcommand{\arrayrulewidth}{3pt}
\centering
\begin{tabular}{ c | c | c }
$ #1 $ &$ #2 $ & \\ \hline
$ #3 $ & $ #4 $ & \cellcolor[gray]{0.9} $ #5 $ \\ \hline
& \cellcolor[gray]{0.9} $ #6 $ & \cellcolor[gray]{0.9} $ #7 $ \\
\end{tabular}
\end{table}
}
Invoking the command:
\PTgen{1} {2} {3} {4} {5} {6} {7}
I would appreciate any suggestions that help me solve the problem.
htbpas float specifier (which should be the default)? – Werner Mar 14 '21 at 22:47%at ends of lines here and\extrarowheight = -0.5ex %Ajusta espacio superior entre filas para centradoswill, in general, cause rows in the table to over-print the row above with no warning. – David Carlisle Mar 14 '21 at 22:53tableenvironment is to specify the tabular can be moved, if you do not want it to move, why are you usingtable? – David Carlisle Mar 14 '21 at 23:00