\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}
答案1
假设您的问题是关于过满的框,由于您已将 parbox 指定为完整的\linewidth
,因此该行已过满,但在两边\colorbox
添加了填充,除非您抑制它,否则该框会按段落缩进缩进,并且行尾\fboxsep
缺少一个或两个单词空格。%
此版本没有警告:
\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}