LaTeX 错误:命令 \authorname 已定义。或名称 \end... 非法,请参阅手册第 192 页

LaTeX 错误:命令 \authorname 已定义。或名称 \end... 非法,请参阅手册第 192 页

我有以下来源main.tex,其内容除第一页封面外都是空的:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Masters/Doctoral Thesis 
% LaTeX Template
% Version 2.5 (27/8/17)
%
% This template was downloaded from:
% http://www.LaTeXTemplates.com
%
% Version 2.x major modifications by:
% Vel ([email protected])
%
% This template is based on a template by:
% Steve Gunn (http://users.ecs.soton.ac.uk/srg/softwaretools/document/templates/)
% Sunil Patel (http://www.sunilpatel.co.uk/thesis-template/)
%
% Template license:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%----------------------------------------------------------------------------------------
%   PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------

\documentclass[
12pt, % The default document font size, options: 10pt, 11pt, 12pt
%oneside, % Two side (alternating margins) for binding by default, uncomment to switch to one side
english, % ngerman for German
onehalfspacing,
%singlespacing, % Single line spacing, alternatives: onehalfspacing or doublespacing
%draft, % Uncomment to enable draft mode (no pictures, no links, overfull hboxes indicated)
%nolistspacing, % If the document is onehalfspacing or doublespacing, uncomment this to set spacing in lists to single
liststotoc, % Uncomment to add the list of figures/tables/etc to the table of contents
%toctotoc, % Uncomment to add the main table of contents to the table of contents
%parskip, % Uncomment to add space between paragraphs
%nohyperref, % Uncomment to not load the hyperref package
headsepline, % Uncomment to get a line under the header
%chapterinoneline, % Uncomment to place the chapter title next to the number on one line
%consistentlayout, % Uncomment to change the layout of the declaration, abstract and acknowledgements pages to match the default layout
]{MastersDoctoralThesis} % The class file specifying the document structure

\usepackage[utf8]{inputenc} % Required for inputting international characters
\usepackage[T1]{fontenc} % Output font encoding for international characters

\usepackage{mathpazo} % Use the Palatino font by default
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{braket}
\usepackage{bm}
\usepackage{minitoc}
\usepackage{float}
\usepackage{listings}


%\usepackage{placeins}

%\usepackage{graphics}
%\usepackage{epsfig} 
\usepackage{multirow}
\usepackage{rotating}
\usepackage{longtable}
\usepackage{imakeidx}
%\usepackage{hyperref}
\makeindex

\usepackage[backend=bibtex,style=authoryear,natbib=true]{biblatex} % Use the bibtex backend with the authoryear citation style (which resembles APA)

\addbibresource{example.bib} % The filename of the bibliography

\usepackage[autostyle=true]{csquotes} % Required to generate language-dependent quotes in the bibliography

\usepackage[ED=SDU2E-Ast, Ets=UT3]{tlsflyleaf} % Packaged to generate the first page
                                % for UPS
%----------------------------------------------------------------------------------------
%   MARGIN SETTINGS
%----------------------------------------------------------------------------------------

\geometry{
    paper=a4paper, % Change to letterpaper for US letter
    inner=2.5cm, % Inner margin
    outer=3.8cm, % Outer margin
    bindingoffset=.5cm, % Binding offset
    top=1.5cm, % Top margin
    bottom=1.5cm, % Bottom margin
    %showframe, % Uncomment to show how the type block is set on the page
}

%----------------------------------------------------------------------------------------
%   THESIS INFORMATION
%----------------------------------------------------------------------------------------

\thesistitle{\'{E}tude des composantes noires de l'Univers\\ avec la mission
  Euclid} % Your thesis title, this is used in the title and abstract,
          % print it elsewhere with \ttitle
\title{\'{E}tude des composantes noires de l'Univers\\ avec la mission
  Euclid} % Your thesis title, this is used in the title and abstract,
          % print it elsewhere with \ttitle
\defencedate{20 septembre 2018}
\lab{Institut de Recherche en Astrophysique et Plan\'{e}tologie (UMR 5277)}
\nboss{2}
\nreferee{2}
\njudge{8}
\makesomeone{boss}{1}{Prof. Alain \textsc{hard}}{}{Directeur de thèse}
\makesomeone{boss}{2}{Dr. Brahim \textsc{ine}}{}{Co-directeur de thèse}
\makesomeone{referee}{1}{Dr. Sophie \textsc{Hill\'{e}}}{}{Rapporteuse}
\makesomeone{referee}{2}{Prof. Martin \textsc{nz}}{}{Rapporteur}
\makesomeone{judge}{1}{\small Prof. A. \textsc{ard}}{\small Professeur des universités}{\small UPS/IRAP (France)}
\makesomeone{judge}{7}{\small Dr. B. \textsc{ine}}{\small Ma\^{i}tre de conférences}{\small UPS/IRAP (France)}
\makesomeone{judge}{2}{\small Dr. A. \textsc{let}}{\small Directeur de recherche}{\small IPNL (France)}
\makesomeone{judge}{6}{\small Prof. M. \textsc{nz}}{\small Professeur associ\'{e}}{\small UNIGE (Suisse)}
\makesomeone{judge}{5}{\small Dr. T. \textsc{ing}}{\small{\it Reader}}{\small MSSL/UCL (Royaume-Uni)}
\makesomeone{judge}{4}{\small Dr. S. \textsc{ill\'{e}}}{\small Directeur de recherche}{\small LAL (France)}
\makesomeone{judge}{3}{\small Dr. P. \textsc{ba}}{\small {\it Cient\'{i}fico titular}}{\small ICE, IEEC-CSIC (Espagne)}
%\makesomeone{judge}{8}{\small Dr. Y. \textsc{ier}}{\small Astronome}{\small IAP/IRFU (France)}

%\supervisor{Dr. James \textsc{Smith}} % Your supervisor's name, this is used in the title page, print it elsewhere with \supname
%\examiner{} % Your examiner's name, this is not currently used anywhere in the template, print it elsewhere with \examname
%\degree{Doctor of Philosophy} % Your degree name, this is used in the title page and abstract, print it elsewhere with \degreename
\author{Pierre \textsc{Dupont}} % Your name, this is used in the title page and abstract, print it elsewhere with \authorname
%\addresses{} % Your address, this is not currently used anywhere in the template, print it elsewhere with \addressname

%\subject{Biological Sciences} % Your subject area, this is not currently used anywhere in the template, print it elsewhere with \subjectname
%\keywords{} % Keywords for your thesis, this is not currently used anywhere in the template, print it elsewhere with \keywordnames
\university{\href{http://www.univ-tlse3.fr}{Universit\'{e} Toulouse 3
    Paul Sabatier}} % Your university's name and URL, this is used in the title page and abstract, print it elsewhere with \univname
%\department{\href{http://department.university.com}{Department or School Name}} % Your department's name and URL, this is used in the title page and abstract, print it elsewhere with \deptname
%\group{\href{http://researchgroup.university.com}{Research Group Name}} % Your research group's name and URL, this is used in the title page, print it elsewhere with \groupname
%\faculty{\href{http://faculty.university.com}{Faculty Name}} % Your faculty's name and URL, this is used in the title page and abstract, print it elsewhere with \facname

\AtBeginDocument{
\hypersetup{pdftitle=\ttitle} % Set the PDF's title to your title
\hypersetup{pdfauthor=\authorname} % Set the PDF's author to your name
%\hypersetup{pdfkeywords=\keywordnames} % Set the PDF's keywords to your keywords
}

\setstretch{1.175}

\begin{document}

bla bla bla
\end{document}  

但在编译时,我收到以下错误:

编译错误

我不明白,authorname似乎已经定义了。

这里是MastersDoctoralThesis.cls文件:

硕士博士论文

tlsflyleaf.sty文件:

tlsflyleaf.sty

我没有看到双重声明\authorname,如果有人能看到错误,这样通知它就可以了。

编辑@frabjous

第一页是:首页示例

现在,我有两个问题:

  1. 我无法让旧名字消失(即使“ $ grep -ri oldname ”也没有找到任何东西)

  2. 姓氏不是大写的:我尝试了很多方法,但找不到办法。上面的 pastebin 文件中应为:“Antoine DUPONT”(Antoine 为名),DUPOND 为姓氏。

如果有人能帮忙,那就太好了。

答案1

问题是 的第 744 行tlsflyleaf.sty\author{Nom du doctorant},但 way\author是在 中定义的MasterDoctoralThesis.cls,它只能使用一次(因为它用 定义\authorname\newcommand。因此,当您在文档中以实际名称使用它时,就会出现该错误。

很难说谁应该为这场冲突“负责”;这是 的一个非典型定义\author,但一个包中包含对 的调用也很奇怪\author。(还有其他奇怪之处tlsflyleaf.sty:它是一个包裹它不是一个文档类,但它在开始附近使用它…… \ProvidesClass\ProvidesPackage

我猜想该包和文档类实际上并不是设计为一起使用的 — — 或者如果是这样,那么实现得就很差。

您可以修改其中一个文件或者两个文件,但是如果您希望保持它们不变,您可以更改:

\author{Pierre \textsc{Dupont}}

在您自己的 .tex 文件中:

\makeatletter
\renewcommand{\authorname}{Pierre \textsc{Dupont}}
\renewcommand{\@author}{Pierre \textsc{Dupont}}
\makeatother

这将执行与 相同的操作\author,只是用\renewcommand而不是\newcommandfor \authorname,因此您不会收到该错误。

不过,你确定要用小写字母吗?你可以用小写字母吗?(我写论文的时候,不允许用小写字母任何地方,但你的大学可能有所不同。)

相关内容