0

I need to use tabular for 2 cases: one for numbered data(table float) and other for text data(I named quadro). Now Im need to use longtable for both, the way I thought to do that is load the longtable package twice, but editing the counters and some commands(Im going to create the environment longquadro).

Could someone please list the principals commands that I have to change and which I may keep?

The code is the longtable.sty

3
  • 1
    You don't want to load a package twice (and can't without some trickery). Loading a package defines the various commands and environments that you can use. So your first attempt would be to take what you're doing for table and quadro, and see what happens if you intermix them. If you're having trouble, try to create an example with ~40 lines of code that you think should work but doesn't, and post that here.
    – Teepeemm
    Commented Jun 13 at 2:51
  • Im going to load longtable.sty, then i'll load a edited version with the commands name's changed.
    – Leonidas
    Commented Jun 13 at 3:10
  • Does that mean that your approach for quadro was to edit the contents of longtable.sty to use "quadro" instead of "longtable"? Editing a package is tricky at best, and should only be a last resort.
    – Teepeemm
    Commented Jun 13 at 13:13

1 Answer 1

2

enter image description here

You don't need to duplicate all of the definitions or load the package code twice, just tell longtable to use the quadro counter for captions in these cases:

\documentclass{article}
\usepackage{float,longtable}
\newfloat{quadro}{tbp}{qud}

\makeatletter

\def\QT@c@ption#1[#2]#3{%
  \LT@makecaption#1\fnum@quadro{#3}%
  \def\@tempa{#2}%
  \ifx\@tempa\@empty\else
     {\let\\\space
     \addcontentsline{\ext@quadro}{quadro}{\protect\numberline{\thequadro}{#2}}}%
  \fi}

\newenvironment{longquadro}
{\let\LT@c@ption\QT@c@ption\let\c@table\c@quadro\begin{longtable}}
{\end{longtable}}

\makeatother
\begin{document}

\listoftables
\listof{quadro}{List of Quadro}

\begin{table}[htp]
  \centering
   TTTT
  \caption{a table}
\end{table}

\begin{quadro}[htp]
  \centering
   QQQ
  \caption{a quadro}
\end{quadro}


\begin{longtable}{c|c}
  \caption{a long table}\\
  LT&LTTTTT\\
  LTTTT&LT\\
\end{longtable}


\begin{longquadro}{c|c}
  \caption{a long quadro}\\
  LQ&LQQQQQ\\
  LQQQQ&LQ\\
\end{longquadro}

\begin{table}[htp]
  \centering
   TTTT222
  \caption{another table}
\end{table}

\begin{quadro}[htp]
  \centering
   QQQ222
  \caption{another quadro}
\end{quadro}

\end{document}

You must log in to answer this question.

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