我正在尝试使用 LaTeX 为我的论文制作标题页,但什么都没有出现。我读过其他问题,但仍然无法正确完成。我所做的是:
\documentclass[reqno]{article}
\usepackage{amsmath,amsthm,amsfonts}
\usepackage{empheq}
\usepackage{lipsum}
\usepackage{caption}
\usepackage[utf8]{inputenc}
\usepackage[capposition=top]{floatrow}
\usepackage[table]{xcolor}
\definecolor{myblue}{rgb}{.8, .8, 1}
\usepackage{amssymb}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{bm}
\usepackage{mathcomp}
\usepackage[table]{xcolor}
\usepackage{pdfpages}
\usepackage{amsmath,esint}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[colorlinks]{hyperref}
\usepackage{tensor}
\usepackage{atbegshi}
\usepackage{esvect}
\usepackage{titlesec}
\usepackage{listings}
\usepackage[margin=1in]{geometry}
\usepackage{float}
\usepackage{minitoc}
\usepackage{booktabs}
\usepackage{apacite}
\usepackage{nomencl}
\newlength\mytemplen
\newsavebox\mytempbox
\makeatletter
\newcommand\mybluebox{%
\@ifnextchar[%]
{\@mybluebox}%
{\@mybluebox[0pt]}}
\def\@mybluebox[#1]{%
\@ifnextchar[%]
{\@@mybluebox[#1]}%
{\@@mybluebox[#1][0pt]}}
\def\@@mybluebox[#1][#2]#3{
\sbox\mytempbox{#3}%
\mytemplen\ht\mytempbox
\advance\mytemplen #1\relax
\ht\mytempbox\mytemplen
\mytemplen\dp\mytempbox
\advance\mytemplen #2\relax
\dp\mytempbox\mytemplen
\colorbox{myblue}{\hspace{1em}\usebox{\mytempbox}\hspace{1em}}}
\makeatother
\newcommand*\widefbox[1]{\fbox{\hspace{2em}#1\hspace{2em}}}
\newcommand{\vhtable}{\rule{30pt}{30pt}}
\newcommand{\eps}{\varepsilon}
\newcommand{\bU}{\mathbf{U}}
\newcommand{\bH}{\mathbf{H}}
\newcommand{\uvec}[1]{\boldsymbol{\hat{\textbf{#1}}}}
\newcommand{\sgn}{\text{sgn}}
\newcommand{\pw}{p^w}
\newcommand{\epsw}{\varepsilon^w}
\def\R{\mathbb{R}}
\def\N{\mathbb{N}}
\newcommand{\ud}{u^{\delta}}
\newcommand{\vect}[1]{\boldsymbol{#1}}
\newcommand{\md}{m^{\delta}}
\newcommand{\nd}{n^{\delta}}
\newcommand{\psid}{\psi_{\delta}}
\newcommand{\cde}{c^{\delta}}
\newcommand*\VF[1]{\mathbf{#1}}
\newcommand*\dif{\mathop{}\!\mathrm{d}}
\newcommand*{\captionsource}[2]{%
\caption[{#1}]{%
#1%
\\\hspace{\linewidth}%
\textbf{Source:} #2%
}%
}
\newcommand\citecolor[1]{\@namedef{keycolor#1}{\color{black}}}
\newcommand{\mde}{m^{\delta}}
\newcommand{\nde}{n^{\delta}}
\newcommand{\ude}{u^{\delta}}
\newlength\dlf
\newcommand\alignedbox[2]{
{
\settowidth\dlf{$\displaystyle #1$}
\addtolength\dlf{\fboxsep+\fboxrule}
\hspace{-\dlf}
\boxed{#1 #2}
}
}
\newcommand\MyTabHeadings{%
\rowcolor{Tab}\rowstyle{\bfseries\color{white}}}
\newcommand{\mT}{\widetilde{m}}
\renewcommand{\arraystretch}{2}
\renewcommand{\thesection}{\arabic{section}}
\newtheorem{deff}{Definition}[section]
\newtheorem{thm}{Theorem}[section]
\newtheorem{remark}{Remark}[section]
\newtheorem{lem}{Lemma}[section]
\newtheorem{prop}{Proposition}[section]
\newtheorem{cor}{Corollary}[section]
\titleformat{\chapter}{\LARGE\bfseries}{\thechapter.\ }{0em}{}
\AtBeginDocument{\AtBeginShipoutNext{\AtBeginShipoutDiscard}}
\makeatletter
\newcommand*{\@rowstyle}{}
\newcommand*{\rowstyle}[1]{
\gdef\@rowstyle{#1}
\@rowstyle\ignorespaces
}
\newcolumntype{=}{
>{\gdef\@rowstyle{}}
}
\newcolumntype{+}{
>{\@rowstyle}
}
\makeatletter
\AtBeginDocument{
\let\nl@org@contentsline\contentsline
\def\contentsline#1{
\def\nl@current@levelname{#1}
\nl@org@contentsline{#1}
}%
}
\protected\def\numberline#1{%
\begingroup
\edef\nl@align{%
nl@align@%
\@ifundefined{nl@current@levelname}{}{\nl@current@levelname}%
}%
\edef\nl@align{%
\@ifundefined{\nl@align}\nl@align@{\csname\nl@align\endcsname}%
}%
\@ifundefined{nl@numberline@\nl@align}{%
\errmessage{Unknown alignment '\nl@align' for \noexpand\numberline}%
\nl@numberline@l{#1}%
}{%
\csname nl@numberline@\nl@align\endcsname{#1}%
}%
\endgroup
}
\newcommand*{\nl@numberline@l}[1]{
\hb@xt@\@tempdima{#1 \hfil}%
}
\newcommand*{\nl@numberline@c}[1]{%
\hb@xt@\@tempdima{\hfil#1 \hfil}%
}
\newcommand*{\nl@numberline@r}[1]{%
\hb@xt@\@tempdima{\hfil#1 }%
}
\def\nl@align@{l}
\def\nl@align@section{r}
\makeatletter
\makeatother
\makeatletter
\definecolor{lightgray}{gray}{0.9}
\makenomenclature
\makeglossary
\makeatletter
\setcounter{tocdepth}{3}
\AtBeginDocument{%
\expandafter\newcommand\csname r@tocindent0\endcsname{0pt}
}
\makeatother
\makeatother
\begin{document}
\title{title name}
\author{My name}
\date{Spring 2017}
\maketitle
\newpage
\begin{abstract}
\normalsize
Abstract
\end{abstract}
\newpage
{
\hypersetup{linkcolor=black}
\tableofcontents
\clearpage
}
\makeatletter
\let\toc@pre\relax
\let\toc@post\relax
\makeatother
\section{\textbf{Introduction}}
\end{document}
但它没有在我的 LaTeX 文档中显示任何内容。我正在使用article
文档类。
有人知道我应该做些什么不同的事情吗?
答案1
下面提到的几行导致了这个问题,
\usepackage{titlesec}
\titleformat{\chapter}{\LARGE\bfseries}{\thechapter.\ }{0em}{}
\AtBeginDocument{\AtBeginShipoutNext{\AtBeginShipoutDiscard}}
通过注释这些行,标题文本会出现在输出中