简体   繁体   English

sphinx doc具有不同的乳胶版本

[英]sphinx doc with different latex versions

Recently, I found some issue with different version of tex. 最近,我发现不同版本的tex存在一些问题。 In our company, some are using texlive2018 and some are using texlive2017. 在我们公司中,有些正在使用texlive2018,有些正在使用texlive2017。 In our conf.py , I put 在我们的conf.py ,我把

latex_elements = {
    'preamble': '''\usepackage{chngcntr}
                 \counterwithin{figure}{chapter}
                 \counterwithin{table}{chapter}''',
}

It runs OK in texlive2017 but have a redefined error in texlive2018. 它在texlive2017中运行正常,但在texlive2018中有redefined error If I remove \\usepackage{chngcntr} , then texlive2018 works, but texlive2017 have a undefined error . 如果我删除\\usepackage{chngcntr} ,则texlive2018可以工作,但是texlive2017有undefined error Certainly, it is triggered by some changes in newer version of texlive. 当然,它是由texlive的较新版本中的某些更改触发的。 But I am wondering if there is a way so that it works on both texlive version. 但是我想知道是否有办法在两个texlive版本上都可以使用。

Indeed the macros of chngcntr have been moved to the LaTeX format with TeXLive2018. 实际上, chngcntr的宏已通过chngcntr移至LaTeX格式。

A new version of chngcntr package starts with this chngcntr软件包的新版本chngcntr开始

% version 1.1 this package has been adoped into the format so does not 
% need to do anything in current latex releases.

\@ifundefined{counterwithout}{}{%
\PackageInfo{chngcntr}{\string\counterwithout\space already defined.\MessageBreak
Quitting chngcntr}%
\endinput
}

Thus all should be find if your TeXLive2018 has the v1.1a 2018/04/09 version of the chngctr package. 因此,如果您的TeXLive2018具有chngctr软件包的v1.1a 2018/04/09版本,则应该全部找到。 Please check. 请检查。 Is this the Info you see? 这是您看到的信息吗? this is not an Error. 这不是错误。

Else you can always do (beware the r else double the backslashes) 否则,你总是可以做(提防r别人双倍的反斜杠)

latex_elements = {
    'preamble': r'''\ifdefined\counterwithout\else\usepackage{chngcntr}\fi
                 \counterwithin{figure}{chapter}
                 \counterwithin{table}{chapter}''',
}

By the way there was a related issue with the LaTeX format, but it has been fixed since. 顺便说一下,LaTeX格式存在一个相关问题 ,但此后已得到解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM