How do I center all the contents of a table in Latex using Overleaf?

Asked

Viewed 175 times

4

All the contents of my table are located to the left of it. How do I center the contents of the columns and rows of this table?

  • Table photo.

inserir a descrição da imagem aqui

  • Table code.
\begin{table}[H]
    \centering
    \footnotesize
     \caption{Tabela de cadastro de clientes}
        \begin{tabular}{|p{7cm}|p{7cm}|}
        \hline
        \rowcolor{lightgray}\textbf{RF01. Cadastrar cliente} & \textbf{RNF01.01} \\
        \hline
        O sistema deve permitir o cadastro de novos clientes. &  Só é permitido funcionários realizarem essa função. \\
        \hline
    \end{tabular} \\ [0.5cm]
    \textbf{Fonte:} Elaboração Própria (2020.1)
    \label{tab:my_label}
\end{table}
  • Have you tried using P{7cm} or C{7cm} ?

  • @Fourzerofive I’ll see if this works.

  • @Fourzerofive works, but slightly exceeds the margin of the page.

1 answer

2


  • 1

    I tried the first stretch and it worked, but it occupies a lot of space in the margin of the right side, the second I’m still trying to do.

  • 1

    The second code executed, but no expected effect still remains the same.

  • 1

    I think we can solve all this by changing the line \begin{tabular}{|p{7cm}|p{7cm}|} now I’m trying to understand how you do.

  • \begin{tabular}{|c|c|} the problem is that the right margin is too far right

  • Try to take a look at this table documentation page that I’ve given you that usually you can solve most table related problems.

  • @Kyukay remember that Capital C is different from c, and the same goes for P

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.