0

When using this class: http://daviddoria.com/Uploads/acmtog.cls

I am trying to place a figure* right under the title/authors. I tried this:

\documentclass{acmtog}
\pdfminorversion=5

\usepackage{float}
\usepackage{graphicx}
\usepackage[caption=false,format=hang]{subfig} % needed for \subfloat. caption=false fixes: ``Unsupported document class (or package) detected, (caption) use of the caption package is not recommended''. format=hang makes the hanging indention in the figure captions look correct.
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{algpseudocode}
\usepackage{algorithm}
\usepackage{lipsum}

\acmVolume{VV}
\acmNumber{N}
\acmYear{2012}
\acmMonth{April}
\acmArticleNum{XXX}
\acmdoi{10.1145/XXXXXXX.YYYYYYY}

\begin{document}

\title{My paper}

\author{Me {\upshape and} My Friend
\affil{Affiliation}}

\maketitle

\begin{bottomstuff}

Authors' addresses: 
\end{bottomstuff}

\def\BannerFigSize{.25}
\begin{figure*}[ht!]
\centering
\subfloat[a.]
  {
  \fbox{\rule{0pt}{1in} Some text \rule{1in}{0pt} }
  \label{fig:banner:scene}
  }
\subfloat[b.]
  {
  \fbox{\rule{0pt}{1in} Some text \rule{1in}{0pt} }
  \label{fig:banner:strokes}
  }
\caption{Our algorithms.}
\label{fig:banner}
\end{figure*}


\lipsum[1-4]

\end{document}

But the figure appears on the next page. I also tried [H] placement (from the float package) but that seems to make the image disappear entirely. Is there a better way to do this?

Martin Scharrer
  • 262,582
  • 1
    Don't use the environment figure. Use instead center in combination with captionof. – Marco Daniel May 01 '12 at 15:09
  • @Marco Daniel - How do you make subfigures in a 'center' environment? I tried this but it doesn't work:

    \def\BannerFigSize{.25} \begin{center} \subfloat[a.] { \fbox{\rule{0pt}{1in} Some text \rule{1in}{0pt} } \label{fig:banner:scene} } \subfloat[b.] { \fbox{\rule{0pt}{1in} Some text \rule{1in}{0pt} } \label{fig:banner:strokes} } \caption{Our algorithms.} \label{fig:banner} \end{center}

    – David Doria May 01 '12 at 15:15
  • I wrote an example. – Marco Daniel May 01 '12 at 15:24

1 Answers1

3

As I wrote in the comment you should use the environment center instead of a floating one. However my system doesn't know your document class so I can't provide a general solution. Use the package caption which allows setting a type. So at the beginning of center write \captionsetup{type=figure}.

\documentclass{article}
\usepackage{graphicx}
\usepackage[caption=false,format=hang]{subfig} 
\usepackage{caption}
\begin{document}
\def\BannerFigSize{.25}
\begin{center}
\captionsetup{type=figure}
\subfloat[a.]
  {
  \fbox{\rule{0pt}{1in} Some text \rule{1in}{0pt} }
  \label{fig:banner:scene}
  }
\subfloat[b.]
  {
  \fbox{\rule{0pt}{1in} Some text \rule{1in}{0pt} }
  \label{fig:banner:strokes}
  }
\caption{Our algorithms.}
\label{fig:banner}
\end{center}
\end{document}

The class uses special definitions of caption so you can do the following: I defined the command \captiontype{} so that you can use it inside an environment.

\newcommand*\captiontype[1]{\def\@captype{#1}}

In your case simple \captiontype{figure}

\documentclass{acmtog}
\usepackage{graphicx}
\usepackage[caption=false,format=hang]{subfig} 
\makeatletter
\newcommand*\captiontype[1]{\def\@captype{#1}}
\makeatother
\begin{document}
\def\BannerFigSize{.25}
\begin{center}
\captiontype{figure}
\subfloat[a.]
  {
  \fbox{\rule{0pt}{1in} Some text \rule{1in}{0pt} }
  \label{fig:banner:scene}
  }
\subfloat[b.]
  {
  \fbox{\rule{0pt}{1in} Some text \rule{1in}{0pt} }
  \label{fig:banner:strokes}
  }
\caption{Our algorithms.}
\label{fig:banner}
\end{center}
\end{document}
Marco Daniel
  • 95,681
  • Your solution does work as is. However, when I try it with acmtog.cls, I get "\subfloat outside float". When you say "my system doesn't know your document class" - is there something more than dropping this file: daviddoria.com/Uploads/acmtog.cls in the same directory?

    Thanks for your help so far!

    – David Doria May 01 '12 at 15:27
  • @DavidDoria: See my update – Marco Daniel May 01 '12 at 15:37
  • Actually... @Marco Daniel I'm not sure why in the demo acmtog produces a single column format? Typically it produces a two column format. In which case we have to span the columns. figure* does that, but center* does not seem to. Is there an easy fix? – David Doria May 01 '12 at 15:48
  • @DavidDoria: Not really. Why do you have twocolumn? – Marco Daniel May 01 '12 at 16:39
  • It is the default (and I have to use it for this particular journal) - see this demo: http://pastebin.com/HsbdbLmH – David Doria May 01 '12 at 16:44