4

Things look pretty good without threeparttable.

Without threeparttable

Uncomment threeparttable and tablenotes results in the caption riding up into the previous paragraph.

With threeparttable

\documentclass{scrbook}                                                                                                                               
%                                                                                                                                                     
\usepackage[english]{babel}                                                                                                                           
\usepackage{caption}                                                                                                                                  
\usepackage{threeparttable}                                                                                                                           
\usepackage{lipsum}                                                                                                                                   
%                                                                                                                                                     
\KOMAoptions{captions=topbeside}                                                                                                                      
\setcapindent*{0pt}%                                                                                                                                  
\begin{document}                                                                                                                                      

\chapter{Crapper}                                                                                                                                     

\lipsum[1]                                                                                                                                            

\begin{table}[h]%                                                                                                                                     
  \label{tab:psource:final-params}%                                                                                                                   
  \begin{captionbeside}{This is the captions which should be top aligned}[l]%                                                            
      \raisebox{\dimexpr0.5\baselineskip-0.5\totalheight\relax}{%                                                                                     
      %\begin{threeparttable}                                                                                                                         
        \begin{tabular}{cccc}                                                                                                                         
          \hline                                                                                                                                      
          Test & Test & Test & Test \\                                                                                                                
          Test & Test & Test & Test\tnote{1} \\                                                                                                       
          Test & Test & Test & Test \\                                                                                                                
          Test & Test & Test & Test \\                                                                                                                
          Test & Test & Test & Test\tnote{2} \\                                                                                                       
          \hline                                                                                                                                      
        \end{tabular}                                                                                                                                 
      %  \begin{tablenotes}                                                                                                                           
      %    \item[1]{Test note}                                                                                                                        
      %    \item[2]{Test note}                                                                                                                        
      %    \end{tablenotes}                                                                                                                           
      %\end{threeparttable}%                                                                                                                          
  }%                                                                                                                                                  
  \end{captionbeside}                                                                                                                                 
\end{table}                                                                                                                                           

\end{document}                                                                                                                                        
1
  • If I replace \raisebox and with \subfloat (from subfig) It's close, but seems very hacky.
    – h0tw1r3
    Apr 2, 2013 at 22:41

1 Answer 1

3

No need for \raisebox; use t (top alignment) in the optional argument of tabular, and \firsthline (from the array package) instead of the first \hline:

\documentclass{scrbook}                                                                                                                               
%                                                                                                                                                     
\usepackage[english]{babel}                                                                                                                           
\usepackage{caption}                                                                                                                                  
\usepackage{threeparttable,array}                                                                                                                           
\usepackage{lipsum}                                                                                                                                   
%                                                                                                                                                     
\KOMAoptions{captions=topbeside}                                                                                                                      
\setcapindent*{0pt}%                                                                                                                                  

\begin{document}                                                                                                                                      

\chapter{Test}                                                                                                                                     

\lipsum[1]                                                                                                                                            
\begin{table}%                                                                                                                                     
  \label{tab:psource:final-params}%                                                                                                                   
  \begin{captionbeside}{This is the caption which is now top aligned}[l]%                                                            
      \begin{threeparttable}
        \begin{tabular}[t]{cccc}                                                                                                                         
          \firsthline                                                                                                                                      
          Test & Test & Test & Test \\                                                                                                                
          Test & Test & Test & Test\tnote{1} \\                                                                                                       
          Test & Test & Test & Test \\                                                                                                                
          Test & Test & Test & Test \\                                                                                                                
          Test & Test & Test & Test\tnote{2} \\                                                                                                       
          \hline                                                                                                                                      
        \end{tabular}                                                                                                                                 
        \begin{tablenotes}                                                                                                                           
          \item[1]{Test note}                                                                                                                        
          \item[2]{Test note}                                                                                                                        
          \end{tablenotes}                                                                                                                           
      \end{threeparttable}%                                                                                                                          
  \end{captionbeside}                                                                                                                                 
\end{table}                                                                                                                                           

\end{document} 

enter image description here

If you decide to use the booktabs package for your tables (and I suggest this), then some extra work has to be done: in the following example I defined a command \firsttoprule which mixes the features of \firsthline and \toprule:

\documentclass{scrbook}                                                                                                                               
%                                                                                                                                                     
\usepackage[english]{babel}                                                                                                                           
\usepackage{caption}                                                                                                                                  
\usepackage{threeparttable,array,booktabs}                                                                                                                           
\usepackage{lipsum}                                                                                                                                   
%                                                                                                                                                     
\KOMAoptions{captions=topbeside}                                                                                                                      
\setcapindent*{0pt}%                                                                                                                                  

\makeatletter
\newcommand\firsttoprule{%
  \multicolumn1c{%
    \global\backup@length\ht\@arstrutbox
    \global\advance\backup@length\dp\@arstrutbox
    \global\advance\backup@length\arrayrulewidth
     \raise\extratabsurround\copy\@arstrutbox
    }\\[-\backup@length]\toprule
}
\makeatother


\begin{document}                                                                                                                                      

\chapter{Test}

\lipsum[1]                                                                                                                                            
\begin{table}[h]%                                                                                                                                     
  \label{tab:psource:final-params}%                                                                                                                   
  \begin{captionbeside}{This is the caption which is now top aligned}[l]%                                                            
      \begin{threeparttable}[t]                                                                                                                    
        \begin{tabular}[t]{cccc}                                                                                                                         
          \firsttoprule                                                                                                                                      
          Test & Test & Test & Test \\                                                                                                                
          Test & Test & Test & Test\tnote{1} \\                                                                                                       
          Test & Test & Test & Test \\                                                                                                                
          Test & Test & Test & Test \\                                                                                                                
          Test & Test & Test & Test\tnote{2} \\                                                                                                       
          \bottomrule                                                                                                                                     
        \end{tabular}                                                                                                                                 
        \begin{tablenotes}                                                                                                                           
          \item[1]{Test note}                                                                                                                        
          \item[2]{Test note}                                                                                                                        
          \end{tablenotes}                                                                                                                           
      \end{threeparttable}%                                                                                                                          
  \end{captionbeside}                                                                                                                                 
\end{table}                                                                                                                                           

\end{document}                 

enter image description here

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.