Docclass {article}:将 {exam} 类更改为 {article} 会产生日志错误

Docclass {article}:将 {exam} 类更改为 {article} 会产生日志错误

下面的 mwe 编译时没有错误,直到我做了这个改变:

原来的:\documentclass[12pt]{exam}

修订:\documentclass[12pt]{article}

从 更改为{exam}{article}导致以下 2 个相关错误:

Undefined control sequence

l.53 \pagestyle{head}

No \begin{document} command was found.

\begin{document}与修订前位于同一位置。

感谢您花时间帮助我!

姆韦

\documentclass[12pt]{article}
\usepackage[a4paper,margin=0.5in,include head]{geometry}
%--code lines #4-6 show grid lines for page layout. Don't use in a real document!
%\usepackage{showframe}
%\renewcommand\ShowFrameLinethickness{0.15pt}
%\renewcommand*\ShowFrameColor{\color{red}}

\usepackage{amsmath}
\usepackage{systeme}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}       % <---
\pgfplotsset{GRID/.style = {    % define common style for images
    width=100mm,
    axis lines=middle,
    axis line style={-stealth,shorten >=-3mm},
    xlabel=$x$, xlabel style={anchor=south west},
    ylabel=$y$, ylabel style={anchor=south east},
    grid=both,
    grid style={draw=gray!25},
    ticklabel style={font=\scriptsize, text=black!50, inner sep=1pt},
    xmin=-10,   xmax=10,
    ymin=-10,   ymax=10,
    xtick distance=2,
    ytick distance=2,
    minor tick num=1,
    tick align=outside,
            }}
\usetikzlibrary{intersections}

%added
\usepackage[strict]{changepage}     
\makeatletter
\newsavebox\restorebox              
\newenvironment{restoretext}%
    {\@parboxrestore%
     \begin{adjustwidth}{-3em}{}%
                \begin{lrbox}{\restorebox}%
                \begin{minipage}{\linewidth}%
    }{\end{minipage}\end{lrbox}
        \usebox\restorebox
        \end{adjustwidth}
     }
\makeatother     
%---------------------------------------------------------------%
\usepackage{tikz}
\usepackage{enumitem,tasks}
\settasks{
  label-width=2em,
  item-indent=3em,
  label=(\arabic*),
  column-sep=0.75em,    % <---
 }
 \pagestyle{head}
\header{\textbf{Algebra II: Quadratic Systems}}
{}
{ 04/17/23}

\begin{document}

\textbf {SET A: Solve each system by graphing.}

\begin{tasks}(2)   
%Prob #1
\task $\syslineskipcoeff{1}\systeme*{y=2(x+4)^2-5, y=-2x-9}$\\
\medskip
\begin{restoretext}
\begin{tikzpicture}
        \begin{axis}[GRID]
        \end{axis}
    \end{tikzpicture}
\end{restoretext}

%Prob #2
  \task $\syslineskipcoeff{1}\systeme*{y=2(x+4)^2-3, y=x+7}$\\
\medskip
\begin{restoretext}
\begin{tikzpicture}
        \begin{axis}[GRID]
        \end{axis}
    \end{tikzpicture}
\end{restoretext}

\bigskip
%Prob #3
\task $\syslineskipcoeff{1}\systeme*
{y=2(x-3)^2+1, 2x+y=11}$\\
\medskip
\begin{restoretext}
\begin{tikzpicture}
        \begin{axis}[GRID]
        \end{axis}
    \end{tikzpicture}
\end{restoretext}
%Prob #4
\task $\syslineskipcoeff{1}\systeme*
{y=\frac{1}{2}(x-4)^2-3, y=2x-11}$\\
\medskip
\begin{restoretext}
\begin{tikzpicture}
        \begin{axis}[GRID]
        \end{axis}
    \end{tikzpicture}
\end{restoretext}
\end{tasks}

\end{document}```

答案1

考试类定义了自己的标题和样式,与文章类不同。因此\pagestyle{head}产生了不可恢复的错误,编译崩溃。

如果您更换

\pagestyle{head}
\header{\textbf{Algebra II: Quadratic Systems}}
{}
{ 04/17/23}

\thispagestyle{myheadings}
\markright{\normalfont\textbf{Algebra II: Quadratic Systems}\hfill  04/17/23}

由于exam加载了类article,该解决方案(针对此页面)将适用于这两个类。

相关内容