Graphics, Figures & Tablesfloat | Sub-floats for custom floating Environment

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Hadi Safi aghdam
Posts: 2
Joined: Sat Nov 24, 2012 11:36 am

float | Sub-floats for custom floating Environment

Post by Hadi Safi aghdam »

Hello,

I want to have a float called figuren with this properties.
  1. figuren numbering shall not interfere with figure numbering.
  2. figuren numbering shall restart each chapter.
  3. have this caption:
    figure exer 1-1: This is a caption text ...
But I get an error. :(

Code: Select all

! LaTeX Error: No counter 'subfiguren' defined.
this is my file:

Code: Select all

‎\documentclass{book}‎
‎
‎\usepackage{subfig}‎‎
‎
‎\usepackage{float}‎‎
‎\floatstyle{plain}‎
‎\newfloat{figuren}{!hbtp}{lof}[chapter]‎
‎\floatname{figuren}{figure}‎
‎
‎\renewcommand{\thefiguren}‎{exer ‎\arabic{chapter}--\arabic{figuren}}‎‎

‎\begin{document}‎
‎\chapter{}
‎
‎‎\begin{figure}‎‎[!ht]
‎\centering‎‎
\rule{50mm}{20mm}
\caption{this is a caption text...}
\end{figure}‎‎‎

‎‎\begin{figuren}‎‎[!ht]
‎\centering‎‎
\rule{50mm}{20mm}
\caption{this is a caption text...}
\end{figuren}‎‎
‎
‎‎\begin{figuren}‎‎[!ht]
    \subfloat[first subfig]{\rule{50mm}{20mm}} ‎‎
\quad‎ 
    \subfloat[second subfig]{\rule{50mm}{20mm}}‎‎‎
    \caption{this is a caption text...}
\end{figuren}‎‎
       
‎\end{document}
Thanks very much.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

float | Sub-floats for custom floating Environment

Post by sommerfee »

Please read the subfig documentation, especially "4. Compatibility With Other Packages." / "4.2 Float Package".

There you'll find an example code for creating new types of sub-floats.
Post Reply