GeneralProblem with \@xfloat and figures

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
dberg
Posts: 3
Joined: Mon May 24, 2010 5:10 pm

Problem with \@xfloat and figures

Post by dberg »

I am using a thesis template provided by my University but am running into an issue with a portion of it. The following piece of code from the .cls file produces an error that goes away when I comment this portion out.

Code: Select all

% Single Space Figures, Tables, and Footnotes
% Redefine the macro used for floats (including figures and tables) so
% that single spacing is used.  (Note \def\figure{\@float{figure}set
% single spacing} doesn't work because figure has an optional argument)

\def\@xfloat#1[#2] {
  \ifhmode
    \@bsphack\@floatpenalty -\@Mii
  \else
    \@floatpenalty -\@Miii
  \fi
  \def\@captype{#1}
  \ifinner
    \@parmoderr\@floatpenalty\z@
  \else\@next\@currbox\@freelist {
    \@tempcnta\csname ftype@#1\endcsname
    \multiply\@tempcnta\@xxxii\advance\@tempcnta\sixt@@n
    \@tfor \@tempa :=#2\do {
      \if\@tempa h\advance\@tempcnta \@ne\fi
      \if\@tempa t\advance\@tempcnta \tw@\fi
      \if\@tempa b\advance\@tempcnta 4\relax\fi
      \if\@tempa p\advance\@tempcnta 8\relax\fi
    }
    \global\count\@currbox\@tempcnta
  } \@fltovf\fi
  \global\setbox\@currbox\vbox\bgroup
  \def\baselinestretch{1}\@normalsize
  \boxmaxdepth\z@

% leave captions indented, I hope
 \hsize\columnwidth
  \@parboxrestore
}
The error it produces reads:
Paragraph ended before \@xfloat was complete
The error at the point at which the first figure in the document is inserted. Can someone help me to fix the issue with this?

Thank you.

Recommended reading 2024:

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

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

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

Re: Problem with \@xfloat and figures

Post by localghost »

The error messages indicates that you've forgotten a closing brace.


Best regards and welcome to the board
Thorsten
dberg
Posts: 3
Joined: Mon May 24, 2010 5:10 pm

Re: Problem with \@xfloat and figures

Post by dberg »

I appreciate your response; however, looking through the portion of code that I posted, I don't see any missed brace.
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

Re: Problem with \@xfloat and figures

Post by sommerfee »

Patching internal LaTeX commands inside a document class was necessary in LaTeX 2.09 days, but is IMHO a bad idea in "modern" LaTeX2e times.

I would just drop this faulty redefinition and include a \RequirePackage{setspace} instead. (The setspace package includes a proper redefinition so content inside floating environments are typeset with single spacing.)
dberg
Posts: 3
Joined: Mon May 24, 2010 5:10 pm

Re: Problem with \@xfloat and figures

Post by dberg »

That does seem to produce the desired output. Thanks a lot! Now if only I can get the University to update the templates...
Post Reply