如何在Sphinx生成的乳胶文档中添加版权声明? [英] How to add copyright notice to sphinx-generated latex documentation?

查看:169
本文介绍了如何在Sphinx生成的乳胶文档中添加版权声明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了 copyright配置值,它会正确显示在HTML输出中.但是,它根本不会出现在LaTeX输出中,并且我找不到任何

I have set the copyright configuration value and it correctly appears in the HTML output. However, it does not appear at all in the LaTeX output, and I can't find any option for LaTeX output that will make it appear.

如何使用狮身人面像自动在LaTeX输出中包含版权声明?当然,我可以手动添加它,也可以编写一个小的脚本来添加它,但是我希望它可以在sphinx框架内实现.

How can I automatically include the copyright notice in the LaTeX output, using sphinx? Of course, I could manually add it or write a small script to add it, but I expect it should be possible within the sphinx framework.

显然,有一个要求改进,以使此过程变得更容易.

Apparently, there is a request for improvement to make this easier.

推荐答案

如果每个页面都需要版权(在标题页及其背面之后),则可以使用大量LaTeX宏来实现(抱歉,它将忽略copyright配置值)

If you want a copyright on each page (after title page and its back), you can do it with this mouthful of LaTeX macros (and sorry, it will ignore the copyright config value)

latex_elements = {
    'preamble': r'''
\makeatletter
   \fancypagestyle{normal}{
% this is the stuff in sphinx.sty
    \fancyhf{}
    \fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}
% we comment this out and
    %\fancyfoot[LO]{{\py@HeaderFamily\nouppercase{\rightmark}}}
    %\fancyfoot[RE]{{\py@HeaderFamily\nouppercase{\leftmark}}}
% add copyright stuff
    \fancyfoot[LO,RE]{{This is \textcopyright\ 2019, Sphinx Team.}}
% again original stuff
    \fancyhead[LE,RO]{{\py@HeaderFamily \@title\sphinxheadercomma\py@release}}
    \renewcommand{\headrulewidth}{0.4pt}
    \renewcommand{\footrulewidth}{0.4pt}
    }
% this is applied to each opening page of a chapter
   \fancypagestyle{plain}{
    \fancyhf{}
    \fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0.4pt}
% add copyright stuff for example at left of footer on odd pages,
% which is the case for chapter opening page by default
    \fancyfoot[LO,RE]{{This is \textcopyright\ 2019, Sphinx Team.}}
    }
\makeatother
''',
}

有关LaTeX语法的更多信息,请参见 fancyhdr文档.您必须使用LaTeX逃避任何令人担忧的字符,例如$.

For more info on the LaTeX syntax see fancyhdr docs. You have to LaTeX-escape yourself any worrisome character like $.

自Sphinx 1.8.3起,您可以通过\sphinxbackoftitlepage将LaTeX素材直接放置在标题页的背面(对于'manual' docclass,因为对于'howto' docclass没有这种概念),您可以使用可选的LaTeX宏.在'preamble''maketitle'中定义.参见文档(您需要向下滚动到'maketitle').

Since Sphinx 1.8.3, you can put LaTeX material directly on back of title page (for 'manual' docclass, as there is no such notion for 'howto' docclass) via \sphinxbackoftitlepage which is optional LaTeX macro you can define in 'preamble' or 'maketitle'. See docs (you need to scroll down to 'maketitle').

似乎只在一个位置发布版权确实更好,所以为什么不在标题页的后面发布版权,因为默认情况下将其保留为空. ('manual'文档类)

It seems to make indeed better sense to issue the copyright only at one location, so why not at back of title page as it is left empty by default. ('manual' docclass)

这篇关于如何在Sphinx生成的乳胶文档中添加版权声明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆