我想在第一页的顶部中央插入一个徽标,位于标题和作者姓名之前。如果我使用命令 \begin{figure},则会在标题之前出现另一个带有图像的新页面。我也尝试过不使用 \begin{figure}。正文代码如下:
%\documentclass[5p,sort&compress]{elsarticle}
\documentclass[final,5p,times,twocolumn,authoryear]{elsarticle}
\makeatletter
\def\ps@pprintTitle{%
\let\@oddhead\@empty
\let\@evenhead\@empty
\def\@oddfoot{\footnotesize\itshape
\hfill\today}%
\let\@evenfoot\@oddfoot}
\makeatother
\usepackage{dcolumn}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{cleveref}
\usepackage{textcomp}
\usepackage{mathtools}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage[fixlanguage]{babelbib}
\renewenvironment{abstract}{\global\setbox\absbox=\vbox\bgroup
\hsize=\textwidth\def\baselinestretch{1}%
\noindent\unskip\textbf{Abstract}
\par\medskip\noindent\unskip\ignorespaces}
{\egroup}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{caption}
\usepackage{booktabs}
\usepackage[utf8]{inputenc}
\usepackage[table]{xcolor}
\usepackage{caption}
\usepackage{listings}
\usepackage{gensymb}
\usepackage{xcolor}
\usepackage[title]{appendix}
\usepackage{appendix}
\usepackage[toc,page]{appendix}
\usepackage{bm}
\usepackage{siunitx}
\sisetup{
exponent-product = \cdot,
output-decimal-marker = {,},
separate-uncertainty = true,
per-mode = symbol,
group-digits = false,
}
\usepackage{graphicx}
\renewcommand{\topfraction}{.85}
\renewcommand{\bottomfraction}{.7}
\renewcommand{\textfraction}{.15}
\renewcommand{\floatpagefraction}{.66}
\setcounter{topnumber}{3}
\setcounter{bottomnumber}{2}
\setcounter{totalnumber}{10}
\usepackage{flafter}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage[colorlinks=true,allcolors=blue]{hyperref}
\usepackage{float}
\restylefloat{table}
\usepackage{floatrow}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{chemformula} %chemical formulas can be written more easily using \ch
\usepackage[version=4]{mhchem}
\usepackage{amsmath} % lar deg dele opp equations
\usepackage{mathtools} % dele opp eq.
\usepackage{titlesec}
\pagestyle{fancy}
\fancyhf{}
\rfoot{Page \thepage \hspace{1pt} of \pageref{LastPage}}
%For at section, subsection og subsubsection skal bli deecent
\titleformat{\section}
{\normalfont\fontfamily{phv}\fontsize{12}{15}\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}
{\normalfont\fontfamily{phv}\fontsize{10}{13}\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}
{\normalfont\fontfamily{phv}\fontsize{10}{13}\selectfont}{\thesubsubsection}{1em}{}
\urlstyle{same}
\begin{document}
\begin{frontmatter}
\centering\includegraphics[width = .8\linewidth]{img/logo-polimi_600x250.png}
\title{Laboratory experiment 1: Magnetic Nanoparticles}
\author{}
\address{}
\begin{abstract}
text
\end{abstract}
\end{frontmatter}
\input{text/01_Introduction}
\input{text/02_Materials&methods}
\input{text/03_Results&discussion}
\input{text/04_Conclusion}
\makeatother
\bibliographystyle{babunsrt}
\bibliography{references}
\end{document}
答案1
我心软了,制作了你的 MWE 的精简版,并在你的标题上方放置了一张图片。
% logoprob.tex SE 637240
%\documentclass[5p,sort&compress]{elsarticle}
\documentclass[final,5p,times,twocolumn,authoryear]{elsarticle}
\usepackage{graphicx}
\usepackage{mwe} %%%% PW added for the image
\begin{document}
\begin{frontmatter}
%\centering\includegraphics[width = .8\linewidth]{img/logo-polimi_600x250.png}
\title{{\begin{center}\includegraphics{example-image-a}\end{center}}
\vspace{1cm}Laboratory experiment 1: Magnetic Nanoparticles}
\author{A. N. Author}
\address{Somewhere}
\begin{abstract}
text
\end{abstract}
\end{frontmatter}
\end{document}
答案2
我删除了除该部分之外的所有软件包和其他命令\makeatletter\def\ps@pprintTitle
(它删除了预印本已提交至 Elsevier)。
这懒惰的我采用的解决方案是插入\centering\includegraphics[width=0.3\linewidth]{example-image-1x1}\\
标题定义。这不是最优雅的解决方案,但很简单。我用标准安装中的一个替换了您的图example-image
。
我还添加了包,lipsum
以便更好地直观地显示摘要和章节的内容。
创建您自己的自定义标题页的建议:
- 如何自定义我的标题页?
- 在自定义标题页上使用 \title、\author 和 \date 的值
- https://pt.overleaf.com/learn/latex/How_to_Write_a_Thesis_in_LaTeX_(Part_5)%3A_Customising_Your_Title_Page_and_Abstract
MWE 如下:
\documentclass[final,5p,times,twocolumn,authoryear]{elsarticle}
\usepackage{lipsum}
\title{\centering
\includegraphics[width=0.3\linewidth]{example-image-1x1}\\
Laboratory experiment 1:\\
Magnetic Nanoparticles}
\author{Author}
\address{Address}
\makeatletter
\def\ps@pprintTitle{%
\let\@oddhead\@empty
\let\@evenhead\@empty
\def\@oddfoot{\footnotesize\itshape
\hfill\today}%
\let\@evenfoot\@oddfoot}
\makeatother
\begin{document}
\begin{frontmatter}
\begin{abstract}
\lipsum[65-68]
\end{abstract}
\end{frontmatter}
\section{First section}
\lipsum[66-67]
\end{document}