1
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\graphicspath{ {c:/User/Images/} }
\usepackage{soul}
%\usepackage{biblatex}
\usepackage{listings}
%\usepackage[numbers]{natbib}
%\usepackage[backend=biber,style=alphabetic,sorting=ynt]{biblatex}
\usepackage[style=numeric,backend=bibtex]{biblatex}
\addbibresource{bib.bib}
%\usepackage[nottoc, notlof, notlot]{tocbibind}
%\usepackage{tikz}
\usepackage[a4paper,pdftex]{geometry}
\usepackage{geometry}% A4paper margins
\geometry{
 a4paper,
 total={210mm,280mm},
 left=4cm,
 right=4cm,
 top=20mm,
 bottom=20mm
 }
\usepackage{listings}
\lstset{language=Matlab,
    breaklines=true,
    morekeywords={matlab2tikz},
    keywordstyle=\color{blue},
    morekeywords=[2]{1}, keywordstyle=[2]{\color{black}},
    identifierstyle=\color{black},
    commentstyle=\color{green},
    showstringspaces=false,
    numbers=left,
    numberstyle={\tiny \color{black}},
    numbersep=9pt, 
tabsize=2,
    emph=[1]{for,end,break},emphstyle=[1]\color{red}, 
    emph=[2]{word1,word2}, emphstyle=[2]{style} 
}



\setlength{\oddsidemargin}{0mm}                 % Adjusting margins to center the colorbox, ...
\setlength{\evensidemargin}{0mm}                    % ... you might want to change these

\usepackage[english]{babel}
\usepackage[protrusion=true,expansion=true]{microtype}  
\usepackage{amsmath,amsfonts,amsthm,amssymb}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{fix-cm}
\newtheorem*{remark}{Remark}
\numberwithin{equation}{section}
\def\w{\omega}
\def\eq{equation}
\def\bet{$\beta$}
\def\eee{\epsilon}
%\addbibresource{bib.bib}
% ------------------------------------------------------------------------------
% Definitions (do not change this)
% ------------------------------------------------------------------------------
\newcommand{\HRule}[1]{\hfill \rule{0.2\linewidth}{#1}}     % Horizontal rule

\definecolor{grey}{rgb}{0.9,0.9,0.9} 

\makeatletter                           % Title
\def\printtitle{%                       
    {\centering \@title\par}}
\makeatother                                    

\makeatletter                           % Author
\def\printauthor{%                  
    {\centering \large \@author}}               
\makeatother                            

% ------------------------------------------------------------------------------
% Metadata (Change this)
% ------------------------------------------------------------------------------
\title{ \fontsize{50}{60}\selectfont
            \vspace*{0.7cm}
            \hfill The Dynamics of  \\[0.8cm]
            \hfill Elastic Rods     \\[0.8cm]
            \hfill \\
            \hfill By\\
            \hfill Pi\\[0.2cm]
        }

\author{\hfill \textbf{{\LARGE{Supervisor Dr E}}}\\
        \hfill Department of Mathematics, \\
        \hfill College of Engineering, \\
        \hfill D Sciences\\
        \hfill Bondon}
        %Department of Mathematics, College of Engineering, Design and Physical Sciences, Brunel University
       % \hfill {Supervisor Dr E} \\

\begin{document}
% ------------------------------------------------------------------------------
% Maketitle
% ------------------------------------------------------------------------------
\thispagestyle{empty}               % Remove page numbering on this page

\colorbox{grey}{
    \parbox[t]{1.0\linewidth}{
        \printtitle 
        \vspace*{0.7cm}}}

    \vfill
\printauthor                                % Print the author data as defined above
%\HRule{1pt}
\clearpage
\end{document}

enter image description here

  • That was just the top bit of my doc, I did have \end{document} – Punit Mar 19 '15 at 0:04
  • how would i fix the \hbox? – Punit Mar 19 '15 at 0:04
  • I do apologize about that. It was my first time posting a question here. – Punit Mar 19 '15 at 0:36
  • drive.google.com/file/d/0B3ZHjqrVUX4oaVpXM3pzTE1CWkU/… Here's what shows up on my output – Punit Mar 19 '15 at 0:36
  • I added the image to the question, but the question is not answerable unless you fix the example to demonstrate the problem. – David Carlisle Mar 19 '15 at 15:32
3

Assuming your question is about the over full box, the line was overfull as you had specified the parbox to be the full \linewidth wise, but \colorbox adds \fboxsep padding either side, the box is indented by paragraph indent unless you suppress that, and there were one or two word spaces from missing % at ends of lines.

This version has no warnings:

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\graphicspath{ {c:/User/Images/} }
\usepackage{soul}
%\usepackage{biblatex}
\usepackage{listings}
%\usepackage[numbers]{natbib}
%\usepackage[backend=biber,style=alphabetic,sorting=ynt]{biblatex}
\usepackage[style=numeric,backend=bibtex]{biblatex}
\addbibresource{bib.bib}
%\usepackage[nottoc, notlof, notlot]{tocbibind}
%\usepackage{tikz}
\usepackage[a4paper,pdftex]{geometry}
\usepackage{geometry}% A4paper margins
\geometry{
 a4paper,
 total={210mm,280mm},
 left=4cm,
 right=4cm,
 top=20mm,
 bottom=20mm
 }
\usepackage{listings}
\lstset{language=Matlab,
    breaklines=true,
    morekeywords={matlab2tikz},
    keywordstyle=\color{blue},
    morekeywords=[2]{1}, keywordstyle=[2]{\color{black}},
    identifierstyle=\color{black},
    commentstyle=\color{green},
    showstringspaces=false,
    numbers=left,
    numberstyle={\tiny \color{black}},
    numbersep=9pt, 
tabsize=2,
    emph=[1]{for,end,break},emphstyle=[1]\color{red}, 
    emph=[2]{word1,word2}, emphstyle=[2]{style} 
}



\setlength{\oddsidemargin}{0mm}                 % Adjusting margins to center the colorbox, ...
\setlength{\evensidemargin}{0mm}                    % ... you might want to change these

\usepackage[english]{babel}
\usepackage[protrusion=true,expansion=true]{microtype}  
\usepackage{amsmath,amsfonts,amsthm,amssymb}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{fix-cm}
\newtheorem*{remark}{Remark}
\numberwithin{equation}{section}
\def\w{\omega}
\def\eq{equation}
\def\bet{$\beta$}
\def\eee{\epsilon}
%\addbibresource{bib.bib}
% ------------------------------------------------------------------------------
% Definitions (do not change this)
% ------------------------------------------------------------------------------
\newcommand{\HRule}[1]{\hfill \rule{0.2\linewidth}{#1}}     % Horizontal rule

\definecolor{grey}{rgb}{0.9,0.9,0.9} 

\makeatletter                           % Title
\def\printtitle{%                       
    {\raggedleft\@title\par}}
\makeatother                                    

\makeatletter                           % Author
\def\printauthor{%                  
    {\raggedleft \large \@author\par}}               
\makeatother                            
% ------------------------------------------------------------------------------
% Metadata (Change this)
% ------------------------------------------------------------------------------
\title{\fontsize{50}{60}\selectfont
            \vspace*{0.7cm}
            The Dynamics of  \\[0.8cm]
            Elastic Rods     \\[0.8cm]
            \mbox{} \\
             By\\
             Pi\\[0.2cm]
        }

\author{\textbf{{\LARGE{Supervisor Dr E}}}\\
        Department of Mathematics, \\
        College of Engineering, \\
        D Sciences\\
        Bondon}
        %Department of Mathematics, College of Engineering, Design and Physical Sciences, Brunel University
       % \hfill {Supervisor Dr E} \\

\begin{document}
% ------------------------------------------------------------------------------
% Maketitle
% ------------------------------------------------------------------------------
\thispagestyle{empty}               % Remove page numbering on this page


\noindent\colorbox{grey}{%
    \parbox[t]{\dimexpr\linewidth-2\fboxsep}{%
        \printtitle 
        \vspace*{0.7cm}}}%

    \vfill
\printauthor                                % Print the author data as defined above
%\HRule{1pt}
\clearpage

\end{document}
  • unfortunately that's not fixed it. I've included an immage to show you the output error. drive.google.com/file/d/0B3ZHjqrVUX4oaVpXM3pzTE1CWkU/view – Punit Mar 19 '15 at 1:00
  • 1
    @Punit oh you did mean that there were numbers in the output! OK all the things I fixed needed fixing so that's not wasted effort, you should do those anyway. For the numbers they do not occur in the example you posted. the example should be an example of the problem not just some unrelated tex code. That means there is an error in some code you have not shown. If you fix your example so that it demonstrates the problem and add a comment here when the question is updated, I'll look. – David Carlisle Mar 19 '15 at 8:27

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.