我最近更新了我的 miktex 发行版的软件包。现在,在使用 LuaHBTeX 进行编译时,KOMA 脚本 (scrbook) 和 subfig 软件包的组合出现了问题。
MWE 给出了两个关于“未定义控制序列”的错误。当我删除 subfig 选项时,caption=false
它就可以正常工作了。但是,我使用了一些 KOMA 选项来更改字幕的外观,我想我记得在这种情况下应该caption=false
使用。
与我之前使用的版本相比,有什么变化?
- 子图:更新
Package: subfig 2005/06/28 ver: 1.3 subfig package
至not changed
- scrbook:更新
Document Class: scrbook 2018/03/30 v3.25 KOMA-Script document class (book)
至Document Class: scrbook 2020/07/22 v3.31 KOMA-Script document class (book)
KOMA 字幕外观选项:
\addtokomafont{caption}{\small}
\renewcommand\bfdefault{sb}
\setkomafont{captionlabel}{\small\sffamily\bfseries}
\setcapindent{1em}
\newlength{\lengthforcapwidth}
\setlength{\lengthforcapwidth}{10pt}
\setcapwidth[c]{\textwidth - \lengthforcapwidth - \lengthforcapwidth}
梅威瑟:
\documentclass [] {scrbook}
\usepackage[caption=false]{subfig}
\begin{document}
\begin{figure}[]%
\centering%
\subfloat[][Fig a]{%
\label{subfig:Figa}%
%\input{./Grafiken/TikzSource/FigaSource}}%
}
\hfill%
\subfloat[][Fig b]{%
\label{subfig:Figb}%
%\input{./Grafiken/TikzSource/FigbSource}}%
}
\caption{A description}%
\label{fig:notworking}%
\end{figure}
\end{document}
答案1
我建议用 替换包subfig
。然后您可以使用包和subcaption
的选项来布局标题:caption
subcaption
\documentclass [] {scrbook}
\usepackage{subcaption}% loads caption
\captionsetup[sub]{indention=0pt}
\captionsetup{
font=small,
labelfont={sf,bf},
format=plain,
indention=1em,
margin=10pt
}
\renewcommand\bfdefault{sb}
\begin{document}
\begin{figure}[htb]%
\centering
\subfloat[][Fig a]{%
\label{subfig:Figa}%
\rule{5cm}{2cm}%
}%
\hfill
\subfloat[][Fig b]{%
\label{subfig:Figb}%
\rule{5cm}{2cm}%
}%
\caption{A description}
\label{fig:notworking1}
\end{figure}
\begin{figure}[htb]%
\centering%
\subfloat[][Lorem ipsum dolor sit amet, consectetuer adipiscing elit.]
{\label{subfig:Figc}\rule{5cm}{2cm}}%
\hfill
\subfloat[][Etiam lobortis facilisis sem. Nullam nec mi et neque pharetra sollicitudin.]
{\label{subfig:Figd}\rule{5cm}{2cm}}%
\caption{Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Etiam lobortis facilisis sem.
Nullam nec mi et neque pharetra sollicitudin.}
\label{fig:notworking2}
\end{figure}
\end{document}
或者您可以使用 KOMA-Script 选项:
\documentclass [] {scrbook}
\usepackage{subcaption}% loads caption
\captionsetup[sub]{indention=0pt}
\addtokomafont{caption}{\small}
\setkomafont{captionlabel}{\sffamily\bfseries}
\setcapindent{1em}
\newlength{\lengthforcapwidth}
\setlength{\lengthforcapwidth}{10pt}
\setcapwidth{\dimexpr\textwidth - 2\lengthforcapwidth\relax}
\renewcommand\bfdefault{sb}
\begin{document}
\begin{figure}[htb]%
\centering
\subfloat[][Fig a]{%
\label{subfig:Figa}%
\rule{5cm}{2cm}%
}%
\hfill
\subfloat[][Fig b]{%
\label{subfig:Figb}%
\rule{5cm}{2cm}%
}%
\caption{A description}
\label{fig:notworking1}
\end{figure}
\begin{figure}[htb]%
\centering%
\subfloat[][Lorem ipsum dolor sit amet, consectetuer adipiscing elit.]
{\label{subfig:Figc}\rule{5cm}{2cm}}%
\hfill
\subfloat[][Etiam lobortis facilisis sem. Nullam nec mi et neque pharetra sollicitudin.]
{\label{subfig:Figd}\rule{5cm}{2cm}}%
\caption{Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Etiam lobortis facilisis sem.
Nullam nec mi et neque pharetra sollicitudin.}
\label{fig:notworking2}
\end{figure}
\end{document}
*File List*
scrbook.cls 2020/07/22 v3.31 KOMA-Script document class (book)
scrkbase.sty 2020/07/22 v3.31 KOMA-Script package (KOMA-Script-dependent bas
ics and keyval usage)
scrbase.sty 2020/07/22 v3.31 KOMA-Script package (KOMA-Script-independent b
asics and keyval usage)
keyval.sty 2014/10/28 v1.15 key=value parser (DPC)
scrlfile.sty 2020/07/22 v3.31 KOMA-Script package (loading files)
tocbasic.sty 2020/07/22 v3.31 KOMA-Script package (handling toc-files)
scrsize11pt.clo 2020/07/22 v3.31 KOMA-Script font size class option (11pt)
typearea.sty 2020/07/22 v3.31 KOMA-Script package (type area)
subcaption.sty 2020/08/23 v1.3g Sub-captions (AR)
caption.sty 2020/09/02 v3.5a Customizing captions (AR)
caption3.sty 2020/08/30 v2.0 caption3 kernel (AR)
caption-koma.sto 2020/08/22 v2.0 Adaption of the caption package to the KOMA
-Script document classes (AR)
l3backend-pdftex.def 2020-09-01 L3 backend support: PDF output (pdfTeX)
***********