# Custom document class, math mode in thesis title

I'm writing my thesis using a custom document class provided by our university vutinfth ( template in overleaf ), the title of the thesis has a few math symbols, which I need them to be bold to match the Title, however when I use \mathbf (in fact any \math... command) I get the error ! Undefined control sequence. And instead of the title: edefYou'reintroublehere.Trytyping<return .....

Unfortunately I'm not equipped to debug this issue, so I would appreciate any help on how I can debug, hack, or figure out a workaround.

here's what I found so far. To set the title of the thesis we use \settitle{}{}, to set an English and a German title, and which is defined as follows:

\newcommand{\settitle}[2]{%
\CreatePolylingual[english=#1,naustrian=#2]{Title}%
}%

such that CreatePolylingual is:

\newcommand{\CreatePolylingual}[2][]{%
\begingroup
\setkeys{vutinfth}{#1}%
\vutinfth@allocate@polylingual{#2}%
\endgroup
\@namedef{vutinfth@polylingual@#2}{%
\vutinfth@selectlanguage@polylingual{#2}}%
}%

Interesting question! Following the chain of commands for a few more levels, the \settitle command ends up defining the names \vutinfth@Title@english for the English title and \vutinfth@Title@naustrian for the German title. There’s a bug that makes this break if you use commands inside the title, but rather than attempt to patch this command, we can just fix it up right after:

\settitle{Incorrect Title}{Incorrect Title} % Sets English and German version of the title (both can be English or German).
\makeatletter
\def\vutinfth@Title@english{\boldmath Why Does the Universe use $$\mathbb{R}^3$$?}
\def\vutinfth@Title@naustrian{\boldmath Why Does the Universe use $$\mathbb{R}^3$$?}
\makeatother

This thesis class does not provide any way to override the formatting of the title other than to insert a new command within it, so I add \boldmath to select the bold version of all math symbols. (One gotcha that might or might not be relevant: for bold symbols such as vectors within bold math, with the bm package, you might need to use \hm{v}.) We need the \makeatletter for LaTeX to accept csnames containing @ in a .tex file. You can write your title in German better than I could, so I’ll spare you any attempt.

We’re not done yet. Earlier up in the preamble, the template calls \hypersetup and sets pdftitle to \thesistitle, which was defined as a placeholder. This needs to be Unicode, not TeX, so we can change this one line to:

pdftitle        = {Why does the Universe Use ℝ³?},         % The document's title in the document properties (optional).

You will need to choose the best approximation to the title you want that you can, without switching to math mode.

Finally, you need to add bold versions of the math-mode symbols you use, so add to the list of packages in the preamble:

\usepackage{bm}  % Improves the appearance of \boldmath and \boldsymbol.
\usepackage[bb=px]{mathalpha}  % A free \mathbb alphabet with a bold version.

You could stick them right before \usepackage{hyperref} if you don’t want the comment about how that has to be second-to-last to go out of date.

Here is a complete version of example.tex from the Overleaf template:

% Copyright (C) 2014-2016 by Thomas Auzinger <thomas@auzinger.name>

\documentclass[draft,final]{vutinfth} % Remove option 'final' to obtain debug information.

% Load packages to allow in- and output of non-ASCII characters.
\usepackage{lmodern}        % Use an extension of the original Computer Modern font to minimize the use of bitmapped letters.
\usepackage[T1]{fontenc}    % Determines font encoding of the output. Font packages have to be included before this line.
\usepackage[utf8]{inputenc} % Determines encoding of the input. All input files have to use UTF8 encoding.

% Extended LaTeX functionality is enables by including packages with \usepackage{...}.
\usepackage{fixltx2e}   % Provides fixes for several errors in LaTeX2e.
\usepackage{amsmath}    % Extended typesetting of mathematical expression.
\usepackage{amssymb}    % Provides a multitude of mathematical symbols.
\usepackage{mathtools}  % Further extensions of mathematical typesetting.
\usepackage{microtype}  % Small-scale typographic enhancements.
\usepackage{enumitem}   % User control over the layout of lists (itemize, enumerate, description).
\usepackage{multirow}   % Allows table elements to span several rows.
\usepackage{booktabs}   % Improves the typesettings of tables.
\usepackage{subcaption} % Allows the use of subfigures and enables their referencing.
\usepackage[ruled,linesnumbered,algochapter]{algorithm2e} % Enables the writing of pseudo code.
\usepackage[usenames,dvipsnames,table]{xcolor} % Allows the definition and use of colors. This package has to be included before tikz.
\usepackage{nag}       % Issues warnings when best practices in writing LaTeX documents are violated.
\usepackage{hyperref}  % Enables cross linking in the electronic document version. This package has to be included second to last.
\usepackage[acronym,toc]{glossaries} % Enables the generation of glossaries and lists fo acronyms. This package has to be included last.
\usepackage{bm}  % Improves the appearance of \boldmath and \boldsymbol.
\usepackage[bb=px]{mathalpha}  % A free \mathbb alphabet with a bold version.

% Define convenience functions to use the author name and the thesis title in the PDF document properties.
\newcommand{\authorname}{Forename Surname} % The author name without titles.
\newcommand{\thesistitle}{Thesis Title} % The title of the thesis. The English version should be used, if it exists.

% Set PDF document properties
\hypersetup{
pdfpagelayout   = TwoPageRight,           % How the document is shown in PDF viewers (optional).
linkbordercolor = {Melon},                % The color of the borders of boxes around crosslinks (optional).
pdfauthor       = {\authorname},          % The author's name in the document properties (optional).
pdftitle        = {Why does the Universe Use ℝ³?},         % The document's title in the document properties (optional).
pdfsubject      = {Subject},              % The document's subject in the document properties (optional).
pdfkeywords     = {a, list, of, keywords} % The document's keywords in the document properties (optional).
}

\setsecnumdepth{subsection} % Enumerate subsections.

\nonzeroparskip             % Create space between paragraphs (optional).
\setlength{\parindent}{0pt} % Remove paragraph identation (optional).

\makeindex      % Use an optional index.
\makeglossaries % Use an optional glossary.
%\glstocfalse   % Remove the glossaries from the table of contents.

% Set persons with 4 arguments:
%  {title before name}{name}{title after name}{gender}
%  where both titles are optional (i.e. can be given as empty brackets {}).
\setauthor{Pretitle}{\authorname}{Posttitle}{female}

% For bachelor and master theses:
\setfirstassistant{Pretitle}{Forename Surname}{Posttitle}{male}
\setsecondassistant{Pretitle}{Forename Surname}{Posttitle}{male}
\setthirdassistant{Pretitle}{Forename Surname}{Posttitle}{male}

% For dissertations:
\setfirstreviewer{Pretitle}{Forename Surname}{Posttitle}{male}
\setsecondreviewer{Pretitle}{Forename Surname}{Posttitle}{male}

% For dissertations at the PhD School:

% Required data.
\setregnumber{0123456}
\setdate{01}{01}{2001} % Set date with 3 arguments: {day}{month}{year}.
\settitle{Incorrect Title}{Incorrect Title} % Sets English and German version of the title (both can be English or German).
%% Workaround for a bug in \settitle:
\makeatletter
\def\vutinfth@Title@english{\boldmath Why Does the Universe use $$\mathbb{R}^3$$?}
\def\vutinfth@Title@naustrian{\boldmath Why Does the Universe use $$\mathbb{R}^3$$?}
\makeatother

\setsubtitle{Optional Subtitle of the Thesis}{Optionaler Untertitel der Arbeit} % Sets English and German version of the subtitle (both can be English or German).

% Select the thesis type: bachelor / master / doctor / phd-school.
% Bachelor:
\setthesis{bachelor}
%
% Master:
%\setthesis{master}
%\setmasterdegree{dipl.} % dipl. / rer.nat. / rer.soc.oec. / master
%
% Doctor:
%\setthesis{doctor}
%\setdoctordegree{rer.soc.oec.}% rer.nat. / techn. / rer.soc.oec.
%
% Doctor at the PhD School
%\setthesis{phd-school} % Deactivate non-English title pages (see below)

% For bachelor and master:
\setcurriculum{Media Informatics and Visual Computing}{Medieninformatik und Visual Computing} % Sets the English and German name of the curriculum.

% For dissertations at the PhD School:
\setfirstreviewerdata{Affiliation, Country}
\setsecondreviewerdata{Affiliation, Country}

% Define convenience macros.
\newcommand{\todo}[1]{{\color{red}\textbf{TODO: {#1}}}} % Comment for the final version, to raise errors.

\begin{document}

\frontmatter % Switches to roman numbering.
% The structure of the thesis has to conform to
%  http://www.informatik.tuwien.ac.at/dekanat

\addtitlepage{naustrian} % German title page (not for dissertations at the PhD School).
\addtitlepage{english} % English title page.

\begin{danksagung*}
\todo{Ihr Text hier.}
\end{danksagung*}

\begin{acknowledgements*}
\todo{Enter your text here.}
\end{acknowledgements*}

\begin{kurzfassung}
\todo{Ihr Text hier.}
\end{kurzfassung}

\begin{abstract}
\todo{Enter your text here.}
\end{abstract}

% Select the language of the thesis, e.g., english or naustrian.
\selectlanguage{english}

\tableofcontents % Starred version, i.e., \tableofcontents*, removes the self-entry.

% Switch to arabic numbering and start the enumeration of chapters in the table of content.
\mainmatter

\chapter{Introduction}
\todo{Enter your text here.}

\todo{Enter your text here.}

% Remove following line for the final thesis.
\input{intro.tex} % A short introduction to LaTeX.

\backmatter

% Use an optional list of figures.
\listoffigures % Starred version, i.e., \listoffigures*, removes the toc entry.

% Use an optional list of tables.
\listoftables % Starred version, i.e., \listoftables*, removes the toc entry.

% Use an optional list of alogrithms.
\listofalgorithms