Definir o tamanho de coluna em uma tabela do LaTex

De MediaWiki do Campus São José
Ir para navegação Ir para pesquisar

Tamanho de colunas

Para definir o tamanho de uma coluna no Latex com alinhamento a esquerda, existem 3 comandos:

  • p{'width'} paragraph column with text vertically aligned at the top
  • m{'width'} paragraph column with text vertically aligned in the middle (requires array package)
  • b{'width'} paragraph column with text vertically aligned at the bottom (requires array package)

Para os comandos m e b, é necessário incluir a linha:

\usepackage{array}

Se quiser definir o tamanho de cada coluna da tabela, e manter as 3 opções de alinhamento, crie os novos comandos:

\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

E depois defina o tamanho usando os comandos definidos

   \begin{tabular}{L{2.8cm} C{7cm} c R{2cm}}
   \end{tabular}

Tamanho da tabela

Para delimitar o tamanho de uma tabela, use o comando \resizebox

\resizebox{15cm}{!} {
   \begin{tabular}...
   \end{tabular}
}

FONTE: http://tex.stackexchange.com/questions/12703/how-to-create-fixed-width-table-columns-with-text-raggedright-centered-raggedlef