I have a script in R that build a report in LaTeX. Sometimes, this report has very long and very wide table, so, after some research I decided try ltxtable. My problem is that I didn't get how it works.
I have this LaTeX code for the report:
\documentclass{report}
\usepackage{ltxtable, tabularx, longtable}
\usepackage[latin1]{inputenc}
\usepackage[left=2cm,top=1cm,right=3cm,nohead,nofoot]{geometry}
\title{CP 68 - Estatístico}
\author{Rodrigo Coster - 1141783-01}
\begin{document}
\textbf{ \begin{center}{\LARGE Informações referentes ao CP 68 - Estatístico }\end{center} }
\section*{Informações sobre processos}
Relação do quantitativo de candidatos convocados para cada processo selecionado
\LTXtable{\textwidth}{'table.tex'}
\section*{Informações sobre fila de espera}
Este CP não possui mais candidatos habilitados.
\end{document}
And, in the same folder, the file table.tex:
\begin{longtable}{|c|c|c|c|c{1cm}|}
\begin{center}
\hline
\textbf{\textbf{Processo}} & \textbf{Vagas} & \textbf{Data} & \textbf{Convocados} & \textbf{Exercicio ok} \\ \hline
\textbf{001.010726.12.8} & 2 & 13/04/2012 & 2 & 2 \\ \hline
\end{center}
\end{longtable}
After run, in console appears:
("C:\relatorios\Concursos\20130312 - CP 68 - Estatistico.aux")
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
Enter file name:
I tried a lot of file names. For most of them, he ask for the name again. If I type table.tex I get this error:
(C:\relatorios\Concursos\table.tex
! Missing # inserted in alignment preamble.
<to be read again>
&
l.1 \begin{longtable}{|c|c|c|c|c{1cm}|}
?
I already tried put \begin{center} in the first line, but didn't work.
EDIT:
Anothe table.tex:
\begin{longtable}{|c|c|c|c|c|c|}
\hline
\textbf{\textbf{Área}} & \textbf{Convocados} & \textbf{Não ingressou} & \textbf{Para convocar} & \textbf{Manifestou interesse} & \textbf{Exercicio ok} \\ \hline
\textbf{Administração e economia } & 8 & 6 & 0 & 0 & 2 \\ \hline
\textbf{Anos iniciais dos ciclos de formação } & 474 & 80 & 0 & 13 & 381 \\ \hline
\textbf{Artes visuais } & 45 & 8 & 2 & 2 & 33 \\ \hline
\textbf{Biologia } & 1 & 0 & 0 & 0 & 1 \\ \hline
\textbf{Ciências da computação } & 2 & 1 & 0 & 0 & 1 \\ \hline
\textbf{Ciências físicas, químicas e biológicas} & 72 & 12 & 0 & 1 & 59 \\ \hline
\textbf{Ciências sócio-históricas } & 48 & 11 & 0 & 2 & 35 \\ \hline
\textbf{Dança } & 17 & 6 & 0 & 0 & 11 \\ \hline
\textbf{Deficiência mental } & 40 & 5 & 0 & 0 & 35 \\ \hline
\textbf{Deficiência visual } & 4 & 1 & 0 & 0 & 3 \\ \hline
\textbf{Educação de surdos } & 6 & 3 & 0 & 0 & 3 \\ \hline
\textbf{Educação física/rede escolar } & 134 & 26 & 0 & 1 & 107 \\ \hline
\textbf{Educação infantil } & 123 & 17 & 1 & 2 & 103 \\ \hline
\textbf{Filosofia } & 7 & 0 & 0 & 0 & 7 \\ \hline
\textbf{Física } & 1 & 0 & 0 & 0 & 1 \\ \hline
\textbf{Geografia } & 56 & 15 & 1 & 2 & 38 \\ \hline
\textbf{História } & 51 & 15 & 0 & 0 & 36 \\ \hline
\textbf{Língua espanhola } & 33 & 8 & 0 & 1 & 24 \\ \hline
\textbf{Língua francesa } & 3 & 1 & 0 & 0 & 2 \\ \hline
\textbf{Língua inglesa } & 38 & 9 & 1 & 0 & 28 \\ \hline
\textbf{Língua portuguesa } & 81 & 22 & 1 & 0 & 58 \\ \hline
\textbf{Matemática } & 104 & 26 & 1 & 1 & 76 \\ \hline
\textbf{Música } & 51 & 17 & 0 & 1 & 33 \\ \hline
\textbf{Teatro } & 5 & 0 & 0 & 0 & 5 \\ \hline
\end{longtable}


\begin{center}insidelongtable)or any other latex tabular environment` Justdelete those lines.c{1cm}is also a syntax error latexccolumns do not take a length parameter. – David Carlisle Mar 12 at 17:13ltxtable/tabularxas that allows entries in a column to wrap over several lines but you can not do line breaking in numbers. – David Carlisle Mar 12 at 17:15\begin{center},\end{center}and{1cm}. Now it ask the file name several times (actualy, 4). After the 4th, the .pdf file is created (and with the table! \o/). You know why (and how to solve)? My problem with the width is in the title line (some tables has more than 5 columns) – Rcoster Mar 12 at 17:21{'table.tex'}to{table}But ltxtable will do nothing on this example other than be slower than a normal tabular. see this for ways of making tables narrower tex.stackexchange.com/questions/101748/… – David Carlisle Mar 12 at 17:28table.tex, with more columns. I read you post, but didn't get how to adapt it toltxtable:/ – Rcoster Mar 12 at 17:46