Graphics, Figures & Tablescaption package in ucthesis class?

Information and discussion about graphics, figures & tables in LaTeX documents.
natermiller
Posts: 9
Joined: Thu Oct 15, 2009 8:07 pm

caption package in ucthesis class?

Post by natermiller »

It seems that the caption package cannot be used in the ucthesis class, both available from CTAN. It runs error free when I load the package with no options, but when I select options I want it produces an error: "Latex error: Option clash for package caption" and the options I chose are not used.

I want to make basic changes to the captions like single spaced or italic or bold faced labels. This is similar to another post http://www.latex-community.org/forum/vi ... sis#p19335. I'm not a Latex expert, but I know these changes are easily made with the caption package. Is there any way to use it?

Assuming I couldn't use the caption package I figured out how to edit the class file to make the figure label (e.g. "Figure 1.4") bold faced, but can't figure out how to edit the appearance of the caption itself.

Any help?

Thanks,
Nate

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 package in ucthesis class?

Post by localghost »

I have no problem with the following example.

Code: Select all

Code, edit and compile here:
\listfiles
\documentclass[11pt,english]{ucthesis}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[font=small,labelfont={bf,sf},tableposition=top]{caption}
\usepackage{blindtext}
\begin{document}
\blinddocument
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This is the ist of used packages and other files.

Code: Select all

*File List*
ucthesis.cls 2004/12/19 v3.2 University of California Thesis Class
fontenc.sty
t1enc.def 2005/09/27 v1.99g Standard LaTeX file
inputenc.sty 2006/05/05 v1.1b Input encoding file
utf8.def 2006/03/30 v1.1i UTF-8 support for inputenc
t1enc.dfu 2006/03/30 v1.1i UTF-8 support for inputenc
ot1enc.dfu 2006/03/30 v1.1i UTF-8 support for inputenc
omsenc.dfu 2006/03/30 v1.1i UTF-8 support for inputenc
babel.sty 2008/07/06 v3.8l The Babel package
english.ldf 2005/03/30 v3.3o English support from the babel system
caption.sty 2008/04/01 v3.1h Customizing captions (AR)
caption3.sty 2008/03/20 v3.1h caption3 kernel (AR)
keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
blindtext.sty 2006/11/21 V1.7 blindtext-Package
xspace.sty 2006/05/08 v1.12 Space after command names (DPC,MH)
***********
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Best regards and welcome to the board
Thorsten¹
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

caption package in ucthesis class?

Post by sommerfee »

natermiller wrote:It runs error free when I load the package with no options, but when I select options I want it produces an error: "Latex error: Option clash for package caption" and the options I chose are not used.
This has nothing to do with the document class but with packages which have already loaded the caption package - like the subfig package.

BTW: There is a alphabetical list (and explanation) of all caption package related warnings and errors in the caption package documentation.

The easiest way to fix this is to simply use \captionsetup{...} instead of \usepackage[...]{caption}.

Axel
natermiller
Posts: 9
Joined: Thu Oct 15, 2009 8:07 pm

caption package in ucthesis class?

Post by natermiller »

Ahhh, I see. Thanks guys.

I found this information (below) in the caption package documentation. Simply loading the subfig package first was enough to fix the problem.
_________________________________________
Option clash for package caption.
– but sometimes also –
Missing \begin{document}.
The caption package has already been loaded by some other LATEX package, so you can’t do that again specifying different options. A candidate causing this could be the subfig package; if this is the case, please load the caption package before the subfig package or specify the option caption=false while loading the subfig package.
(See the subfig package[20] documentation)
natermiller
Posts: 9
Joined: Thu Oct 15, 2009 8:07 pm

caption package in ucthesis class?

Post by natermiller »

Again, thanks Axel. But I have one more for you. There seems to be a clash between the setspace and caption packages within ucthesis.

If I run this code...

Code: Select all

Code, edit and compile here:
\documentclass[11pt,draft]{ucthesis}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage[]{caption}
\begin{document}
\begin{figure}[!htbp]
\centering
\includegraphics[width=0.5\columnwidth]{Alloys}%
\caption{Here I write a rather long caption, because I want to ensure that even in this simple made up example, the caption text will appear in singlespacing format.}%
\label{fig:alloys}%
\end{figure}
\end{document}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
...it gives the error "! Undefined control sequence. \setstretch ...ef \baselinestretch {#1}\@currsize"

If I run it in report class it works fine. If it run it without the caption package it works fine. If I run it without the setspace package it works fine. I would like to be able to make the captions singlespaced while the text of the document is doublespaced. Any help?

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

caption package in ucthesis class?

Post by sommerfee »

The caption package uses the command \singlespacing offered by the setspace package, but the setspace package seems to be incompatible to the ucthesis class (or vice versa). The following even smaller example does not work, too, and results in the same error:

Code: Select all

Code, edit and compile here:
\documentclass[11pt,draft]{ucthesis}
\usepackage{setspace}
\begin{document}
\singlespacing
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The ucthesis class inputs uct11.clo but its size command definitions are incompatible to the ones used by size11.clo which is part of the standard document classes offered by LaTeX (article, report, and book). uct11.clo uses the old LaTeX 2.09 nomenclature \fontsize...\selectfont which is obsolete since LaTeX2e. (The actual one is \@setfontsize...) So it seems to me that ucthesis was not ported 100% complete to LaTeX2e.

I tried to adapt the definitions:

Code: Select all

Code, edit and compile here:
\documentclass[11pt,draft]{ucthesis}
\makeatletter
% taken from uct11.clo and adapted to LaTeX2e nomenclature
\renewcommand{\normalsize}{\@setfontsize\normalsize\@xipt{13.6}%
\abovedisplayskip 11\p@ plus3\p@ minus6\p@
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus3\p@
\belowdisplayshortskip 6.5\p@ plus3.5\p@ minus3\p@
\let\@listi\@listI} % Setting of \@listi added 9 Jun 87
\renewcommand{\small}{\@setfontsize\small\@xpt{12}%
\abovedisplayskip 10\p@ plus2\p@ minus5\p@
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus3\p@
\belowdisplayshortskip 6\p@ plus3\p@ minus3\p@
\def\@listi{\leftmargin\leftmargini %% Added 22 Dec 87
\topsep 6\p@ plus2\p@ minus2\p@\parsep 3\p@ plus2\p@ minus\p@
\itemsep \parsep}}
\renewcommand{\footnotesize}{\@setfontsize\footnotesize\@ixpt{11}%
\abovedisplayskip 8\p@ plus2\p@ minus4\p@
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus\p@
\belowdisplayshortskip 4\p@ plus2\p@ minus2\p@
\def\@listi{\leftmargin\leftmargini %% Added 22 Dec 87
\topsep 4\p@ plus2\p@ minus2\p@\parsep 2\p@ plus\p@ minus\p@
\itemsep \parsep}}
\renewcommand{\scriptsize}{\@setfontsize\scriptsize\@viiipt{9.5pt}}
\renewcommand{\tiny}{\@setfontsize\tiny\@vipt{7pt}}
\renewcommand{\large}{\@setfontsize\large\@xiipt{14pt}}
\renewcommand{\Large}{\@setfontsize\Large\@xivpt{18pt}}
\renewcommand{\LARGE}{\@setfontsize\LARGE\@xviipt{22pt}}
\renewcommand{\huge}{\@setfontsize\huge\@xxpt{25pt}}
\renewcommand{\Huge}{\@setfontsize\Huge\@xxvpt{30pt}}
\makeatother
\usepackage{setspace}
\begin{document}
\singlespacing
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This runs without errors but since I'm not very familiar with internal LaTeX font stuff this may cause unwanted side effects. Try to copy the \makeatletter...\makeatother block from the above document into your document (right after \documentclass[...]{ucthesis}) and keep your fingers crossed. Maybe it helps.

HTH,
Axel
natermiller
Posts: 9
Joined: Thu Oct 15, 2009 8:07 pm

Re: caption package in ucthesis class?

Post by natermiller »

Worked like a charm - no adverse side effects so far.

Works fine just dropping this code into the preamble. I tried dropping it into the class file instead but that didn't work. Maybe it has to be in a certain place? Sorry, I don't know much about editing class files.

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

caption package in ucthesis class?

Post by sommerfee »

natermiller wrote:I tried dropping it into the class file instead but that didn't work.
What class file? Do you have an own one or do you mean ucthesis.cls? Usually it's not a good idea to patch foreign files since the change could get lost by updating or changing the LaTeX distribution. And it will make your document non-portable since it depends on the fix.

But you could move the code between \makeatletter and \makeatother (without \makeatletter and \makeatother itself) to a file called uct11fix.sty (the code originally comes from uct11.clo, therefore this file name) and use this with \usepackage{uct11fix} within your document.

Axel
natermiller
Posts: 9
Joined: Thu Oct 15, 2009 8:07 pm

caption package in ucthesis class?

Post by natermiller »

Yeah, I was talking about the ucthesis class file.

Does the uct11fix.sty file have to be in a certain place? I dropped the following code into a file and named it as you said and saved it in the ucthesis folder, but it gives emergency stop error because it can't find the file. Or does the file need anything else?

Code: Select all

Code, edit and compile here:
%__________________________________________________________________________
%This patch (written by Axel Somerfee) is used so that setspace will work with ucthesis
% taken from uct11.clo and adapted to LaTeX2e nomenclature
\renewcommand{\normalsize}{\@setfontsize\normalsize\@xipt{13.6}%
\abovedisplayskip 11\p@ plus3\p@ minus6\p@
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus3\p@
\belowdisplayshortskip 6.5\p@ plus3.5\p@ minus3\p@
\let\@listi\@listI} % Setting of \@listi added 9 Jun 87
\renewcommand{\small}{\@setfontsize\small\@xpt{12}%
\abovedisplayskip 10\p@ plus2\p@ minus5\p@
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus3\p@
\belowdisplayshortskip 6\p@ plus3\p@ minus3\p@
\def\@listi{\leftmargin\leftmargini %% Added 22 Dec 87
\topsep 6\p@ plus2\p@ minus2\p@\parsep 3\p@ plus2\p@ minus\p@
\itemsep \parsep}}
\renewcommand{\footnotesize}{\@setfontsize\footnotesize\@ixpt{11}%
\abovedisplayskip 8\p@ plus2\p@ minus4\p@
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus\p@
\belowdisplayshortskip 4\p@ plus2\p@ minus2\p@
\def\@listi{\leftmargin\leftmargini %% Added 22 Dec 87
\topsep 4\p@ plus2\p@ minus2\p@\parsep 2\p@ plus\p@ minus\p@
\itemsep \parsep}}
\renewcommand{\scriptsize}{\@setfontsize\scriptsize\@viiipt{9.5pt}}
\renewcommand{\tiny}{\@setfontsize\tiny\@vipt{7pt}}
\renewcommand{\large}{\@setfontsize\large\@xiipt{14pt}}
\renewcommand{\Large}{\@setfontsize\Large\@xivpt{18pt}}
\renewcommand{\LARGE}{\@setfontsize\LARGE\@xviipt{22pt}}
\renewcommand{\huge}{\@setfontsize\huge\@xxpt{25pt}}
\renewcommand{\Huge}{\@setfontsize\Huge\@xxvpt{30pt}}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

caption package in ucthesis class?

Post by sommerfee »

natermiller wrote:Does the uct11fix.sty file have to be in a certain place? I dropped the following code into a file and named it as you said and saved it in the ucthesis folder, but it gives emergency stop error because it can't find the file.
Usually you need to tell your TeX distribution about the new file, on Unix systems this will be usually done with "texhash".

See also http://www.tex.ac.uk/cgi-bin/texfaq2htm ... =inst-wlcf

Alternatively you can put the file beside your document file.

Axel
Post Reply