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 used floatrow to put all my captions (figure, table, listing) into the margin. The only captions left that i'm unable to put there belong to the longtable environment.

Is there a way to put the caption which currently resides ontop of longtable also into the margin?

See the example for a figure (with margincaption) and longtable (with caption ontop that i would also like to place in the margin). caption of longtable

Code:

  \documentclass[8pt]{scrartcl}

  \usepackage[a4paper,
  text={380pt,500pt},
  marginparwidth=112pt,
  marginparsep=10pt,
  inner=0.8in,
  asymmetric]{geometry}
  \usepackage{floatrow}

  \usepackage{booktabs}
  \usepackage{longtable}


  \begin{document}


  %% CAPTION IN MARGIN
  \thisfloatsetup{%
  floatwidth=\linewidth,
  capposition=beside,
  capbesideposition={top,outside},
  capbesideframe=yes,
  capbesidewidth=\marginparwidth,
  capbesidesep=quad,
  floatrowsep=qquad}
  %% FIGURE
  \begin{figure}[h]
  \rule{4in}{0.5in}
  \caption{Test.}
  \end{figure}

  %% LONGTABLE
  \begin{longtable}{lll}
  \caption{Caption Table Test.Caption Table Test.Caption Table Test.Caption Table Test.Caption Table Test.} \\
  \toprule
   \multicolumn{1}{c}{time} & \multicolumn{1}{c}{triple} & \multicolumn{1}{c}{trip}  \\
  \midrule
  \endfirsthead
  %
  \caption[]{Further table data\emph{(continued)}} \\
  \toprule
   \multicolumn{1}{c}{time} & \multicolumn{1}{c}{triple} & \multicolumn{1}{c}{trip}  \\
  \midrule
  \endhead
  %
  \bottomrule \multicolumn{3}{r}{\emph{Continued on next page}} \\
  \endfoot
  \bottomrule
  \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{document}

Source: Tabledata

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

enter image description here

\makeatletter
\def\LT@makecaption#1#2#3{%
  \noalign{\smash{\hbox{\kern\textwidth\rlap{\kern\marginparsep
  \parbox[t]{\marginparwidth}{\raggedright#1{#2: }#3}}}}}}
\makeatother
share|improve this answer
    
Awesome, this helps me out alot! The table has a bit whitespace ontop making the caption top slightly misaligned. But putting a simple \vspace{Xcm} into the parbox allows to manually readjust that. –  bioslime Jan 30 '13 at 13:43
    
Is it possible to enable this for a two-sided layout with flipping odd/even pages? I know how to alter the line so that the caption would fit in the left margin but when i use \checkoddpagewithin the redefinition of makecaption using the ìfoddpage package i am getting a Misplaced \noalign error. –  bioslime Mar 5 '13 at 16:03
1  
@bioslime you want the check to be inside the \noalign so \noalign{ if odd page \smash{something} else \smash{something else}} –  David Carlisle Mar 5 '13 at 16:11
add comment

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.