LaTeX forum ⇒ Graphics, Figures & TablesVertically centered text in the table

Information and discussion about graphics, figures & tables in LaTeX documents.
ciema7
Posts: 10
Joined: Sat Nov 10, 2018 2:31 am

Vertically centered text in the table

Postby ciema7 » Wed Nov 28, 2018 2:56 pm

Hello Friends,

today I have simply question, but I cannot apply solutions that I found in the forums.
Do you know how to vertically center my text in each cell ?

  1. \resizebox{\textwidth}{!}{
  2.  
  3. \begin{tabular}{|l|l|l|l|l|l|l|l|l|l|l|l|l|}
  4. \hline
  5. \rowcolor[RGB]{31,78,121}
  6. \multicolumn{1}{|c|}{\cellcolor[RGB]{31,78,121}{\color[HTML]{FFFFFF} Liczba porzadkowa}} & \multicolumn{1}{c|}{\cellcolor[RGB]{31,78,121}{\color[HTML]{FFFFFF}1 }} & \multicolumn{1}{c|}{\cellcolor[RGB]{31,78,121}{\color[HTML]{FFFFFF}2 }} & \multicolumn{1}{c|}{\cellcolor[RGB]{31,78,121}{\color[HTML]{FFFFFF}3 }} & \multicolumn{1}{c|}{\cellcolor[RGB]{31,78,121}{\color[HTML]{FFFFFF}4 }} & \multicolumn{1}{c|}{\cellcolor[RGB]{31,78,121}{\color[HTML]{FFFFFF}5 }} & \multicolumn{1}{c|}{\cellcolor[RGB]{31,78,121}{\color[HTML]{FFFFFF}6 }} & \multicolumn{1}{c|}{\cellcolor[RGB]{31,78,121}{\color[HTML]{FFFFFF}7 }} & \multicolumn{1}{c|}{\cellcolor[RGB]{31,78,121}{\color[HTML]{FFFFFF}8 }} & \multicolumn{1}{c|}{\cellcolor[RGB]{31,78,121}{\color[HTML]{FFFFFF}9 }} & \multicolumn{1}{c|}{\cellcolor[RGB]{31,78,121}{\color[HTML]{FFFFFF}10 }} & \multicolumn{1}{c|}{\cellcolor[RGB]{31,78,121}{\color[HTML]{FFFFFF}11 }} & \multicolumn{1}{c|}{\cellcolor[RGB]{31,78,121}{\color[HTML]{FFFFFF}12 }} \\ \hline
  7. \rowcolor[RGB]{208,206,206}
  8. \cellcolor[RGB]{31,78,121}{\color[HTML]{FFFFFF} Kolejne postaci drgan wlasnych [Hz]} & {\color[HTML]{000000}1931.9} & {\color[HTML]{000000}1738.1} & {\color[HTML]{000000}1429.9} &
  9. {\color[HTML]{000000}1376.3} &
  10. {\color[HTML]{000000}272.5} &
  11. {\color[HTML]{000000}380.5} &
  12. {\color[HTML]{000000}595.6}& {\color[HTML]{000000}871.9} &
  13. {\color[HTML]{000000}1000.9} &
  14. {\color[HTML]{000000}0.4} &
  15. {\color[HTML]{000000}0.4} &
  16. {\color[HTML]{000000}0.4} \\ \hline
  17.  
  18. \end{tabular}
  19. }

ciema7
Posts: 10
Joined: Sat Nov 10, 2018 2:31 am

Postby ciema7 » Tue Dec 04, 2018 4:24 am

I think the best solution is to generate a new table on website with spacing adjusted manually and then to copy the code to LaTeX file, thanks for help ! :) .

User avatar
Stefan Kottwitz
Site Admin
Posts: 9197
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Tue Dec 04, 2018 5:44 am

Centering by cell would destroy the alignment of th text baseline in a row. Some cells have letters with decenders, such as p and g. Seo we have different text heights but with the same base line by default.

Stefan
Site admin


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: Baidu [Spider] and 14 guests