I've got this code but as you can see only the left cell borders are connecting with the top \hline enter image description here






Mass (g) & Position (cm) & $ \mathbf{ \frac{Mass}{Position}\left( \frac{g}{cm} \right) }$ \\[2pt] \hline 
 &  & \\ \hline
 &  & \\ \hline

  • remove \\[-1em] Commented Jun 15, 2023 at 1:16
  • I need to have space above and below the first row; that is the purpose of \\[-1em] and \\[2pt] Commented Jun 15, 2023 at 1:24
  • it is completely wrong syntax, by adjusting the length you may get something that looks ok but if you use \\ after \hline then any result is accidental error correction Commented Jun 15, 2023 at 7:04

1 Answer 1

  • By using tabularray package you will avoid your problem:

enter image description here

  • I suspect that table body rows are numbers.
  • Unfortunately it is not known how many digits they have and if they are decimal numbers.
  • if above is know, than you can use S columns type defined in siunitx package, for example:
Q[c, wd=30mm, 
  si={table-format=<number of integers>:<number of decimals>}]
  • Using above definition of columns you need for text in the first row add row{1} = {guard} option to tblr specifications.
  • So far MWE below consider your column definition.

\UseTblrLibrary{amsmath, siunitx}

    \sisetup{per-mode = fraction}
\begin{tblr}{hlines, vlines,
             colspec={ *{4}{Q[c, wd=30mm]} },
             row{1} = {rowsep=5pt}
Mass (g)    & Position (cm) & $\dfrac{\text{Mass}}{\text{Position}} 
                               \displaystyle\left(\si{\gram\per\centi\metre}\right)$    \\
            &               &                                               \\
            &               &                                               \\         
  • Fantastic, time to learn another package! Commented Jun 15, 2023 at 2:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .