3

I'm writing my thesis and I have one Chapter that is a step by step instruction manual. I'm using the package sidecap to get a figure on the outside of the page with caption beside it. What's getting generated now is a caption that's labeled with Figure <chapter_no>.<fig_no>.

What I'd like is if the caption was labeled with Step <section_no>.<fig_no>. I also don't want them appearing in my list of figures either.

EDIT: I'm okay with using a different package for side captions as well.

EDIT: here's my minimal example. note that right now example-image-a is captioned Figure 2.1:... and I'd prefer Step 1.1 as it's in section 1 (of ch2) and it's the first figure.

\documentclass[10pt,a4paper]{book}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage{sidecap}
\begin{document}
    \chapter{My first chapter}
    \lipsum[4]
    \chapter{My second chapter}
    \section{ the first section}
    \lipsum[2]
    \begin{SCfigure}[][h]
        \includegraphics[width=4cm]{example-image-a}
        \caption[short cap]{hello world}
    \end{SCfigure}
\end{document}

enter image description here

  • Please can you post a minimal example document which demonstrates what you get now so we know where to start? This should start with \documentclass and will certainly include a few \usepackage commands as you'll need sidecap, at least. And end with \end{document}. It will, obviously, need to include a figure or two to demonstrate the issue. If you want sample images, load graphicx and then say \includegraphics{example-image-a b and c are other exciting alternatives to a. This will ensure everyone can compile your code. – cfr Oct 23 '15 at 21:48
3

You can use newfloat for defining a float type independent of figure:

\documentclass[10pt,a4paper]{book}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage{newfloat}
\usepackage{sidecap}

\DeclareFloatingEnvironment[
  fileext=los,
  listname={List of Steps},
  name=Step,
  placement=htp,
  within=section,% steps are reset with sections
]{step}
\renewcommand{\thestep}{\arabic{section}.\arabic{step}}

\begin{document}

\listoffigures

\chapter{My second chapter}

\section{The first section}

\lipsum[2]

\begin{SCstep}[][h]
\includegraphics[width=4cm]{example-image-a}
\caption[short cap]{hello world}
\end{SCstep}

\begin{figure}
\centering
\includegraphics[width=4cm]{example-image-b}
\caption{Example figure}
\end{figure}

\end{document}

You can check that the list of figures only contain the figure and not the “Step”.

enter image description here

  • This is pretty close! the first number after step is still the chapter number and not the section number. – user1816847 Oct 23 '15 at 22:46
  • @user1816847 Check now – egreg Oct 23 '15 at 22:51

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.