0

I'm having troubles in setting up a simple title-page.

  1. Some horizontal lines aren't drawn at the proper place, one on top of the next (see the preview below).

  2. I would like to add a white border all around the page, where the printer can't print the background color.

  3. I would like to add a thin black line (rectangular frame) all around the page, delimiting the background color and the white border.

Here's the MWE code:

\documentclass[letterpaper]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{microtype,lmodern}
\usepackage{anysize}
\marginsize{1.5in}{1in}{0.5in}{0.5in}
\usepackage{xcolor}
\definecolor{backgroundcolor}{RGB}{160,180,200}
\usepackage{graphicx}
\usepackage{here}
\usepackage{afterpage}

\newcommand*{\maintitle}{\begingroup

\pagecolor{backgroundcolor}

\centering

\newlength{\titlelength}
\settowidth{\titlelength}{\Huge\scshape Some Main Title}

\vspace*{\baselineskip}

\rule{\titlelength}{1.6pt} \vspace*{-\baselineskip}\vspace*{2pt}
\rule{\titlelength}{0.4pt} \\[\baselineskip]

{\Huge\scshape Some Main Title} \\[\baselineskip]

{\large\slshape Subtitle} \\[0.2\baselineskip]

\rule{\titlelength}{0.4pt} \vspace*{-\baselineskip}\vspace{3.2pt}
\rule{\titlelength}{1.6pt} \\[4\baselineskip]

{\Large\scshape Name} \\

\vfill

{\large\scshape Version Number}

\par

\endgroup}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\begin{titlepage}
    \maintitle
\end{titlepage}

\end{document}

Preview of the issue:

enter image description here

As you can see, the horizontal lines should be stacked one on top of another, and be exactly of the same lenght as the main title.

How can I fix and simplify the code above, and add a rectangular frame with a white border on its exterior side?

  • You're lacking a blank line between both. – Bernard Aug 7 at 19:19
  • Can you be more specific? You mean Im missing \\ ? Yes it appears to fix the issue #1. – Cham Aug 7 at 19:40
  • A blank line introduces a new paragraph. You also can use ``. In each case, check whether the paragraph indent interferes. – Bernard Aug 7 at 19:44
  • Well, using \\ \vspace*{... appears to fix my issue number 1. Is that the proper way to do this? – Cham Aug 7 at 19:48
  • 1
    It's one of the proper ways. You might interested by a look at the documentation of the titling package, which provides some tools to customise \maketitle. – Bernard Aug 7 at 20:19
2

Nice ! I found a simple way to add a nice frame using the tikz package:

\documentclass[letterpaper]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{microtype,lmodern}
\usepackage{anysize}
\marginsize{1.5in}{1in}{0.5in}{0.5in}
\usepackage{xcolor}
\definecolor{backgroundcolor}{RGB}{160,180,200}
\usepackage{graphicx}
\usepackage{here}
\usepackage{afterpage}
\usepackage{tikz}
\usetikzlibrary{calc}

\newcommand*{\maintitle}{\begingroup

\pagecolor{backgroundcolor}

\centering

\newlength{\titlelength}
\settowidth{\titlelength}{\Huge\scshape Some Main Title}

\vspace*{\baselineskip}

\rule{\titlelength}{1.6pt} \\ \vspace*{-\baselineskip}\vspace*{2pt}
\rule{\titlelength}{0.4pt} \\[\baselineskip]

{\Huge\scshape Some Main Title} \\[\baselineskip]

{\large\slshape Subtitle} \\[0.2\baselineskip]

\rule{\titlelength}{0.4pt} \\ \vspace*{-\baselineskip}\vspace{3.2pt}
\rule{\titlelength}{1.6pt} \\[4\baselineskip]

{\Large\scshape Name} \\

\vfill

{\large\scshape Version Number}

\par

\endgroup}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\begin{titlepage}
   \maintitle

   \begin{tikzpicture}[remember picture, overlay]
       \draw[line width = 0.25pt,color = black] ($(current page.north west) + (0.75in,-0.25in)$) rectangle ($(current page.south east) + (-0.25in,0.25in)$);
       \draw[line width = 1in,color = white] ($(current page.north west) + (0.25in,0.25in)$) rectangle ($(current page.south east) + (0.25in,-0.25in)$);
       \draw[line width = 0.25pt,color = black] ($(current page.north west) + (1in,-0.5in)$) rectangle ($(current page.south east) + (-0.5in,0.5in)$);
   \end{tikzpicture}

\end{titlepage}

\end{document}

Preview:

enter image description here

| improve this answer | |

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.