phd-thesis-template icon indicating copy to clipboard operation
phd-thesis-template copied to clipboard

Problem with Spanish Babel

Open jeliaslm opened this issue 7 years ago • 3 comments

I have had problems trying to use \usepackage[spanish]{babel}

jeliaslm avatar Oct 28 '18 19:10 jeliaslm

And what problems did you have?

johannesbottcher avatar Feb 24 '19 06:02 johannesbottcher

I'm also having problem with both spanish and portuguese babel. Without changing anything in the template, a lot of errors start appearing in the .out file just by adding the babel package to any of those languages.

The problem seems to be with the presence of some specific characters in the \appendixname command. For example, a simple: \renewcommand{\appendixname}{ê} or \renewcommand{\appendixname}{é} in the template file will already spawn 18 errors in the overleaf environment.

frones avatar Feb 06 '20 20:02 frones

There is a conflict between the appendix and babel environments, see Conflict between appendix, bookmark, hyperref and magyar babel due to utf8 chars.

The answer suggests that the appendix package maintainer needs to change the definition of \appendixname

The first thing to do is to ensure that \usepackage[spanish,portuguese]{babel} appears above \RequirePackage[title,titletoc]{appendix} in the class file (phDThesisPSnPDF.cls line 259). Then add the code fix from the above answer to the bottom of the class file, you'll still be left with a couple of warnings to deal with from the babel package. I.e. add this to the bottom of phDThesisPSnPDF.cls.

\renewcommand{\@resets@pp}{\par
  \@ppsavesec
  \stepcounter{@pps}
  \setcounter{section}{0}%
  \if@chapter@pp
    \setcounter{chapter}{0}%
    \renewcommand\@chapapp{\appendixname}%
    \renewcommand\thechapter{\@Alph\c@chapter}%
  \else
    \setcounter{subsection}{0}%
    \renewcommand\thesection{\@Alph\c@section}%
  \fi
  \if@pphyper
    \if@chapter@pp
      \renewcommand{\theHchapter}{\theH@pps.\Alph{chapter}}%
    \else
      \renewcommand{\theHsection}{\theH@pps.\Alph{section}}%
    \fi
    \xdef\Hy@chapapp{\Hy@appendixstring}% <- changed appendixname to \Hy@appendixstring
  \fi
  \restoreapp
}
\renewcommand{\@resets@ppsub}{\par
  \stepcounter{@pps}
  \if@chapter@pp
    \setcounter{section}{0}
    \renewcommand{\thesection}{\setthesection}
  \else
    \setcounter{subsection}{0}
    \renewcommand{\thesubsection}{\setthesubsection}
  \fi
  \if@pphyper
    \if@chapter@pp
      \renewcommand{\theHsection}{\theH@pps.\setthesection}%
    \else
      \renewcommand{\theHsubsection}{\theH@pps.\setthesubsection}%
    \fi
    \xdef\Hy@chapapp{\Hy@appendixstring}% <- changed appendixname to \Hy@appendixstring
  \fi
}

GR8DAN avatar Feb 08 '20 11:02 GR8DAN