我使用Sphinx来发布一门课程。我想创建一个自定义的训诫,标题由几个单词组成(例如 "历史笔记")。.admonition-title:after
在我的custom.css文件中。
.admonition-historical {
border: solid 1px;
border-color: rgb(153,102,153);
}
.rst-content .admonition-historical .admonition-title {
background: #AD85AD;
}
.rst-content .admonition-historical {
background: #EDE5ED
}
.rst-content .admonition-historical .admonition-title:before {
content: " 📖";
}
.rst-content .admonition-historical .admonition-title:after {
content: " notes";
}
在HTML文档中可以正常工作,但在LaTeX中就不行了,它只显示为 "历史"。
什么是正确的方式来定义一个复杂的多字标题的训诫,在HTML和LaTeX中都能很好的显示?
我不确定我是否正确理解了你的问题。不过,有 admonition
指令,允许在其参数中设置一个标题。
.. admonition:: This is generic admonition title
Generic admonition are rarely used but has one important benefit over
specific ones: author may define admonition title in directive argument.
Specific admonitions gets its type as title (danger has danger as title
etc.).