3

I am making a paper and for one table I have to use the longtable package, after struggling a lot I am almost done with this table. One problem left, the caption does/header of the table is too small and does not align with the other tables (these other tables are not made with longtable but with tabular). I used almost exactly the example on https://stackoverflow.com/questions/2896833/how-to-stretch-a-table-over-multiple-pages

  \documentclass[12pt]{article}

  % input Marco 
  \setlength{\parindent}{30pt}
  \usepackage{perpage} %the perpage package
  \MakePerPage{footnote} %the perpage package command
  \usepackage{rotating}
  \usepackage{longtable}

  % Standard list of included packages
  \usepackage{setspace}           % Allows easy changes to line spacing 
  \usepackage{graphicx}           % Allows including of graphics files
  \usepackage{amsmath}            % Additional math capabilities
  \usepackage{tabularx}
  \usepackage{longtable}
  \usepackage{multirow} 
  \usepackage{array}
  \usepackage{nth}
  \usepackage{multicol}
  \usepackage{versionPO}          % Include text conditionally
  \usepackage{marginnote}         % Used with todonotes package
  \usepackage{datetime}           % Allows formatting of date and time
  \usepackage{enumitem}           % Change formatting of lists
  \usepackage{subfigure}          % Create numbered and captioned subfigures
  \usepackage{rotating}           % Create landscape tables and figures
  \usepackage{hyperref}           % URLS and hyperlinks
  \usepackage{float}              % Activate [H] option to place figure HERE

  \usdate  % Use usual LaTeX date layout
  % Packages included specifically for this document.
  \usepackage{texintro}           % Document-specific definitions
  \usepackage{tocvsec2}           % More flexible formatting of table of contents
  \usepackage[longnamesfirst]{natbib} % Bibliography formatting
  \usepackage{bibentry}           % Print full citation in text
    \nobibliography*                                % Allow use of \bibentry
    \usepackage[retainorgcmds]{IEEEtrantools}  % Equation formatting. Option needed
    % to
                                     % allow enumitem to work.    

    % Notes options
    \ifnotes{%
    \usepackage[margin=1in,paperwidth=10in,right=2.5in]{geometry}%
    \usepackage[textwidth=1.4in,shadow,colorinlistoftodos]{todonotes}%
    }{%
    \usepackage[margin=1in]{geometry}%
    \usepackage[disable]{todonotes}%

    \begin{document}
    \begin{center}
    \begin{longtable}{lccccc}
    \caption{{\bf Cointegration}\newline In ....
    \hline \multicolumn{1}{c}{\textbf{Intercept}} & \multicolumn{1}{c}{Max. rank} &
                       multicolumn{1}{c}{Parameters} 
    & \multicolumn{1}{c}{Eigenvalue}
    & \multicolumn{1}{c}{T-stat}
    & \multicolumn{1}{c}{5\% Crit. value}
    \\ \hline
    \endfirsthead   

    \multicolumn{3}{c}%
    {{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
    \hline \multicolumn{1}{c}{\textbf{Slope}} & \multicolumn{1}{c}{Max. rank} &  

    \multicolumn{1}{c}{Parameters}  
    & \multicolumn{1}{c}{Eigenvalue}
    & \multicolumn{1}{c}{T-stat}
    & \multicolumn{1}{c}{5\% Crit. value}
    \\ \hline
    \endhead

    \hline \multicolumn{3}{c}{{Continued on next page}} \\ \hline
    \endfoot

    \hline 
    \endlastfoot

   % \(then my results)    

    \end{longtable}
    \end{center}
    \vfill
    \end{document}

First I thought may be I can exclude \begin{center} and \end{center} but unfortunately, it did not help. Thanks for your response. PS: I also made a screenshot of my problem!! Where on the first page is a good table made with tablurx and on the second page (after the pagebreak) there must be my longtable, but as you can see the caption is smaller than the caption of the first table.

enter image description here

  • It would be helpful if you could turn this into a complete minimal working example (MWE). That is, complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. – ferahfeza Jun 6 '14 at 10:59
  • 2
    I can't tell anything from your image it is just fuzz, and your example produces ! LaTeX Error: File 'versionPO.sty' not found. and ! LaTeX Error: File 'texintro.sty' not found. and ! Undefined control sequence. l.41 \ifnotes Please make a minimal example that runs without error and without any packages that are not needed in the example – David Carlisle Jun 6 '14 at 12:45
  • 1
    Don't put longtable in a center environment (it just adds vertical space and doesn't centre anything) – David Carlisle Jun 6 '14 at 12:46
  • @DavidCarlisle this because some packages needed text files that I had to upload.. The only thing that I wanted to point out with the picture is the difference in width of caption between the two tables.. The first table is the above (the good one) with a width caption and after the page break the second table (only the caption of the caption is visible) is shown, but this caption is very small – user45266 Jun 6 '14 at 12:59
  • 1
    But how can we comment on the caption size if we can't see the captions: your image has no visible content and the example code produces no output. Surely you can remove all the extra definitions and make an example that actually shows the problem? – David Carlisle Jun 6 '14 at 13:01
5

Longtable captions are set to the width \LTcapwidth which defaults to 4in If you want a different setting you can change this with \setlength\LTcapwidth{\textwidth} as it says in the documentation.

  • thank you very much.. Your solution worked, Thanks again. – user45266 Jun 6 '14 at 17:01
  • @user45266 I would never have guessed that was the issue from your question, you only said what the issue was in a comment. – David Carlisle Jun 6 '14 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.