I need pretty urgent help (thesis hits the printer in two days!) getting scrheadings
and longtable
working together.
The problem is if I have scrheadings
enabled, the longtable
tables will not align properly, regardless of how many times I rerun pdflatex
on it. The longtable
documentation does not mention anything about incompatibility with KOMA-Script or scrheadings
. However, KOMA-Script documentation does make note of that longtable
captions can be iffy, and has a special "origlongtable
" option, but this did not work for me, and the captions are not my problem to begin with, as it looks fine to me.
Doing a search I found that I'm not the first to stumble into it (I think), but no coherent question (and thus no answer) was offered by previous reporter: scrheadings-and-longtable-alignment-problems, and longtable-column-problem-column-alignment-changes. Also, this mailing list, alas, in German: scrheadings-und-grosze-tabellen.
I have spent many hours hunting the cause for this, and I have desperately tried to make a MWE, but things are not easy since I don't understand TeX code. I could not figure out how to make it not depend on classicthesis.sty
, so I had to include that as well, but in a version that I cut out a lot of (to me unintelligible) TeX-code.
I note the following:
- If I comment out the
\pagestyle{scrheadings}
thelongtable
will align just fine. Same goes for the ToC:\include{contents}
, it seems. So what on earth is going on here?
My current plan is to compile two versions of my thesis, one to get the TOC and one for the correctly aligned longtable
s, and then splice the PDFs together. Desperate solution for a poor desperate PhD-student. If the above is not solvable, could one issue some command before and after the longtable
to make scrheadings
stop messing up my tables?
\RequirePackage{fix-cm}
\documentclass[headinclude,9pt]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage[american,swedish]{babel}
\usepackage{longtable}
\usepackage{classicthesis}
\begin{document}
% Commenting out one or both of the below 2 lines will make longtable work again.
\pagestyle{scrheadings}
\include{contents}
\scriptsize
\begin{longtable}[l]{rrrrrrrr}
$1$ & $2$ & $3$ & $4$ & $5$ & $6$ & $7$ & $8$ \\
\hline
\endhead
$5.314$ & $1.022$ & $6.962$ & $4.835$ & $9.946$ & $9.707$ & $9.971$ & $9.964$ \\
$7.175$ & $9.866$ & $4.687$ & $9.776$ & $8.412$ & $7.882$ & $7.139$ & $1.155$ \\
$1.96$ & $5.353$ & $1$ & $5.004$ & $4.883$ & $9.988$ & $2.672$ & $1.112$ \\
$8.874$ & $2.278$ & $2.459$ & $1.371$ & $2.25$ & $1.821$ & $1.04$ & $1$ \\
$1.528$ & $5.917$ & $1$ & $9.246$ & $1.73$ & $1.005$ & $9.33$ & $8.058$ \\
$3.014$ & $4.365$ & $6.927$ & $9.413$ & $7.008$ & $9.914$ & $2.72$ & $9.866$ \\
$5.673$ & $3.747$ & $11.45$ & $1.182$ & $3.794$ & $3.458$ & $1.028$ & $1.24$ \\
$1.395$ & $2.384$ & $2.638$ & $5.219$ & $3.087$ & $2.826$ & $4.889$ & $3.528$ \\
$8.556$ & $4.747$ & $1.171$ & $7.636$ & $9.789$ & $3.979$ & $0.01852$ & $9.399$ \\
$3.422$ & $16.3$ & $5.842$ & $94.55$ & $0.1007$ & $0.1002$ & $0.1057$ & $0.1001$ \\
$0.1532$ & $0.1$ & $0.1$ & $0.1183$ & $0.1001$ & $0.1001$ & $0.1002$ & $0.1001$ \\
$25.77$ & $0.4728$ & $96.91$ & $275.3$ & $41.25$ & $31.46$ & $1.286$ & $176.2$ \\
$12.27$ & $35.94$ & $23.2$ & $231.6$ & $2.785$ & $0.4538$ & $13.76$ & $12.07$ \\
$1.753$ & $2.225$ & $1.867$ & $1.574$ & $1.401$ & $1.785$ & $0.3183$ & $1.026$ \\
$30.75$ & $0.5885$ & $153.7$ & $363.5$ & $47.7$ & $39.29$ & $2.544$ & $396.5$ \\
$9.981$ & $21.8$ & $11.88$ & $81.95$ & $3.601$ & $0.01082$ & $26.78$ & $11.29$ \\
$1.941$ & $2.086$ & $1.59$ & $1.066$ & $1.232$ & $2.428$ & $1.6$ & $1.102$ \\
$4.987$ & $6.033$ & $3.409$ & $3.455$ & $4.937$ & $10.59$ & $15.17$ & $1.303$ \\
$44.99$ & $1.053$ & $142.6$ & $443.7$ & $58.63$ & $35.93$ & $4.415$ & $326.5$ \\
$3.904$ & $12.66$ & $8.865$ & $0.1209$ & $1.807$ & $0.3359$ & $94.19$ & $17.22$ \\
$5.344$ & $6.743$ & $18.56$ & $4.354$ & $5.036$ & $10.07$ & $6.786$ & $11.3$ \\
$9.74$ & $0.1519$ & $52.48$ & $82.46$ & $13.34$ & $8.783$ & $0.9119$ & $84.15$ \\
$2.25$ & $5.199$ & $41.75$ & $0.3816$ & $1.775$ & $0.8467$ & $61.33$ & $14.62$ \\
$41.94$ & $1.205$ & $291.2$ & $493.8$ & $63.51$ & $22.02$ & $3.123$ & $385.8$ \\
$15.93$ & $16.24$ & $26.48$ & $12.24$ & $12.13$ & $11.21$ & $7.592$ & $29.8$ \\
$0.109$ & $0.1465$ & $0.1458$ & $0.4281$ & $0.6299$ & $0.01341$ & $0.2518$ & $12.3$ \\
$3.336$ & $5.127$ & $3.068$ & $2.549$ & $1.704$ & $13.25$ & $2.484$ & $4.045$ \\
$56.5$ & $1.971$ & $182.5$ & $150.7$ & $33.31$ & $93.73$ & $6.552$ & $725.3$ \\
$3.28$ & $7.1$ & $4.992$ & $4.912$ & $2.576$ & $4.767$ & $4.378$ & $3.856$ \\
$4.315$ & $16.33$ & $10.8$ & $54.31$ & $4.513$ & $0.106$ & $18.25$ & $0.101$ \\
$41.19$ & $1.027$ & $156.9$ & $365.3$ & $43.43$ & $39$ & $2.794$ & $368.7$ \\
$4.774$ & $5.466$ & $4.54$ & $3.558$ & $4.259$ & $6.963$ & $3.439$ & $4.691$ \\
$1.34$ & $6.864$ & $4.343$ & $1.108$ & $2.083$ & $0.4267$ & $17.04$ & $7.185$ \\
$5.91$ & $8.392$ & $8.667$ & $4.178$ & $3.885$ & $11.58$ & $4.722$ & $7.319$ \\
$0.2745$ & $0.1423$ & $0.1$ & $1.732$ & $0.7494$ & $0.1001$ & $0.1002$ & $0.1$ \\
$1.411$ & $2.714$ & $6.728$ & $0.5166$ & $0.5525$ & $3.9$ & $0.2139$ & $0.1194$ \\
$0.03975$ & $0.01041$ & $0.2149$ & $0.1999$ & $1.944$ & $0.3978$ & $2.477$ & $2.029$ \\
$6.967$ & $4.775$ & $1.069$ & $7.782$ & $10.91$ & $3.516$ & $0.1142$ & $0.04042$ \\
$0.7146$ & $0.9026$ & $0.03532$ & $0.5893$ & $0.06372$ & $0.1207$ & $0.1105$ & $0.8943$ \\
$2.874$ & $0.05704$ & $1.302$ & $0.1891$ & $1.021$ & $1.025$ & $9.955$ & $6.847$ \\
$0.06041$ & $0.02929$ & $0.2607$ & $0.1446$ & $0.03939$ & $0.02616$ & $9.917$ & $0.02871$ \\
$0.08923$ & $0.49$ & $0.5084$ & $2.492$ & $8.706$ & $1.344$ & $0.02061$ & $0.01041$ \\
$9.958$ & $0.554$ & $0.01093$ & $0.5246$ & $0.1416$ & $0.04229$ & $0.1703$ & $0.08021$ \\
$3.887$ & $0.05062$ & $0.3151$ & $0.1267$ & $0.1986$ & $0.6058$ & $0.9035$ & $0.3665$ \\
$1.422$ & $1.051$ & $0.2785$ & $1.016$ & $2.263$ & $1.208$ & $1.681$ & $5.28$ \\
$1.856$ & $0.3341$ & $0.3861$ & $0.6126$ & $2.295$ & $1.034$ & $9.883$ & $2.965$ \\
$0.06021$ & $0.409$ & $0.1273$ & $0.4442$ & $0.4195$ & $0.09476$ & $0.3549$ & $0.04486$ \\
$0.02732$ & $2.021$ & $0.01001$ & $0.01015$ & $0.02322$ & $0.07358$ & $7.587$ & $2.726$ \\
$0.2654$ & $0.03313$ & $4.774$ & $48.57$ & $1.886$ & $6.904$ & $0.01097$ & $3.993$ \\
$0.2687$ & $0.1$ & $0.1848$ & $5.627$ & $0.1$ & $0.187$ & $0.6628$ & $1.854$ \\
$0.2899$ & $0.3853$ & $0.2802$ & $0.4432$ & $0.353$ & $0.2547$ & $0.2058$ & $0.4459$ \\
$0.08977$ & $0.2525$ & $0.03518$ & $0.08095$ & $1.744$ & $0.0169$ & $0.09316$ & $0.2516$ \\
$0.2518$ & $1.103$ & $1.484$ & $0.6334$ & $3.107$ & $6.618$ & $0.5109$ & $0.1847$ \\
$0.112$ & $0.5891$ & $0.6062$ & $1.099$ & $2.985$ & $1.76$ & $0.2073$ & $0.9535$ \\
$3.772$ & $0.2317$ & $13.31$ & $0.1221$ & $0.2228$ & $0.3602$ & $0.6104$ & $3.268$ \\
$28.34$ & $0.1472$ & $1.198$ & $3.449$ & $0.1286$ & $0.5261$ & $0.1402$ & $2.619$ \\
$2.543$ & $0.8543$ & $1.947$ & $0.9492$ & $0.1006$ & $1.171$ & $3.011$ & $3.302$ \\
$0.6127$ & $0.996$ & $0.7966$ & $0.6529$ & $0.4437$ & $0.6407$ & $0.5032$ & $0.7201$ \\
$0.6154$ & $0.5889$ & $0.472$ & $0.6059$ & $0.5981$ & $0.5305$ & $0.3759$ & $0.4505$ \\
$0.4322$ & $0.3761$ & $0.4737$ & $0.5013$ & $0.5489$ & $0.5424$ & $0.4513$ & $0.5409$ \\
$1.869$ & $2.3$ & $0.5026$ & $0.9276$ & $0.8059$ & $0.6966$ & $0.5001$ & $0.961$ \\
$0.451$ & $0.0133$ & $0.1935$ & $0.05858$ & $2.764$ & $0.03575$ & $0.01039$ & $0.01$ \\
$1.277$ & $0.6487$ & $0.6006$ & $0.6056$ & $0.6031$ & $0.7777$ & $0.7167$ & $0.6031$ \\
$0.1$ & $5.437$ & $3.417$ & $5.527$ & $2.369$ & $2.336$ & $4.77$ & $0.5255$ \\
$0.1886$ & $0.1225$ & $0.3288$ & $0.2881$ & $0.07189$ & $0.1356$ & $0.01001$ & $0.03257$ \\
$0.01001$ & $0.01001$ & $0.01$ & $0.01087$ & $0.2276$ & $0.01072$ & $3.854$ & $0.2368$ \\
$0.7611$ & $0.6771$ & $0.6066$ & $0.7547$ & $1.042$ & $1.191$ & $0.5066$ & $0.8838$ \\
$2.57$ & $1.988$ & $2.987$ & $2.085$ & $1.146$ & $2.72$ & $1.726$ & $1.597$ \\
$0.6654$ & $0.376$ & $0.6748$ & $0.2103$ & $0.3006$ & $0.6107$ & $0.2658$ & $0.2214$ \\
$0.5015$ & $4.916$ & $0.5044$ & $3.482$ & $0.5081$ & $0.5002$ & $0.6408$ & $0.5017$ \\
$0.1791$ & $0.09303$ & $0.1774$ & $0.2039$ & $0.241$ & $0.2177$ & $0.2261$ & $0.1897$ \\
$0.5383$ & $0.5828$ & $0.4082$ & $0.6494$ & $2.579$ & $2.917$ & $1.366$ & $0.2781$ \\
$0.07499$ & $0.04744$ & $0.108$ & $0.1645$ & $0.1993$ & $0.1999$ & $0.07084$ & $0.1023$ \\
$4.505$ & $2.426$ & $1.549$ & $2.13$ & $2.219$ & $1.41$ & $1.211$ & $1.192$ \\
$0.3007$ & $0.3012$ & $0.3003$ & $0.3006$ & $0.3002$ & $2.409$ & $0.3835$ & $0.4269$ \\
$0.08544$ & $0.1764$ & $0.09547$ & $0.1197$ & $0.0651$ & $0.03943$ & $0.08041$ & $0.07392$ \\
$1.5$ & $2.848$ & $4.21$ & $1.874$ & $2.577$ & $5.882$ & $1.152$ & $7.667$ \\
$0.6526$ & $0.4176$ & $0.2553$ & $0.4625$ & $0.08625$ & $0.3877$ & $0.1015$ & $0.0686$ \\
$1.032$ & $1.57$ & $0.7937$ & $0.8424$ & $1.04$ & $0.3001$ & $0.7549$ & $0.6028$ \\
$0.0382$ & $0.02757$ & $0.02349$ & $0.4466$ & $7.57$ & $8.143$ & $9.986$ & $1.737$ \\
$0.01001$ & $0.01$ & $0.01$ & $0.05984$ & $0.168$ & $0.01032$ & $0.01$ & $0.03227$ \\
$4.949$ & $5.491$ & $3.84$ & $5.204$ & $7.242$ & $1.795$ & $9.875$ & $3.856$ \\
$9.998$ & $5.681$ & $6.275$ & $8.609$ & $6.993$ & $3.588$ & $9.996$ & $5.083$ \\
$0.1561$ & $0.1115$ & $0.2087$ & $0.8513$ & $0.2252$ & $0.1086$ & $0.1061$ & $0.1566$ \\
$0.9413$ & $0.9188$ & $1.184$ & $6.928$ & $6.751$ & $1.56$ & $0.7253$ & $5.421$ \\
$0.506$ & $0.5711$ & $0.5108$ & $0.5072$ & $0.502$ & $9.773$ & $0.5003$ & $0.5017$ \\
$0.01001$ & $0.9391$ & $0.03945$ & $0.01014$ & $0.6989$ & $2.776$ & $0.03128$ & $0.01007$ \\
$1.774$ & $7.975$ & $0.07585$ & $25.38$ & $9.964$ & $44.21$ & $0.2389$ & $0.1916$ \\
$0.2001$ & $0.216$ & $0.2012$ & $0.2854$ & $0.2021$ & $1.619$ & $0.202$ & $0.447$ \\
$0.9229$ & $0.3759$ & $0.2279$ & $0.456$ & $0.1023$ & $0.09626$ & $0.3508$ & $0.3184$ \\
$1.139$ & $0.5214$ & $0.03266$ & $0.05359$ & $0.07754$ & $0.06792$ & $0.02179$ & $0.001505$ \\
$0.6769$ & $0.3577$ & $0.4285$ & $1.443$ & $4.363$ & $0.3769$ & $0.4726$ & $0.4493$ \\
$0.8039$ & $0.7944$ & $9.998$ & $1.633$ & $5.051$ & $0.8805$ & $6.154$ & $8.512$ \\
$5.273$ & $0.7541$ & $0.9665$ & $0.8438$ & $0.7331$ & $0.5034$ & $0.7004$ & $2.599$ \\
$0.2466$ & $0.1293$ & $0.1668$ & $0.1838$ & $0.2269$ & $0.1458$ & $0.2496$ & $0.2389$ \\
$1.912$ & $1.78$ & $0.6623$ & $0.684$ & $3.208$ & $0.4549$ & $1.356$ & $1.939$ \\
$0.1211$ & $0.4024$ & $0.1647$ & $0.2261$ & $0.1254$ & $0.3022$ & $0.1949$ & $0.1181$ \\
$1.011$ & $1.461$ & $3.951$ & $14.66$ & $5.237$ & $29.92$ & $11.17$ & $29.93$ \\
$1.003$ & $1.111$ & $1.004$ & $1.213$ & $4.415$ & $4.268$ & $4.768$ & $1.017$ \\
$1.061$ & $2.13$ & $1.187$ & $1.622$ & $8.092$ & $1.104$ & $1.66$ & $3.725$ \\
$10.18$ & $25.2$ & $5.827$ & $23.91$ & $3.122$ & $19.15$ & $3.93$ & $5.9$ \\
$0.2607$ & $0.1217$ & $0.5518$ & $0.3$ & $0.9744$ & $1.543$ & $1.358$ & $0.5445$ \\
$0.4659$ & $0.2873$ & $0.312$ & $1.13$ & $1.225$ & $1.666$ & $9.682$ & $2.453$ \\
\caption{\textbf{Foo bar}
}
\end{longtable}
\end{document}
The TOC that I include
% Table of Contents
\manualmark
\markboth{\spacedlowsmallcaps{\contentsname}{\spacedlowsmallcaps{\contentsname}}
\tableofcontents
With the classicthesis.sty:
% ********************************************************************
% classicthesis.sty
%
% Copyright (C) 2008 André Miede http://www.miede.de
%
% If you like the style then I would appreciate a postcard. My address
% can be found in the file ClassicThesis.pdf. A collection of the
% postcards I received so far is available online at
% http://postcards.miede.de
%
% ********************************************************************
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{classicthesis}[2008/10/01 v2.5 Typographic Style for a classic-looking thesis]
\RequirePackage{ifthen}
\newboolean{@listsseparated} % toggles the vertical space between lof/lot entries of different chapters
\newboolean{@nochapters} % disable all chapter-specific commands
\newboolean{@parts} % use part division for the text
\newboolean{@minionpro} % setup for minion pro font
\newboolean{@minionprospacing} % use minion pro's textssc for letter spacing
\newboolean{@pdfspacing} % use pdftex for letterspacing (via microtype)
\RequirePackage{mparhack} % get marginpar right
\RequirePackage[smaller]{acronym} % nice macros for handling all acronyms in the thesis
% ********************************************************************
% Options
% ********************************************************************
\DeclareOption{listsseparated}{\setboolean{@listsseparated}{true}}
\DeclareOption{parts}{\setboolean{@parts}{true}}
\DeclareOption{minionpro}{\setboolean{@minionpro}{true}}
\DeclareOption{minionprospacing}{\setboolean{@minionprospacing}{true}}
\ProcessOptions\relax
% ********************************************************************
% Fancy Stuff
% ********************************************************************
\RequirePackage{booktabs} % for better rules in tables
\RequirePackage{textcase} % for \MakeTextUppercase
\ifthenelse{\boolean{@minionprospacing}}%
{%
\PackageInfo{classicthesis}{Using MinionPro's textssc for character spacing.}%
\DeclareRobustCommand{\spacedallcaps}[1]{\textssc{\MakeTextUppercase{#1}}}%
\DeclareRobustCommand{\spacedlowsmallcaps}[1]{\textssc{\MakeTextLowercase{#1}}}%
}{%
\ifthenelse{\boolean{@pdfspacing}}%
{%
\PackageInfo{classicthesis}{Using pdftex/microtype for character spacing.%
Make sure your pdftex is version 1.40 or higher.}%
\microtypesetup{expansion=false}%
\DeclareRobustCommand{\spacedallcaps}[1]{\textls[160]{\MakeTextUppercase{#1}}}%
\DeclareRobustCommand{\spacedlowsmallcaps}[1]{\textls[80]{\scshape\MakeTextLowercase{#1}}}%
\DeclareRobustCommand{\spaced}[1]{\textls[120]{#1}}%
}{%
\RequirePackage{soul} % for letterspacing
\sodef\allcapsspacing{\upshape}{0.15em}{0.65em}{0.6em}%
\sodef\lowsmallcapsspacing{\scshape}{0.075em}{0.5em}{0.6em}%
\sodef\spacedspacing{}{0.075em}{0.5em}{0.6em}%
\DeclareRobustCommand{\spacedallcaps}[1]{\MakeTextUppercase{\allcapsspacing{#1}}}%
\DeclareRobustCommand{\spacedlowsmallcaps}[1]{\MakeTextLowercase{\textsc{\lowsmallcapsspacing{#1}}}}%
\DeclareRobustCommand{\spaced}[1]{\spacedspacing{#1}}%
}%
}
% ********************************************************************
% headlines
% ********************************************************************
\RequirePackage[automark]{scrpage2} % provides headers and footers (KOMA Script)
\clearscrheadings
\setheadsepline{0pt}
\ifthenelse{\boolean{@nochapters}}%
{\relax}%
{
\renewcommand{\chaptermark}[1]{%
\ifthenelse{\value{paper}>0}%
{\markleft{\textit{Paper \Roman{paper}}}}%: #1}}}
{\markleft{\textit{#1}}}
}%
}
%\renewcommand{\sectionmark}[1]{\markright{\spacedlowsmallcaps{#1}}}
\renewcommand{\sectionmark}[1]{\markright{\textit{#1}}}
\lehead{\mbox{\llap{\thepage\kern2em}}\leftmark\hfil}
%\lehead{\thepage}
%\cehead{\leftmark}
\rohead{\mbox{\hfil{\rightmark}\rlap{\kern2em\thepage}}}
%\rohead{\thepage}
%\cohead{\rightmark}
\renewcommand{\headfont}{\rm\small}
%\DeclareRobustCommand{\fixBothHeadlines}[1]{} % <--- ToDo
% hack to get the content headlines right (thanks, Lorenzo!)
\def\toc@heading{%
\ifthenelse{\boolean{@nochapters}}%
{\section*{\contentsname}}%nochapters
{\chapter*{\contentsname}}%chapters
\@mkboth{\textit{\contentsname}}{\textit{\contentsname}}}
And Makefile:
all: test.tex contents.tex classicthesis.sty
latexmk -pdf -pdflatex="pdflatex -interactive=nonstopmode -file-line-error" $<
clean:
latexmk -c
.PHONY: all clean test
Help me Obi-Wan Kenobi, your my only hope!
PS. From my .log file I appear to have:
longtable
2004/02/01 v4.11scrreprt
2012/07/29 v3.11b KOMA (and an older now cut down version of classicthesis.sty)
\markboth{\spacedlowsmallcaps{\contentsname}}{\spacedlowsmallcaps{\contentsname}}
does not fix the issue, nor\markboth{\contentsname}{\spacedlowsmallcaps{\contentsname}}
. – Johan A Apr 10 '16 at 13:46