Graphics, Figures & Tableschange the format of the counter for figures

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
uccaamo
Posts: 8
Joined: Thu Jul 23, 2009 11:10 am

change the format of the counter for figures

Post by uccaamo »

hi,

In my document, figures and schemes are two separate things. The caption of my figures start with Figure 1.1: blah blah, but schemes starts with Scheme 1:

what would be the appropriate command to change the format of my schemes to Scheme1.1:
by any chance?
many thanks in advance for your help. :|

Recommended reading 2024:

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

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

change the format of the counter for figures

Post by localghost »

It's impossible to help without knowledge of the setup for the schemes. Build a complete minimal working example (MWE) reduced to the necessary packages.

The easiest way would be to use the caption package as shown below.

Code: Select all

\documentclass[11pt,a4paper,english]{report}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{blindtext}

\parindent0em
\DeclareCaptionType[fileext=los,placement=htb,within=chapter]{scheme}

\begin{document}
  \listoffigures
  \listofschemes
  \listoftables

  \chapter{One}\label{chp:one}
  \begin{figure}[!ht]
    \centering
    \rule{6.4cm}{3.6cm}
    \caption{Dummy figure}\label{fig:dummy}
  \end{figure}

  \blindtext

  \begin{scheme}[!ht]
    \centering
    \rule{6.4cm}{3.6cm}
    \caption{Dummy scheme}\label{sch:dummy}
  \end{scheme}

  \blindtext

  \begin{table}[!ht]
    \caption{Dummy table}\label{tab:dummy}
    \centering
    \rule{6.4cm}{3.6cm}
  \end{table}

  \blindtext
\end{document}

Best regards
Thorsten
uccaamo
Posts: 8
Joined: Thu Jul 23, 2009 11:10 am

change the format of the counter for figures

Post by uccaamo »

many thanks, it works just fine! :D

the only problem, that I have right now is that I seem to have an incompatibility issue with my packages.

the errors are:
1.
command \c@float@type already defined

\newcounter{float@type}

2. addtocontents{1}{1}} \the\float@exts}

the permeable of my document is here. I would be grateful if you could kindly have a look at it. The text compiled with no problem, it just gives 2 errors.

many many thanks :)

Code: Select all

%!TEX TS-program = latex
%!TEX encoding = UTF-8 Unicode
\documentclass[11,a4paper,english]{report}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage{array,booktabs}
\usepackage{tikz}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{blindtext}

\parindent0em
\DeclareCaptionType[fileext=los,placement=htb,within=chapter]{scheme}

\usepackage[super]{natbib}
\bibliographystyle{science}
\nocite{*}		% list all refs in database, cited or not.
\usepackage{geometry}                % See geometry.pdf to learn the layout options. There are lots.
\geometry{letterpaper}                   % ... or a4paper or a5paper or ... 
%\geometry{landscape}                % Activate for for rotated page geometry
%\usepackage[parfill]{parskip}    % Activate to begin paragraphs with an empty line rather than an indent

\usepackage{amssymb}
\usepackage{textcomp} 
\usepackage{epstopdf} % to include .eps graphics files with pdfLaTeX
\usepackage{flafter}  % Don't place floats before their definition
%\usepackage{topcapt}   % Define \topcation for placing captions above tables (not in gwTeX)
\usepackage{memhfixc}
\usepackage{booktabs} % for much better looking tables
\usepackage{pdfsync}  % enable tex source and pdf output syncronicity
\usepackage{paralist} % very flexible & customisable lists (eg. enumerate/itemize, etc.)
\usepackage{verbatim} % adds environment for commenting out blocks of text & for better verbatim
\usepackage{subfigure} % make it possible to include more than one captioned figure/table in a single float 
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{color}
\usepackage{amsfonts}
\usepackage{latexsym}
\usepackage{fancyhdr}
\usepackage{afterpage}
\usepackage{psfrag}
\usepackage{cite}
\usepackage{citesort}
\usepackage{float}
\usepackage{array}
\usepackage{setspace} 
\doublespacing
\usepackage{subfigure}
\usepackage{wrapfig}

\renewcommand{\chaptermark}[1]{% 
\markboth{#1}{}} 
\renewcommand{\sectionmark}[1]{% 
\markright{\thesection\ #1}} 
\fancyhf{} % delete current header and footer 
\fancyhead[LE,RO]{\bfseries\thepage} 
\fancyhead[LO]{\bfseries\rightmark} 
\fancyhead[RE]{\bfseries\leftmark} 
\renewcommand{\headrulewidth}{0.5pt} 
\renewcommand{\footrulewidth}{0pt} 
\addtolength{\headheight}{0.5pt} % space for the rule 
\fancypagestyle{plain}{% 
\fancyhead{} % get rid of headers on plain pages 
\renewcommand{\headrulewidth}{0pt} % and the line 
} 

%% NEW PACKAGES %%
%stuff that follows is for the Scheme float labels
%\makeatletter \def\fnum@scheme{\textbf{\fname@scheme~\thescheme}}\renewcommand\float@makebox{% \vbox{\hsize\columnwidth \@parboxrestore\@fs@pre
%   \@fs@iftopcapt \ifvbox\@floatcapt\unvbox\@floatcapt\par\@fs@mid\fi  \unvbox\@currbox
%    \else\unvbox\@currbox
%      \ifvbox\@floatcapt\par\@fs@mid\unvbox\@floatcapt\fi
%    \fi\par\@fs@post\vskip\z@}}\makeatother

%%%%

%counter for compounds; arabic numbers
% syntax: to introduce new compound: \newcompd{label}.
% The compound receives a consecutive, bold number.
% this number can be referenced by "label" and the correct compound number is output.
% usage : \refcompd{label}
\newcounter{compd}   % definition of compd as a counter
\renewcommand{\thecompd}{{\bfseries \arabic{compd}}}
% LaTeX uses "the"counter, to reference to counter. Output is formatted as bold, arabic
% Usage of \newcompd does:
% thecompd is incremented as a referencable counter and label is defined.
% then the value of thecompd is output in bold arabic digits, as definedin  \renewcommand.
\newcommand{\newcompd}[1]{\refstepcounter{compd}\label{#1}\thecompd}
% The command \refcompd is used for referencing to defined compounds:
% \ref calls on the corresponding \thecompd to a given label #1 and outputs it as defined.
\setcounter{compd}{0}



\newcommand{\refcompd}[1]{\ref{#1}}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}

%\newfloat{scheme}{thb}{lop}[chapter]
%\floatname{scheme}{\bf Scheme}



%%%%% set length are missing  %%%
\pagestyle{fancy} 




%%% SECTION TITLE APPEARANCE
\usepackage{sectsty}
\allsectionsfont{\sffamily\mdseries\upshape} % (See the fntguide.pdf for font help)
% (This matches ConTeXt defaults)


%%% ToC APPEARANCE
\usepackage[nottoc,notlof,notlot]{tocbibind} % Put the bibliography in the ToC

%%% HEADERS & FOOTERS
\usepackage{fancyhdr} % This should be set AFTER setting up the page geometry
\pagestyle{fancy} % options: empty , plain , fancy




\DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .tif`.png}



                                        % Activate to display a given date or no date



\begin{document}
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

change the format of the counter for figures

Post by gmedina »

Hi,

1) You are loading the caption and float packages; the caption package must be loaded after the float package. Of course, this implies moving the \DeclareCaptionType command also.

2) You are using a wrong class option: instead of

Code: Select all

\documentclass[11,a4paper,english]{report}
use

Code: Select all

\documentclass[11pt,a4paper,english]{report}


3) You are using the obsolote subfigure package; use the subfig package instead.

4) You are using the "E" option for the headers built with the fancyhdr package; this option won't have any effect unless the twoside class option is used; you should get the corresponding warnings once you compile your document. Please refer to the package documentation for further information.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

change the format of the counter for figures

Post by localghost »

Some additions to the remarks of gmedina.
  • Clean up your preamble thoroughly. You are loading some packages twice. The same is true for redundant commands.
  • The structure of the preamble is very confusing. Think carefully if you really need every package and omit unnecessary ones to keep the preamble clear. Answer yourself the question why you load the memhfixc package. It is supposed to offer adjustments when using hyperref in the memoir class. Information about packages can be found on CTAN.
  • The subfig package is not considered outdated, but it isn't maintained anymore. Thus there are no accommodations to other current packages. I suggest to use the subcaption package that comes with caption.
uccaamo
Posts: 8
Joined: Thu Jul 23, 2009 11:10 am

Re: change the format of the counter for figures

Post by uccaamo »

I can't thank you enough! thank you many very much!! it works!! I have been trying to solve this for almost a month!

I agree I have many packages that I don't even know what they are for, just added from the internet!
;)

many thanks to both of you
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

change the format of the counter for figures

Post by sommerfee »

Hi gmedina,
gmedina wrote:1) You are loading the caption and float packages; the caption package must be loaded after the float package.
Most times it's fine either way, but the float package should be included before \DeclareCaptionType.

I forgot to mention this in the caption package documentation, so many thanks for the hint!

Axel
Post Reply