0

I have made a front page in LaTeX, and I am happy with how it looks right now. However, I would like to optimize my code such that all I need is to change the text each time. More specifically, I would like the title to be at the bottom of the blue box, and if long to be split over two lines (preferably with the second line being the longest). Also, I would like the Tikzpicture to the right for the title to stay there independently of the title length. Same goes for the "Logo" picture.

Also, would it be possible to define "title", "leadparagraph", "seriesnumber", "author", etc. in the preamble? So it's easier to change from time to time.

I am very new to LaTeX, and appreciate all help.

Here is my code:

\documentclass[a4paper, 12pt, svgnames]{article}
\usepackage{tcolorbox, graphicx, standalone, mathptmx, tikz}
\pagestyle{empty}
\usepackage[utf8]{inputenc}
\usepackage[left=0.6in, right=0.6in, top=0.6in, bottom=0.6in]{geometry}

\begin{document}

\begin{tcolorbox}[colback=NavyBlue, colframe=NavyBlue, height=6.2in, sharpish corners]
\begin{minipage}{4.5in}
\vspace{5.2in}
\begin{flushleft}
{\bfseries\color{white}\fontsize{35}{42}\selectfont Title (Sometimes Over Two Lines) }
\end{flushleft}
\end{minipage}
\begin{minipage}{2in}
\vspace{5.2in}
\begin{flushright}
\begin{tikzpicture}[smooth cycle, line width=6pt, scale=1]
\draw[line join=miter, color=Gold]  (0,0) -- ++ (0.7,-0.5) -- ++ (0.7,0.5);
\draw[line join=miter, color=brown]  (0,-0.4) -- ++ (0.7,-0.5) -- ++ (0.7,0.5);
\draw[line join=miter, color=red]  (0,-0.8) -- ++ (0.7,-0.5) -- ++ (0.7,0.5);

\end{tikzpicture}
\end{flushright}
\end{minipage}
\end{tcolorbox}
\vspace{-0.1in} 
\begin{tcolorbox}[colback=AliceBlue, colframe=AliceBlue, height=3.8in, sharpish corners]
\begin{minipage}{2.7in}
\vspace{2.18in}
\begin{flushright}
\textit{Name of Author\\\vspace{10pt}
Department\\
University}
\end{flushright}
\vspace{0.1in}
\begin{tikzpicture}
\draw[fill=NavyBlue] (0,0) -- (0,0.5) -- (4,0.5) --(4,0) -- (0,0);
\draw (2, 0.23) node{\color{AliceBlue}LOGO};        
\end{tikzpicture}   
\end{minipage}
\hspace{0.25in}
\begin{minipage}{3.5in}
\textbf{\Large Series number xx/xx}
\vspace{12pt}

        Here goes the lead paragraph. Usually not more than 7-8 lines. 
        Here goes the lead paragraph. Usually not more than 7-8 lines. 
        Here goes the lead paragraph. Usually not more than 7-8 lines. 
        Here goes the lead paragraph. Usually not more than 7-8 lines. 
        Here goes the lead paragraph. Usually not more than 7-8 lines.
\vspace{1.7in}
\end{minipage}
\end{tcolorbox} 

\end{document}

And here is what it looks likeenter image description here

  • Welcome to TeX - LaTeX! Try using glue rather than absolute dimensions, e.g. \vspace{5in plus 1fill} – Andrew Swann May 21 '16 at 15:50
1

I have rebuilt your code from scratch (but using your colors, font sizes, etc.) solely in Tikz. The code is shorter and easier to maintain in some cases. There are very minor differences in positions, but I tried to replicate your own as close as I could

I have wrapped everything in a newcommand \mytitlepage with 5 arguments:

\mytitlepage{ <title> }{ <serial> }{ <text> }{ <author> }{ <dept> }

In the case of the serial number, only the number is required, the part "Serial Number" is already printed. The arrows will stay where they are regardless of the title's length.

I'm not sure whether you can automate the line break of the title to make the second line longer, but that's easily solved by applying \\ where you want the new line to commence.

Output

enter image description here

Code

\documentclass[a4paper, 12pt, svgnames]{article}
\usepackage{mathptmx, tikz}
\usepackage{varwidth}
\usepackage[utf8]{inputenc}
\usepackage[left=0.6in, right=0.6in, top=0.6in, bottom=0.6in]{geometry}

\usetikzlibrary{calc}

\newcommand\mytitlepage[5]{%
\noindent
\begin{tikzpicture}[overlay,remember picture, 
    shift={($(current page.south west)+(.6in,.6in)$)}
    ]
% Background
\fill[NavyBlue] ($(current page.west)+(.6in,-2cm)$) rectangle
    ($(current page.north east)+(-.6in,-.6in)$);
\fill[AliceBlue] ($(current page.west)+(.6in,-2cm)$) rectangle
    ($(current page.south east)+(-.6in,.6in)$);
% Dark blue section
\node[text=white, font=\bfseries, text width=9cm, anchor=south west, outer xsep=5mm,outer ysep=1mm] 
    at ($(current page.west)+(.6in,-2cm)$) 
    {\fontsize{35}{42}\selectfont #1};
\begin{scope}[smooth cycle, line width=6pt, scale=1, shift={($(current page.east)+(-4cm,-2mm)$)}]
\draw[line join=miter, color=Gold]  (0,0) -- ++ (0.7,-0.5) -- ++ (0.7,0.5);
\draw[line join=miter, color=brown]  (0,-0.4) -- ++ (0.7,-0.5) -- ++ (0.7,0.5);
\draw[line join=miter, color=red]  (0,-0.8) -- ++ (0.7,-0.5) -- ++ (0.7,0.5);
\end{scope}
% Light blue section
\node[font=\bfseries\Large, anchor=north west, outer ysep=2mm] (sn) at ($(current page)+(-1cm,-2cm)$) {Serial Number #2};
\node[anchor=north west, outer ysep=2mm] (text) at (sn.south west) {\begin{varwidth}{8cm}#3\end{varwidth}};
\node[anchor=east, yshift=-6cm, xshift=-6mm, font=\itshape, align=right] at (sn.south west) {#4};
\node[anchor=east, text width=2cm, font=\itshape, yshift=-7.5cm, xshift=-6mm, align=right] at (sn.south west) {#5};
\node[fill=NavyBlue, text=AliceBlue, 
    anchor=south west, align=center, text width=4cm] at (.5,.5) {LOGO};
\end{tikzpicture}   
}

\begin{document}

\mytitlepage{Super mega\\ultra long Title}{555/2368}{Here goes the lead paragraph. Usually not more than 7-8 lines. Here goes the lead paragraph. Usually not more than 7-8 lines. Here goes the lead paragraph. Usually not more than 7-8 lines. Here goes the lead paragraph. Usually not more than 7-8 lines. Here goes the lead paragraph. Usually not more than 7-8 lines. Here goes the lead paragraph. Usually not more than 7-8 lines.}{John Doe}{Some\\Department}
\end{document}
  • Thank you, that was very useful, and much more help than what I expected! – HTJ May 23 '16 at 13:48
  • @HTJ If this solved your question, consider accepting the answer (by clicking on √ below the voting buttons of the answer). And you're welcome! – Alenanno May 23 '16 at 16:29

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.