Document Classescaption and nonfloat package: disabling position

Information and discussion about specific document classes and how to create your own document classes.
l0calh05t
Posts: 19
Joined: Fri Jul 04, 2008 2:57 pm

caption and nonfloat package: disabling position

Post by l0calh05t »

How do I disable the position option of the caption package?
As is it always produces the error:

! Package caption Error: Usage of the `position' option is incompatible
(caption) to the `nonfloat' package.

I tried adding it after the nonfloat package (in case it gets disable automatically), and tried setting position=false and position=b (default latex behavior). None of these disabled the position option.

Recommended reading 2024:

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

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

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

caption and nonfloat package: disabling position

Post by localghost »

You should omit the (very old) nonfloat package and find other ways of typesetting captions with preventing them to float. The caption package offers the \captionof command which can be used in a grouping environment.

Code: Select all

\begin{center}
  \includegraphics{dummy}
  \captionof{figure}[ToC entry]{Dummy caption}
\end{center}
Refer to the documentation of this package to learn more.


Best regards
Thorsten¹
l0calh05t
Posts: 19
Joined: Fri Jul 04, 2008 2:57 pm

Re: caption and nonfloat package: disabling position

Post by l0calh05t »

It might be old but it worked better than using only caption. caption -- even with position set to auto -- does not manage to put the correct spacing between captions above tables (both in the float environment, as in any other environment using captionof) and the table.

EDIT: Never mind. I found out it was the use of KOMA-Script which was bothering the caption package
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

caption and nonfloat package: disabling position

Post by localghost »

l0calh05t wrote:[...] caption -- even with position set to auto -- does not manage to put the correct spacing between captions above tables (both in the float environment, as in any other environment using captionof) and the table.
Considering that you use Version 3.0 or higher of the caption package, this should be no problem. The package offers settings for those cases.
l0calh05t wrote:[...] Never mind. I found out it was the use of KOMA-Script which was bothering the caption package
That shouldn't occur but also may depend on the used versions.
l0calh05t
Posts: 19
Joined: Fri Jul 04, 2008 2:57 pm

Re: caption and nonfloat package: disabling position

Post by l0calh05t »

I'm using the newest version available for MikTeX (packaged on 2008-04-15, so it's quite new)
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

caption and nonfloat package: disabling position

Post by localghost »

l0calh05t wrote:I'm using the newest version available for MikTeX (packaged on 2008-04-15, so it's quite new)
So do I. Without any problems. But I never used nonfloat.
l0calh05t
Posts: 19
Joined: Fri Jul 04, 2008 2:57 pm

Re: caption and nonfloat package: disabling position

Post by l0calh05t »

I'm not using nonfloat anymore. The problem (with correct position) is caused by using KOMA-Script with caption.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

caption and nonfloat package: disabling position

Post by Stefan Kottwitz »

Hi,
l0calh05t wrote:I'm not using nonfloat anymore. The problem (with correct position) is caused by using KOMA-Script with caption.
Could you provide a minimal example that shows the problem?

Stefan
LaTeX.org admin
l0calh05t
Posts: 19
Joined: Fri Jul 04, 2008 2:57 pm

caption and nonfloat package: disabling position

Post by l0calh05t »

Sure:

Code: Select all

\documentclass{scrartcl}
\usepackage[labelfont=bf,position=auto]{caption}

\begin{document}
\begin{table}
\centering
\caption{Caption that is too close to table}
\begin{tabular}{|c|}
\hline
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.\\
\hline
\end{tabular}
\end{table}
\end{document}
My solution was to use the tablecaptionabove option for the document class.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

caption and nonfloat package: disabling position

Post by Stefan Kottwitz »

You could use

Code: Select all

\captionsetup{belowskip=10pt}
after \begin{table} or into your preamble if you always want the space below.

Stefan
LaTeX.org admin
Post Reply