如何在干净的论文中以月年格式编写日期时间?

如何在干净的论文中以月年格式编写日期时间?

我正在使用 clean thesis 来撰写论文。但是,我无法以月年格式写入日期时间,例如(2016 年 8 月)。

答案1

定义一个\MONTH\YEAR宏来设置您需要的内容。以下示例在 中突出显示了这\maketitle一点\date

在此处输入图片描述

\documentclass{scrreprt}

\usepackage{cleanthesis}

\newcommand{\MONTH}{%
  \ifcase\month% 0
    \or January% 1
    \or February% 2
    \or March% 3
    \or April% 4
    \or May% 5
    \or June% 6
    \or July% 7
    \or August% 8
    \or September% 9
    \or October% 10
    \or November% 11
    \or December% 12
  \fi}
\newcommand{\YEAR}{\number\year}

\author{An author}
\title{A title}
\date{\MONTH\ \YEAR}

\begin{document}

\maketitle

\end{document}

答案2

我不建议使用cleanthesis。无论如何,可以使用包设置日期格式datetime2

% **************************************************
% Document Class Definition
% **************************************************
\documentclass[
  paper=A4,                     % paper size --> A4 is default in Germany
  twoside=true,                 % onesite or twoside printing
  openright,                    % doublepage cleaning ends up right side
  parskip=full,                 % spacing value / method for paragraphs
  chapterprefix=true,           % prefix for chapter marks
  11pt,                         % font size
  headings=normal,              % size of headings
  bibliography=totoc,           % include bib in toc
  listof=totoc,                 % include listof entries in toc
  titlepage=on,                 % own page for each title page
  captions=tableabove,          % display table captions above the float env
  draft=false,                  % value for draft version
  enabledeprecatedfontcommands,
]{scrreprt}

\usepackage[utf8]{inputenc} % defines file's character encoding

\usepackage[                % clean thesis style
  figuresep=colon,
  sansserif=false,
  hangfigurecaption=false,
  hangsection=true,
  hangsubsection=true,
  colorize=full,
  colortheme=bluemagenta,
  bibsys=bibtex,
  bibfile=bib-refs,
  bibstyle=alphabetic,
]{cleanthesis}

\usepackage{datetime2,datetime2-calc}
\DTMnewdatestyle{Myyyy}{%
  \renewcommand*{\DTMdisplaydate}[4]{\DTMmonthname{##2}~##1}%
  \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}%
}
\DTMsetdatestyle{Myyyy}

\begin{document}

\today

\end{document}

在此处输入图片描述

相关内容