-
-
Save YoshiRi/fb0e27c99f14851420998d55f3c969ed to your computer and use it in GitHub Desktop.
New template for jupyter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Default to the notebook output style | |
((* if not cell_style is defined *)) | |
((* set cell_style = 'new_style_ipython.tplx' *)) | |
((* endif *)) | |
% Inherit from the specified cell style. | |
((* extends cell_style *)) | |
%=============================================================================== | |
% Latex Article | |
%=============================================================================== | |
((* block docclass *)) | |
\documentclass[10pt,dvipdfmx,fleqn]{jarticle} | |
((* endblock docclass *)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
((= Latex base template (must inherit) | |
This template builds upon the abstract template, adding common latex output | |
functions. Figures, data_text, | |
This template does not define a docclass, the inheriting class must define this.=)) | |
((*- extends 'document_contents.tplx' -*)) | |
%=============================================================================== | |
% Abstract overrides | |
%=============================================================================== | |
((* block header *)) | |
((* block docclass *))((* endblock docclass *)) | |
((* block packages *)) | |
\usepackage[T1]{fontenc} | |
% Nicer default font (+ math font) than Computer Modern for most use cases | |
\usepackage{mathpazo} | |
% Basic figure setup, for now with no caption control since it's done | |
% automatically by Pandoc (which extracts ![](path) syntax from Markdown). | |
\usepackage{graphicx} | |
% We will generate all images so they have a width \maxwidth. This means | |
% that they will get their normal width if they fit onto the page, but | |
% are scaled down if they would overflow the margins. | |
\makeatletter | |
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth | |
\else\Gin@nat@width\fi} | |
\makeatother | |
\let\Oldincludegraphics\includegraphics | |
% Set max figure width to be 80% of text width, for now hardcoded. | |
\renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=.8\maxwidth]{#1}} | |
% Ensure that by default, figures have no caption (until we provide a | |
% proper Figure object with a Caption API and a way to capture that | |
% in the conversion process - todo). | |
\usepackage{caption} | |
\DeclareCaptionLabelFormat{nolabel}{} | |
\captionsetup{labelformat=nolabel} | |
\usepackage{adjustbox} % Used to constrain images to a maximum size | |
\usepackage{xcolor} % 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{textcomp} % defines textquotesingle | |
% Hack from http://tex.stackexchange.com/a/47451/13684: | |
\AtBeginDocument{% | |
\def\PYZsq{\textquotesingle}% Upright quotes in Pygmentized code | |
} | |
\usepackage{upquote} % Upright quotes for verbatim code | |
\usepackage{eurosym} % defines \euro | |
\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[inline]{enumitem} % IRkernel/repr support (it uses the enumerate* environment) | |
\usepackage[normalem]{ulem} % ulem is needed to support strikethroughs (\sout) | |
% normalem makes italics be italics, not underlines | |
((* endblock packages *)) | |
((* block definitions *)) | |
% Colors for the hyperref package | |
\definecolor{urlcolor}{rgb}{0,.145,.698} | |
\definecolor{linkcolor}{rgb}{.71,0.21,0.01} | |
\definecolor{citecolor}{rgb}{.12,.54,.11} | |
% ANSI colors | |
\definecolor{ansi-black}{HTML}{3E424D} | |
\definecolor{ansi-black-intense}{HTML}{282C36} | |
\definecolor{ansi-red}{HTML}{E75C58} | |
\definecolor{ansi-red-intense}{HTML}{B22B31} | |
\definecolor{ansi-green}{HTML}{00A250} | |
\definecolor{ansi-green-intense}{HTML}{007427} | |
\definecolor{ansi-yellow}{HTML}{DDB62B} | |
\definecolor{ansi-yellow-intense}{HTML}{B27D12} | |
\definecolor{ansi-blue}{HTML}{208FFB} | |
\definecolor{ansi-blue-intense}{HTML}{0065CA} | |
\definecolor{ansi-magenta}{HTML}{D160C4} | |
\definecolor{ansi-magenta-intense}{HTML}{A03196} | |
\definecolor{ansi-cyan}{HTML}{60C6C8} | |
\definecolor{ansi-cyan-intense}{HTML}{258F8F} | |
\definecolor{ansi-white}{HTML}{C5C1B4} | |
\definecolor{ansi-white-intense}{HTML}{A1A6B2} | |
% commands and environments needed by pandoc snippets | |
% extracted from the output of `pandoc -s` | |
\providecommand{\tightlist}{% | |
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} | |
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}} | |
% Add ',fontsize=\small' for more characters per line | |
\newenvironment{Shaded}{}{} | |
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}} | |
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}} | |
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} | |
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} | |
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} | |
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} | |
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} | |
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}} | |
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}} | |
\newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}} | |
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}} | |
\newcommand{\RegionMarkerTok}[1]{{#1}} | |
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}} | |
\newcommand{\NormalTok}[1]{{#1}} | |
% Additional commands for more recent versions of Pandoc | |
\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.53,0.00,0.00}{{#1}}} | |
\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} | |
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} | |
\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.73,0.40,0.53}{{#1}}} | |
\newcommand{\ImportTok}[1]{{#1}} | |
\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.73,0.13,0.13}{\textit{{#1}}}} | |
\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} | |
\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} | |
\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.10,0.09,0.49}{{#1}}} | |
\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}} | |
\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.40,0.40,0.40}{{#1}}} | |
\newcommand{\BuiltInTok}[1]{{#1}} | |
\newcommand{\ExtensionTok}[1]{{#1}} | |
\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.74,0.48,0.00}{{#1}}} | |
\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.49,0.56,0.16}{{#1}}} | |
\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} | |
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} | |
% Define a nice break command that doesn't care if a line doesn't already | |
% exist. | |
\def\br{\hspace*{\fill} \\* } | |
% Math Jax compatability definitions | |
\def\gt{>} | |
\def\lt{<} | |
% Document parameters | |
((* block title *))\title{((( resources.metadata.name | ascii_only | escape_latex )))}((* endblock title *)) | |
((* block date *))((* endblock date *)) | |
((* block author *))((* endblock author *)) | |
((* endblock definitions *)) | |
((* block commands *)) | |
% Prevent overflowing lines due to hard-to-break entities | |
\sloppy | |
% Setup hyperref package | |
\hypersetup{ | |
breaklinks=true, % so long urls are correctly broken across lines | |
colorlinks=true, | |
urlcolor=urlcolor, | |
linkcolor=linkcolor, | |
citecolor=citecolor, | |
} | |
% Slightly bigger margins than the latex defaults | |
((* block margins *)) | |
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in} | |
((* endblock margins *)) | |
((* endblock commands *)) | |
((* endblock header *)) | |
((* block body *)) | |
\begin{document} | |
((* block predoc *)) | |
((* block maketitle *))\maketitle((* endblock maketitle *)) | |
((* block abstract *))((* endblock abstract *)) | |
((* endblock predoc *)) | |
((( super() ))) | |
% Add a bibliography block to the postdoc | |
((* block postdoc *)) | |
((* block bibliography *))((* endblock bibliography *)) | |
((* endblock postdoc *)) | |
\end{document} | |
((* endblock body *)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
((= IPython input/output style =)) | |
((*- extends 'new_base.tplx' -*)) | |
% Custom definitions | |
((* block definitions *)) | |
((( super() ))) | |
% Pygments definitions | |
((( resources.latex.pygments_definitions ))) | |
% Exact colors from NB | |
\definecolor{incolor}{rgb}{0.0, 0.0, 0.5} | |
\definecolor{outcolor}{rgb}{0.545, 0.0, 0.0} | |
((* endblock definitions *)) | |
%=============================================================================== | |
% Input | |
%=============================================================================== | |
((* block input scoped *)) | |
((*- if resources.global_content_filter.include_input_prompt *)) | |
((( add_prompt(cell.source | highlight_code(strip_verbatim=True, metadata=cell.metadata), cell, 'In ', 'incolor') ))) | |
((* endif *)) | |
((* endblock input *)) | |
%=============================================================================== | |
% Output | |
%=============================================================================== | |
((* block execute_result scoped *)) | |
((*- for type in output.data | filter_data_type -*)) | |
((*- if resources.global_content_filter.include_output_prompt -*)) | |
((*- if type in ['text/plain'] *)) | |
((( add_prompt(output.data['text/plain'] | escape_latex, cell, 'Out', 'outcolor') ))) | |
((* else -*)) | |
\texttt{\color{outcolor}Out[{\color{outcolor}((( cell.execution_count )))}]:}((( super() ))) | |
((*- endif -*)) | |
((*- endif -*)) | |
((*- endfor -*)) | |
((* endblock execute_result *)) | |
%============================================================================== | |
% Support Macros | |
%============================================================================== | |
% Name: draw_prompt | |
% Purpose: Renders an output/input prompt | |
((* macro add_prompt(text, cell, prompt, prompt_color) -*)) | |
((*- if cell.execution_count is defined -*)) | |
((*- set execution_count = "" ~ (cell.execution_count | replace(None, " ")) -*)) | |
((*- else -*)) | |
((*- set execution_count = " " -*)) | |
((*- endif -*)) | |
((*- set indention = " " * (execution_count | length + 7) -*)) | |
\begin{Verbatim}[commandchars=\\\{\}] | |
((( text | add_prompts(first='{\color{' ~ prompt_color ~ '}' ~ prompt ~ '[{\\color{' ~ prompt_color ~ '}' ~ execution_count ~ '}]:} ', cont=indention) ))) | |
\end{Verbatim} | |
((*- endmacro *)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment