Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am sectioning my appendix with \chapter and \section, I sometimes have to add some text sections and then the following table is placed after the next page. I don't know how to prevent these table placements.

Problem 1

My second problem is that the appendix mostly consists only of long tables (\longtable), and when placing one longtable after another etc., blocks of rows are being shifted. I guess these are some float problems. See screenshot here:

enter image description here

I get the warning:

Package longtable Warning: Column widths have changed (longtable) in table 2 on input line 257.

When I remove the \chapter and \section sectioning, the table lining up well, however I need a structured appendix. What is happening there?

MWE

\documentclass[BCOR=5mm,paper=letter,11pt,title page,oneside,headinclude, footinclude=true,abstractoff,headings=optiontohead,cleardoublepage=empty]{scrbook}
\usepackage{classicthesis} % nochapters

\usepackage{lipsum}


\usepackage{longtable}
\usepackage{booktabs}

\usepackage{lscape}

\begin{document}

    \lipsum[3-6]

    \appendix

    \chapter{Data}
    \section{A section}
    \lipsum[3-8]

    \begin{landscape}
    \begin{center} %example from: http://users.sdsc.edu/~ssmallen/latex/longtable.html
    \begin{longtable}{|l|l|l|}
    \caption[Feasible triples for a highly variable Grid]{Feasible triples for 
    highly variable Grid, MLMMH.} \label{grid_mlmmh} \\

    \hline \multicolumn{1}{|c|}{\textbf{Time (s)}} & \multicolumn{1}{c|}{\textbf{Triple chosen}} & \multicolumn{1}{c|}{\textbf{Other feasible triples}} \\ \hline 
    \endfirsthead

    \multicolumn{3}{c}%
    {{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
    \hline \multicolumn{1}{|c|}{\textbf{Time (s)}} &
    \multicolumn{1}{c|}{\textbf{Triple chosen}} &
    \multicolumn{1}{c|}{\textbf{Other feasible triples}} \\ \hline 
    \endhead

    \hline \multicolumn{3}{|r|}{{Continued on next page}} \\ \hline
    \endfoot

    \hline \hline
    \endlastfoot

    0 & (1, 11, 13725) & (1, 12, 10980), (1, 13, 8235), (2, 2, 0), (3, 1, 0) \\
    2745 & (1, 12, 10980) & (1, 13, 8235), (2, 2, 0), (2, 3, 0), (3, 1, 0) \\
    5490 & (1, 12, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    8235 & (1, 12, 16470) & (1, 13, 13725), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    10980 & (1, 12, 16470) & (1, 13, 13725), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    13725 & (1, 12, 16470) & (1, 13, 13725), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    16470 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    19215 & (1, 12, 16470) & (1, 13, 13725), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    21960 & (1, 12, 16470) & (1, 13, 13725), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    24705 & (1, 12, 16470) & (1, 13, 13725), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    27450 & (1, 12, 16470) & (1, 13, 13725), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    30195 & (2, 2, 2745) & (2, 3, 0), (3, 1, 0) \\
    32940 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    35685 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    38430 & (1, 13, 10980) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    41175 & (1, 12, 13725) & (1, 13, 10980), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    43920 & (1, 13, 10980) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    46665 & (2, 2, 2745) & (2, 3, 0), (3, 1, 0) \\
    49410 & (2, 2, 2745) & (2, 3, 0), (3, 1, 0) \\
    52155 & (1, 12, 16470) & (1, 13, 13725), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    54900 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    57645 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    60390 & (1, 12, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    63135 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    65880 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    68625 & (2, 2, 2745) & (2, 3, 0), (3, 1, 0) \\
    71370 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    74115 & (1, 12, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    76860 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    79605 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    82350 & (1, 12, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    85095 & (1, 12, 13725) & (1, 13, 10980), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    87840 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    90585 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    93330 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    96075 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    98820 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    101565 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    104310 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    107055 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    109800 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    112545 & (1, 12, 16470) & (1, 13, 13725), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    115290 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    118035 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    120780 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    123525 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    126270 & (1, 12, 16470) & (1, 13, 13725), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    129015 & (2, 2, 2745) & (2, 3, 0), (3, 1, 0) \\
    131760 & (2, 2, 2745) & (2, 3, 0), (3, 1, 0) \\
    134505 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    137250 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    139995 & (2, 2, 2745) & (2, 3, 0), (3, 1, 0) \\
    142740 & (2, 2, 2745) & (2, 3, 0), (3, 1, 0) \\
    145485 & (1, 12, 16470) & (1, 13, 13725), (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    148230 & (2, 2, 2745) & (2, 3, 0), (3, 1, 0) \\
    150975 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    153720 & (1, 12, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    156465 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    159210 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    161955 & (1, 13, 16470) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    164700 & (1, 13, 13725) & (2, 2, 2745), (2, 3, 0), (3, 1, 0) \\
    \end{longtable}
    \end{center}
    \end{landscape}



    \end{document}
share|improve this question
    
Package longtable Warning: Column widths have changed (longtable) in table 2 on input line 257. That's normal, at the end of the run it will tell you to run latex again. If you do that then they will line up, usually takes two runs can take more if there are lots of spanning entries. –  David Carlisle Mar 12 '13 at 18:32
    
I tried that before, but it didn't line up. i probably re-ran it like at least 15 times.. –  Paglia Orba Mar 12 '13 at 18:46
    
Also LuaLaTeX let's the CPU go through the roof –  Paglia Orba Mar 12 '13 at 18:52
    
I removed the \chapter and \section sectioning and now all is lining up very well, however, the empty page after the text still remains. Also, I still need a structured appendix, so I don't know how to solve the clash between sectioning and longtable.. –  Paglia Orba Mar 12 '13 at 19:33

2 Answers 2

up vote 4 down vote accepted

After the hint from egreg about soul, adding the following to the preamble after loading classicthesis (or soul) allows longtable to stabilize.

The problem is that classicthesis defines the chaptermark to use letter spacing in the page head, and if that is implemented using soul, box 1 gets reset at an unfortunate time for longtable. Arguably longtable ought to protect itself from that but it's easier to stop soul using box 1 and use a newly allocated box instead.

\makeatletter
\newbox\zzzz
\def\SOUL@analyze{{%
    \setbox\z@\vbox{%
        \unvcopy\z@
        \unskip
        \unpenalty
        \global\setbox\zzzz=\lastbox}%
    \ifvoid\zzzz
    \else
        \setbox\zzzz\hbox{\unhbox\zzzz}%
        \SOUL@syllgoal=\wd\zzzz
        \advance\count@\@ne
        \SOUL@analyze
        \SOUL@syllwidth\z@
        \SOUL@syllable={}%
        \ifnum\count@>\z@
            \advance\SOUL@syllgoal-\SOUL@ttwidth
            \SOUL@dosyllable
            \SOUL@getkern{\the\SOUL@lasttoken}{\SOUL@hyphkern}%
                {\SOUL@sethyphenchar}%
            \SOUL@everyhyphen
        \else
            \SOUL@dosyllable
        \fi
    \fi
}}

Non answer in case anyone wants to work on this over (GMT) night.

A more M MWE is

\documentclass{book}
\usepackage{classicthesis}

\makeatletter

\usepackage{longtable}

\usepackage{lscape}

\begin{document}

\chapter{Data}

\begin{landscape}


\begin{longtable}{|l|}
a\endfirsthead
b\endhead
cc\endfoot
d\endlastfoot
x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\
x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\
x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\
x\\x\\x\\x\\x\\x\\x\\x\\x\\x\\
\typeout{^^J^^JFINAL WIDTHS: \LT@save@row^^J^^J}
\end{longtable}

\end{landscape}

\end{document}

That produces a typeout of

FINAL WIDTHS: 

with the column width data lost.

If you comment out any one of \usepackage{classicthesis} or \chapter{Data} or \begin{landscape} \end{landscape} then it works as expected and you get a typeout of

FINAL WIDTHS: \omit \kern 20.8889pt\relax 

something classic thesis is loading is messing with longtable's output routine but it's too late at night to be staring at \tracingall log of my own code:-)

share|improve this answer

The problem of the longtable that doesn't stabilize is due to bad interaction with the soul package; it's fixed if you use the pdfspacing option, that's recommended anyway:

\usepackage[pdfspacing]{classicthesis}

For the other problem, the information is not sufficient.

share|improve this answer
1  
soul I was looking for somoene hooking the output routine.. +10 (and a gold badge probably:-) –  David Carlisle Mar 12 '13 at 23:52
    
this produces Package microtype Error: Letterspacing currently doesn't work with luatex. Should I now post my not-so-short preamble? –  Paglia Orba Mar 13 '13 at 3:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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