无法在环境中使用多受众枚举

无法在环境中使用多受众枚举

我正在尝试创建一个包含受众的枚举环境。截至目前,我有以下内容:

\documentclass[12pt]{article}
    \usepackage{hyperref, fancyhdr, setspace, array, keycommand, lastpage, xcolor}
    \usepackage{enumerate, enumitem}
    \usepackage{multiaudience, environ}
    \usepackage{amsmath, amssymb, amsfonts}
    \usepackage[margin=1 in]{geometry}
    \allowdisplaybreaks
    \hypersetup{
        linktoc=all,
        linkcolor=black,
    }

    \SetNewAudience{compact}
    \SetNewAudience{full}
    \def\CurrentAudience{compact}

    \newcommand{\divider}[0]{\textcolor{lightgray}{\rule{\textwidth}{0.1pt}}}

    % \NewEnviron{examples}{
    %   \begin{shownto}{-,compact}
    %       \underline{Examples}
    %       \begin{enumerate}
    %           \BODY
    %       \end{enumerate}
    %   \end{shownto}
    % }
    % \newenvironment{examples}{\underline{Examples}\enumerate}{\endenumerate\divider}
    \newenvironment{examples}{\shownto{-,compact}\underline{Examples}\enumerate}{\endenumerate\divider\endshownto}

\begin{document}

\begin{shownto}{-,compact}
    \begin{enumerate}
        \item test
    \end{enumerate}
\end{shownto}

\begin{examples}
    \item Test
\end{examples}

\end{document}

在所有情况下,目标都是为“紧凑”受众隐藏示例。

对于 NewEnviron, compact 可以工作,但 full 会给出一堆LaTeX Error: Too deeply nested.输出\end{examples}

对于新环境,完整工作,但紧凑给出以下内容:

[dir]/notes.tex:110: Undefined control seque
nce.
\enit@endenumerate ->\enit@after 
                                 \endlist \ifx \enit@series \relax \else \if...
l.110 \end{examples}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

[dir]/notes.tex:110: Undefined control seque
nce.
\enit@endenumerate ...\else \ifnum \enit@resuming 
                                                  =\@ne \enit@setresumekeys ...
l.110 \end{examples}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

[dir]/notes.tex:110: Missing number, treated
 as zero.
<to be read again> 
                   =
l.110 \end{examples}

A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

[dir]/notes.tex:110: Undefined control seque
nce.
\enit@setresumekeys ...xpandafter {\enit@savekeys 
                                                  }\xdef \enit@afterlist {#2...
l.110 \end{examples}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

[dir]/notes.tex:110: Undefined control seque
nce.
\enit@setresumekeys ...it@toks }\ifnum \enit@type 
                                                  =\z@ #3\def \enit@noexcs {...
l.110 \end{examples}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

[dir]/notes.tex:110: Missing number, treated
 as zero.
<to be read again> 
                   =
l.110 \end{examples}

A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

[dir]/notes.tex:110: Undefined control seque
nce.
<argument> enit@resume@series@\enit@series 

l.110 \end{examples}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

[dir]/notes.tex:110: Undefined control seque
nce.
\enit@setresumekeys ...me@#1}{\csname c@\@listctr 
                                                  \endcsname \the \csname c@...
l.110 \end{examples}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

[dir]/notes.tex:110: Undefined control seque
nce.
\enit@setresumekeys ...e \the \csname c@\@listctr 
                                                  \endcsname }\fi }
l.110 \end{examples}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

[dir]/notes.tex:110: You can't use `\relax' 
after \the.
<recently read> \c@ 

l.110 \end{examples}

I'm forgetting what you said and using zero instead.

[dir]/notes.tex:110: Undefined control seque
nce.
\enit@endenumerate ...t \fi \ifnum \enit@resuming 
                                                  =\thr@@ \enit@setresumekey...
l.110 \end{examples}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

[dir]/notes.tex:110: Missing number, treated
 as zero.
<to be read again> 
                   =
l.110 \end{examples}

A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

[dir]/notes.tex:110: Undefined control seque
nce.
\enit@setresumekeys ...xpandafter {\enit@savekeys 
                                                  }\xdef \enit@afterlist {#2...
l.110 \end{examples}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

[dir]/notes.tex:110: Undefined control seque
nce.
\enit@setresumekeys ...it@toks }\ifnum \enit@type 
                                                  =\z@ #3\def \enit@noexcs {...
l.110 \end{examples}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

[dir]/notes.tex:110: Missing number, treated
 as zero.
<to be read again> 
                   =
l.110 \end{examples}

A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

[dir]/notes.tex:110: Undefined control seque
nce.
\enit@setresumekeys ...me@#1}{\csname c@\@listctr 
                                                  \endcsname \the \csname c@...
l.110 \end{examples}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

[dir]/notes.tex:110: Undefined control seque
nce.
\enit@setresumekeys ...e \the \csname c@\@listctr 
                                                  \endcsname }\fi }
l.110 \end{examples}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

[dir]/notes.tex:110: You can't use `\relax' 
after \the.
<recently read> \c@ 

l.110 \end{examples}

I'm forgetting what you said and using zero instead.


Package Fancyhdr Warning: \headheight is too small (12.0pt): 
 Make it at least 14.49998pt.
 We now make it that large for the rest of the document.
 This may cause the page layout to be inconsistent, however.

[2]

有任何想法吗?

相关内容