我在 latex 上遇到了错误,但不明白为什么... 目的是在 latex 上创建一些表格,但它却给我带来了一些我不太明白的错误... 有什么提示吗?谢谢 :)
错误:
! LaTeX Error: Illegal character in array arg.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.5 \begin{tabular}{ | 1 | p{5cm} |}
代码:
\documentclass[12pt,a4paper]{article}
\usepackage[portuguese]{babel}
\usepackage[applemac]{inputenc}
\begin{document}
\begin{tabular}{ | 1 | p{5cm} |}
\hline
Nome & Manuel da Silva
\\ \line
Data de nascimento & 1977 \\ \line
Data de falecimento & 2011 \\ \line
\end{tabular}
\begin{tabular}{ | 1 | p{5cm} |}
\hline
Nome & Ana da Silva
\\ \line
Data de nascimento & 2006 \\ \line
\end{tabular}
\begin{tabular}{ | 1 | p{5cm} |}
\hline
Nome & Maria Felisbina
\\ \line
Data de nascimento & 1980 \\ \line
\end{tabular}
\end{document}
答案1
错误是由于在列说明中使用了1
(数字 1)而不是l
(字母 l,表示左)。在不加载任何包的情况下,有效的列说明符是l
(左对齐内容)、c
(居中内容)、r
(右对齐内容)和(宽度为 的p{<width>}
内容集)。\parbox
<width>
您还必须更改 \line
为\hline
。
\documentclass[12pt,a4paper]{article}
\usepackage[portuguese]{babel}
\usepackage[applemac]{inputenc}
\begin{document}
\begin{tabular}{ | l | p{5cm} |}
\hline
Nome & Manuel da Silva
\\ \hline
Data de nascimento & 1977 \\ \hline
Data de falecimento & 2011 \\ \hline
\end{tabular}
\begin{tabular}{ | l | p{5cm} |}
\hline
Nome & Ana da Silva
\\ \hline
Data de nascimento & 2006 \\ \hline
\end{tabular}
\begin{tabular}{ | l | p{5cm} |}
\hline
Nome & Maria Felisbina
\\ \hline
Data de nascimento & 1980 \\ \hline
\end{tabular}
\end{document}