1

I'm building a title page for a custom report .sty file. A MWE follows:

\documentclass{report}


 \usepackage{lipsum}
 \usepackage{geometry}
 \usepackage{mwe}
 \usepackage{tikz}
 \usepackage{pgf}

\begin{document}

\begin{titlepage}
\newgeometry{margin = 0in}


\begin{center}

    \includegraphics[width = \paperwidth]{header.png}

    \begin{flushright}
        \includegraphics[height = 5cm]{example-image}
    \end{flushright}

    \pgfpicture
        \pgftext{\includegraphics[width = \paperwidth, height = 16.71cm]{example-image}}
        \pgftext[right]{
            \begin{tabular}[t]{l}
            {\Huge \color{red} \bfseries A longish title that pushes the bg image to the right}\\
            \\
            \\
            {\Large \color{red} {Author information goes here \\ hopefully on multiple lines \\ city, state, zip}}

            \end{tabular}
        }
    \endpgfpicture

    \includegraphics[width = \paperwidth, height = 1.35cm]{example-image}

\end{center}

\end{titlepage}
\restoregeometry

\section{A section}
\lipsum[3-6]

\end{document}

that produces the following title page: enter image description here

My question is in several parts:

1. The longer the title gets, the further to the right the image is pushed. Why is this and how can I prevent it from happening?

2. How can I force the table to wrap the title text to a second line automatically (i.e., without the addition of a \\)?

3. Why is the author information on the second and third lines not the same size and color as the first line?

I am open to other options or suggestions for overlaying text on an image.

0

I had to disable your header-image here, as I don't have it, but it doesn't have anything to do with the solution anyway.

When using \\ in a tabular-environment, it works a lot different, as TeX is in vertical-mode, not in horizontal mode. Basically, it means that what you define in one cell, is not carried over, even though you put curlybraces around it, which here just gives you an error, because in the first cell a { is given, and then the cell was ended by \\. The missing } cannot be found here, but you can solve this. \newline will make a new line, as it name intends, and works within tabular also. However, the l-column won't let it, as it tries to figure how long the included text is, and will not issue linebreaks. Tell the column how wide it should be however, and it will break text, both automaticly, and at \linebreaks.

As for your last problem, we could hack it by setting a \parbox around the tabular and a width lower that its content. This last part is not a very good solution, I think more of the code requires a different approach than you have supplied.

Output

enter image description here

Code

\documentclass{report}


 \usepackage{lipsum}
 \usepackage{geometry}
 \usepackage{mwe}
 \usepackage{tikz}
 \usepackage{pgf}

\begin{document}

\begin{titlepage}
\newgeometry{margin = 0in}


\begin{center}

   % \includegraphics[width = \paperwidth]{header.png}

    \begin{flushright}
        \includegraphics[height = 5cm]{example-image}
    \end{flushright}

    \pgfpicture
        \pgftext{\includegraphics[width = \paperwidth, height = 16.71cm]{example-image}}
        \pgftext[right]{
            \parbox[t][0ex][l]{8cm}{\begin{tabular}[t]{p{12cm}}
            {\Huge \color{red} \bfseries A longish title that pushes the bg image to the right}\\
            \\
            \\
            {\Large \color{red} {Author information goes here \newline hopefully on multiple lines \newline city, state, zip}}\\
            \end{tabular}}
        }
    \endpgfpicture

    \includegraphics[width = \paperwidth, height = 1.35cm]{example-image}

\end{center}

\end{titlepage}
\restoregeometry

\section{A section}
\lipsum[3-6]

\end{document}
| improve this answer | |
  • If I increase the p{Xcm} value to say, x = 12, the image moves over to the right. Is there a way I could have the title text stretch 3/4 of the way across the image? – Steven Jun 22 '16 at 18:08
  • see my edit @Steven – Runar Jun 22 '16 at 18:21
2

You could place all your images in a tikzpicture, but you will need to compile twice to get correct placement. You can then place your text inside a minipage instead of dealing with a table.

enter image description here

\documentclass{report}
 \usepackage{lipsum}
 \usepackage{geometry}
 \usepackage{mwe}
 \usepackage{tikz}
    \usetikzlibrary{positioning}

\begin{document}
\begin{titlepage}
\newgeometry{margin = 1in}
\begin{tikzpicture}[remember picture,overlay,outer sep=0pt,inner sep=0pt]
% Header
\node (header) at (current page.north)[anchor=north]{\includegraphics[width=\paperwidth, height=4cm]{image-9x16}};
% Footer
\node(footer) at (current page.south)[anchor=south]{\includegraphics[width=\paperwidth, height=1.35cm]{image-9x16}};
% Image at right
\node(rtimg) at (header.south east)[anchor=north east,yshift=-5mm]{\includegraphics[height=5cm]{example-image-a}};
% Background image
\node at (footer.north)[anchor=south]{\includegraphics[width = \paperwidth, height = 16.71cm]{example-image}};
\end{tikzpicture}\par
\vspace{8cm}
\begin{minipage}{0.55\paperwidth}
\raggedright
{\Huge \color{red} \bfseries A longish title that pushes the bg image to the right}

\medskip
{\color{red} {\Large Author information goes here} \\ hopefully on multiple lines \\ city, state, zip}
\end{minipage}
\end{titlepage}
\restoregeometry

\section{A section}
\lipsum[3-6]

\end{document}
| 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.