4

In my document, I have a lot of short case studies, which I would like to number, just like figures. So I am using this:

\subsubsection{Case study \ref{cs:this}: Title}
\begin{figure}
\label{cs:this} 
\end{figure}

But this just copies the (sub)section number in the reference. So I have multple "1.1" case studies, etc... I would like them to be numbered X.Y, where X is the section number and Y is the case study number. So for example, in section 1, I would have case studies 1.1-1.10, in section 2 case studies 2.1-2.7, etc... Those case studies can be a part of section or subsection. My secnumdepth is 2.

And later I would like to have a list of case studies, where I would include all figures with labels beginning with cs:. Is that possible as well?

8

You need a \caption in order to increment the figure/float counter. See Understanding how references and labels work.

Instead, make yourself a new casestudy float:

enter image description here

\documentclass{article}
\usepackage{float}% http://ctan.org/pkg/casestudy

% New casestudy float
\floatstyle{plain}
\newfloat{casestudy}{htbp}{loc}[section]
\renewcommand{\thecasestudy}{\thesection.\arabic{casestudy}}
\floatname{casestudy}{Case Study}
\newcommand*{\listofcasestudies}{\listof{casestudy}{List of Case Studies}}
\begin{document}
\tableofcontents
\listofcasestudies
\section{Case study~\ref{cs:this}: Title}
\begin{casestudy}
\caption{A case study}
\label{cs:this}
\end{casestudy}
\end{document}

This is fully supported by the float package.

  • Is there a way to not include the caption in the text? This way I end up with heading AND caption. – Jakub Zaverka May 22 '13 at 11:50
  • @JakubZaverka It seems to me that you don't want a floating environment at all. So using \subsubsection, figure and \newfloat seems to be a wrong approach, you should define your own counter (using \newcounter and \refstepcounter) and your own commands (or environment) instead. – Axel Sommerfeldt May 22 '13 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.