【问题标题】:sphinx doc with different latex versions具有不同乳胶版本的狮身人面像文档
【发布时间】:2018-05-24 06:03:14
【问题描述】:

最近,我发现不同版本的 tex 存在一些问题。在我们公司,有的使用texlive2018,有的使用texlive2017。在我们的conf.py,我放了

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

它在 texlive2017 中运行良好,但在 texlive2018 中有一个redefined error。如果我删除\usepackage{chngcntr},那么 texlive2018 可以工作,但 texlive2017 有一个undefined error。当然,它是由较新版本的 texlive 中的一些更改触发的。但我想知道是否有一种方法可以在两个 texlive 版本上运行。

【问题讨论】:

    标签: latex python-sphinx


    【解决方案1】:

    确实,chngcntr 的宏已通过 TeXLive2018 移至 LaTeX 格式。

    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
    }
    

    如果您的 TeXLive2018 具有 chngctr 软件包的 v1.1a 2018/04/09 版本,那么应该可以找到所有内容。请检查。这是你看到的信息吗?这不是错误。

    其他你总是可以做的(注意r,否则反斜杠加倍)

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

    顺便说一句,有一个相关的 issue 与 LaTeX 格式,但它已经被修复了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-08
      • 1970-01-01
      • 1970-01-01
      • 2013-08-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多