我从这个网站下载了一些文件来构建我的论文文档http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/ThesisStyle/。我有一个问题,我可以在哪里定义西班牙语以获取西班牙语标题。我尝试在文件中声明它CUEDthesisPSnPDF.cls
,usepackage[spanish]{babel}
但它不起作用。我希望得到你的帮助。
答案1
如果您确实需要使用那个有缺陷的类,那么您必须对其进行编辑。
复制一份,调用它myCUEDthesis.cls
并更改第一行,原来内容为(为了清晰起见,添加了行号)
1 %
2 % CUEDthesis v1.1
3 % By Harish Bhanderi <[email protected]
4 % Version 1.0 released 15/07/2002
5 % Version 1.1 released 14/07/2010
6 %-------------------------- identification ---------------------
7 %\NeedsTeXFormat{LaTeX2e}
8 \ProvidesClass{CUEDthesisPSnPDF}[2010/07/14 v1.1 CUED thesis class]
9 %-------------------------- initial code -----------------------
10 \newif\ifCU@bookmode
11 \CU@bookmodetrue
12
13 \DeclareOption{report}{\CU@bookmodefalse}
14 \DeclareOption{book}{\CU@bookmodetrue}
15 \ProcessOptions\relax%
16
17 \ifCU@bookmode
18 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}%
19 \ProcessOptions\relax%
20 \ifx\pdfoutput\undefined%
21 \LoadClass[dvips, a4paper]{book}%
22 \else%
23 \LoadClass[pdftex, a4paper]{book}%
24 \fi%
25 \else
26 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}%
27 \ProcessOptions\relax%
28 \ifx\pdfoutput\undefined%
29 \LoadClass[dvips, a4paper]{report}%
30 \else%
31 \LoadClass[pdftex, a4paper]{report}%
32 \fi%
33 %\renewcommand{\refname}{References}%
34 \fi
35
36 %\DeclareOption{book}{%
37 %}%
38 \usepackage{setspace}
39 \usepackage{tocbibind}
40 \usepackage{amssymb}
41 %\usepackage{graphicx}
42 \usepackage{fancyhdr}
43 \usepackage{eucal}
44 \usepackage[english]{babel}
45 \usepackage[usenames, dvipsnames]{color}
46 \usepackage[perpage]{footmisc}
47 \usepackage[square, sort, numbers, authoryear]{natbib}
48 \usepackage{ifthen}
49 \usepackage{ifpdf}
到以下
% CUEDthesis v1.1 with modifications by Isai
%%%%%%%
% By Harish Bhanderi <[email protected]
% Version 1.0 released 15/07/2002
% Version 1.1 released 14/07/2010
%-------------------------- identification ---------------------
%\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{myCUEDthesis}[2013/01/26 v1.1m CUED thesis class]
%-------------------------- initial code -----------------------
\newif\ifCU@bookmode
\CU@bookmodetrue
\DeclareOption{report}{\CU@bookmodefalse}
\DeclareOption{book}{\CU@bookmodetrue}
\ProcessOptions\relax%
\ifCU@bookmode
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
\ProcessOptions\relax
\LoadClass[a4paper]{book}
\else
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
\ProcessOptions\relax
\LoadClass[dvips, a4paper]{report}
\fi
\usepackage{setspace}
\usepackage{tocbibind}
\usepackage{amssymb}
\usepackage{fancyhdr}
\usepackage{eucal}
\usepackage[usenames, dvipsnames]{color}
\usepackage[perpage]{footmisc}
\usepackage[square, sort, numbers, authoryear]{natbib}
\usepackage{ifthen}
\usepackage{ifpdf}
然后你就可以在文档中说
\documentclass[twoside,11pt]{Classes/myCUEDthesis}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} %%% use the actual input encoding
\usepackage[spanish]{babel}
你也可以使用原来的类并说
\documentclass[twoside,11pt,spanish]{Classes/CUEDthesisPSnPDF}
文档开头为
\begin{document}
\selectlanguage{spanish}
但是,我认为不建议babel
在类文件中加载,因为这是典型的用户设置。此外,我修改的部分在原始版本中确实存在错误,因为它会绝不选择 DVI 输出,但始终将文档设置为 PDF 输出。
每一个建筑
\ifx\pdfoutput\undefined
是错误的, 因为\pdfoutput
是在所有情况下均有定义(至少如果 TeX 发行版大约少于五年)。