我想在标题上方放置徽标,但我还想将标题/作者/日期保留在文本的第一页上。
到目前为止我发现的所有解决方案都与标题页包有关,这会引发单独的页面。
插入图形会将第一页变成“常规”页面,带有页眉和页脚,下一页上接着是标题。
我正在使用文章类。
有什么建议么?
下面的代码对 XeLaTeX 模板进行了稍微修改,以提供 MWE。
\documentclass[12pt]{article}
\usepackage{geometry}
\geometry{a4paper}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text]{Hoefler Text}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Gill Sans}
\setmonofont[Scale=MatchLowercase]{Andale Mono}
\title{Brief Article}
\author{The Author}
\date{}
\begin{document}
\maketitle
Content of document, starting straight away, same page...
I would like the image to have appeared at the top, above Brief Article.
But where to put the command?
\end{document}
答案1
这个titling
包就是你要找的:
\documentclass[12pt]{article}
\usepackage{geometry}
\geometry{a4paper}
\usepackage[demo]{graphicx} % the demo option is just for the example
\usepackage{amssymb}
\usepackage{titling}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Hoefler Text}
\setsansfont[Scale=MatchLowercase,Ligatures=TeX]{Gill Sans}
\setmonofont[Scale=MatchLowercase]{Andale Mono}
\pretitle{%
\begin{center}
\LARGE
\includegraphics[width=6cm,height=2cm]{logo}\\[\bigskipamount]
}
\posttitle{\end{center}}
\begin{document}
\title{Brief Article}
\author{The Author}
\date{}
\maketitle
Content of document, starting straight away, same page...
I would like the image to have appeared at the top, above Brief Article.
But where to put the command?
\end{document}
请注意,您正在使用一个相当古老的语法来加载字体。
答案2
你为什么不直接把图片添加到标题中
\title[Brief Article]{\includegraphics[scale=0.2]{example-image-a}\\ Brief Article}
正如芭芭拉 (Barbara) 所说,由于文章标题成为了页眉,因此最好使用可选参数和适合用作页眉的文本。
完整代码:
\documentclass[12pt]{article}
\usepackage{geometry}
\geometry{a4paper}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text]{Hoefler Text}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Gill Sans}
\setmonofont[Scale=MatchLowercase]{Andale Mono}
\title[Brief Article]{\includegraphics[scale=0.2]{example-image-a}\\ Brief Article}
\author{The Author}
\date{}
\begin{document}
\maketitle
Content of document, starting straight away, same page...
I would like the image to have appeared at the top, above Brief Article.
But where to put the command?
\end{document}