1

The XY problem --as is often requested on SE forums-- is how to automatically set the following parameters of a longtable environment (because I'm using Pandoc to generate the latex):

  • width ratio of the page
  • centering
  • font size

I achieved that previously on the table environment (renewenvironment with opening brace before, and closing brace after (to center wide floats)), also helped by existing macros from the Pandoc default template:

% Original macro to customize table
\makeatletter
\renewenvironment{table}[1][\fps@table]{
  \edef\@tempa{\noexpand\@float{table}[#1]}
  \@tempa\centerfloat\footnotesize%
}{
  \end@float
}
\makeatother

Copy-pasting the above and replacing "table" by "longtable" just does not work:

\makeatletter
\renewenvironment{longtable}[1][\fps@longtable]{
  \edef\@tempa{\noexpand\@float{longtable}[#1]}
  \@tempa\centerfloat\footnotesize%
}{
  \end@float
}
\makeatother

I suppose there is no such macro as \fps@longtable in the longtable source, and also that one longtable might indeed be made of multiple floats... So what is the macro that I should redefine?

6
  • 3
    longtable doesn't float so there is nothing corresponding to \fps@longtable and certainly you do not want \end@float at the end. longtables are centred by default, so don't you just want to add \footnotesize before the table? Jun 17, 2020 at 18:52
  • 1
    It is not clear what changes you want, but perhaps \let\oldlongtable\longtable \def\longtable{\footnotesizse\oldlongtable} Jun 17, 2020 at 18:57
  • yes, I just want a \centerfloat\footnotesize before the longtable content Jun 17, 2020 at 18:58
  • 1
    what do you want \centerfloat to do given that longtables are centred and do not float? Jun 17, 2020 at 18:58
  • 1
    why not simply specify a larger \textwidth ? but anyway you can set \LTleft and \LTright to -.1\textwith plus 1fill and it'll allow to spill 10% at either side Jun 17, 2020 at 19:36

1 Answer 1

3

As far as I understand the question you can do

\let\oldlongtable\longtable
\longtable{%
\LTleft-.1\textwidth plus 1fill
\LTright\LTleft
\footnotesize
\oldlongtable}

To get footnotesize tables that may spill into the margin by 10% of textwidth.

1
  • For the end of the story, I used your solution, and included a \setlength{\columnwidth}{1.2\columnwidth} to make it as wide as wanted (and the \def before \longtable). Jun 23, 2020 at 14:16

You must log in to answer this question.

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