I am using \longtable
command in a thesis preamble. My problem is that my data are large numbers, and I need to reduce the size of the table to footnote size. I tried using \begin{footnotesize}
–\end{footnotesize}
commands, it gave me an error message. What is the right way to reduce the size of the table with using a longtable?
[Tex/LaTex] How to use \footnotesize with longtable command
fontsizelongtable
Related Solutions
I've cut your code down a bit for demonstration purposes, to make it a bit more minimal. But one way to do this is to specify the font size for each entry through the setup of the longtabu
environment. For example:
\documentclass{report}
\usepackage{tabu}
\usepackage{longtable}
\usepackage{booktabs}
\begin{document}
Composition of samples
\begin{longtabu} to \linewidth{>{\footnotesize}X[l3.0] *{5}{>{\footnotesize}X[c]}}
\caption{Composition of samples} \\
\toprule
\textbf{Component} & \textbf{Text1} & \textbf{Text2} & \textbf{Text3} & \textbf{Text4} & \textbf{Text5} \\
\midrule
H$_2$ & 3.94 & 3.81 & 4.03 & 3.88 & 4.01 \\
\bottomrule
\end{longtabu}
\end{document}
Because the declaration \footnotesize
affects only the relevant column, it does not affect the caption. However, you do need to specify it for each column. If you have several consecutive columns with the same definition, however, you can combine those using the *{<number>}{<column specification>}
syntax as I've done for 5 of the 6 columns in this case.
This produces:
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
This should work: