Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

My seraching creativity didn't provide useable results so far, so I have to ask this question...

I have a group of related (figure-like) item types (music examples) which I include in different ways:

  1. a floating environment defined with \DeclareFloatingEnvironment

  2. a non-floating environment (allowing page breaks)

  3. a full-page command using \includepdf internally.

I managed to let the environments share a counter (the one from 1.), but I don't know how I can include the non-floating versions in a \listofmusicexamples.

Probably I would find a way to directly write a line into the auxiliary file from 2. and 3., but isn't there a less hacky way to accomplish this?

Thanks in advance for any hint or suggestion


Unfortunately I have to revoke my comment somewhat. Using \captionsetup only works smoothly in my non-floating environment (2.) but not in the command 3.

Using the command environment gives a warning \captionsetup{type=...} (caption) outside box or environment. While I could live with that warning I just realized that this command affects paragraph formatting afterwards. After the first appearance of my command all paragraphs are not indented anymore (they now are like the captions(?)).

If I enclose everything with a \begingroup \endgroup I get lots of errors, but the document compiles and the paragraph formatting is correct again. So my assumption seems right that somehow the caption's formatting was kept active. I tried some kinds of other approaches but none seems to work.

So I had to reimplement 3. by manually incrementing the counter with \refstepcounter and adding an entry to the list with \addcontentsline

share|improve this question
1  
If you put \captionsetup{type=...} within your non-floating environment you could use \caption for captioning and listing the environment. Otherwise you could use \captionlistentry for the list entry. (See caption package doc for details) –  Axel Sommerfeldt Feb 11 '13 at 10:13
    
Thanks, I'll look into that. I made a workaround to use 'fake' captions, but having real \captions would make it more consistent. –  uli_1973 Feb 11 '13 at 10:17
    
Works perfectly. I'd 'accept' the answer, but it is only a comment ... –  uli_1973 Feb 13 '13 at 21:53
add comment

1 Answer

up vote 4 down vote accepted

If you put \captionsetup{type=...} within your non-floating environment you could use \caption for captioning and listing the environment. Otherwise you could use \captionlistentry for the list entry. (See caption package doc for details)

Example code:

\documentclass{article}
\usepackage{caption,newfloat}

\DeclareFloatingEnvironment{test}

\begin{document}

\listoftests

\begin{test}
  ...
  \caption{A}
\end{test}

\begin{center}
  \captionsetup{type=test}
  ...
  \caption{B}
\end{center}

\begin{center}
  \captionsetup{type=test}
  ...
  \captionlistentry{C}
  ...
\end{center}

\captionlistentry[test]{D}

\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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