定义不适用于独立

定义不适用于独立

我有一个在 beamer 中突出显示文本的定义,它是从这里的一些帖子中获得的。当我使用beamer类时,它工作正常,但当我使用类时,它会抱怨定义standalone。这是一个外部定义的文件,\input当我使用独立类生成一些 PDF 图时,我需要该文件内容中的其他定义。所以,如果我能解决这个问题会很有帮助。有人知道为什么定义在类中失败了吗standalone?这是一个有效的 MWE:

\documentclass[margin=1mm,xcolor=pdftex,dvipsnames]{beamer}

\usepackage{tikz}
%---This is for highlighting text on overlays ----
\usepackage{xcolor,soul}
\sethlcolor{yellow}
\renewcommand<>{\hl}[1]{\only#2{\beameroriginal{\hl}}{#1}}
\makeatletter
\newcommand\SoulColor{%
    \let\set@color\beamerorig@set@color
    \let\reset@color\beamerorig@reset@color}
\makeatother
\SoulColor

\begin{document}
    \frame{\hl{Test}
    }
    
\end{document}

但是,当我转换为时beamerstandalone它会给我错误:

line 7: Command < undefined. \renewcommand<
line 7: Missing control sequence inserted. \renewcommand<>
line 7: Argument of \SOUL@n has an extra }. \renewcommand<>{\hl}
line 7: Paragraph ended before \SOUL@n was complete. \renewcommand<>{\hl}
line 7: Missing \begin{document}. \renewcommand<>{\hl}[
line 7: Undefined control sequence. \renewcommand<>{\hl}[1]{\only
line 7: You can't use `macro parameter character #' in horizontal mode. \renewcommand<>{\hl}[1]{\only#
line 7: Undefined control sequence. ...ewcommand<>{\hl}[1]{\only#2{\beameroriginal
line 7: Argument of \SOUL@n has an extra }. ...mand<>{\hl}[1]{\only#2{\beameroriginal{\hl}
line 7: Paragraph ended before \SOUL@n was complete. ...mand<>{\hl}[1]{\only#2{\beameroriginal{\hl}
line 7: You can't use `macro parameter character #' in vertical mode. ...d<>{\hl}[1]{\only#2{\beameroriginal{\hl}}{#
line 7: Missing \begin{document}. ...<>{\hl}[1]{\only#2{\beameroriginal{\hl}}{#1
line 15: Undefined control sequence. \begin{document}
line 17: Undefined control sequence. }
line 19: Undefined control sequence. \end{document}
line 19: Undefined control sequence. \end{document}
line 19: Undefined control sequence. \end{document}
line 19: Undefined control sequence. \end{document}
line 19: Undefined control sequence. \end{document}
: Unused global option(s): [xcolor].

任何帮助都将非常感激。

相关内容