I want to place my university logo at a certain distance from the top-left margins of the page. How am I supposed to do that?
1 Answers
Consider the red rectangle as being the needed logo. The solution below is based on TikZ. Some comments concerning the code:
The command for the logo is
\inclkudelogo. To appear on the first page it is invoked after the title. To appear on the others it is invoked in the fancy headings."The logo" is a node with empty content in my file. If your logo is the file
logo.jpglet's say, you can use it through an\includegraphics[height=...,width=...]{logo}command in the node's content.\usepackage{showframe}is there to make the page layout explicit.The important options in the TikZ environment are
remember pictureandoverlay.
\documentclass[11pt, a4paper]{article}
\usepackage{geometry}
\geometry{total={160mm, 240mm}, left=25mm, top=30mm}
\usepackage{tikz}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{\insertlogo}
\rhead{some header}
\usepackage{showframe}
\usepackage{lipsum}
\newcommand{\insertlogo}{%
\begin{tikzpicture}[remember picture, overlay]
\path (current page.north west)
node[draw, fill, red, inner sep=3ex, text width=6ex,
below right=2ex] {};
\end{tikzpicture}
}
\title{Document with logo using TikZ}
\begin{document}
\maketitle
\insertlogo
\lipsum[1]
\lipsum[2-8]
\end{document}
See also @Peter Grill answer How do I add an image in the upper, left-hand corner using TikZ and graphicx which uses background library.
- 5,687

tikz-page: https://ctan.org/pkg/tikz-page?lang=en – Alan Xiang Sep 06 '20 at 01:31