Graphics, Figures & Tables ⇒ caption package in ucthesis class?
-
- Posts: 9
- Joined: Thu Oct 15, 2009 8:07 pm
caption package in ucthesis class?
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
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
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?
I have no problem with the following example.
This is the ist of used packages and other files.
Best regards and welcome to the board
Thorsten¹
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}
Code: Select all
*File List*ucthesis.cls 2004/12/19 v3.2 University of California Thesis Classfontenc.styt1enc.def 2005/09/27 v1.99g Standard LaTeX fileinputenc.sty 2006/05/05 v1.1b Input encoding fileutf8.def 2006/03/30 v1.1i UTF-8 support for inputenct1enc.dfu 2006/03/30 v1.1i UTF-8 support for inputencot1enc.dfu 2006/03/30 v1.1i UTF-8 support for inputencomsenc.dfu 2006/03/30 v1.1i UTF-8 support for inputencbabel.sty 2008/07/06 v3.8l The Babel packageenglish.ldf 2005/03/30 v3.3o English support from the babel systemcaption.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-Packagexspace.sty 2006/05/08 v1.12 Space after command names (DPC,MH)***********
Best regards and welcome to the board
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
caption package in ucthesis class?
This has nothing to do with the document class but with packages which have already loaded the caption package - like the subfig package.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.
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
-
- Posts: 9
- Joined: Thu Oct 15, 2009 8:07 pm
caption package in ucthesis class?
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)
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)
-
- Posts: 9
- Joined: Thu Oct 15, 2009 8:07 pm
caption package in ucthesis class?
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...
...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
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}
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
caption package in ucthesis class?
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:
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:
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
Code: Select all
Code, edit and compile here:
\documentclass[11pt,draft]{ucthesis}\usepackage{setspace}\begin{document}\singlespacing\end{document}
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}
HTH,
Axel
-
- Posts: 9
- Joined: Thu Oct 15, 2009 8:07 pm
Re: caption package in ucthesis class?
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
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
caption package in ucthesis class?
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.natermiller wrote:I tried dropping it into the class file instead but that didn't work.
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
-
- Posts: 9
- Joined: Thu Oct 15, 2009 8:07 pm
caption package in ucthesis class?
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?
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}}
caption package in ucthesis class?
Usually you need to tell your TeX distribution about the new file, on Unix systems this will be usually done with "texhash".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.
See also http://www.tex.ac.uk/cgi-bin/texfaq2htm ... =inst-wlcf
Alternatively you can put the file beside your document file.
Axel