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 want a sidewaystable to appear with its top against the inner margin of the body text. According to the rotating package documentation, these following settings:

\rotFPtop=0pt and  
\rotFPbot=0pt plus 1fil  

will place a sidewaystable with its top nearest the edge of the page. However, what actually happens is that the center of the table is positioned at the margin, as is illustrated with the following:

\documentclass[twoside]{article}
\usepackage[counterclockwise]{rotating}
\usepackage[a4paper,margin=50mm,showframe]{geometry}

\rotFPtop=0pt
\rotFPbot=0pt plus 1fil
\fboxsep0pt
\def\tab{
   \begin{sidewaystable}
      \begin{center}
         \fbox{\begin{tabular}{c}
            line 1\\line 2\\line 3\\line 4\\\hline
            line 5\\line 6\\line 7\\line 8\             \end{tabular}}
      \end{center}
   \end{sidewaystable}
}
\begin{document}
\tab\newpage\tab
\end{document}

which shows that the top is neither at the edge of the page, nor at the margin (i.e. 50mm from the edge of the page in this example). How can I get it at the margin?

(Edit by Gonzalo Medina) This image showing the problem mentioned was obtained from the code posted (I added showframe for visualization purposes) using TeX Live2012:

enter image description here

share|improve this question
    
@Mico I added showframe to the code and uploaded an image of the resulting document showing the problem mentioned. Do you get a different result? –  Gonzalo Medina Sep 6 '12 at 2:00
    
@WyboDekker I took the liberty of addind the package option showframe to geometry and uploading an image of the resulting document; I hope it's OK. –  Gonzalo Medina Sep 6 '12 at 2:01
    
Thanks! I should have thought about that myself. This makes very clear that it is not the top, but the center of the table that is aligned. Still don't know how to align the top... –  Wybo Dekker Sep 6 '12 at 9:08
add comment

1 Answer 1

I can't say I understand the problem with the package, but found that if \rotFPtop is set to a value of .5\dp\tmpbox+.5\ht\tmpbox+.19\baselineskip (where the content has been set in \tmpbox), the top of the content aligns with the margin (left on odd pages, right on even pages). I have verified this for boxes of various heights and depths, and using 10pt, 11pt, and 12pt documents.

\documentclass[twoside,12pt]{article}
\usepackage[counterclockwise]{rotating}
\usepackage[a4paper,margin=50mm,showframe]{geometry}
\usepackage{calc}
\usepackage{stackengine}
\fboxsep0pt
\newsavebox\tmpbox
\def\prepbox#1{%
  \savebox{\tmpbox}{#1}%
  \setlength{\rotFPtop}{.5\dp\tmpbox+.5\ht\tmpbox+.19\baselineskip}%
}
\def\swtab{
   \begin{sidewaystable}
      \begin{center}
        \usebox{\tmpbox}
      \end{center}
   \end{sidewaystable}
}
\begin{document}
\prepbox{%
         \fbox{\begin{tabular}{c}
            line 1\\line 2\\line 3\\line 4\\\hline
            line 5\\line 6\\line 7\\line 8\\
         \end{tabular}}%
}
\swtab\newpage\swtab\newpage
\prepbox{\fbox{A baseline}}
\swtab\newpage\swtab\newpage
\prepbox{\fbox{baseline \stackon{\stackunder{a}{b}}{c}}}
\swtab\newpage\swtab\newpage
\prepbox{\fbox{A baseline \stackunder{\stackunder{a}{b}}{c}}}
\swtab\newpage\swtab\newpage
\prepbox{\fbox{baseline \Shortstack{A B C D E}}}
\swtab\newpage\swtab\newpage
\end{document}

enter image description here

enter image description here

enter image description here

share|improve this answer
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.