1

I am making a thesis template for a university and am having trouble with designing the title page. They would like the seal of the university to be centered behind the student's name on the title page. Right now, I am using the background package, which allows me to place a background image in a specific location on a page. However, the student's name on the title page is relative to the length of the thesis title (i.e., if the title is longer or shorter, it moves the student's name down or up respectively). Is there a way to anchor the background seal so that it centers behind the student's name and automatically moves with it? I am using Overleaf as my editor. Here is the current mwe:

    \documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage[pages=some, placement=top]{background}


\newcommand{\thesistitle}{CHARACTERIZATION OF DEGRADATION IN TIN PHOSPHIDE ANODES FOR SODIUM-ION BATTERIES}
\newcommand{\studentname}{Student Name}
\newcommand{\degree}{Master of Science in Engineering}%e.g., Master of Science, Doctor of Philosphy, etc.
\newcommand{\department}{The Department of Mechanical and Aerospace Engineering}
\newcommand{\gradyear}{2022}
\newcommand{\gradmonth}{August}

\begin{document}
\backgroundsetup{contents=\includegraphics{Seal.jpg}, opacity=.3, scale=.4, angle=0, hshift=1.5cm, vshift=-4in}
\BgThispage

\newgeometry{left=1.5in,bottom=.5in}
    \begin{center}
        \large
        \singlespacing
        \textbf{\thesistitle}
        
    \vspace{2.5cm}

        \Large
        \textbf{\studentname}\\
    \vspace{1.5cm}
        \normalsize
        \textbf{A THESIS}\\
    \vspace{1.5cm}
        \textbf{Submitted in partial fulfillment of the requirements \\for the degree of \degree}\\  
    \vspace{0.1cm}
        \textbf{in}\\
     \vspace{0.1cm}
        \textbf{\department}\\
    \vspace{0.1cm}
        \textbf{to}\\
    \vspace{0.1cm}
        \textbf{The Graduate School}\\
    \vspace{0.1cm}
        \textbf{of}\\
    \vspace{0.1cm}
        \textbf{The University of ...}\\
    \vspace{0.4cm}
        \textbf{\gradmonth\ \gradyear}
    \end{center}

    
\end{document}

When compiled, it looks correct with the seal centered behind the student's name. See the picture below.

enter image description here

However, if the title is longer than two lines or shorter than two lines, the seal is no longer centered on the student's name. For example:

enter image description here

Can anyone help me with this? I know that the seal background can manually be adjusted. However, the template is supposed to automatically format the thesis so that the students do not have to adjust the formatting themselves.

Thanks for the help!

2 Answers 2

1

You could use the tikzmark library

(\AddToHookNext{shipout/background}{...} currently does not yet work on overleaf, but I heard rumours that TL2022 will be available there in a week or so)

    \documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{setspace}
\usepackage{graphicx}



\newcommand{\thesistitle}{CHARACTERIZATION OF DEGRADATION IN TIN PHOSPHIDE ANODES FOR SODIUM-ION BATTERIES}
\newcommand{\studentname}{Student Name}
\newcommand{\degree}{Master of Science in Engineering}%e.g., Master of Science, Doctor of Philosphy, etc.
\newcommand{\department}{The Department of Mechanical and Aerospace Engineering}
\newcommand{\gradyear}{2022}
\newcommand{\gradmonth}{August}

\usepackage{tikz}
\usetikzlibrary{tikzmark}

\begin{document}


\newgeometry{left=1.5in,bottom=.5in}
    \begin{center}
        \large
        \singlespacing
        \textbf{\thesistitle}
        
    \vspace{2.5cm}

        \Large
        \textbf{\tikzmark{foo}\makebox[0pt]{studentname}}\\
    \vspace{1.5cm}
        \normalsize
        \textbf{A THESIS}\\
    \vspace{1.5cm}
        \textbf{Submitted in partial fulfillment of the requirements \\for the degree of \degree}\\  
    \vspace{0.1cm}
        \textbf{in}\\
     \vspace{0.1cm}
        \textbf{\department}\\
    \vspace{0.1cm}
        \textbf{to}\\
    \vspace{0.1cm}
        \textbf{The Graduate School}\\
    \vspace{0.1cm}
        \textbf{of}\\
    \vspace{0.1cm}
        \textbf{The University of ...}\\
    \vspace{0.4cm}
        \textbf{\gradmonth\ \gradyear}
    \end{center}
 \AddToHookNext{shipout/background}{
 \begin{tikzpicture}[remember picture,overlay]
  \node[opacity=0.2] at (pic cs:foo) {\includegraphics[width=3cm]{example-image-duck}};
 \end{tikzpicture}
 }

\newpage

test
    
\end{document}

enter image description here

6
  • Thank you! This is exactly what I was hoping for.
    – Stephen
    Commented Jul 26, 2022 at 15:52
  • @Stephen You're welcome! Commented Jul 26, 2022 at 15:52
  • I just realized that when I added your code back to my file, the watermark background appears on every page now instead of only on the title page. Does the Tikzmark package allow me to only create that background image on the title page?
    – Stephen
    Commented Jul 26, 2022 at 16:17
  • @Stephen Fixed. Please see my edited answer Commented Jul 26, 2022 at 16:19
  • That fixed it. Thanks!
    – Stephen
    Commented Jul 26, 2022 at 16:46
2

To anchor an image to a specific text is much more natural for TeX than to anchor to the background. Simply insert \vbox to0pt{material\vss} immediately before the text. You need not any TikZ, just include graphic in the \vbox. In your case, insert:

\par\nointerlineskip\vbox to0pt{
   \includegraphics[scale=.7]{Seal.jpg}
   \vss}

just before your \vspace{2.5cm}.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .