我将文档配置为可自行编译的章节。每章的配置如下:
\documentclass[crop=false,class=embedchap]{standalone}
\begin{document}
\begin{subappendices}
\input{merge-algo}
\end{subappendices}
\end{document}
内容如下embedchap.cls
:
% embedchap
% This package provides common settings for chapters embedded in the book
%
% When a chapter is compiled by itself is compiled as an article
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{embedchap}[2019/09/01 Common configurations for the chapters embedded in the book]
% This class is based on KOMA script article class
\LoadClass{scrartcl}
% We want the title as in an article, instead of a book
\KOMAoptions{titlepage=false,fontsize=12pt}
% :: Language and charset
\RequirePackage[utf8]{inputenc}
\RequirePackage[french,american]{babel}
\RequirePackage[T1]{fontenc}
\RequirePackage{standalone}
\RequirePackage{appendix}
\RequirePackage{algorithm}
\RequirePackage{algpseudocode}
现在,如果的内容merge-algo.tex
如下:
\section{Algorithm to handle multiblock simulations}
\begin{algorithm}
\caption{Algorithm to merge a multi-block simulation}
\label{algo:merge}
\begin{algorithmic}[1]
\Procedure{MergeBlocks}{$blocks$}
\State $blocks\gets$\Call{Sort}{$blocks$}
\State $b_0 \gets blocks[0]$
\State $n_x, n_y, n_z \gets$ \Call{GetDimensions}{$b_0$}\Comment{Get first block dimensions}
\State $b_0\rightarrow$ \Call{SetStartIJK}{$0, 0, 0$}\Comment{The starting $i, j, k$ indices in the merged block}
\EndProcedure
\end{algorithmic}
\end{algorithm}
当我编译单个章节时,出现以下错误:
! Extra }, or forgotten \endgroup.
\@endfloatbox ...pagefalse \outer@nobreak \egroup
\color@endbox
l.13 \end{algorithm}
有什么帮助可以解决吗?