Skip to content

Instantly share code, notes, and snippets.

@ischurov
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ischurov/e3cc29246d6136e222b1 to your computer and use it in GitHub Desktop.
Save ischurov/e3cc29246d6136e222b1 to your computer and use it in GitHub Desktop.
Template for creating pdfs from ipynb (based on latex_article.tplx). Depends on hse-coursedata.sty which contains data about the particular course
%custom IPython Notebook / NBConvert template
%based on latex_article.tplx from ipython notebook
%modified by Ilya V. Schurov <ilya at schurov.com>
%license: BSD-like (see http://ipython.org/ipython-doc/stable/about/license_and_copyright.html for details)
% Default to the notebook output style
((* if not cell_style is defined *))
((* set cell_style = 'style_ipython.tplx' *))
((* endif *))
% Inherit from the specified cell style.
((* extends cell_style *))
%===============================================================================
% Latex Article
%===============================================================================
((* block docclass *))
\documentclass{article}
((* endblock docclass *))
((* block packages *))
\usepackage{graphicx} % Used to insert images
\usepackage{adjustbox} % Used to constrain images to a maximum size
\usepackage{color} % Allow colors to be defined
\usepackage{enumerate} % Needed for markdown enumerations to work
\usepackage{geometry} % Used to adjust the document margins
\usepackage{amsmath} % Equations
\usepackage{amssymb} % Equations
\usepackage[mathletters]{ucs} % Extended unicode (utf-8) support
\usepackage[utf8x]{inputenc} % Allow utf-8 characters in the tex document
\usepackage[T1,T2A]{fontenc}
\usepackage[russian]{babel}
\usepackage{fancyvrb} % verbatim replacement that allows latex
\usepackage{grffile} % extends the file name processing of package graphics
% to support a larger range
% The hyperref package gives us a pdf with properly built
% internal navigation ('pdf bookmarks' for the table of contents,
% internal cross-reference links, web links for URLs, etc.)
\usepackage{hyperref}
\usepackage{longtable} % longtable support required by pandoc >1.10
\usepackage{booktabs} % table support for pandoc > 1.12.2
\usepackage{parskip}
\renewcommand{\thesection}{}
\renewcommand{\thesubsection}{}
\renewcommand{\thesubsubsection}{}
\makeatletter
\def\@seccntformat#1{}
\let\sectionignore\@gobbletwo
\let\latex@numberline\numberline
\def\numberline#1{\if\relax#1\relax\else\latex@numberline{#1}\fi}
\makeatother
\renewcommand\maketitle{}
((* endblock packages *))
((* block margins *))
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
\RequirePackage{fancyhdr}
\RequirePackage{hse-coursedata}
\makeatletter
\fancyhead[L]{}
\fancyhead[C]{}
\fancyhead[R]{\footnotesize \university, \uchgod, «\coursename»}
\fancyfoot[L]{\footnotesize \@author}
\fancyfoot[R]{\thepage}
\fancyfoot[C]{}
\makeatother
\pagestyle{fancy}
((* endblock margins *))
((* macro draw_figure(filename) -*))
((* set filename = filename | posix_path *))
((*- block figure scoped -*))
\begin{center}
\adjustimage{max size={0.9\linewidth}{0.9\paperheight},scale=0.8}{((( filename )))}
\end{center}
{ \hspace*{\fill} \\}
((*- endblock figure -*))
((*- endmacro *))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment