Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want do define a project name somewhere and use it all through my document – but I get problems when trying to use my project name in the document title which should be quite big, so I tried this way:

\newcommand{\projectName}{MyProject}

...

\begin{titlepage}
\begin{center}

\HRule \\[1.2cm] % horizontal line
{\huge \bfseries \projectName{}}\\[0.5cm] % title
\HRule \\[1.5cm] % Horizontal line

\end{center}
\end{titlepage}

But what I get when I try to set the file is the following:

./TitlePage.tex:lineNumberWhereProjectNameIsUsed: Undefined control sequence.

Does anyone know what I do wrong or how I can solve this?

Thanks in advice for all helpers!

EDIT: Here's the full main .tex files content (in which the TitlePage.tex above is included):

\documentclass[11pt, a4paper, oneside]{Thesis} % Paper size, default font size and one-sided paper

\graphicspath{{./Pictures/}} % Specifies the directory where pictures are stored

\usepackage[square, numbers, comma, sort&compress]{natbib} % Use the natbib reference package - read up on this to edit the reference style; if you want text (e.g. Smith et al., 2012) for the in-text references (instead of numbers), remove 'numbers' 
\hypersetup{urlcolor=blue, colorlinks=true} % Colors hyperlinks in blue - change to black if annoying
\usepackage[ngerman]{babel}     % Sprachen
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[german]{varioref}
\hyphenation{}
% adding glossary functionality
\usepackage{hyperref}
\usepackage[toc]{glossaries}
\makeglossaries
\input{./GlossaryEntries} 
% only showing chapters and sections in table of contents
\setcounter{tocdepth}{1}


\begin{document}
\selectlanguage{ngerman}    % set language to german

\frontmatter % Use roman page numbering style (i, ii, iii, iv...) for the pre-content pages

\setstretch{1.3} % Line spacing of 1.3

% Define the page headers using the FancyHdr package and set up for one-sided printing
\fancyhead{} % Clears all page headers and footers
\rhead{\thepage} % Sets the right side header to show the page number
\lhead{} % Clears the left side page header

\pagestyle{fancy} % Finally, use the "fancy" page style to implement the FancyHdr headers

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} % New command to make the lines in the title page

%----------------------------------------------------------------------------------------
%   TITLE PAGE
%----------------------------------------------------------------------------------------

\include{TitlePage}

\end{document}  
share|improve this question
1  
We really need to see a fully compilable example (starting \documentclass and finishing \end{document}) –  Joseph Wright Nov 12 '12 at 20:10
    
There you are, I've added a fully compilable example. –  CGee Nov 12 '12 at 20:17
1  
Sorry, but the FunctSpec class is unknown to me. –  egreg Nov 12 '12 at 20:18
    
Does it help, when I quote the following from the file header: This is file `Thesis.cls', based on 'ECSthesis.cls', by Steve R. Gunn. (I only changed its name to fit to the project. I've edited the question with the correct name.) –  CGee Nov 12 '12 at 20:19
1  
@Dschee: You really should eliminate anything that is not required to reproduce the problem to get the M part of MWE. First try article class to see if the problem is still there, and then start removing packages... –  Peter Grill Nov 12 '12 at 20:25
add comment

1 Answer

It looks like you are using this thesis template. A minimal working example of what you want is:

\documentclass[11pt,a4paper,oneside]{Thesis}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

\begin{document}

\newcommand{\projectName}{MyProject}

\begin{titlepage}
\begin{center}

\HRule \\[1.2cm]
{\huge \bfseries \projectName{}}\\[0.5cm]
\HRule \\[1.5cm]

\end{center}
\end{titlepage}

\end{document}

which produces a page containing

Sample output

Placing this in your code example and only commenting out the line \input{./GlossaryEntries} gives the file below that compiles without problem and produces a similar result.

\documentclass[11pt, a4paper, oneside]{Thesis} % Paper size, default font size and one-sided paper

\graphicspath{{./Pictures/}} % Specifies the directory where pictures are stored

\usepackage[square, numbers, comma, sort&compress]{natbib} % Use the natbib reference package - read up on this to edit the reference style; if you want text (e.g. Smith et al., 2012) for the in-text references (instead of numbers), remove 'numbers' 
\hypersetup{urlcolor=blue, colorlinks=true} % Colors hyperlinks in blue - change to black if annoying
\usepackage[ngerman]{babel}     % Sprachen
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[german]{varioref}
\hyphenation{}
% adding glossary functionality
\usepackage{hyperref}
\usepackage[toc]{glossaries}
\makeglossaries
%\input{./GlossaryEntries} 
% only showing chapters and sections in table of contents
\setcounter{tocdepth}{1}


\begin{document}
\selectlanguage{ngerman}    % set language to german

\frontmatter % Use roman page numbering style (i, ii, iii, iv...) for the pre-content pages

\setstretch{1.3} % Line spacing of 1.3

% Define the page headers using the FancyHdr package and set up for one-sided printing
\fancyhead{} % Clears all page headers and footers
\rhead{\thepage} % Sets the right side header to show the page number
\lhead{} % Clears the left side page header

\pagestyle{fancy} % Finally, use the "fancy" page style to implement the FancyHdr headers

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} % New command to make the lines in the title page

%----------------------------------------------------------------------------------------
%   TITLE PAGE
%----------------------------------------------------------------------------------------

\newcommand{\projectName}{MyProject}

\begin{titlepage}
\begin{center}

\HRule \\[1.2cm] % horizontal line
{\huge \bfseries \projectName{}}\\[0.5cm] % title
\HRule \\[1.5cm] % Horizontal line

\end{center}
\end{titlepage}

\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.