Generalcaption | Problems with JINST Document Class

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
cahitugur
Posts: 3
Joined: Mon Oct 31, 2011 8:45 pm

caption | Problems with JINST Document Class

Post by cahitugur »

Hi,

I have been trying to prepare a document with an already supplied package (JINST) by a journal. After 2-3 compiles on my computer, everything works fine, except a warning:
Package caption Warning: Unsupported document class (or package) detected, (caption) usage of the caption package is not recommended. See the caption package documentation for explanation.
As it is a warning, I just ignored it.

When I upload to the journals computer, after compiling I get many times the following error:
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.

! Use of \caption@@settype doesn't match its definition.
\new@ifnextchar ...ved@d = #1\def \reserved@a {#2} .....
I attach the whole log file and the package file of the journal.

I had the suspicion that the caption package was causing the problem. So I removed all of the figures, but the warning was still there.

As I don't know what exactly the problem is, I upload the whole .tex file as well.

Any ideas about these errors? :)

Thanks and best regards,
Cahit
Attachments
tdc_twepp2011.tex
(21.18 KiB) Downloaded 390 times
JINST.cls
the package file of the journal
(62.52 KiB) Downloaded 353 times
log.txt
the log file
(64.41 KiB) Downloaded 433 times
Last edited by cahitugur on Fri Nov 04, 2011 6:45 pm, edited 2 times in total.

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

caption | Problems with JINST Document Class

Post by localghost »

The caption package is simply not compatible with your non-standard document class. I suggest to drop it and find another way to customize your captions. Contact the class maintainer and ask for help.


Best regards and welcome to the board
Thorsten
cahitugur
Posts: 3
Joined: Mon Oct 31, 2011 8:45 pm

caption | Problems with JINST Document Class

Post by cahitugur »

localghost wrote:The caption package is simply not compatible with your non-standard document class. I suggest to drop it and find another way to customize your captions. Contact the class maintainer and ask for help.
Thanks for the answer, but this is not the reason of the error on the journal computer. Somehow I can have a nice dvi output without any errors on my computer, however, on the journal computer this is not the case.

What might be the reason? any idea?

Thanks,
Cahit
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

caption | Problems with JINST Document Class

Post by sommerfee »

cahitugur wrote:Thanks for the answer, but this is not the reason of the error on the journal computer. Somehow I can have a nice dvi output without any errors on my computer, however, on the journal computer this is not the case.

What might be the reason? any idea?
You have a version >= 3.1 of the caption package installed, but on the journal computer there is only version v3.0j (from 2006/03/21) available. This version is more than 5 years old.

The compatibility issue has changed massive from version 3.0 to 3.1. The version 3.0 tried to patch existing macros for being most compatible. However, this proofed to be a bad idea since this often gave strange problems with non-standard document classes. The version 3.1 does not patch code anymore but simply overwrites it. Before overwriting the code it tests if the existing code is known to the caption package - if yes, everything is fine, if no, a warning will be issued.

However, while unsupported document classes and packages used to give errors with caption package v3.0 they usually work quite well with version v3.1 (or newer).
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

caption | Problems with JINST Document Class

Post by sommerfee »

I finally found some time to take a look at your document.
  1. Since you are not using the caption package but it is loaded by the subfig package, a possible solution would be not loading the caption package. This can be done by loading the subfig package with the option "caption=false":

    Code: Select all

    \usepackage[caption=false]{subfig}
    
    Unfortunately this does not work with the given document class either, so this needs further investigation. Hopefully I will have time for this tomorrow.
  2. \subref is a fragile command, so using it inside \caption can lead to problems. One can add the lines

    Code: Select all

    \usepackage{makerobust}
    \MakeRobustCommand\subref
    
    right after loading the subfig package to make at least these problems go away.
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

caption | Problems with JINST Document Class

Post by sommerfee »

This one works with caption v3.0j, v3.1m, and v3.2c, and solve the compatibility problems between the JINST document class and the caption package:

Replace \usepackage{subfig} with:

Code: Select all

\usepackage[caption=false]{subfig}
% Make \subref robust
\makeatletter
\AtBeginDocument{%
\DeclareRobustCommand*\subref{\@ifstar\sf@@subref\sf@subref}}
\makeatother
cahitugur
Posts: 3
Joined: Mon Oct 31, 2011 8:45 pm

caption | Problems with JINST Document Class

Post by cahitugur »

sommerfee wrote:This one works with caption v3.0j, v3.1m, and v3.2c, and solve the compatibility problems between the JINST document class and the caption package:

Replace \usepackage{subfig} with:

Code: Select all

\usepackage[caption=false]{subfig}
% Make \subref robust
\makeatletter
\AtBeginDocument{%
\DeclareRobustCommand*\subref{\@ifstar\sf@@subref\sf@subref}}
\makeatother
Excellent! works like a charm :) thank you so much! saved me from transporting the whole document to word :)

Cheers,
Cahit
Post Reply