Document ClassesLaTeX Warning: Unused global option(s)

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
ivan_b
Posts: 4
Joined: Thu Jul 15, 2010 2:57 pm

LaTeX Warning: Unused global option(s)

Post by ivan_b »

Hi,

I wrote a document class based on standard article.cls. I defined some additional options using the \DeclareOption command. This options work as intended, however "LaTeX Warning: Unused global option(s)" is produced when they are used.

My code in document class:

Code: Select all

\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{actamont}[2010/06/01 LaTeX class for Acta Montanistica Slovaca]

%% Necessary variables for defined options
\newif\if@Final
\newif\if@Special
\newif\if@SK
\newif\if@CZ
\def\@Page{1}
\newif\if@Numbered

\@Finalfalse
\@Specialfalse
\@SKfalse
\@CZfalse
\@Numberedfalse

%% Other variables used
\def\@Journal{Acta Montanistica Slovaca}

%% Options of actamont class
\DeclareOption{final}{\global\@Finaltrue}
\DeclareOption{special}{\global\@Specialtrue}
\DeclareOption{sk}{\global\@SKtrue}
\DeclareOption{cz}{\global\@CZtrue}
\DeclareOption{numberedrefs}{\global\@Numberedtrue}
\DeclareOption{a4paper}{\PassOptionsToClass{a4paper}{article}}
\DeclareOption{twoside}{\PassOptionsToClass{twoside}{article}}
\DeclareOption{10pt}{\PassOptionsToClass{10pt}{article}}
\DeclareOption{onecolumn}{\PassOptionsToClass{onecolumn}{article}}
%\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\DeclareOption*{\ClassWarningNoLine{actamont}{Unknown option `\CurrentOption' specified for 'actamont' class}}

\ExecuteOptions{a4paper,10pt,twoside,onecolumn}
\ProcessOptions

%% This class is based on standard LaTeX article class
%\LoadClass[a4paper,twoside,10pt]{article}
\LoadClass{article}
the rest of the code continues with various \RequirePackage, \setlength, ... commands. Many of these vary according to defined options:

Code: Select all

\if@option
   command if defined
   \else
   command if undefined
\fi
These definitions work well, but I really need to get rid of the Warnings.

I.e. if I specify following options in .tex document:

Code: Select all

\documentclass[sk,final,special,numberedrefs]{actamont}
following warning is produced:

Code: Select all

LaTeX Warning: Unused global option(s):
[sk,final,special,numberedrefs].
Any help would be appreciated.
Last edited by ivan_b on Fri Jul 16, 2010 7:48 pm, edited 1 time 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.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Re: LaTeX Warning: Unused global option(s)

Post by josephwright »

Are you sure? I've tried your class with your test file and don't get any warnings. Perhaps post your log file.
Joseph Wright
ivan_b
Posts: 4
Joined: Thu Jul 15, 2010 2:57 pm

Re: LaTeX Warning: Unused global option(s)

Post by ivan_b »

Here are some zipped files containing document class and .tex documents.
Attachments
acta.zip
(46.57 KiB) Downloaded 328 times
ivan_b
Posts: 4
Joined: Thu Jul 15, 2010 2:57 pm

Re: LaTeX Warning: Unused global option(s)

Post by ivan_b »

Anybody was able to reproduce the warning?
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

LaTeX Warning: Unused global option(s)

Post by meho_r »

Yes, the warning is there (I run pdflatex on submission.tex; TeXLive2009 on Debian).

Code: Select all

LaTeX Warning: Unused global option(s):
    [sk].
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

Re: LaTeX Warning: Unused global option(s)

Post by sommerfee »

There are multiple \ProcessOptions inside your document class. Just remove the second one.

How did I find this:

First of all I used a real minimal example document which does use the document class but not any features of it. This one still produced the warning.

Afterwards I placed an \endinput inside the document class file, right after \LoadClass{article}. The warning has gone away. So the problem must be somewhere inside the document class, below \LoadClass{article}.

By moving the \endinput line step-by-step below inside the document class code I was able to encircle the lines which causes the problem.

This technique for finding bugs in (La)TeX documents is described here:
http://www.minimalbeispiel.de/mini-en.html

The link to this guide can be found inside the Board Rules (marked with "Everybody, by all means, read before posting!"), section 2.2 "Building an example":
http://www.latex-community.org/forum/vi ... =35&t=5838
ivan_b
Posts: 4
Joined: Thu Jul 15, 2010 2:57 pm

Re: LaTeX Warning: Unused global option(s)

Post by ivan_b »

Thank you very much sommerfee. Nice technique. Now I am going to read the thread you linked to, it will definitely be usefull.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

LaTeX Warning: Unused global option(s)

Post by localghost »

ivan_b wrote:[...] Now I am going to read the thread you linked to, it will definitely be usefull.
This is hopefully not only an empty word. So, don't forget to act according to Section 3, which describes what has to be done after posting.


Best regards and welcome to the board
Thorsten
Post Reply