如何在文档首页的页眉中添加徽标

如何在文档首页的页眉中添加徽标

我想在标题页的页眉中添加徽标。我没有使用 \maketitle 来创建标题页,而其他帖子中的所有建议实际上都使用它。有人能帮我解决这个问题吗?我只希望我的徽标出现在第一页(即标题页)的页眉中。

\begin{titlepage}
\begin{center}
\centerline{
 \includegraphics[width=1\textwidth]{logo.png}
}
    \vspace*{1cm}

    \Huge
    \textbf{title}


    \vspace{1.5cm}

by
    \textbf{name}\\
\vspace{1.5cm}
\Large
supervised by
\textbf{name}

    \vfill

    A report presented for the degree of...

    \vspace{0.8cm} 

    Department of... \\

    \vspace{1.5cm}

\end{center}

\end{titlepage}

答案1

这是一种非常基本的方法。(它假设徽标应占据整个物理页面。)

\documentclass{article}
\usepackage{lipsum, mwe,graphicx,eso-pic}
% lipsum provides:   \lipsum
% mwe provides:      example-image
% graphicx provides: \includegraphics
% eso-pic provides:  \AddTo..., \AtStockUpperLeft

\newlength\headpicwd
\newlength\headpicht
\setlength{\headpicwd}{\pdfpagewidth}% image width of physical page?
\setlength{\headpicht}{3cm}
\newcommand\printpic{%
  \AddToShipoutPictureBG*{%
    \AtStockUpperLeft{%
      \raisebox{-\headpicht}{%
        % centred with respect to physical page ..?
        % \hspace*{\dimexpr 0.5\pdfpagewidth - 0.5\headpicwd\relax}%
        \includegraphics[width=\headpicwd, height=\headpicht]{example-image}%
      }%
    }%
  }%
}

\begin{document}
% print logo
\printpic

\lipsum

\end{document}

如果您想更改它,请设置\headpicwd为适当的宽度并取消注释该\hspace行。如果您希望它相对于文本块居中,并且边距大小不同,则需要进行一些进一步的(微小)更改。

答案2

titling这是一个带有包和简单的简单解决方案 \includegraphics

\documentclass[11pt,a4paper,twoside]{report}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[osf]{garamondx}
\usepackage[showframe, nomarginpar]{geometry}
\usepackage{graphicx}
\usepackage{lipsum}

\usepackage{titling}%
\title{Title}
\author{by\quad Name}
\date{}

\pretitle{\begin{center} \Huge\bfseries}
\posttitle{\end{center}\vskip1.5cm}
\preauthor{\begin{center}\Huge\bfseries}
\postauthor{\vskip1.5cm\par\Large supervised by supername\end{center}\vfill}
\renewcommand{\maketitlehooka}{%
\noindent\centering\raisebox{95pt}[0pt][0cm]{\includegraphics[scale=0.25]{dodo.jpeg}}}%
\renewcommand{\maketitlehookd}{%
\noindent\raggedright A report presented for the degree of...
\vspace{0.8cm}\\
Department of...
\vspace{1.5cm}}%

\begin{document}

\maketitle

\lipsum[1-5]

\end{document} 

在此处输入图片描述

相关内容