\date 不显示日期

\date 不显示日期

我的 LaTeX 代码是

\documentclass[12pt]{article}


\usepackage[margin=1in]{geometry}
\usepackage{amsfonts, amsmath, amssymb}
\usepackage[none]{hyphenat}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{float}
\usepackage{url}
\usepackage[nottoc, notlot, notlof]{tocbibind}
\usepackage{url}
\usepackage{bm}
\usepackage[autostyle]{csquotes}
\usepackage[cache=false]{minted}
\usepackage{xcolor}
\usepackage{mdframed}
\usepackage[colorlinks,linkcolor=black]{hyperref}
\usepackage[lined, linesnumbered, ruled,vlined]{algorithm2e}

% \usepackage{natbib}
% \usepackage[hyperref=true,backend=bibtex8,sorting=none,backref=true]{biblatex}

\DeclareMathOperator*{\argmax}{argmax}

\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyhead[L]{\slshape \MakeUppercase{My Report}}
\fancyhead[R]{\slshape MY NAME}
\fancyfoot[C]{\thepage}  % page number in the center at the footer

% \renewcommand{\headrulewidth}{0pt}  % remove the horizotal line
\renewcommand{\footrulewidth}{0pt}  % remove the footer line


% \parindent 0ex % no need for indent
% \setlength{\parindent}{4em}  % indentation of paragraph

% \setlength{\parskip}{1em} % length between paragraphs
% \renewcommand{\baselinestretch}{1.5} % line spacing

\begin{document}

\begin{titlepage}

\begin{center}
\vspace*{1cm}
\huge{\textbf{My Group}} \\
% \Large{\textbf{My Report}} \\
\vfill
\line(1, 0){430}\\[1mm]
\Large{\textbf{TITLE 1}} \\[3mm]
\Large{\textbf{TITLE 2}}\\[1mm]
\line(1, 0){430}
\vfill

My NAME \\
[email protected] \\
http://ME.COM \\
%\today
\date{August 4, 2018}

\end{center}

\end{titlepage}

\tableofcontents
\thispagestyle{empty}
\clearpage

\setcounter{page}{1}  % set page number 1

\definecolor{bg}{rgb}{0.95,0.95,0.95}

\section{My Section}

HELLO HERE is My Section........

\end{document}

使用\today可以在页面上显示日期,但是使用\date{August 4, 2018}它不会在页面上显示日期。我该如何修复?

答案1

\date{}是指定日期 - 可以使用自由文本(例如您的) August 4, 2018或使用当前日期\date{\today}。这将存储日期以供日后使用。

要将其插入到文档中,您可以使用

\makeatletter
\@date
\makeatother

或者仅以纯文本形式书写,就像您对所有其他元素(如标题、作者等)所做的那样。


关于您的代码的一些其他评论:

  • 请不要多次加载同一个包

  • 类似命令\huge是开关,不接受参数


\documentclass[12pt]{article}


\usepackage[margin=1in]{geometry}
\usepackage{amsfonts, amsmath, amssymb}
\usepackage[none]{hyphenat}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{float}
%\usepackage{url}
\usepackage[nottoc, notlot, notlof]{tocbibind}
\usepackage{url}
\usepackage{bm}
\usepackage[autostyle]{csquotes}
%\usepackage[cache=false]{minted}
\usepackage{xcolor}
\usepackage{mdframed}
\usepackage[colorlinks,linkcolor=black]{hyperref}
\usepackage[lined, linesnumbered, ruled,vlined]{algorithm2e}

% \usepackage{natbib}
% \usepackage[hyperref=true,backend=bibtex8,sorting=none,backref=true]{biblatex}

\DeclareMathOperator*{\argmax}{argmax}

\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyhead[L]{\slshape \MakeUppercase{My Report}}
\fancyhead[R]{\slshape MY NAME}
\fancyfoot[C]{\thepage}  % page number in the center at the footer

% \renewcommand{\headrulewidth}{0pt}  % remove the horizotal line
\renewcommand{\footrulewidth}{0pt}  % remove the footer line

\date{August 4, 2018}

% \parindent 0ex % no need for indent
% \setlength{\parindent}{4em}  % indentation of paragraph

% \setlength{\parskip}{1em} % length between paragraphs
% \renewcommand{\baselinestretch}{1.5} % line spacing

\begin{document}

\begin{titlepage}

\begin{center}
\vspace*{1cm}
{\huge\textbf{My Group}} \\
% \Large{\textbf{My Report}} \\
\vfill
\line(1, 0){430}\\[1mm]
{\Large \textbf{TITLE 1}} \\[3mm]
{\Large\textbf{TITLE 2}}\\[1mm]
\line(1, 0){430}
\vfill

My NAME \\
[email protected] \\
http://ME.COM \\
%\today
\makeatletter
\@date
\makeatother


\end{center}

\end{titlepage}

\tableofcontents
\thispagestyle{empty}
\clearpage

\setcounter{page}{1}  % set page number 1

\definecolor{bg}{rgb}{0.95,0.95,0.95}

\section{My Section}

HELLO HERE is My Section........

\end{document}

相关内容