Formatting the columns of a table in LaTeX [closed]

谁说我不能喝 提交于 2019-12-12 01:57:24

问题


I am trying to use LaTeX for documentation. I am unable to format the table. Please refer the following snippet of code.

\begin{table}[!htbp]
\begin{center}
 \begin{tabular}{| m{3cm} | m{3cm} | m{3cm}| m{3cm} | m{3cm} |}
\hline
Software Project & a_a & b_b & c_b & d_b \\
\hline
Organic &   2.4 &  1.05   & 2.5 & 0.38\\
\hline
Semi-detached & 3.0 &  1.12  & 2.5 & 0.35\\
 \hline
 Embedded & 3.6 &  1.20   & 2.5 & 0.32\\
 \hline


回答1:


Do you mean something like the code+screenshot I posted below?

If that fits, remember what follows:

  1. check to have \usepackage{array} in your preamble;
  2. use \centering instead of nesting tabular into center into table;
  3. review the width of the columns;
  4. a_a only works in math mode: $a_a$;
  5. check to have your environments closed properly (\end{tabular}, etc. are missing in the code you pasted in your question).
\documentclass[11pt,a4paper]{article}
\usepackage{array}

\begin{document}

\begin{table}[!htbp]
  \centering
  \begin{tabular}{| m{3.5cm} | m{1.5cm} | m{1.5cm} | m{1.5cm} | m{1.5cm} |}
    \hline
    Software Project & $a_a$ & $b_b$ & $c_b$ & $d_b$\\
    \hline
    Organic & 2.4 & 1.05 & 2.5 & 0.38\\
    \hline
    Semi-detached & 3.0 & 1.12 & 2.5 & 0.35\\
    \hline
    Embedded & 3.6 & 1.20 & 2.5 & 0.32\\
    \hline
  \end{tabular}
\end{table}

\end{document}



来源:https://stackoverflow.com/questions/37053549/formatting-the-columns-of-a-table-in-latex

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!