Skip to content

Instantly share code, notes, and snippets.

@sstirlin
sstirlin / number_figures_in_sphinx.rst
Last active April 18, 2022 20:36
How to number figures in Sphinx. How to do subfigures

Numbering figures in Sphinx. Subfigures as a bonus

Although the .. figure:: and .. image:: directives in reStructuredText are much easier than their LaTex counterparts, they are also lacking some critical features:

  • no automatic numbering
  • no subfigures

How to remove blank pages from Sphinx LaTex output

Sphinx assumes that you will be duplex printing, hence it adds several blank pages in its LaTex output.

To avoid these blank pages, edit the file source/conf.py and add the following lines to the latex_elements dict:

@sstirlin
sstirlin / vim_bindings_ipython.md
Last active November 15, 2024 22:48
vim bindings for IPython

As of IPython 5, readline is no longer used to interpret keystrokes.
Instead, the pure-python library prompt_toolkit is used.

Getting vim mode in IPython is straightforward. First, edit

~/.ipython/profile_default/ipython_config.py

and add the following line:

c.TerminalInteractiveShell.editing_mode = 'vi'