1

I have the following table:

   \documentclass[a4paper,preprint,aps,
                   unsortedaddress]{revtex4}
    \usepackage[top=2.5cm,bottom=2.5cm,
                left=3.5cm,right=2.5cm]{geometry}
    \usepackage{longtable,array,booktabs}

    \ifdefined\mc
       \renewcommand{\mc}{\multicolumn}
    \else
       \newcommand{\mc}{\multicolumn}
    \fi

    \begin{document} 

        \setlength\LTleft{-3.0cm}
        \setlength\LTright{-2.0cm}

        \scriptsize

    \begin{longtable}{ l r @{--} p{1.3cm} >{\centering}p{2.6cm} 
                       *{4}{p{1.25cm}} p{2.1cm}}               
    %% headers and footers

    \caption{Table} \\ 
    \hline\hline
    \endfirsthead

    \mc{9}{c}{\tablename\ \thetable\ -- \emph{Continued from previous page}} \\ 
    \hline
    aaaaaaaaaaaaaaaaaaaaaaaa & \mc{2}{c}{bbb--ccc} & ddd & eee & fff & ggg & hhh & iii \\
    \hline
    \endhead

    \hline
    \mc{9}{r}{\emph{Continued on next page}} \\
    \endfoot

    \hline\hline
    \endlastfoot

    %% body of table

        aaaaaaaaaaaaaaaaaaaaaaaa & \mc{2}{c}{bbb--ccc} & ddd & eee & fff & ggg & hhh & iii \\
    aaaaaaaaaaaaaaaaaaaaaaaa & bbb & ccc & ddd & eee & fff & ggg & hhh & iii \\
    aaaaaaaaaaaaaaaaaaaaaaaa & bbb & ccc & ddd & eee & fff & ggg & hhh & iii \\
    aaaaaaaaaaaaaaaaaaaaaaaa & bbb & ccc & ddd & eee & fff & ggg & hhh & iii \\

    \end{longtable}
    \end{document}

which I would like to shift to the left by setting \setlength\LTleft{-3.0cm} and \setlength\LTright{-2.0cm}. Furthermore, I have to apply \scriptsize for the table. However, none of these commands are working with revtex4. Could you please provide a solution to this problem? (This question is the same as in \LTleft, \LTright, and \scriptsize not working with revtex4, but I cannot sign up with that username.) If it is not possible, an alternative solution would also be useful for me. For this case, I attached the first page of my real table.

enter image description here

8

1 Answer 1

1

The revtex4 classes (by the way, the current version is revtex4-2) issue \table@hook when a longtable is being built. The standard value for \table@hook is \small.

\documentclass[a4paper,preprint,aps,unsortedaddress]{revtex4-2}

\usepackage{longtable,array,booktabs}

\newcommand{\mc}{\multicolumn}

\makeatletter
\newenvironment{xlongtable}[1]
 {\appdef\table@hook{#1}\longtable}
 {\endlongtable}

\begin{document}

\begin{xlongtable}{\scriptsize}{
  l r @{--} p{1.3cm} >{\centering}p{2.6cm} 
  *{4}{p{1.25cm}} p{2.1cm}
}
%% headers and footers

\caption{Table} \\
\toprule
\endfirsthead

\mc{9}{c}{\tablename\ \thetable\ -- \emph{Continued from previous page}} \\ 
\midrule
aaaaaaaaaaaaaaaaaaaaaaaa & \mc{2}{c}{bbb--ccc} & ddd & eee & fff & ggg & hhh & iii \\
\midrule
\endhead

\midrule
\mc{9}{r}{\emph{Continued on next page}} \\
\endfoot

\bottomrule
\endlastfoot

%% body of table

aaaaaaaaaaaaaaaaaaaaaaaa & \mc{2}{c}{bbb--ccc} & ddd & eee & fff & ggg & hhh & iii \\
aaaaaaaaaaaaaaaaaaaaaaaa & bbb & ccc & ddd & eee & fff & ggg & hhh & iii \\
aaaaaaaaaaaaaaaaaaaaaaaa & bbb & ccc & ddd & eee & fff & ggg & hhh & iii \\
aaaaaaaaaaaaaaaaaaaaaaaa & bbb & ccc & ddd & eee & fff & ggg & hhh & iii \\

\end{xlongtable}

\end{document}

enter image description here

I removed the conditional redefinition of \mc: if the command is defined, it would be a mistake to redefine it without knowing where it comes from.

Setting \LTleft and \LTright requires a hack. Be aware that such tricks can be worthy a rejection, as they change the shape of documents from what revtex people expect.

\documentclass[a4paper,preprint,aps,unsortedaddress]{revtex4-2}

\usepackage{longtable,array,booktabs}
\usepackage{showframe}

\newcommand{\mc}{\multicolumn}

\makeatletter
\newenvironment{xlongtable}[1]
 {\appdef\table@hook{#1}\longtable}
 {\endlongtable}
\newcommand\tobirgobblefour[4]{}
\makeatother

\begin{document}

\begin{xlongtable}{%
  \scriptsize % this table is in script size
  \setlength{\LTleft}{-3cm plus 1fill}% move to left
  \tobirgobblefour % remove the setting of \LTleft and \LTright
}{
  l r @{--} p{1.3cm} >{\centering}p{2.6cm} 
  *{4}{p{1.25cm}} p{2.1cm}
}
%% headers and footers

\caption{Table} \\
\toprule
\endfirsthead

\mc{9}{c}{\tablename\ \thetable\ -- \emph{Continued from previous page}} \\ 
\midrule
aaaaaaaaaaaaaaaaaaaaaaaa & \mc{2}{c}{bbb--ccc} & ddd & eee & fff & ggg & hhh & iii \\
\midrule
\endhead

\midrule
\mc{9}{r}{\emph{Continued on next page}} \\
\endfoot

\bottomrule
\endlastfoot

%% body of table
aaaaaaaaaaaaaaaaaaaaaaaa & \mc{2}{c}{bbb--ccc} & ddd & eee & fff & ggg & hhh & iii \\
aaaaaaaaaaaaaaaaaaaaaaaa & bbb & ccc & ddd & eee & fff & ggg & hhh & iii \\
aaaaaaaaaaaaaaaaaaaaaaaa & bbb & ccc & ddd & eee & fff & ggg & hhh & iii \\
aaaaaaaaaaaaaaaaaaaaaaaa & bbb & ccc & ddd & eee & fff & ggg & hhh & iii \\

\end{xlongtable}

\end{document}

Here I used showframe just to make the page boundaries clear.

enter image description here

2
  • Thank you for your answer. However, I still have a problem with shifting the table to the left with -3.0 cm. Could you please help me how to perform it?
    – TobiR
    Commented Feb 13, 2019 at 7:05
  • 1
    @TobiR I provided it. However, you shouldn't be doing such tricks, as your paper might be rejected. If it is not for a submission to PhysRev (or associated journal), then don't use revtex4 to begin with.
    – egreg
    Commented Feb 13, 2019 at 9:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .