Graphics, Figures & Tables ⇒ caption package in ucthesis class?
-
- Posts: 9
- Joined: Thu Oct 15, 2009 8:07 pm
caption package in ucthesis class?
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.
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
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
caption package in ucthesis class?
Code: Select all
\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 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)
***********
Best regards and welcome to the board
Thorsten¹
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?
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?
If I run this code...
Code: Select all
\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?
Code: Select all
\documentclass[11pt,draft]{ucthesis}
\usepackage{setspace}
\begin{document}
\singlespacing
\end{document}
I tried to adapt the definitions:
Code: Select all
\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?
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?
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
%__________________________________________________________________________
%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