TeXnik - Tips TeX and LaTeX


Welcome to the TeXnik website (under construction)

Non Floats
TUG logo

Main page

Index
UK FAQ
Documentation
Software
CTAN
Search CTAN:

Statistics

Google c.t.t.

Google d.c.t.t.

 


 


Figures with Caption |  Subfigures with Caption |  Tables with Caption | 


If you want always nonfloats with captions, than use package nonfloat, available at CTAN. If you have only one float which is longer than one page, try one of the following
Tables with Caption
Standard-floats like figure/table/algorithm do not support a pagebreak! In this case you must define your own semi-float-environment, because these ones supports a pagebreak. They are not real floats, because they are allways there where the command appears. In latex-preamble this new environment is defined as:
\newenvironment{myTables}[1] {% caption as parameter 
  \stepcounter{table} 
  \vspace{1ex} 
  \addcontentsline{lot}{section}{\thetable\hspace{0.75em} #1} 
  \center{\textbf{Table \thetable : }#1}% 
} 
{% 
  \vspace{1ex}% 
  \addtocounter{table}{-1}% 
}
This environment is called by the structure:

\begin{myTables}{a very long table}

... the table ... or anything else

\end{myTables}

The reason why this "float" can be interrupted by another "real" float is that the placement-options have a high priority. Therefore it may be possible, that you have to correct the text-structure "by hand", means inserting some \newpage-commands or something else.


Figures with Caption
It's just the same than the above tables, if you change table against figure


Subfigures with Caption
You can use this environment if you need subfigures with special captions. Remember that there is a package subfigure at CTAN. The following subfigure-environments uses the figure counter, so that couting of the floats is continuing. To get correct counting choose the environments in correct order:
\begin{myFirstSubfigure}{ --- any Caption --- }
--- the figure ---
\end{myFirstSubfigure}
--- any text or not ---
\begin{mySubfigure}{ --- any Caption --- }
--- the figure ---
\end{mySubfigure}
--- any text or not ---

.... so much sunbfigures as you like ....

\begin{myLastSubfigure}{ --- any Caption --- }
--- the figure ---
\end{myLastSubfigure}
--- any text or not ---
between these subfigures there can not be any other float!!
in LaTeX preamble write
\newcounter{mySubCounter}
\newcommand{\mySubCaption}{}
\newenvironment{myFirstSubFigure}[1] {% caption as parameter 
  \addtocounter{figure}{1}% increase the float figure counter
  \begin{mySubFigure}{#1}%
}{%
  \end{mySubFigure}%
}
\newenvironment{mySubFigure}[1] {% caption as parameter 
  \renewcommand\mySubCaption{#1}
  \refstepcounter{mySubCounter} 
} 
{% 
  \vspace{1ex} 
  \addtocontents{lof}{\protect\contentsline %
         {figure}%
         {\numberline{%
            \arabic{figure}\alph{mySubCounter}}{\mySubCaption}}%
         {\arabic{page}}%
}
  \hfill\textbf{Figure \thefigure\alph{mySubCounter} : }\mySubCaption\hfill% 
  \vspace{1ex}% 
}
\newenvironment{myLastSubFigure}[1] {% caption as parameter 
  \begin{mySubFigure}{#1}
}{%
  \end{mySubFigure}%
  \setcounter{mySubCounter}{0}% resetting the subcounter
}
Look at subfigure page.

local time: Thu Apr 25 20:51:49 CEST 2024 ; file is: 1765.16193287037 days old
contact webmaster _at_ TeXnik.de