首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Sphinx和Mathjax时,数组中包含\cline的错误输出

使用Sphinx和Mathjax时,数组中包含\cline的错误输出
EN

Stack Overflow用户
提问于 2020-09-15 21:17:58
回答 1查看 148关注 0票数 1

我使用Sphinx (v3.2.1)和LaTeX来生成矩阵方程,我想使用带数组的\cline。然而,它不会像预期的那样呈现:

代码语言:javascript
复制
.. math::
  :label: lp

  \left[
  \begin{array}{cc|c}
    a_{11} &a_{12} &b_1 \\
    a_{21} &a_{22} &b_2 \\
    a_{31} &a_{32} &b_3 \\ \cline{1-2}
    c_{1}  &c_{2}  &d \\
  \end{array}
  \right]

呈现为

我的conf.py是

代码语言:javascript
复制
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))

import os
import sys

sys.path.insert(1, os.path.abspath("../../"))
from trellis import __version__  # nopep8

import sphinx_rtd_theme  # nopep8

# -- Project information -----------------------------------------------------

project = 'foo'
copyright = 'foo'
author = 'foo'

# The full version, including alpha/beta/rc tags
release = __version__


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
    "sphinx.ext.autodoc",
    "sphinx.ext.doctest",
    "sphinx.ext.intersphinx",
    "sphinx.ext.todo",
    "sphinx.ext.coverage",
    "sphinx.ext.ifconfig",
    "sphinx.ext.viewcode",
    "sphinx.ext.githubpages",
    "sphinx.ext.autosummary",
    "sphinx.ext.napoleon",
    "sphinx.ext.autosectionlabel",
    "sphinx_rtd_theme",
    "sphinx.ext.mathjax",
]

intersphinx_mapping = {
    "python": ("https://docs.python.org/3", None),
    'numpy': ('http://docs.scipy.org/doc/numpy', None),
    'scipy': ('http://docs.scipy.org/doc/scipy/reference', None),
}

autodoc_default_options = {
    'members': None
}

napoleon_google_docstring = False
napoleon_include_init_with_doc = True
napoleon_include_private_with_doc = True
napoleon_include_special_with_doc = True
napoleon_use_admonition_for_examples = True
napoleon_use_admonition_for_notes = True
napoleon_use_admonition_for_references = True
napoleon_use_rtype = False

latex_elements = {
    "preamble": r'''\usepackage{amsmath}'''
}

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

# These paths are either relative to html_static_path
# or fully qualified paths (eg. https://...)
html_css_files = ['css/custom.css']
EN

回答 1

Stack Overflow用户

发布于 2020-12-30 18:59:03

所以我偶然发现了这个问题,因为我有一个非常相似的问题。我不确定您是否从一段时间前就解决了这个问题,但这是我得到的结果:我简单地使用了\hline而不是\cline。

代码语言:javascript
复制
.. math::

  \left[
  \begin{array}{cc|c}
    a_{11} &a_{12} &b_1 \\
    a_{21} &a_{22} &b_2 \\
    a_{31} &a_{32} &b_3 \\ 
    \hline
    c_{1}  &c_{2}  &d \\
  \end{array}
  \right]
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63902708

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档