继之前关于修改长文档的问题之后caption
(带有不错的解决方案由@egreg 提议),我最终使用该changes
包来处理更正。由于我的文档是法语的,因此我还使用带有选项的babel
包french
。
使用[french]{babel}
,[final]{changes}
并且caption
重新定义会导致编译错误
删除 或 修改都{babel}
不会[final]
显示caption
错误。
有人能澄清一下这个问题吗?
% arara: pdflatex
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage[dvipsnames,svgnames]{xcolor}
\usepackage[french]{babel}
\usepackage[justification=centering]{caption}
\usepackage{hyperref}
\usepackage[final]{changes}
% Retouche automatique de la liste des figures
\usepackage{xparse}
\ExplSyntaxOn
\NewDocumentCommand{\bamboocaption}{som}
{
\IfBooleanTF{#1}
{
\captioncaption*{#3}
}
{
\IfValueTF{#2}
{
\captioncaption[#2]{#3}
}
{
\seq_set_split:Nnn \l_tmpa_seq { . } { #3 }
\int_compare:nTF { \seq_count:N \l_tmpa_seq < 2 }
{% no period
\captioncaption{#3}
}
{
\captioncaption[\seq_item:Nn \l_tmpa_seq { 1 }]{#3}
}
}
}
}
\ExplSyntaxOff
\AtBeginDocument{%
\let\captioncaption\caption
\let\caption\bamboocaption
}
\begin{document}
\lipsum[1]
\begin{figure}
\includegraphics[scale=0.5]{example-image-a}
\caption{Graph A. Some additional information. \label{figa}}
\end{figure}
\begin{figure}
\includegraphics[scale=0.5]{example-image-b}
\caption{Graph B. Some additional information. \label{figb}}
\end{figure}
\added{Discussion about figure~\ref{figa}}
\listoffigures
\end{document}
编辑日志文件错误
! Undefined control sequence.
\r@figa ->{1}{1}{\seq
_item:Nn \l _tmpa_seq {1}}{figure.caption.1}{}
l.57 \added{Discussion about figure~\ref{figa}}
编辑文件列表
*File List*
article.cls 2018/09/03 v1.4i Standard LaTeX document class
size10.clo 2018/09/03 v1.4i Standard LaTeX file (size option)
inputenc.sty 2018/08/11 v1.3c Input encoding file
fontenc.sty
t1enc.def 2018/08/11 v2.0j Standard LaTeX file
lipsum.sty 2019/01/02 v2.2 150 paragraphs of Lorem Ipsum dummy text
expl3.sty 2019-08-14 L3 programming layer (loader)
expl3-code.tex 2019-08-14 L3 programming layer
l3backend-pdfmode.def 2019-04-06 v L3 Experimental backend support: PDF mode
xparse.sty 2019-05-28 L3 Experimental document command parser
lipsum.ltd
xcolor.sty 2016/05/11 v2.12 LaTeX color extensions (UK)
color.cfg 2016/01/02 v1.6 sample color configuration
pdftex.def 2018/01/08 v1.0l Graphics/color driver for pdftex
dvipsnam.def 2016/06/17 v3.0m Driver-dependent file (DPC,SPQR)
svgnam.def 2016/05/11 v2.12 Predefined colors according to SVG 1.1 (UK)
graphicx.sty 2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)
keyval.sty 2014/10/28 v1.15 key=value parser (DPC)
graphics.sty 2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)
trig.sty 2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg 2016/06/04 v1.11 sample graphics configuration
babel.sty 2019/07/19 3.33 The Babel package
bblopts.cfg 2005/09/08 v0.1 add Arabic and Farsi to "declared" options of b
abel
french.ldf 2019/03/30 v3.5e French support from the babel system
scalefnt.sty
caption.sty 2018/10/06 v3.3-154 Customizing captions (AR)
caption3.sty 2018/09/12 v1.8c caption3 kernel (AR)
hyperref.sty 2019/06/12 v6.88h Hypertext links for LaTeX
hobsub-hyperref.sty 2016/05/16 v1.14 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty 2016/05/16 v1.14 Bundle oberdiek, subset generic (HO)
hobsub.sty 2016/05/16 v1.14 Construct package bundles (HO)
infwarerr.sty 2016/05/16 v1.4 Providing info/warning/error messages (HO)
ltxcmds.sty 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
ifluatex.sty 2016/05/16 v1.4 Provides the ifluatex switch (HO)
ifvtex.sty 2016/05/16 v1.6 Detect VTeX and its facilities (HO)
intcalc.sty 2016/05/16 v1.2 Expandable calculations with integers (HO)
ifpdf.sty 2018/09/07 v3.3 Provides the ifpdf switch
etexcmds.sty 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty 2016/05/16 v1.17 Key value parser (HO)
kvdefinekeys.sty 2016/05/16 v1.4 Define keys (HO)
pdftexcmds.sty 2019/07/25 v0.30 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty 2016/05/16 v1.14 Implements pdfTeX's escape features (HO)
bigintcalc.sty 2016/05/16 v1.4 Expandable calculations on big integers (HO)
bitset.sty 2016/05/16 v1.2 Handle bit-vector datatype (HO)
uniquecounter.sty 2016/05/16 v1.3 Provide unlimited unique counter (HO)
letltxmacro.sty 2016/05/16 v1.5 Let assignment for LaTeX macros (HO)
hopatch.sty 2016/05/16 v1.3 Wrapper for package hooks (HO)
xcolor-patch.sty 2016/05/16 xcolor patch
atveryend.sty 2016/05/16 v1.9 Hooks at the very end of document (HO)
atbegshi.sty 2016/06/09 v1.18 At begin shipout hook (HO)
refcount.sty 2016/05/16 v3.5 Data extraction from label references (HO)
hycolor.sty 2016/05/16 v1.8 Color options for hyperref/bookmark (HO)
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
auxhook.sty 2016/05/16 v1.4 Hooks for auxiliary files (HO)
kvoptions.sty 2016/05/16 v3.12 Key value format for package options (HO)
pd1enc.def 2019/06/12 v6.88h Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive
url.sty 2013/09/16 ver 3.4 Verb mode for urls, etc.
hpdftex.def 2019/06/12 v6.88h Hyperref driver for pdfTeX
rerunfilecheck.sty 2016/05/16 v1.8 Rerun checks for auxiliary files (HO)
changes.sty 2019/07/21 v3.1.3 changes package
xkeyval.sty 2014/12/03 v2.7a package option processing (HA)
xkeyval.tex 2014/12/03 v2.7a key=value parser (HA)
xifthen.sty 2015/11/05 v1.4.0 Extended ifthen features
calc.sty 2017/05/25 v4.3 Infix arithmetic (KKT,FJ)
ifthen.sty 2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
ifmtarg.sty 2018/04/16 v1.2b check for an empty argument
xstring.sty 2019/02/06 v1.83 String manipulations (CT)
pdfcolmk.sty 2016/05/16 v1.3 Color support for pdfTeX via marks (HO)
ulem.sty 2012/05/18
todonotes.sty 2018/11/22
tikz.sty 2019/08/03 v3.1.4b (3.1.4b)
pgf.sty 2019/08/03 v3.1.4b (3.1.4b)
pgfrcs.sty 2019/08/03 v3.1.4b (3.1.4b)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfcore.sty 2019/08/03 v3.1.4b (3.1.4b)
pgfsys.sty 2019/08/03 v3.1.4b (3.1.4b)
pgfsys.code.tex
pgfsyssoftpath.code.tex 2019/08/03 v3.1.4b (3.1.4b)
pgfsysprotocol.code.tex 2019/08/03 v3.1.4b (3.1.4b)
pgfcore.code.tex
pgfcomp-version-0-65.sty 2019/08/03 v3.1.4b (3.1.4b)
pgfcomp-version-1-18.sty 2019/08/03 v3.1.4b (3.1.4b)
pgffor.sty 2019/08/03 v3.1.4b (3.1.4b)
pgfkeys.sty
pgfkeys.code.tex
pgfmath.sty
pgfmath.code.tex
pgffor.code.tex
tikz.code.tex
truncate.sty 2001/08/20 ver 3.6
supp-pdf.mkii
epstopdf-base.sty 2016/05/15 v2.6 Base part for package epstopdf
grfext.sty 2016/05/16 v1.2 Manage graphics extensions (HO)
nameref.sty 2016/05/21 v2.44 Cross-referencing by name of section
gettitlestring.sty 2016/05/16 v1.5 Cleanup title references (HO)
test.out
test.out
example-image-a.pdf Graphic file (type pdf)
example-image-b.pdf Graphic file (type pdf)
答案1
您想要使用以下扩展\seq_item:Nn
:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage[dvipsnames,svgnames]{xcolor}
\usepackage[french]{babel}
\usepackage[justification=centering]{caption}
\usepackage[final]{changes}
\usepackage{xparse}
\usepackage{hyperref}
% Retouche automatique de la liste des figures
\ExplSyntaxOn
\NewDocumentCommand{\bamboocaption}{som}
{
\IfBooleanTF{#1}
{
\captioncaption*{#3}
}
{
\IfValueTF{#2}
{
\captioncaption[#2]{#3}
}
{
\seq_set_split:Nnn \l_tmpa_seq { . } { #3 }
\int_compare:nTF { \seq_count:N \l_tmpa_seq < 2 }
{% no period
\captioncaption{#3}
}
{
\use:x{\exp_not:N \captioncaption[\seq_item:Nn \l_tmpa_seq { 1 }]\exp_not:n{{#3}}}
}
}
}
}
\ExplSyntaxOff
\AtBeginDocument{%
\let\captioncaption\caption
\let\caption\bamboocaption
}
\begin{document}
\lipsum[1]
\begin{figure}
\includegraphics[scale=0.5]{example-image-a}
\caption{Graph A. Some additional information. \label{figa}}
\end{figure}
\begin{figure}
\includegraphics[scale=0.5]{example-image-b}
\caption{Graph B. Some additional information. \label{figb}}
\end{figure}
\added{Discussion about figure~\ref{figa}}
\listoffigures
\end{document}