如何使标题居中对齐,同时将徽标保留在页眉左侧?

如何使标题居中对齐,同时将徽标保留在页眉左侧?

需要帮助将徽标左对齐,但保持标题居中。目前,我尝试对序言进行任何编辑,这两者会一起移动或被删除。

\documentclass[a4paper,11pt]{article}
\usepackage[a4paper, left=15mm, right=15mm, top=20mm, bottom=20mm]{geometry}
\usepackage[parfill]{parskip}
\usepackage{amssymb,amsmath}% http://ctan.org/pkg/{amssymb,amsmath}
\usepackage{braket}% http://ctan.org/pkg/braket
\usepackage{datetime}
\usepackage[normalem]{ulem}
\usepackage[colorlinks = true, linkcolor = blue, urlcolor  = blue, citecolor = blue, anchorcolor = blue]{hyperref}
\newdateformat{mydate}{\twodigit{\THEDAY}{ }\shortmonthname[\THEMONTH] \THEYEAR}
\newcommand{\forceindent}{\leavevmode{\parindent=1em\indent}}
\usepackage{enumitem}
\usepackage{graphicx}% http://ctan.org/pkg/graphicx

\usepackage{titling}


\pretitle{%
\begin{flushleft}
\includegraphics[width=7cm,height=2cm]{image.png}\\[\bigskipamount]
\pretitle{\begin{flushleft}\LARGE}
}
\posttitle{\end{flushleft}}


\date{\today}

\title{Financial Analysis}

\begin{document}

\maketitle

答案1

这里是:

\documentclass[a4paper,11pt]{article}
\usepackage[a4paper, left=15mm, right=15mm, top=20mm, bottom=20mm]{geometry}
\usepackage[parfill]{parskip}
\usepackage{amssymb,amsmath}% http://ctan.org/pkg/{amssymb,amsmath}
\usepackage{braket}% http://ctan.org/pkg/braket
\usepackage{datetime}
\usepackage[normalem]{ulem}
\usepackage[colorlinks = true, linkcolor = blue, urlcolor = blue, citecolor = blue, anchorcolor = blue]{hyperref}
\newdateformat{mydate}{\twodigit{\THEDAY}{ }\shortmonthname[\THEMONTH] \THEYEAR}
\newcommand{\forceindent}{\leavevmode{\parindent=1em\indent}}
\usepackage{enumitem}
\usepackage{graphicx}% http://ctan.org/pkg/graphicx

\usepackage{titling}


\pretitle{%
\begin{flushleft}
\includegraphics[width=4cm]{suitcase1}\end{flushleft}\vspace{2\baselineskip}
\begin{center}\LARGE\bfseries}
\posttitle{\end{center}}


\date{\today}

\title{Financial Analysis}

\begin{document}

\maketitle

\end{document}

在此处输入图片描述

答案2

我认为这个例子可以精简一些,但是,如果我明白你在寻找什么,这是一种方法:

\documentclass[a4paper,11pt]{article}
\usepackage[showframe, % to help visualize the output
a4paper, left=15mm, right=15mm, top=20mm, bottom=20mm]{geometry}
\usepackage[parfill]{parskip}
\usepackage{graphicx}% 
\usepackage{mwe}% for `example-image-a`
\usepackage{titling}

\newlength\imgwd
\newlength\imght
\newcommand{\setimg}[3]{%
  % #1 = filename | #2 = width | #3 = height
  \def\imgname{#1}
  \setlength{\imgwd}{#2}
  \setlength{\imght}{#3}
}

\renewcommand{\maketitle}{%
  \insertimg
  \vspace*{\dimexpr -\imght -1.2\baselineskip \relax}%
  {\pretitle \thetitle \posttitle}%
  \begin{center}
  {\preauthor \theauthor \postauthor}%
  \par
  {\predate \thedate \postdate}%
  \end{center}
}

\newcommand\insertimg{%
  \par\noindent
  \includegraphics[width=\imgwd,height=\imght]{\imgname}}

\renewcommand{\pretitle}{\par\LARGE\bfseries\centering}
\renewcommand{\posttitle}{\par}
\renewcommand{\preauthor}{\bfseries}
\renewcommand{\postauthor}{}
\renewcommand{\predate}{}
\renewcommand{\postdate}{}

\setimg{example-image-a}{7cm}{2cm}
\title{Financial Analysis}
\author{Karl Polanyi}
\date{\today}

\begin{document}

\maketitle

% For comparison
\bigskip

\begin{center}
{\LARGE\bfseries \thetitle}

\theauthor

\thedate
\end{center}

\end{document}

主要的附加功能是\setimg命令,它允许您在提供所有其他文档“元数据”的同时指定图像和尺寸。(我也使用了 packages titling- \pre/ \post-commands,但是当重新定义命令时,这样做并没有什么实际优势\maketitle……我想,除了这些命令名称非常合理之外。)

相关内容