This isn't quite what you asked for, but it may do in a pinch. The problem in odd-sized column width seems to arise when a multicolumn extends past the natural width of the table. So I placed your lipsum in a \parbox
called \tmp
, and then placed it in a 9-column multicolumn with makebox[0pt]{\tmp}
(a zero-width box), so that the width of \tmp
would not screw up the natural spacing of the table.
This solution has two drawbacks:
1) The table does not extend to the margins, but assumes its natural width, which was not what you asked for; and
2) A tweak is required to the width of the \parbox
name d\tmp
to make it conform to the natural width of the table. Here, I subtracted 4ex
from the full width, which is given by \linewidth
.
\documentclass[11pt]{article}
\usepackage[nolists]{endfloat}
\usepackage{comment}
\usepackage[margin=2.5cm]{geometry}
\usepackage{natbib,amssymb}
\setlength{\bibsep}{0pt plus 0.3ex}
\usepackage[affil-it]{authblk}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{siunitx}
\usepackage{lipsum}
\usepackage[FIGBOTCAP]{subfigure}
\usepackage{float}
\usepackage{catchfile,tikz}
\usepackage{filecontents}
\usepackage{silence}
\usepackage{tikz}
\usepackage{amsmath}
\usetikzlibrary{shapes,trees}
\usepackage{pdflscape }
\usepackage{eurosym}
%\usepackage[T1]{fontenc}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{lipsum}
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}%Need for STATA tables
\newenvironment{lgtable}
{\begin{landscape}\begin{longtable}}
{\end{longtable}\end{landscape}}
% make it known to endfloat
\DeclareDelayedFloatFlavor{lgtable}{table}
\begin{document}
\def\tmp{\parbox{\linewidth-4ex}{\footnotesize\lipsum[3-4]\vspace{1ex}}}
\begin{lgtable}{@{\extracolsep{\fill}}l*{8}{c}}
\caption{Regression Estimation: Blank, S(1)}
\label{table:first}\\
\multicolumn{9}{c}{\makebox[0pt]{\tmp}}%
\\
\toprule
\multicolumn{9}{c}{Some text}\\
\midrule
&Blank& \multicolumn{3}{c}{Some title}&\multicolumn{3}{c}{Some title}& Pooled\\
\midrule
&\multicolumn{1}{c}{(1)} &\multicolumn{1}{c}{(2)} &\multicolumn{1}{c}{(3)} &\multicolumn{1}{c}{(4)} &\multicolumn{1}{c}{(5)} &\multicolumn{1}{c}{(6)} &\multicolumn{1}{c}{(7)} &\multicolumn{1}{c}{(8)} \\
& Blank &Blank, abcs &Blank, abcs &Blank, abcs & Blank, Abc & Blank, Abc & Blank, Abc &Blank, Pooled \\
\midrule
S(1) & 0.900\sym{***}& 0.887\sym{***}& 0.876\sym{***}& 0.239\sym{***}& 0.988\sym{***}& 0.952\sym{***}& 0.330 & 0.258\sym{***}\\
\bottomrule
\newpage
\multicolumn{9}{c}{Table \ref{table:first}: (continued)}\\
\toprule
\multicolumn{9}{c}{Panel B: Seom text}\\
\midrule
&Blank& \multicolumn{3}{c}{Some title}&\multicolumn{3}{c}{Some title}& Pooled\\
\midrule
&\multicolumn{1}{c}{(1)} &\multicolumn{1}{c}{(2)} &\multicolumn{1}{c}{(3)} &\multicolumn{1}{c}{(4)} &\multicolumn{1}{c}{(5)} &\multicolumn{1}{c}{(6)} &\multicolumn{1}{c}{(7)} &\multicolumn{1}{c}{(8)} \\
& Blank &Blank, abcs &Blank, abcs &Blank, abcs & Blank, Abc & Blank, Abc & Blank, Abc &Blank, Pooled \\
\midrule
S(1) & 0.900\sym{***}& 0.887\sym{***}& 0.876\sym{***}& 0.239\sym{***}& 0.988\sym{***}& 0.952\sym{***}& 0.330 & 0.258\sym{***}\\
\bottomrule
\end{lgtable}
\end{document}
![enter image description here](https://i.stack.imgur.com/O07ey.jpg)
p.s. Any attempts to extend the natural width of the table ended up adding space only to the last column, which caused me to abandon those attempts.
You can not nest longtable
: just use longtable
for the outer table, and tabular
for the inner ones.
\documentclass[a4paper]{article}
\usepackage{longtable}
\begin{document}
\begin{longtable} {|c|c|c|c|}
\hline
\# & Actividades & Objetivos &
\begin{tabular}[c]{@{}c@{}}Duracion\\ Estimada\end{tabular} \\ \hline
1 & \begin{tabular}[c]{@{}c@{}}Redaccion del documento de \\ Trabajo de Grado\end{tabular} & \multicolumn{1}{l|}{} & 12 semanas \\ \hline
2 & \begin{tabular}[c]{@{}c@{}}Redacci\'on\\ del documento de\\ Trabajo Especial de Grado\end{tabular} & Todos & 23 semanas \\ \hline
3 & \begin{tabular}[c]{@{}c@{}}Realizar un estudio de los requisitos \\ existentes en los horarios del\\ Departamento de computaci\'on\end{tabular} & 1.1 & 2 semanas \\ \hline
\multicolumn{1}{|l|}{4} & \begin{tabular}[c]{@{}c@{}}Construir\\ la representaci\'on \\ adecuada de un horario de clases \\ del departamento\\ de computaci\'on\end{tabular} & 1.1 & 2 semanas \\ \hline
5 & \begin{tabular}[c]{@{}c@{}}Definir\\ las estructuras necesarias \\ para guardar la informaci\'on de \\ todos los\\ elementos involucrados\\ en la asignaci\'on de horarios\end{tabular} & 1.1 y 1.2 & 2 semanas \\ \hline
6 & \begin{tabular}[c]{@{}c@{}}Codificar\\ ambas metaheur\'isticas \\ usando un lenguaje de \\ programaci\'on de alto\\ nivel adecuado\end{tabular} & \begin{tabular}[c]{@{}c@{}}1.2, 1.3 y\\ 1.4\end{tabular} & 5 semanas \\ \hline
7 & \begin{tabular}[c]{@{}c@{}}Determinar la matriz de feromonas\\ y n\'umero de hormigas ideal\end{tabular} & 1.2 y 1.4 & 2 semanas \\ \hline
8 & \begin{tabular}[c]{@{}c@{}}Definir los movimientos, \\ condiciones tab\'u, \\ criterios de aspiraci\'on mediante\\ la aplicaci\'on de pruebas para \\ optimizar el c\'alculo de la \\ soluci\'on final\end{tabular} & 1.3 y 1.4 & 2 semanas \\ \hline
9 & \begin{tabular}[c]{@{}c@{}}Establecer el nivel de hibridizaci\'on \\ entre ambas metaheur\'isticas\end{tabular} & \begin{tabular}[c]{@{}c@{}}1.2, 1.3 \\ y 1.4\end{tabular} & 2 semanas \\ \hline
10 & \begin{tabular}[c]{@{}c@{}}Crear\\ distintos casos de prueba\\ basados en modelos de entradas de datos\\ sintetizadospara la asignaci\'on de horarios\end{tabular} & 2.1 & 2 semanas \\ \hline
11 & \begin{tabular}[c]{@{}c@{}}Realizar pruebas finales\\ que permitan precisar \\ el comportamiento y eficiencia\\ del programa frente a los \\ distintos casos de prueba establecidos\end{tabular} & 2.1 & 2 semanas \\ \hline
12 & \begin{tabular}[c]{@{}c@{}}Realizar el an\'alisis\\ de los resultados usando\\ las m\'etricas definidas\end{tabular} & 2.2 & 2 semanas \\ \hline
\end{longtable}
\end{document}
Best Answer
add
and replace
by
in any columns where you want ragged text.