我的目录出现错误。而不是:
1 Section 1 -------- 1
我正进入(状态
black1 Section 1 --------1
我不知道为什么。我怀疑可能是因为我使用 pylatex 来编译 latex 脚本,它看起来像这样:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{geometry}
\usepackage{hyperref}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{array}
\usepackage{graphicx}
\geometry{portrait, margin=1in,tmargin=1in}}
\hypersetup{colorlinks,citecolor=black,filecolor=black,linkcolor=black,urlcolor=black}
\renewcommand{\rmdefault}{phv} % Arial
\renewcommand{\sfdefault}{phv} % Arial
\begin{titlepage}
\begin{document}
\hfill \\ Project Name \\
Systems Performance Team \\
External Reference: XXXX \\
Internal Reference: TPREF-XXXXXXXX \\
\begin{center}
\uppercase{\Huge{Report Title}} \\
\uppercase{\Huge{Line}} \\
\end{center}
\end{titlepage}
\tableofcontents
\clearpage
\section{Section 1}
\footnotesize
Hello, testing this document business
\end{document}
答案1
您放错了位置\begin{titlepage}
,导致了几个错误,所以输出实际上是不可预测的。
您的代码还需要一些重塑:
hyperref
应该最后加载- 而不是
colortbl
在之后加载xcolor
,而是\usepackage[table]{xcolor}
\uppercase{\Huge{text}}
是错误的;请\Huge
提前声明并使用\MakeUppercase
;还要记住,\Huge
不接受参数。geometry
和的选项hyperref
最好排成一行,这样更显眼
\documentclass{article}
\usepackage{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[table]{xcolor}% the correct way
\usepackage{array}
\usepackage{graphicx}
\usepackage{hyperref}
\geometry{
portrait,
margin=1in,
tmargin=1in
}
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=black
}
\renewcommand{\rmdefault}{phv} % Arial
\renewcommand{\sfdefault}{phv} % Arial
\begin{document}
\begin{titlepage}% <------ After \begin{document}
\vspace*{1cm} % or whatever
\begin{flushleft}
Project Name \\
Systems Performance Team \\
External Reference: XXXX \\
Internal Reference: TPREF-XXXXXXXX
\end{flushleft}
\vspace*{2cm} % or whatever
\begin{center}
\Huge
\MakeUppercase{Report Title} \\
\MakeUppercase{Line}
\end{center}
\end{titlepage}
\tableofcontents
\clearpage
\section{Section 1}
\footnotesize
Hello, testing this document business
\end{document}