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 use a custom float environment that is basically used as a table environment that provides extra formatting. I would like this environment to use the same numbering as the regular table floats. Is there a way to do that? I have already changed the floatname to match Table by using the floatname command. Here is my initialization code:

\newfloat{newtable}{tbp}{lop}[chapter]
\floatname{newtable}{Table}

Regular tables numbering also span over chapters... do you have any ideas?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

If you're doing this only to get a second table environment with different formatting, why don't you simply define it in terms of the existing table? For example something like

\newenvironment{newtable}{\table[opts]\formatting\stuff}{\endtable}
share|improve this answer
    
Or if the OP must use a new float for whatever reason, another option is to define a wrapper environment newnewtable which in its initialization \setcounter{newtable}{table} before loading newtable, and in its end \setcounter{table}{newtable} after ending newtable. –  Willie Wong Oct 13 '10 at 13:54
    
I kind of need the float functionalities [hbt]... I asked in a previous question how to pass on the [opts] in a new environment and the solution which I got was to use floats... With what you are proposing I would be stuck with the same problem/question... –  levesque Oct 13 '10 at 14:39
    
I see, I've just posted a new answer there. –  Juan A. Navarro Oct 13 '10 at 15:18

A hackish solution - possibly with adverse effects - is to increment the table counter after a newtable environment and vice versa.

\documentclass{book}

\usepackage{float}
\newfloat{newtable}{tbp}{lop}[chapter]
\floatname{newtable}{Table}

\makeatletter
\g@addto@macro\endnewtable{\refstepcounter{table}}
\g@addto@macro\endtable{\refstepcounter{newtable}}
\makeatother

\begin{document}

\chapter{A chapter}

\begin{table}[!ht]
\caption{A table}
\end{table}

\begin{newtable}[!ht]
\caption{A newtable}
\end{newtable}

\begin{table}[!ht]
\caption{Another table}
\end{table}

\end{document}
share|improve this answer

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.