4

I have tried to do a front page to my thesis using mdframe after have read it here. Here it was I have done so far but I am stuck. How do I get the frame over the whole left page and how do a get a picture in the center right of the page? What is the style for the text?

In the figure below is the template that I try to recreate in latex. Please help me to finish it.

\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{color}
\usepackage{mdframed}

\usepackage[top=3cm, bottom=3cm,
        inner=3cm, outer=3cm]{geometry}


\definecolor{BackgrondColor}{cmyk}{0,0.031,0.154,0.110}


\begin{document}

\mdfsetup{backgroundcolor=BackgrondColor}
\begin{mdframed}
\vspace{3cm}
\begin{flushright}
\huge Title\\
\vspace{7cm}
\uppercase{Name1}\\
\uppercase{Name2}\\
\vspace{5cm}
Master of Science Thesis\\

\end{flushright}
\end{mdframed}
\thispagestyle{empty}

\end{document}

This looks like:

enter image description here

But it should look like: enter image description here

  • 1
    Have you checked whether your institution has a template for this? Many do. – David Richerby May 29 '15 at 16:29
5

Use a box as tall as the page height:

\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{color}

\usepackage[top=3cm, bottom=3cm,
        inner=3cm, outer=3cm]{geometry}


\definecolor{BackgroundColor}{cmyk}{0,0.031,0.154,0.110}


\begin{document}

\noindent
\colorbox{BackgroundColor}{%
  \parbox[c][\dimexpr\textheight-2\fboxsep][s]{\dimexpr\textwidth-4cm}{%
    \vspace*{3cm}
    \raggedleft\sffamily
    {\huge Title\\}
    \vfill
    \MakeUppercase{Name1}\\
    \MakeUppercase{Name2}\\
    \vfill
    Master of Science Thesis\\
    Stockholm, Sweden, 2015
    \vspace{3cm}
  }% end of \parbox
}% end of \colorbox
\hfill
\raisebox{-.5\height}{%
  \includegraphics[width=3cm,height=3cm]{example-image}% the logo
}

\thispagestyle{empty}

\end{document}

enter image description here

  • Have a look at: tex.stackexchange.com/questions/31705/… And a % after 2015 fixes the indent – Daniel Schlegel May 29 '15 at 11:19
  • Hey! Thanks for quick answer. Is it possible to get the colorbox out to the page line? So fill the whole paper to the left, right and left? I tried to use pagehight instead but did not worked. I added a figure over the template, it is possible to achieve that? – Jocken May 29 '15 at 11:19
  • @Latex Maybe you want \pagecolor{BackgroundColor}? – egreg May 29 '15 at 11:44
  • Thanks for all answers! I have now fixed it using \newgeometry. Now it is another problem.... There should be two title pages, one on English and one page with Swedish title. But the second title page looks different, the size of the colorbox is not equal and I don't understand why. Looks like the whole page is indented... :( – Jocken May 29 '15 at 11:53
  • @egreg: Super answer. I just modified the geometry to get the colorbox over almost the whole page. But now I got a really annoying problem. I need two title pages, one on english and one on swedish but the second one title page looks like it is indented, why? I just copy your code and place it under each other... – Jocken May 29 '15 at 17:11
2

Here is another suggestion using scrlayer with a new declared layer page style for the title page. Note that for the headers and footers on the other pages any other package (eg. fancyhdr) can be used.

enter image description here

\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{graphicx}
\usepackage{color}
\usepackage[margin=3cm]{geometry}

\definecolor{BackgrondColor}{cmyk}{0,0.031,0.154,0.110}
\newcommand\bgwidth{.7\paperwidth}% width of the colored background
\newcommand\bgtextsep{1.25cm}% sep text -- right border background
\newcommand\titlenamesep{9cm}% sep title -- names

\usepackage{scrlayer}
\DeclarePageStyleByLayers{titlepage}{titlepage.bg,titlepage.fg}
\DeclareNewLayer[
  background,
  area={0pt}{0pt}{\bgwidth}{\paperheight},
  contents={{\color{BackgrondColor}\rule{\layerwidth}{\layerheight}}}
]{titlepage.bg}
\makeatletter
\DeclareNewLayer[
  foreground,
  textarea,
  hoffset=0pt,
  width={\dimexpr\bgwidth-\bgtextsep\relax},
  contents={\parbox[c][\layerheight]{\layerwidth}{\raggedleft\sffamily\bfseries\Large%
      {\huge \@tptitle\\}%
      \vspace{\titlenamesep}
      \MakeUppercase{Name1}\\
      \MakeUppercase{Name2}%
        \makebox[0pt][l]{\hspace*{\bgtextsep}%
          \parbox{\dimexpr\paperwidth-\bgwidth\relax}{\centering
            \raisebox{-.5\height}[0pt][0pt]{%
              \includegraphics[width=4cm,height=4cm]{example-image}%
        }}}%
      \\%
      \vfill
      {\Large\mdseries Master of Science Thesis\\
        Stockholm, Sweden, 2008%
      }
  }}
]{titlepage.fg}
\newcommand\@tptitle{Title}
\newcommand\tptitle[1]{\def\@tptitle{#1}\mbox{}\thispagestyle{titlepage}\cleardoublepage}
\makeatother

\usepackage{fancyhdr}% only to show that it works with fancyhdr
\pagestyle{fancy}% only to show that it works with fancyhdr
\usepackage[nonumberlist]{glossaries}% only to show that it works with this package

\usepackage{mwe}% example-image and dummy text
\begin{document}
\tptitle{English title}
\tptitle{Swedish title}
%
\blinddocument
\end{document}
  • This looks AWESOME!!! I want to use this method! BUT, when I use this in my BIG document i got several errors. Some of my own setting seems to crash the whole thing... :( – Jocken May 29 '15 at 13:56
  • Remove the lines \usepackage{fancyhdr}\pagestyle{fancy} and of course \usepackage{mwe} and try then. I have inserted this lines to show that fancyhdr can be used together with scrlayer. – esdd May 29 '15 at 15:27
  • After some work I found that the \usepackage[nonumberlist]{glossaries} is the bad boy. When I remove the line it works like a charm. Otherwise I got several wrong messages and it wont compile. – Jocken May 29 '15 at 16:52
  • I have changed the code. Now it works with \usepackage[nonumberlist]{glossaries}. The problem were the \par commands inside the contents of the titlepage.fg layer. Additinally I have removed the small white margins at top and bottom. (I do not know if they should be there or not.) – esdd May 29 '15 at 19:04
2

I have a simple solution to your problem. Use the already existing template from our university. All you have to do is to change the text under the logo.

Example from the website: Thesis

Good luck with your thesis, I'm glad your using LaTeX :)


You mentioned two problems in your comment, how to get two authors and how to get two titlepages. When using the normal \author{} and \maketitle commands, you can simply write \author{Name1 \\ Name2} to get two authors. This doesn't work for the \iauthor command they provide in the template (I haven't been able to figure out why). Therefore, the easiest way is to define a command for a co-author, \icoauthor{} for example.

Add the definition at the appropriate places in the .sty file:

\newcommand\@icoauthor{}

and

\newcommand{\icoauthor}[1]{%
\renewcommand\@icoauthor{#1}%
}

(You can also add the shorter version \def\coauthor#1{\gdef\@coauthor{#1}})

And then find these lines in the .sty file:

 {
 \fontsize{14}{18}\selectfont%
   \rightline{\MakeUppercase{\@iauthor}}%
 }%

and add, right below them:

 {
 \fontsize{14}{18}\selectfont%
   \rightline{\MakeUppercase{\@icoauthor}}%
 }%

To get two titlepages, we can simply do the \makeititle twice and change the language and title in between. This wouldn't work for the normal \maketitle command cause it is programmed to "forget" the \maketitle definition after it is used.

Code:

\documentclass[sve,a4paper]{article}
\usepackage[exjobb]{KTHEEtitlepage}
\usepackage[cp1252]{inputenc}
\begin{document}
\ititle{Intressant Rapport}
%\isubtitle{My Subtitle} % Optional
\idate{Februari 2006}
\irefnr{TRITA-EE 2006:666}
\iauthor{Förnamn Efternamn}
\icoauthor{Ett till namn}
\makeititle
\newpage
\makeatletter
\@engtrue
\makeatother
\ititle{A Very Interesting Report}
%\isubtitle{My Subtitle} % Optional
\idate{February 2006}
\irefnr{TRITA-EE 2006:666}
\iauthor{Firstname Lastname}
\icoauthor{Another Name}
\makeititle
\end{document} 

This gives you the Swedish titlepage first and sets the language for the rest of the report to English.

Here's the full, slightly modified version of the KTHEEtitlepage.sty:

%
% DESCRIPTION: Style file to add a title page for masters thesis,
%              licentiate, doctoral thesis and internal reports
%              according to the central KTH design, but with a EE
%              logo.
%%
% OPTIONS:
%       eng:            English text in the logo
%       sve/swe:        Swedish text in the logo
%       forPrint:       Gives a titlepage in black and white
%                       (without any logo for the thesis formats)
%       forWWW:         Gives titlepage in color with logo, intended
%                       for web publishing.
%       ireport:        Internal report
%       exjobb:         master thesis report
%       lic:            licentiate thesis report
%       doktor:         PhD thesis report
%       
%       Default is exjobb, eng and forWWW.
%
% COMMANDS:    \ititle{}, \isubtitle{}, idate{}, \irefnr{}, \iaddress{}
%              and \makeititle.
%
% USAGE:       \usepackage{KTHEEtitlepage},
%              \usepackage[ireport,sve,forPrint]{KTHEEtitlepage}
%              \begin{document}
%                \ititle{My Title}
%                \isubtitle{My Subtitle} % Optional
%                \idate{March 2004}
%                \irefnr{}
%                \iaddress{} % Only for ireports!
%                \makeititle
%                ... % The rest of the document
%
% LIMITATIONS: Currently only supports A4 paper size in a reasonable way.
%
% AUTHORS:     Elisabet Molin, Mats Bengtsson, S3, KTH
%
% DATE:        040921
%
% Updated:      060503 Support for ireport, lic and doktor /mabe
%               060807 Renamed to KTHEEtitlepage, added \submittedIEEE
%                      and \publishedIEEE /mabe
%               061006 Fixed problem if \subtitle wasn't set in
%                      ireport /mabe
%               061010 forPrint now gives B&W logo for ireport and
%                      the title page is now centered even if the
%                      remaining document isn't. Check if the babel
%                      package is used to select swedish. /mabe
%
%******************************************************************************
% Identification
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{KTHEEtitlepage}[2004/09/21 KTH EE titlepage package]
\ProvidesFile{here_the_logos}[2004/09/21 KTH logo English, BW]
\ProvidesFile{here_the_logos}[2004/09/21 KTH logo Swedish, BW]
\ProvidesFile{here_the_logos}[2004/09/21 KTH logo Swedish, colour]
\ProvidesFile{here_the_logos}[2004/09/21 KTH logo Swedish, colour]


% define new booleans for options
\newif\if@eng
\newif\if@sve
\newif\if@colour
\newif\if@ireport
\newif\if@exjobb
\newif\if@lic
\newif\if@doktor

% Default options:
\@engtrue
\@svefalse
\@colourtrue
\@exjobbtrue

% declare options
\DeclareOption{eng}{\@engtrue}
\DeclareOption{sve}{\@svetrue\@engfalse}
\DeclareOption{swe}{\@svetrue\@engfalse}
\DeclareOption{forWWW}{\@colourtrue}
\DeclareOption{forPrint}{\@colourfalse}
\DeclareOption{notitlepage}{\OptionNotUsed}
\DeclareOption{ireport}{\@ireporttrue\@exjobbfalse\@licfalse\@doktorfalse}
\DeclareOption{exjobb}{\@ireportfalse\@exjobbtrue\@licfalse\@doktorfalse}
\DeclareOption{lic}{\@ireportfalse\@exjobbfalse\@lictrue\@doktorfalse}
\DeclareOption{doktor}{\@ireportfalse\@exjobbfalse\@licfalse\@doktortrue}

\ProcessOptions\relax

% babel setting overrides the language set here!
\AtBeginDocument{\@ifpackageloaded{babel}{\iflanguage{swedish}{\@svetrue\@engfalse}{}}{}}

% automatic graphics switching
\RequirePackage{graphicx,color} % for inserting the logos and
                                % the background

\RequirePackage{calc} % for the layout calculations

\newcommand\@ititle{}
\newcommand\@isubtitle{}
\newcommand\@iauthor{}
\newcommand\@icoauthor{}
\newcommand\@idate{}
\newcommand\@irefnr{}
\newcommand\@iaddress{}
\newcommand\@inotice{}

\newcommand{\ititle}[1]{%
  \renewcommand\@ititle{#1}%
}
\newcommand{\isubtitle}[1]{%
  \renewcommand\@isubtitle{#1}%
}
\newcommand{\iauthor}[1]{%
  \renewcommand\@iauthor{#1}%
}
\newcommand{\icoauthor}[1]{%
  \renewcommand\@icoauthor{#1}%
}
\newcommand{\idate}[1]{%
  \renewcommand\@idate{#1}%
}
\newcommand{\irefnr}[1]{%
  \renewcommand\@irefnr{#1}%
}
\newcommand{\iaddress}[1]{%
  \renewcommand\@iaddress{#1}%
}


\newcommand{\submittedIEEE}[1]{\renewcommand{\@inotice}{
    This work has been submitted to the IEEE for possible
    publication. Copyright may be transferred without notice, after
    which this version may no longer be accessible.}}
\newcommand{\publishedIEEE}[1]{\renewcommand{\@inotice}{
    \copyright{} #1 IEEE. Personal use of this material is
    permitted. However, permission to reprint/republish this material
    for advertising or promotional purposes or for creating new
    collective works for resale or redistribution to servers or lists,
    or to reuse any copyrighted component of this work in other works
    must be obtained from the IEEE.}}

\newcommand{\displayKTHlogo}{%
\if@eng
\if@colour
  \includegraphics[width=32mm]{kth_cmyk_electr_engine}%
\else
  \if@ireport
    %% Black white
    \includegraphics[width=32mm]{kth_svv_electr_engine}%
  \else% No logotype
  \mbox{}
  \fi
\fi
\else\if@sve%
\if@colour%
  \includegraphics[width=32mm]{kth_cmyk_elektro_systemtek}%
\else%
  \if@ireport%
    %% Black white
    \includegraphics[width=32mm]{kth_svv_elektro_systemtek}%
  \else% No logotype
  \mbox{}%
  \fi
\fi
\fi\fi
}

% Page layout
%\geometry{left=25mm,right=66mm,top=30mm,bottom=28mm,marginparsep=12mm,includemp=false,noheadfoot}

\newlength{\titlep@getextwidth}
\setlength{\titlep@getextwidth}{12cm}
\newlength{\titlep@gewhitemargin}
\setlength{\titlep@gewhitemargin}{54mm}
\newlength{\titlep@geleftmargin}
\setlength{\titlep@geleftmargin}{27mm}
\newlength{\titlep@gemarginsep}
\setlength{\titlep@gemarginsep}{9mm}
\newlength{\titlep@getextheight}
\setlength{\titlep@getextheight}{240mm}
\newlength{\titlep@getopmargin}
\setlength{\titlep@getopmargin}{35mm}
\newlength{\tmpl@ngth}%

\def\makeititle{
  \begingroup
  \if@twocolumn 
  \onecolumn \m@keititle \twocolumn
  \else \newpage
  \global\@topnum\z@ \m@keititle \fi
  \endgroup
  \setcounter{footnote}{0}
  \thispagestyle{empty}
  \setcounter{page}{0} \newpage\pagecolor{white}
  \if@twoside 
  \setcounter{page}{0}\thispagestyle{empty}\cleardoublepage
  \fi
%  \let\makeititle\relax
%  \let\@makeititle\relax
%  \gdef\@iauthor{}\gdef\@ititle{}
}

\newcommand{\m@keititle}{%
  \if@ireport%
    \m@keireportititle%
  \else%
    \m@kethesisititle%
  \fi%
}

% this is the new style for the title page of ireports
\newcommand\m@keireportititle{%
  % Move so the minipage of widht linewidth is centered.
  % \paperwidth = 1in + \hoffset + "leftmargin" + "rightmargin"
  \setlength{\tmpl@ngth}{.5\linewidth-.5\paperwidth+\hoffset+1in}%
  \if@twoside%
    \addtolength{\tmpl@ngth}{\evensidemargin}%
  \else%
    \addtolength{\tmpl@ngth}{\oddsidemargin}%
  \fi%
  \noindent\hspace*{-\tmpl@ngth}%
  \makebox[0pt][l]{\begin{minipage}[t][\textheight]{\linewidth}%
  \sffamily%
  \begin{center}
    \displayKTHlogo \vfill
    \sffamily%
    \fontsize{20}{25}\selectfont\@ititle\\[5mm]
    \fontsize{10}{12}\selectfont\mbox{}\@isubtitle\\[5mm]
    \textit{\@inotice}\vfill
    \fontsize{14}{18}\selectfont\MakeUppercase{\@iauthor}
    %\ifx\@icoauthor\@empty\else%
    \fontsize{14}{18}\selectfont\MakeUppercase{\@icoauthor}%\par\fi%
    \vfill\vfill\vfill
    \fontsize{14}{18}\selectfont%
    Stockholm \@idate\\
    \rule{\linewidth}{1pt}
    \@iaddress\\[5mm]
  \end{center}
  \fontsize{14}{18}\selectfont%
  \@irefnr
\end{minipage}}
}

% this is the new style for the title page of theses
\newcommand\m@kethesisititle{%
  \if@colour%
    \if@exjobb%
    \pagecolor[cmyk]{0,0.02,0.15,0.02}%
    \fi%
    \if@lic%
    \pagecolor[cmyk]{0,0,0,0.27}%
    \fi%
    \if@doktor%
    \pagecolor[cmyk]{1,0.55,0,0}%
    \fi%
  \fi%
  \def\thefootnote{\fnsymbol{footnote}}%
  \def\@makefnmark{\hbox to 0pt{$^{\@thefnmark}$\hss}}%
  %
  % Move to the top of the page
  \setlength{\tmpl@ngth}{-\voffset-\topmargin-\headheight-\headsep-1in-2\baselineskip}%
%  \mbox{}\vskip\tmpl@ngth%
  \vspace*{\tmpl@ngth}%
  %
  % Move to \titlep@geleftmargin from the left edge of the paper
  \setlength{\tmpl@ngth}{\titlep@geleftmargin-\hoffset-1in}%
  \if@twoside%
    \addtolength{\tmpl@ngth}{-\evensidemargin}%
  \else%
    \addtolength{\tmpl@ngth}{-\oddsidemargin}%
  \fi%
  \noindent\mbox{}\hspace*{\tmpl@ngth}%
  %
  % Fool LaTeX into beleiving that the contents doesn't
  %  occupy any space 
  \raisebox{0pt}[0pt][0pt]{\rlap{\mbox{%
        \if@exjobb\relax\else%
        \color{white}%
        \fi%
        % The text
        \begin{minipage}[t][296mm]{\titlep@getextwidth}%
          \vspace*{\titlep@getopmargin}%
          \sffamily%
          \raggedleft%
          \parbox[b][96mm]{\linewidth}{%
            \raggedleft\fontsize{20}{25}\selectfont\@ititle\vfill
            %
            \fontsize{10}{12}\selectfont\@isubtitle\vfill
         }
         {
         \fontsize{14}{18}\selectfont%
           \rightline{\MakeUppercase{\@iauthor}}%
         }%
         {
         %\ifx\@icoauthor\@empty\else%
        \fontsize{14}{18}\selectfont%
          \rightline{\MakeUppercase{\@icoauthor}}%\par\fi%
         }%
         \vfill%
         \parbox[b][30mm]{\linewidth}{%
           \raggedleft\fontsize{14}{18}\selectfont{}%
           \if@eng%
             \if@exjobb%
               Master's Degree Project\\
               Stockholm, Sweden \@idate
             \fi
             \if@lic
               Licentiate Thesis\\
               Stockholm, Sweden \@idate
             \fi
             \if@doktor
               Doctoral Thesis\\
               Stockholm, Sweden \@idate
             \fi
           \else\if@sve
             \if@exjobb
               Examensarbete\\
               Stockholm, Sverige \@idate
             \fi
             \if@lic
               Licentiatavhandling\\
               Stockholm, Sverige \@idate
             \fi
             \if@doktor
               Doktorsavhandling\\
               Stockholm, Sverige \@idate
             \fi
           \fi\fi
         }
%        
         \vskip1.5cm
         {\fontsize{11}{14}\selectfont{}\@irefnr}
         \vspace{28mm}
      \end{minipage}%
      \hspace{\titlep@gemarginsep}%
      %
      % The margin
      %
      \begin{minipage}[t]{\titlep@gewhitemargin}%
        \raisebox{0pt}[0pt][0pt]{%
          \setlength{\fboxsep}{0pt}%
          % Add some extra height to avoid a yellow line at the bottom
          \colorbox{white}{\parbox[t][310mm]{\linewidth}{%
              \vspace*{120mm}
              \centering\displayKTHlogo\\
              \vfill}}}
      \end{minipage}
    }}
  }
}
  • Hello! Yes, I had that template but I had two simple problem, and a want to learn more latex. The problem I had was the name, I do this thesis with a friend and I want the names stand like in the template i showed and I need two pages, one in eng and one in swedish. The template that the provide was too complex so i did not understand the code so I was unable to edit it to get what i want – Jocken May 29 '15 at 14:34
  • @Latex No need for certain means of expression. – azetina May 29 '15 at 15:34
  • @Jocken you mentioned two problems, how to get two titlepages and how to show both authors. I'll edit my answer and deal with these problems. – Grimler May 29 '15 at 21:38
  • @Grimler Thanks for the AWESOME answer! It was very educational and easy to follow, so thanks again for your time, unfortunately I have handed in the thesis already with another solution. But I really appreciates your help for following problems :D – Jocken May 31 '15 at 22:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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