一旦我运行 latex,我就会收到以下错误 - !Package scrlayer 错误:无法定义“\newpagestyle”。有人能帮我解决吗?我使用与 scrlayer 相关的以下包(之前我使用的是 scrpage2,但它已经过时了)
\usepackage[automark]{scrlayer-scrpage}
下面我包含了无法编译的代码:
\documentclass[12pt]{article}
\usepackage[english]{babel}
\usepackage[mincitenames=1,maxcitenames=2,authordate,giveninits=true,
backend=biber, natbib,bibencoding=utf8]{biblatex-chicago}
\usepackage{calc}
\usepackage{appendix}
\usepackage{multirow}
\usepackage{amsmath}
\usepackage{cellspace}
\usepackage{mathtools}
\usepackage{lipsum}
% package for including graphics with figure-environment
\usepackage{graphicx}
\usepackage[normalem]{ulem}
%\usepackage{hyperref}
\usepackage{multirow}
\usepackage{setspace}
\usepackage{breqn}
%\usepackage{fontspec}
%\setmainfont{Times New Roman}
\usepackage{float}
\usepackage{rotating}
\usepackage[flushleft]{threeparttable}
\usepackage{array}
\usepackage{booktabs}
\usepackage{adjustbox}
\usepackage{tabularx}
\usepackage{titlesec}
\usepackage[colorlinks=true,citecolor=blue]{hyperref}
\addbibresource{Reference.bib}
\usepackage{bm}
\usepackage{blindtext}
\usepackage{multicol}
\usepackage{ragged2e}
\usepackage{mathtools}
\usepackage{fancyvrb}
\usepackage{subcaption}
\usepackage{supertabular}
\usepackage[labelfont=bf]{caption}
\captionsetup{justification = raggedright,
singlelinecheck = false}
\usepackage{makecell}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,decorations.pathreplacing}
%\usepackage[colorlinks=true,linkcolor=blue]{hyperref}
\usepackage[left=2.54cm,top=2.54cm,right=2.54cm,bottom=2.54cm]{geometry}
\pagestyle{myheadings}
\usepackage[automark]{scrlayer-scrpage}
\cfoot[]{\pagemark}
\setheadsepline[122mm]{0.3mm}
\setlength{\parindent}{0pt}
\newcommand{\mc}[1]{\multicolumn{2}{>
{\centering\arraybackslash}p{\widthof{0.000}}}{#1}}
%
\doublespacing
\makeatletter
\def\@xfootnote[#1]{%
\protected@xdef\@thefnmark{#1}%
\@footnotemark\@footnotetext}
\makeatother
\begin{document}
\end{titlepage}
\end{document}
答案1
我简化了您的示例,使其变得非常简洁。其他软件包与此问题无关。
罪魁祸首是titlesec
。 删除它可以解决问题。
\documentclass[12pt]{article}
%\usepackage{titlesec}
\usepackage[left=2.54cm,top=2.54cm,right=2.54cm,bottom=2.54cm]{geometry}
\pagestyle{myheadings}
\usepackage[automark]
{scrlayer-scrpage}
\cfoot[]{\pagemark}
\setheadsepline[122mm]{0.3mm}
\setlength{\parindent}{0pt}
\begin{document}
asdfasdf
\end{document}