我正在尝试将一些 pdf 页面包含到我的报告中包含,但是当我添加时\usepackage{pdfpages}
,任何 \chapter 出现都会给我以下错误:
Missing number, treated as zero \chapter{hi}
Color stack action is missing \chapter{hi}
我正在使用 TexLive 2013、TexStudio 和 Windows 8。
梅威瑟:
\documentclass[12pt,a4paper]{report}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[left=2.00cm, right=2.00cm, top=2.00cm, bottom=2.00cm]{geometry}
\usepackage[toc, page]{appendix}
\usepackage{graphicx}
\usepackage{float}
\usepackage{subcaption}
\usepackage[ampersand]{easylist}
\usepackage{tabularx}
\usepackage[parfill]{parskip}
\usepackage[ampersand]{easylist}
\usepackage{enumitem}
\setlist{nolistsep}
\usepackage{array}% http://ctan.org/pkg/array
\setlength{\extrarowheight}{3pt}
\usepackage{titlesec}
\makeatletter
\renewcommand\chapter{\par%
\thispagestyle{plain}%
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter\@schapter}
\makeatother
\titleformat{\chapter}
{\normalfont\LARGE\bfseries\MakeUppercase}{\thechapter}{1em}{}
\titlespacing{\chapter}{0pt}{10pt}{5pt}
\titlespacing{\section}{0pt}{0pt}{-3pt}
\titlespacing{\subsection}{0pt}{0pt}{-3pt}
\usepackage[style=ieee,backend=biber]{biblatex}
\addbibresource{refs.bib}
\addbibresource{refs2.bib}
\graphicspath{{./img/}}
\usepackage{pdfpages}
\begin{document}
\chapter{hi}
\end{document}
答案1
您的问题与 无关pgfpages
;您使用的\MakeUppercase
方式错误:\MakeUppercase
接收强制参数。如果您想将 \MakeUppercase 用于章节标题,则可以使用 的explicit
选项,该选项titlesec
允许您通过可用作 的参数的参数访问标题\MakeUppercase
:
\documentclass[12pt,a4paper]{report}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[left=2.00cm, right=2.00cm, top=2.00cm, bottom=2.00cm]{geometry}
\usepackage[toc, page]{appendix}
\usepackage{graphicx}
\usepackage{float}
\usepackage{subcaption}
\usepackage[ampersand]{easylist}
\usepackage{tabularx}
\usepackage[parfill]{parskip}
\usepackage[ampersand]{easylist}
\usepackage{enumitem}
\setlist{nolistsep}
\usepackage{array}% http://ctan.org/pkg/array
\setlength{\extrarowheight}{3pt}
\usepackage[explicit]{titlesec}
\makeatletter
\renewcommand\chapter{\par%
\thispagestyle{plain}%
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter\@schapter}
\makeatother
\titleformat{\chapter}
{\normalfont\LARGE\bfseries}{\thechapter}{1em}{\MakeUppercase{#1}}
\titlespacing{\chapter}{0pt}{10pt}{5pt}
\titlespacing{\section}{0pt}{0pt}{-3pt}
\titlespacing{\subsection}{0pt}{0pt}{-3pt}
\usepackage[style=ieee,backend=biber]{biblatex}
\addbibresource{refs.bib}
\addbibresource{refs2.bib}
\graphicspath{{./img/}}
\usepackage{pdfpages}
\begin{document}
\chapter{hi}
\end{document}
顺便说一句,我建议您不要使用大写字母作为标题,而应该使用小写字母;如果您被迫使用大写字母,请考虑使用不使用大写字母作为特殊字符(数学、标签等)的包\MakeTextUppercase
。textcase