MiKTeX and proTeXtusing caption package

Information and discussion about MikTeX distribution for Windows and the related proTeXt: Installing, updating, configuring
me_here_me
Posts: 46
Joined: Mon Feb 05, 2007 5:19 pm

using caption package

Post by me_here_me »

I am using caption package to label my figures as either "Figure" or "Graph". But they are sharing the same numbering system.

e.g this is what is happening:
fig 1
fig 2
graph 3
fig 4
graph5

this is what i want to achieve
fig 1
fig 2
graph 1
fig 3
graph2

can some one tell me how to achieve this?

regards

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Kris
Posts: 56
Joined: Sun Jan 14, 2007 4:04 pm

using caption package

Post by Kris »

Hi,

You can define a new floating environment (like figure) with the float-package
(http://tug.ctan.org/tex-archive/macros/ ... /float.pdf):

Code: Select all

\documentclass{article}
\usepackage{float}
%...
\newfloat{graphic}{tbp}{lgr}   % optional numbering with [section] or [chapter]
\floatname{graphic}{Graphic}
%...
\begin{document}
%...
\section{the start}
%...
\begin{figure}[htb]
  the first figure...
  \caption{a caption for the figure}
\end{figure}
%
\begin{graphic}[htb]
  the first graphic...
  \caption{a caption for the graphic}
\end{graphic}
%...
\end{document}
Regards
Kris
Last edited by Kris on Wed Feb 14, 2007 4:21 pm, edited 1 time in total.
me_here_me
Posts: 46
Joined: Mon Feb 05, 2007 5:19 pm

Re: using caption package

Post by me_here_me »

wow thanks

it works :)
User avatar
Kris
Posts: 56
Joined: Sun Jan 14, 2007 4:04 pm

using caption package

Post by Kris »

Hi

just define the new float without [section] or [chapter] like:


\newfloat{graphic}{tbp}{lgr}
\floatname{graphic}{Graphic}


;)
Kris
Last edited by Kris on Wed Feb 14, 2007 4:37 pm, edited 1 time in total.
me_here_me
Posts: 46
Joined: Mon Feb 05, 2007 5:19 pm

Re: using caption package

Post by me_here_me »

Thanks, actually i figured that out after my post.

anyway, I still have a question left as i am very very new to Latex :)

I got a style from a conference and I am trying to follow that. Infact I am writing into the sample file that they provided. And now the font and style for the captions of my figures and Graphs are different. How can I make them same. I donot find anything in my file that sets the font for my figures?

the sample file is on this webpage: http://www.csc.ncsu.edu/faculty/healey/ ... ormat.html

regards
User avatar
Kris
Posts: 56
Joined: Sun Jan 14, 2007 4:04 pm

using caption package

Post by Kris »

It seems to be that this 'change' of the caption format is located
in the documentclass-file...

\documentclass{tcvg}

But You are using the caption-package already...so what about
this quick and dirty solution... ;)

\captionsetup{font=sf}

Code: Select all

\documentclass{article}
\usepackage{float}
\usepackage{caption}
%
\captionsetup{font=sf}           % global font setting for captions (label and text)
%...
\newfloat{graphic}{tbp}{lgr}   % optional numbering with [section] or [chapter]
\floatname{graphic}{Graphic}
%...
\begin{document}
%...
\section{the start}
%...
\begin{figure}[htb]
the first figure...
\caption{a caption for the figure}
\end{figure}
%
\begin{graphic}[htb]
the first graphic...
\caption{a caption for the graphic}
\end{graphic}
%...
\end{document}
Regards
Kris
Last edited by Kris on Wed Feb 14, 2007 5:07 pm, edited 1 time in total.
me_here_me
Posts: 46
Joined: Mon Feb 05, 2007 5:19 pm

using caption package

Post by me_here_me »

i should use this opportunity to ask another question ...

Can i distribute my long file in multiple files. Lets say my document has five sections

I want to make 6 files. The main file will have an abstract only while each of the sections is written in a different file and they are fetched from those section when required. Actually I am already doing this stuff for bibliography using the following code

Code: Select all

\bibliographystyle{plain}
\nocite{*}
\bibliography{GI2}    % G12.bib is another file in the same directory
best wishes
Last edited by me_here_me on Wed Feb 14, 2007 5:17 pm, edited 1 time in total.
User avatar
Kris
Posts: 56
Joined: Sun Jan 14, 2007 4:04 pm

using caption package

Post by Kris »

Yes, that is possible:

You can create a main-document (e.g. the above mentioned template.tex)
and after the abstract you can 'load' the sections seperately by using

\input{filename} (filename without .tex !)

Code: Select all

...
\input{section_1}
\input{section_2}
\input{section_3}
\input{section_4}
\input{section_5}
...
section_1.tex should look like this:

Code: Select all

\section{First section}
lots of text...
end of first section
and so on...

Have fun!
Kris
Last edited by Kris on Wed Feb 14, 2007 5:26 pm, edited 1 time in total.
me_here_me
Posts: 46
Joined: Mon Feb 05, 2007 5:19 pm

Re: using caption package

Post by me_here_me »

Thanks a lot. Now all my sections are in different files and I am able to create a nice PDF of the paper:)

again thanks for so much help .. :) but again another question

where can i learn about coding make files. Here is briefly what i am required to do:

- put each section into it's own latex file with you 'input' into the main file
- create a makefile to make the paper
- make sure all your images are in png or some other lossless format, but NOT in eps
only have png/tiff files in the repository.
- since you need to include eps files in your repository, your makefile should include a "make myimages" command, that converts png/tiff into eps files before you "make paper".

lets say I have a main latex file called "Main.tex", and 6 files each for one section called:
sec1.tex, sec2.tex, sec3.tex, sec4.tex, sec5.tex, sec6.tex. I have 4 copies of each of the required image in eps, pdf, tiff, png format. My bibliography is in "Main.bib"

can u please help me with this makefile thingy, and what is the use of it when i can make a pdf rfom my TeXnic Centre tool. I also have a cls file in my folder that i got with the sample latex files but i have absolutely no idea what it is for!!
User avatar
Kris
Posts: 56
Joined: Sun Jan 14, 2007 4:04 pm

using caption package

Post by Kris »

Hi again...don't know if I can help You here,
but here are some comments for You:
> where can i learn about coding make files. Here is briefly what i am required to do:
>
> - put each section into it's own latex file with you 'input' into the main file
> - create a makefile to make the paper
> - make sure all your images are in png or some other lossless format, but NOT in eps
> only have png/tiff files in the repository.
> - since you need to include eps files in your repository, your makefile should include a "make myimages" command, that
> converts png/tiff into eps files before you "make paper".

You are using TexnicCenter (with MiKTeX I guess), so why creating a makefile?
> lets say I have a main latex file called "Main.tex", and 6 files each for one section called:
> sec1.tex, sec2.tex, sec3.tex, sec4.tex, sec5.tex, sec6.tex. I have 4 copies of each of the required image in eps, pdf, tiff, > png format. My bibliography is in "Main.bib"
Perfect, so You can compile every format that is possible (DVI, PS, PDF)...
...but actually You only need EPS and PNG images!
> can u please help me with this makefile thingy, and what is the use of it when i can make a pdf rfom my TeXnic Centre
> tool.
Exactly my question, if You have compiled the PDF you don't need the source files anymore
- from whom is the idea of creating a makefile for Your paper?
> I also have a cls file in my folder that i got with the sample latex files but i have absolutely no idea what it is for!!
cls-File: cls = class = DOCUMENTCLASS (e.g. \documentclass{article})

It contains all information on margins, font, size, etc. for Your document
(like the sans-serif font for the captions in TCVG document)

Kris
Last edited by Kris on Thu Feb 15, 2007 2:23 pm, edited 1 time in total.
Post Reply