问题
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:
- check to have
\usepackage{array}in your preamble; - use
\centeringinstead of nestingtabularintocenterintotable; - review the width of the columns;
a_aonly works in math mode:$a_a$;- 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