相关疑难解决方法(0)

使LaTeX中的代码看起来很漂亮*

我正在撰写项目报告,并解释我曾经使用的稍微疯狂的不直观的代码,我需要在其中放入大量的示例代码的简短摘录.

如何将代码导入LaTeX:

  • 看起来不错
  • 如果行太长(列出lstlisting或逐字),则不会偏离页面的一侧
  • 优选地与文本的其余部分一致

EDITED(想想我会添加设置,这样人们就不必尝试自己解决这些问题了(取自wikibooks(进一步向下链接)并编辑好看))

不错的设置:

\usepackage{color}
\usepackage{listings}
\lstset{ %
language=C++,                % choose the language of the code
basicstyle=\footnotesize,       % the size of the fonts that are used for the code
numbers=left,                   % where to put the line-numbers
numberstyle=\footnotesize,      % the size of the fonts that are used for the line-numbers
stepnumber=1,                   % the step between two line-numbers. If it is 1 each line will be numbered
numbersep=5pt,                  % how far the line-numbers are from the code
backgroundcolor=\color{white},  % …
Run Code Online (Sandbox Code Playgroud)

latex listings

132
推荐指数
2
解决办法
11万
查看次数

sphinx定制的latexpdf输出?

只是好奇是否有人知道如何在使用latexpdf目标时自定义sphinx输出?我已经看到很多用于html输出的自定义内容,但似乎无法找到自定义pdf输出的任何示例.

具体来说,我有兴趣自定义标题页,页眉,页脚,并可能在内容之前添加几页前面的内容.

有没有人见过这种定制的例子,或者人们在生成pdf时几乎只使用"股票"sphinx输出?谢谢!

latex pdflatex python-sphinx

19
推荐指数
1
解决办法
7386
查看次数

如何禁用sphinx生成的LaTeX输出中的颜色?

当我构建从sphinx生成的LaTeX文件时,TOC条目和节标题是蓝色的.是否有一种简单的方法来禁用这些项目的着色?如果没有,是否有一种简单的方法可以让它们变黑?我的目标是在非彩色打印机上打印文档,当我这样做时,TOC和标题看起来不像文本的其他部分那样暗.

如果可能的话,我想做一个适用于整个文档的更改.

注意:我正在使用howto文档类.


更新

感谢ddbeck的输入,我仔细研究了sphinx.sty哪些颜色需要改变.我按如下方式设置(创建)latex_elements字典conf.py:

mypreamble ='''
\\pagenumbering{arabic}
\\definecolor{TitleColor}{rgb}{0,0,0}
\\definecolor{InnerLinkColor}{rgb}{0,0,0}
'''
latex_elements = {
    'papersize':'letterpaper',
    'pointsize':'11pt',
    'preamble':mypreamble
    }
Run Code Online (Sandbox Code Playgroud)

这完全符合我的要求.谢谢ddbeck!

latex python-sphinx

14
推荐指数
1
解决办法
1478
查看次数

在Sphinx中创建LaTeX数学宏

我正在用Python编写一些数学代码,并使用Sphinx生成文档.我知道Sphinx可以在Python文档字符串中处理LaTeX代码; 请参阅http://sphinx.pocoo.org/latest/ext/math.html#module-sphinx.ext.mathbase.如何创建LaTeX宏,例如\newcommand{\cG}{\mathcal{G}},在Python文档字符串中使用?

python macros latex python-sphinx

10
推荐指数
2
解决办法
2517
查看次数

标签 统计

latex ×4

python-sphinx ×3

listings ×1

macros ×1

pdflatex ×1

python ×1