2

In the preamble of my thesis, I get the following error, when I write \newpage:

Undefined control sequence. LaTex Error: File ´' not found.

Note that I have 2 x \newpage in the code below, but it's only the second of these that creates a problem. I have tried to write \clearpage instead, but this gives the same answer.

Can anyone see what might have caused the error?

\documentclass[oneside]{article}

%%%% packages \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[english]{babel} \usepackage{blindtext} \usepackage{footnote} \usepackage{csquotes} \usepackage{eso-pic} \usepackage[dvipdfm]{graphicx} \usepackage{bmpsize} \usepackage[a4paper, hmargin={2.5cm, 3cm}, vmargin={3cm, 3cm}]{geometry} \usepackage{fancyhdr} \graphicspath{ {figures/} } \usepackage{array} \usepackage[titletoc]{appendix} \usepackage{tcolorbox} \usepackage{tabularx} \usepackage{multirow} \usepackage{topcapt} \usepackage{marginnote} \usepackage{threeparttable} \usepackage[font=small,format=plain,labelfont=bf,textfont=normal,justification=justified,singlelinecheck=false]{caption} \usepackage{booktabs} \usepackage{amsmath} \usepackage{setspace} \usepackage{parskip} \usepackage{float} \usepackage{wrapfig} \usepackage[style=apa, citestyle=apa, sorting=nyt ]{biblatex} \addbibresource{Biblo.bib}

\pagestyle{fancy} \usepackage{etoolbox}\apptocmd\appendix{\pretocmd\section{\clearpage}{}{}}{}{} \usepackage{subfiles}

% commands \setstretch{1.25} \newcommand{\margmod}[1]{\marginnote{\setstretch{.5}\parbox[t]{\marginparwidth}{\raggedright\emph{#1}}}}

\author{ \LARGE{My name} \ \vspace{0cm} \ {Academic Supervisor: Supervisor name} \ \vspace{.5cm} \ }

\title{ \vspace{3mm} \Huge{Master's Thesis}\ \vspace{18mm} \LARGE{Name of thesis} \vspace{90mm} }

\date{February 2022}

%%%% Layout style \linespread{1.5} \fancyhead[L]{} \fancyhead[R]{\slshape \rightmark} \setlength{\parskip}{1em}

\usepackage{tikz} \usetikzlibrary{calc,matrix} \usepackage{lipsum} \newcommand{\Maroonunderline}[1]{{\color{Maroon}\underline{{\color{black}#1}}}} \definecolor{Maroon_1}{RGB}{144,26,30}

%%%% Frontpage layout \begin{document} \pagenumbering{roman}

\AddToShipoutPicture{\put(0,602){\includegraphics[viewport=0 600 700 1600]{\ColourPDF}}} % adds frontpage image \AddToShipoutPicture{\put(0,0){\includegraphics{\TitlePDF}}}

\thispagestyle{empty}

\newpage % This one doesn't create any trouble

%%%% Meta info \begin{table}[!ht] \begin{tabular}{lll} \vspace{5mm} \textbf{University} & & {University of Copenhagen} \ \vspace{5mm} \textbf{Name of Department} & & {Department of Political Science} \ \vspace{5mm} \textbf{Study Programme} & & {Master of Science (MSc) in Political Science} \ \vspace{5mm} \textbf{Author} & & {My name} \ \vspace{5mm} \textbf{Student ID} & & {My student ID} \ \vspace{5mm} \textbf{Academic Supervisor} & & {Supervisor name} \

\textbf{Title} & & {Title of thesis} \ % \vspace{5mm} %\textbf{Subtitle} & & {Subtitle} \ %\vspace{5mm} \ \textbf{Date of Submission} & & {March 20, 2021} \ % \vspace{5mm} \ \textbf{ECTS} & & {30} \ \end{tabular} \end{table}

\newpage % This line creates the problem


Updated code and picture of issue with graphics issue (based on answer to samcarter_is_at_topanswers):

%%%% Packages
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{footnote}
\usepackage{csquotes}
\usepackage[style=apa, citestyle=apa, sorting=nyt ]{biblatex}
\addbibresource{Biblo.bib}
\usepackage{eso-pic}
\usepackage{graphicx}
\usepackage[a4paper, hmargin={2.5cm, 3cm}, vmargin={3cm, 3cm}]{geometry}
\usepackage{fancyhdr}
\graphicspath{ {figures/} }
\usepackage{array}
\usepackage[titletoc]{appendix}
\usepackage{tcolorbox}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{marginnote}
\usepackage{threeparttable}
\usepackage[font=small,format=plain,labelfont=bf,textfont=normal,justification=justified,singlelinecheck=false]{caption}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{parskip}
\usepackage{float}
\pagestyle{fancy}
\usepackage{etoolbox}\apptocmd\appendix{\pretocmd\section{\clearpage}{}{}}{}{}
\usepackage{subfiles}

% Extra packages \usepackage[T1]{fontenc} \usepackage{bmpsize} \usepackage{topcapt} \usepackage{booktabs} \usepackage{wrapfig}

% commands \setstretch{1.25} \newcommand{\margmod}[1]{\marginnote{\setstretch{.5}\parbox[t]{\marginparwidth}{\raggedright\emph{#1}}}}

% Front page \def \ColourPDF {Images/Metaimages/Front page_Political Science.pdf} \def \TitlePDF {Images/Metaimages/Front page_Political Science.pdf}

\author{ \LARGE{My name} \ \vspace{0cm} \ {Academic Supervisor: Supervisor name} \ \vspace{.5cm} \ }

\title{ \vspace{3mm} \Huge{Master's Thesis}\ \vspace{18mm} \LARGE{Name of thesis} \vspace{90mm} }

\date{February 2022}

%%%% Layout style \linespread{1.5} \fancyhead[L]{} \fancyhead[R]{\slshape \rightmark} \setlength{\parskip}{1em}

%%%% Frontpage layout \begin{document} \pagenumbering{roman}

\AddToShipoutPicture{\put(0,602){\includegraphics[viewport=0 600 700 1600]{example-image}}} % adds frontpage image \AddToShipoutPicture{\put(0,0){\includegraphics{example-image}}}

\thispagestyle{empty}

\newpage

%%%% Meta info \begin{table}[!ht] \begin{tabular}{lll} \vspace{5mm} \textbf{University} & & {University of Copenhagen} \ \vspace{5mm} \textbf{Name of Department} & & {Department of Political Science} \ \vspace{5mm} \textbf{Study Programme} & & {Master of Science (MSc) in Political Science} \ \vspace{5mm} \textbf{Author} & & {My name} \ \vspace{5mm} \textbf{Student ID} & & {My student ID} \ \vspace{5mm} \textbf{Academic Supervisor} & & {Supervisor name} \

\textbf{Title} & & {Title of thesis} \ % \vspace{5mm} %\textbf{Subtitle} & & {Subtitle} \ %\vspace{5mm} \ \textbf{Date of Submission} & & {March 20, 2021} \ % \vspace{5mm} \ \textbf{ECTS} & & {30} \ \end{tabular} \end{table}

\newpage

Start of thesis..
\end{document}

enter image description here

1 Answers1

3

The two commands \ColourPDF and \TitlePDF are not defined in your code. Either define them or replace them with the names of the images you would like to include.

It is better to not specify a driver in \usepackage[dvipdfm]{graphicx}. If you don't give one, latex will automatically pick the one which matches the engine you use to compile your document.

\documentclass[oneside]{article}

%%%% packages \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[english]{babel} \usepackage{blindtext} \usepackage{footnote} \usepackage{csquotes} \usepackage{eso-pic} \usepackage{graphicx} \usepackage{bmpsize} \usepackage[a4paper, hmargin={2.5cm, 3cm}, vmargin={3cm, 3cm}]{geometry} \usepackage{fancyhdr} \graphicspath{ {figures/} } \usepackage{array} \usepackage[titletoc]{appendix} \usepackage{tcolorbox} \usepackage{tabularx} \usepackage{multirow} \usepackage{topcapt} \usepackage{marginnote} \usepackage{threeparttable} \usepackage[font=small,format=plain,labelfont=bf,textfont=normal,justification=justified,singlelinecheck=false]{caption} \usepackage{booktabs} \usepackage{amsmath} \usepackage{setspace} \usepackage{parskip} \usepackage{float} \usepackage{wrapfig} \usepackage[style=apa, citestyle=apa, sorting=nyt ]{biblatex} \addbibresource{Biblo.bib}

\pagestyle{fancy} \usepackage{etoolbox}\apptocmd\appendix{\pretocmd\section{\clearpage}{}{}}{}{} \usepackage{subfiles}

% commands \setstretch{1.25} \newcommand{\margmod}[1]{\marginnote{\setstretch{.5}\parbox[t]{\marginparwidth}{\raggedright\emph{#1}}}}

\author{ \LARGE{My name} \ \vspace{0cm} \ {Academic Supervisor: Supervisor name} \ \vspace{.5cm} \ }

\title{ \vspace{3mm} \Huge{Master's Thesis}\ \vspace{18mm} \LARGE{Name of thesis} \vspace{90mm} }

\date{February 2022}

%%%% Layout style \linespread{1.5} \fancyhead[L]{} \fancyhead[R]{\slshape \rightmark} \setlength{\parskip}{1em}

\usepackage{tikz} \usetikzlibrary{calc,matrix} \usepackage{lipsum} \newcommand{\Maroonunderline}[1]{{\color{Maroon}\underline{{\color{black}#1}}}} \definecolor{Maroon_1}{RGB}{144,26,30}

%%%% Frontpage layout \begin{document} \pagenumbering{roman}

\AddToShipoutPicture{\put(0,602){\includegraphics[viewport=0 600 700 1600]{example-image}}} % adds frontpage image \AddToShipoutPicture{\put(0,0){\includegraphics{example-image}}}

\thispagestyle{empty}

\newpage % This one doesn't create any trouble

%%%% Meta info \begin{table}[!ht] \begin{tabular}{lll} \vspace{5mm} \textbf{University} & & {University of Copenhagen} \ \vspace{5mm} \textbf{Name of Department} & & {Department of Political Science} \ \vspace{5mm} \textbf{Study Programme} & & {Master of Science (MSc) in Political Science} \ \vspace{5mm} \textbf{Author} & & {My name} \ \vspace{5mm} \textbf{Student ID} & & {My student ID} \ \vspace{5mm} \textbf{Academic Supervisor} & & {Supervisor name} \

\textbf{Title} & & {Title of thesis} \ % \vspace{5mm} %\textbf{Subtitle} & & {Subtitle} \ %\vspace{5mm} \ \textbf{Date of Submission} & & {March 20, 2021} \ % \vspace{5mm} \ \textbf{ECTS} & & {30} \ \end{tabular} \end{table}

\newpage % This line creates the problem

test \end{document}

  • Thanks! I have implemented your suggestions (added the new code in my initial post). This creates two new problems though: 1. When I define \ColourPDF and \TitlePDF, I don't get any output at all - only two blank pages. Do you have any idea why that is? A good thing though: When I comment out \ColourPDF, \TitlePDF and the two addtoShipoutPicture lines, the \newpage error goes away. So you were right that the error was caused be this :) – Nicolai MC Feb 10 '22 at 11:23
  • When I don't define a driver for the graphicx package, I get the error "cannot determine size of graphic in X... (no BoundingBox)" for all the graphics (images) that I have included in the text. Before, when I specified a driver with \usepackage[dvipdfm]{graphicx}, I didn't get the same error for my graphics, although the images weren't actually shown in the output - apart from the caption, notes and the "outline" of the image (the picture above shows an example). Any idea what is causing these issues with the graphics?
  • – Nicolai MC Feb 10 '22 at 11:23
  • @NicolaiMC how exactly are you compiling? I know of at least 5 ways to get from latex code to PDF, so it might be important for us to know exactly what you are doing. Sadly "exactly what you are doing" sometimes is hidden behind buttons in your editor. – daleif Feb 10 '22 at 12:06
  • @daleif, sure! I'm using Overleaf. Is that what you mean? – Nicolai MC Feb 10 '22 at 14:39
  • In that case it should be able to tell you exactly what engine you are using via Menu -> Compiler and TeXLive version. BTW image paths with spaces in them should be handled with care – daleif Feb 10 '22 at 16:23
  • @daleif, alright! In the menu, I can see that the compiler is LaTex and the TeX Live version is 2021. Ok - I will check if spaces somewhere are a problem. – Nicolai MC Feb 11 '22 at 10:31
  • @NicolaiMC why are you using the LaTeX compiler with PDF files? Much easier to use the default pdflatex compiler. – daleif Feb 11 '22 at 10:43
  • I have no idea.... :-) I'm fairly new in this, so I don't know the difference. But changing to pdflatex solved my issues! Thanks a lot. Appreciate it. – Nicolai MC Feb 11 '22 at 10:53
  • Thank you for the recent BONUS!! – Steven B. Segletes Mar 17 '22 at 16:16
  • @StevenB.Segletes You're welcome! Your handwriting answer is really great -- it is amazing to see what one can do with fonts! – samcarter_is_at_topanswers.xyz Mar 17 '22 at 16:21
  • I have just added a revision to my answer to give more functionality using token cycles. See https://tex.stackexchange.com/questions/245751/left-handed-writing/245756#245756 – Steven B. Segletes Mar 17 '22 at 17:06
  • @StevenB.Segletes Brilliant! Thank you! – samcarter_is_at_topanswers.xyz Mar 17 '22 at 17:21