Graphics, Figures & TablesAligning sidewaystable to left margin

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
bjung
Posts: 4
Joined: Wed May 05, 2010 3:01 am

Aligning sidewaystable to left margin

Post by bjung »

Hi all,

I have to align a sidewaystable to the left margin of the page, i.e., the caption should be 1.5 inches from the left. Here my example:

Code: Select all

\documentclass[11pt]{article}

\usepackage{rotating}
\usepackage{rotfloat}
\usepackage{threeparttable}
\usepackage[left=1.5in, top=1in, right=1in, bottom=1in, includehead, includefoot]{geometry}

\begin{document}

\begin{sidewaystable}[htbp] \centering  \caption{My Caption}
\begin{threeparttable}
\begin{tabular}{l*{2}{c}}\hline\hline
\multicolumn{1}{l}{column1}&\multicolumn{1}{c}{column2}\\
test1 & test2 \\
\hline\hline \end{tabular}
A footnote goes here.
\end{threeparttable} \end{sidewaystable}

\end{document} 
Thanks for any pointers!
Bert

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Aligning sidewaystable to left margin

Post by gmedina »

Hi,

the hvfloat package could be an option; a little example:

Code: Select all

\documentclass{article}
\usepackage{threeparttable}
\usepackage{hvfloat}

\begin{document}

  \hvFloat[%
   capPos=c,%
   capVPos=c,%
   objectPos=l,%
   capAngle=90,
   objectAngle=90%
  ]{table}{%
  \begin{threeparttable}
    \begin{tabular}{l*{2}{c}}\hline\hline
      \multicolumn{1}{l}{column1}&\multicolumn{1}{c}{column2}\\
      test1 & test2 \\
      \hline\hline 
    \end{tabular}
    A footnote goes here.
  \end{threeparttable}}{%
   A table and its caption rotated and aligned to the left margin}{fig:test}


\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
bjung
Posts: 4
Joined: Wed May 05, 2010 3:01 am

Aligning sidewaystable to left margin

Post by bjung »

Thanks very much for the fast reply and suggestion! I have to apologize for simplifying my problem too much. My table does not fit on a single page even with sidewaystable, so I split it into two parts. I then use \ContinuedFloat to continue the caption on the second part ("Table 1 (Continued)...").

I need both part of this table to be sideways and against the left margin. I will dig around to see if hvfloat can do that. Here my updated example, sorry for not clarifying earlier.

Thanks Bert

Code: Select all

    \documentclass[11pt]{article}

    \usepackage{rotating}
    \usepackage{rotfloat}
    \usepackage{threeparttable}
    \usepackage[left=1.5in, top=1in, right=1in, bottom=1in, includehead, includefoot]{geometry}

    \usepackage{caption}
    \DeclareCaptionLabelFormat{continued}{#1~#2 (Continued)}
    \captionsetup[ContinuedFloat]{labelformat=continued}

    
    \begin{document}

    % Table 1
    \begin{sidewaystable}[htbp] \centering  \caption{My Caption}
    \begin{threeparttable}
    \begin{tabular}{l*{2}{c}}\hline\hline
    \multicolumn{1}{l}{column1}&\multicolumn{1}{c}{column2}\\
    test1 & test2 \\
    test1 & test2 \\
    test1 & test2 \\
    \hline\hline \end{tabular}
    Continued on next page.
    \end{threeparttable} \end{sidewaystable}


    %% Table 1 (Continued)
    \begin{sidewaystable}[htbp] \centering \ContinuedFloat \caption{My Caption}
    \begin{threeparttable}
    \begin{tabular}{l*{2}{c}}\hline\hline
    \multicolumn{1}{l}{column1}&\multicolumn{1}{c}{column2}\\
    test2 & test3 \\
    test2 & test3 \\
    \hline\hline \end{tabular}
    A footnote goes here.
    \end{threeparttable} \end{sidewaystable}


    \end{document}
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Aligning sidewaystable to left margin

Post by gmedina »

Then, you could use something like this:

Code: Select all

\documentclass[11pt]{article}
\usepackage[left=1.5in, top=1in, right=1in, bottom=1in, includehead, includefoot]  {geometry}
\usepackage{hvfloat}
\usepackage{threeparttable}
\usepackage{caption}

\DeclareCaptionLabelFormat{continued}{#1~#2 (Continued)}
    
\begin{document}
\hvFloat[%
  floatPos=p,%
  capWidth=1,%
  capPos=t,%
  rotAngle=90,%
  objectPos=l]%
  {table}{%
  \begin{threeparttable}
    \begin{tabular}{l*{2}{c}}\hline\hline
      \multicolumn{1}{l}{column1}&\multicolumn{1}{c}{column2}\\
      test1 & test2 \\
      test1 & test2 \\
      test1 & test2 \\
      \hline\hline 
    \end{tabular}
    Continued on next page.
  \end{threeparttable}}{My Caption}{tab:test}

\begingroup
\captionsetup{labelformat=continued}

\hvFloat[%
  floatPos=p,%
  capWidth=1,%
  capPos=t,%
  rotAngle=90,%
  objectPos=l]%
  {table}{\addtocounter{table}{-1}%
  \begin{threeparttable}
    \begin{tabular}{l*{2}{c}}\hline\hline
      \multicolumn{1}{l}{column1}&\multicolumn{1}{c}{column2}\\
      test2 & test3 \\
      test2 & test3 \\
      \hline\hline 
    \end{tabular}
    A footnote goes here.
  \end{threeparttable}}{My Caption}{tab:testcont}
\endgroup

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply