exsheets 包中的逗号作为小数分隔符已损坏

exsheets 包中的逗号作为小数分隔符已损坏

如果我想在考试中使用逗号作为分数的小数分隔符,我通常会使用@clemens 在评论中提出的解决方案这里如下例所示。

但是自从我更新到 texlive 2017 后它就不再起作用了,这尤其破坏了很多旧文档。

那么,对此有新的解决方案吗(然后我可以在旧文档中进行查询替换)?

\documentclass{article}

\usepackage{icomma}
\usepackage[locale=DE]{siunitx}

\usepackage{exsheets}
\usepackage{tasks}

\ExplSyntaxOn \cs_set_protected:Npn \exsheets_num:n #1 { \num {#1} } \ExplSyntaxOff 

\begin{document}


\begin{question}{2.5}
  This is a question.
\end{question}


\end{document}

错误信息是:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  ./test_exam.tex:16:
!siunitx error: "invalid-token-in-number" Invalid token '\s ' in
!numerical input.  See the siunitx documentation for further
!information.  For immediate help type H <return>.
!...............................................

l.16 \end{question}


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  ./test_exam.tex:16:
!siunitx error: "invalid-number" Invalid numerical input '\s__fp
!\__fp_chk:w 10{1}{2500}{0000}{0000}{0000};'.  See the siunitx
!documentation for further information.  For immediate help type H
!<return>.  ...............................................

l.16 \end{question}

\listfiles结果是

 *File List*
 article.cls    2014/09/29 v1.4h Standard LaTeX document class
  size10.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
  icomma.sty    2002/03/10 v2.0 (WaS)
 siunitx.sty    2017/08/02 v2.7j A comprehensive (SI) units package
   expl3.sty    2017/09/18 L3 programming layer (loader) 
expl3-code.tex    2017/09/18 L3 programming layer 
l3pdfmode.def    2017/03/18 v L3 Experimental driver: PDF mode
  xparse.sty    2017/09/18 L3 Experimental document command parser
 amstext.sty    2000/06/29 v2.01 AMS text
  amsgen.sty    1999/11/30 v2.0 generic functions
   array.sty    2016/10/06 v2.4d Tabular extension package (FMi)
l3keys2e.sty    2017/09/18 LaTeX2e option processing using LaTeX3 keys
translator.sty    2010/06/12 ver 1.10
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
translator-language-mappings.tex
exsheets.sty    2017/02/08 v0.21i Yet another package for the creation of exercise sheets and exams.
xtemplate.sty    2017/09/18 L3 Experimental prototype document functions
etoolbox.sty    2017/01/02 v2.4 e-TeX tools for LaTeX (JAW)
 environ.sty    2014/05/04 v0.3 A new way to define environments
trimspaces.sty    2009/09/17 v1.1 Trim spaces around a token list
 pgfcore.sty    2010/04/11 v3.0.1a (rcs-revision 1.7)
graphicx.sty    2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)
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
  pdftex.def    2017/06/24 v1.0g Graphics/color driver for pdftex
  pgfsys.sty    2014/07/09 v3.0.1a (rcs-revision 1.48)
  pgfrcs.sty    2015/08/07 v3.0.1a (rcs-revision 1.31)
everyshi.sty    2001/05/15 v3.00 EveryShipout Package (MS)
  pgfrcs.code.tex
  pgfsys.code.tex
pgfsyssoftpath.code.tex    2013/09/09  (rcs-revision 1.9)
pgfsysprotocol.code.tex    2006/10/16  (rcs-revision 1.4)
  xcolor.sty    2016/05/11 v2.12 LaTeX color extensions (UK)
   color.cfg    2016/01/02 v1.6 sample color configuration
 pgfcore.code.tex
cntformats.sty    2014/07/20 v0.7 A different way to read counters. (CN)
cnltx-base.sty    2015/08/17 v0.13 LaTeX tools and documenting facilities (CN)
 pgfopts.sty    2014/07/10 v2.1a LaTeX package options with pgfkeys
 pgfkeys.sty    
 pgfkeys.code.tex
 ltxcmds.sty    2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
pdftexcmds.sty    2017/03/19 v0.25 Utility functions of pdfTeX for LuaTeX (HO)
infwarerr.sty    2016/05/16 v1.4 Providing info/warning/error messages (HO)
ifluatex.sty    2016/05/16 v1.4 Provides the ifluatex switch (HO)
   ifpdf.sty    2017/03/15 v3.2 Provides the ifpdf switch
exsheets_headings.def     2017/02/08 v0.21i ExSheets headings object
exsheets_headings.cfg     2017/02/08 v0.21i ExSheets headings instances 
   tasks.sty    2016/08/13 v0.12 Horizontalcolumnedlists (CN)
    epic.sty    
   tasks.cfg    2016/08/13 v0.12 tasks instances
    ulem.sty    2012/05/18
translations.sty    2017/08/31 v1.7a internationalization of LaTeX2e packages (CN)
scrlfile.sty    2017/09/07 v3.24 KOMA-Script package (loading files)
translator-basic-dictionary-English.dict    
siunitx-abbreviations.cfg    2017/08/02 v2.7j siunitx: Abbreviated units
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)
kvdefinekeys.sty    2016/05/16 v1.4 Define keys (HO)
kvoptions.sty    2016/05/16 v3.12 Key value format for package options (HO)
kvsetkeys.sty    2016/05/16 v1.17 Key value parser (HO)
etexcmds.sty    2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
translations-basic-dictionary-english.trsl    (english translation file `translations-basic-dictionary')
exsheets_configurations.cfg    
 ***********

答案1

添加\fp_eval:n;显然,exsheets传递一个浮点数给\exsheets_num:n并且这必须被“规范化”。

\documentclass{article}

\usepackage[locale=DE]{siunitx}

\usepackage{exsheets}
\usepackage{tasks}

\ExplSyntaxOn
\cs_set_protected:Npn \exsheets_num:n #1
 {
  \num{\fp_eval:n{#1}}
 }
\ExplSyntaxOff

\begin{document}


\begin{question}{2.5}
  This is a question.
\end{question}


\end{document}

在此处输入图片描述

相关内容