Theses, Books, Title pagesMasters/Doctoral Thesis-Font style-section and subsection

Classicthesis, Bachelor and Master thesis, PhD, Doctoral degree
Post Reply
aswadson
Posts: 12
Joined: Mon Feb 20, 2017 12:46 pm

Masters/Doctoral Thesis-Font style-section and subsection

Post by aswadson »

Hey everyone,
Hope that everyone have had a good weekend, I am writing to you regarding the font style used in this thesis! The original template uses "Platino" which is good, but due to my school guidelines this needs to be Times roman. I manged to make this change, the problem is that I have to use Arial Black or Arial to the titles in the thesis! I tried to do that but did not succeed, see the below code:

Code: Select all

\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
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{amsmath}
\usepackage{titlesec}
\titleformat{\chapter}{\normalfont\huge\bfseries}{\thechapter}{20pt}{\huge}
%I added this to make the titles Ariel, SART this is the source of the code http://tex.stackexchange.com/questions/96631/how-do-i-set-the-document-body-to-be-times-new-roman-and-section-headings-to-be
\usepackage{fontspec}
\usepackage{xcolor}
\usepackage{titlesec}
\defaultfontfeatures{Ligatures=TeX}
% Set sans serif font to Arial
\setsansfont{Arial}
% Set serifed font to Times New Roman
\setmainfont{Times New Roman}
% Set formats for each heading level
\titleformat*{\section}{\fontsize{16}{18}\bfseries\sffamily}
\titleformat*{\subsection}{\fontsize{14}{16}\bfseries\sffamily}
\titleformat*{\subsubsection}{\fontsize{12}{14}\bfseries\sffamily}
% This is the end of the addition, END 

\usepackage{times} %This is what KTH uses as a font 
\usepackage{mathptmx} %I added this to write the math in the thesis using "Times" font 
%\usepackage{palatino} % Use the Palatino font by default, this is the previous font used for this template 
%\usepackage{cleveref}
\usepackage[backend=bibtex,style=authoryear,natbib=true]{biblatex} % Use the bibtex backend with the authoryear citation style (which resembles APA)
\usepackage{subfig} 

\addbibresource{example.bib} % The filename of the bibliography
\usepackage[autostyle=true]{csquotes} % Required to generate language-dependent quotes in the bibliography


The font style changes but as fast as I start to write I receive the following massage:

Code: Select all

/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.sty:28:
Fatal fontspe
c error: "cannot-use-pdftex"
! 
! The fontspec package requires either XeTeX or LuaTeX.
! 
! You must change your typesetting engine to, e.g., "xelatex" or
! "lualatex"instead of plain "latex" or "pdflatex".
! 
! See the fontspec documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  
                                                  
l.28 \msg_fatal:nn {fontspec} {cannot-use-pdftex}
Could you please help me?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Masters/Doctoral Thesis-Font style-section and subsection

Post by Johannes_B »

You cannot use pdfTeX when you want to have the features of package fontspec. Fontspec only works with XeTeX and LuTeX.

For times, load package tgtermes, for Arial, use package tgheros (which is actually a Helvetica clone).

Whenever a university or thesis offices makes people use Times New Roman and Arial, this is a clear indicator they don't know what they are talking about. If they know the difference between Arial and Helvetica, using package tgheros won't work for you. But if they do know the difference, they have chosen the wrong job.
I would be very very interested to know what they actually mean by Times New Roman and Arial.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
aswadson
Posts: 12
Joined: Mon Feb 20, 2017 12:46 pm

Masters/Doctoral Thesis-Font style-section and subsection

Post by aswadson »

Thanks man :D I tried it although it works but it would be a bit risky to use these two packages! What I will do is to stick with the current Font style and in the worst case scenario I would edit the headers in Adobe pro to change them to Arial! I think the Idea is to encourage the usage of San serif for the Headers/titles and serif fonts for the body and that is why the recommend these two font types, even though it is stupid.

Anyways as always thank you :D :D
aswadson
Posts: 12
Joined: Mon Feb 20, 2017 12:46 pm

Masters/Doctoral Thesis-Font style-section and subsection

Post by aswadson »

I am a bit curious, what would happen if I compiled my project using XeTeX? From what I have read it should be backward compatible, but as it is already well known I am a novice in this matter I would like to hear what your opinion are, besides that, I would like to learn more as I find it very interesting!
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Masters/Doctoral Thesis-Font style-section and subsection

Post by Johannes_B »

Not much.
With XeTeX, you can use the fonts that are installed on your operating system. With pdfTeX, you can only use the few (a lot) fonts that hae been conerted by people for use with LaTeX.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply