##// END OF EJS Templates
Override Ctrl-S shortcut to save text editor contents
Override Ctrl-S shortcut to save text editor contents

File last commit:

r18596:2d590459
r19016:2c6e2b6c
Show More
base.tplx
202 lines | 7.8 KiB | text/plain | TextLexer
Jonathan Frederic
Refactored latex basic template...
r12660 ((= 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.=))
Jonathan Frederic
Post review with Min, Fernando, and Brian. Simplification...
r12750 ((*- extends 'display_priority.tplx' -*))
Jonathan Frederic
Refactored latex basic template...
r12660
%===============================================================================
% Abstract overrides
%===============================================================================
Jonathan Frederic
Post review with Min, Fernando, and Brian. Simplification...
r12750 ((* block header *))
((* block docclass *))((* endblock docclass *))
((* block packages *))
Jonathan Frederic
Refactored latex basic template...
r12660 \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
MinRK
don't use combine option on ucs package...
r15347 \usepackage[mathletters]{ucs} % Extended unicode (utf-8) support
Richard Everson
Correct order of packages for unicode
r14214 \usepackage[utf8x]{inputenc} % Allow utf-8 characters in the tex document
Jonathan Frederic
Get rid of alltt in base
r12692 \usepackage{fancyvrb} % verbatim replacement that allows latex
Jonathan Frederic
Refactored latex basic template...
r12660 \usepackage{grffile} % extends the file name processing of package graphics
Jonathan Frederic
Post review with Min, Fernando, and Brian. Simplification...
r12750 % to support a larger range
Jonathan Frederic
Refactored latex basic template...
r12660 % 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}
jakobgager
Added mathletters and longtable to latex_base
r12782 \usepackage{longtable} % longtable support required by pandoc >1.10
jakobgager
Add booktabs package to latex base.tplx
r16448 \usepackage{booktabs} % table support for pandoc > 1.12.2
Jonathan Frederic
Post review with Min, Fernando, and Brian. Simplification...
r12750 ((* endblock packages *))
Jonathan Frederic
Add an extra space
r12699
Jonathan Frederic
Post review with Min, Fernando, and Brian. Simplification...
r12750 ((* block definitions *))
Jonathan Frederic
Refactored latex basic template...
r12660 \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
\definecolor{darkorange}{rgb}{.71,0.21,0.01}
\definecolor{darkgreen}{rgb}{.12,.54,.11}
\definecolor{myteal}{rgb}{.26, .44, .56}
\definecolor{gray}{gray}{0.45}
\definecolor{lightgray}{gray}{.95}
\definecolor{mediumgray}{gray}{.8}
\definecolor{inputbackground}{rgb}{.95, .95, .85}
\definecolor{outputbackground}{rgb}{.95, .95, .95}
\definecolor{traceback}{rgb}{1, .95, .95}
MinRK
add missing pandoc declarations...
r13440 % ansi colors
\definecolor{red}{rgb}{.6,0,0}
\definecolor{green}{rgb}{0,.65,0}
\definecolor{brown}{rgb}{0.6,0.6,0}
\definecolor{blue}{rgb}{0,.145,.698}
\definecolor{purple}{rgb}{.698,.145,.698}
\definecolor{cyan}{rgb}{0,.698,.698}
\definecolor{lightgray}{gray}{0.5}
% bright ansi colors
Jonathan Frederic
Refactored latex basic template...
r12660 \definecolor{darkgray}{gray}{0.25}
\definecolor{lightred}{rgb}{1.0,0.39,0.28}
\definecolor{lightgreen}{rgb}{0.48,0.99,0.0}
\definecolor{lightblue}{rgb}{0.53,0.81,0.92}
\definecolor{lightpurple}{rgb}{0.87,0.63,0.87}
\definecolor{lightcyan}{rgb}{0.5,1.0,0.83}
MinRK
add missing pandoc declarations...
r13440
% commands and environments needed by pandoc snippets
% extracted from the output of `pandoc -s`
\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}}
Jonathan Frederic
Small fixes to latex_base
r12672 % Define a nice break command that doesn't care if a line doesn't already
% exist.
\def\br{\hspace*{\fill} \\* }
Jonathan Frederic
Added mathjax compatability definitions.
r12747 % Math Jax compatability definitions
Jonathan Frederic
Typo fix
r12749 \def\gt{>}
Jonathan Frederic
Added mathjax compatability definitions.
r12747 \def\lt{<}
Jonathan Frederic
Move gernic doc properties out of sphinx and into base
r12691 % Document parameters
MinRK
require latex titles to be ascii...
r15435 ((* block title *))\title{((( resources.metadata.name | ascii_only | escape_latex )))}((* endblock title *))
Jonathan Frederic
Move gernic doc properties out of sphinx and into base
r12691 ((* block date *))((* endblock date *))
((* block author *))((* endblock author *))
Jonathan Frederic
Post review with Min, Fernando, and Brian. Simplification...
r12750 ((* endblock definitions *))
Jonathan Frederic
Refactored latex basic template...
r12660
Jonathan Frederic
Post review with Min, Fernando, and Brian. Simplification...
r12750 ((* block commands *))
% Prevent overflowing lines due to hard-to-break entities
\sloppy
Jonathan Frederic
Refactored latex basic template...
r12660 % Setup hyperref package
\hypersetup{
breaklinks=true, % so long urls are correctly broken across lines
colorlinks=true,
urlcolor=blue,
linkcolor=darkorange,
citecolor=darkgreen,
}
% Slightly bigger margins than the latex defaults
Jonathan Frederic
One inch margins latex default
r12698 ((* block margins *))
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
((* endblock margins *))
Jonathan Frederic
Post review with Min, Fernando, and Brian. Simplification...
r12750 ((* endblock commands *))
((* endblock header *))
Jonathan Frederic
Refactored latex basic template...
r12660
Jonathan Frederic
Post review with Min, Fernando, and Brian. Simplification...
r12750 ((* block body *))
\begin{document}
((* block predoc *))
Jonathan Frederic
Added title to latex base
r12681 ((* block maketitle *))\maketitle((* endblock maketitle *))
Jonathan Frederic
Finishing up results of in person review
r12734 ((* block abstract *))((* endblock abstract *))
Jonathan Frederic
Post review with Min, Fernando, and Brian. Simplification...
r12750 ((* endblock predoc *))
((( super() )))
% Add a bibliography block to the postdoc
((* block postdoc *))
((* block bibliography *))((* endblock bibliography *))
((* endblock postdoc *))
\end{document}
((* endblock body *))
Jonathan Frederic
Added title to latex base
r12681
Jonathan Frederic
Refactored latex basic template...
r12660 %===============================================================================
% Support blocks
%===============================================================================
% Displaying simple data text
((* block data_text *))
Jonathan Frederic
Use simple verbatim in base
r12696 \begin{verbatim}
MinRK
move mime-bundle data to rich output.data...
r18589 ((( output.data['text/plain'] )))
Jonathan Frederic
Use simple verbatim in base
r12696 \end{verbatim}
Jonathan Frederic
Refactored latex basic template...
r12660 ((* endblock data_text *))
% Display python error text as-is
MinRK
update nbconvert to nbformat 4
r18580 ((* block error *))
Jonathan Frederic
Use simple verbatim in base
r12696 \begin{Verbatim}[commandchars=\\\{\}]
Jonathan Frederic
Small fixes to latex_base
r12672 ((( super() )))
\end{Verbatim}
MinRK
update nbconvert to nbformat 4
r18580 ((* endblock error *))
Jonathan Frederic
Refactored latex basic template...
r12660 ((* block traceback_line *))
((( line | indent | strip_ansi | escape_latex )))
((* endblock traceback_line *))
% Display stream ouput with coloring
((* block stream *))
\begin{Verbatim}[commandchars=\\\{\}]
Jonathan Frederic
Fixed missing latex escape
r12743 ((( output.text | escape_latex | ansi2latex )))
Jonathan Frederic
Refactored latex basic template...
r12660 \end{Verbatim}
((* endblock stream *))
% Display latex
((* block data_latex -*))
MinRK
move mime-bundle data to rich output.data...
r18589 ((*- if output.data['text/latex'].startswith('$'): -*))
Jonathan Frederic
Refactored latex basic template...
r12660 ((= Replace $ symbols with more explicit, equation block. =))
James Goppert
Fixed latex template to support multicol w/ adjustbox.
r16443 \begin{equation*}\adjustbox{max width=\hsize}{$
MinRK
move mime-bundle data to rich output.data...
r18589 ((( output.data['text/latex'] | strip_dollars )))
James Goppert
Limit latex equations to page width.
r16409 $}\end{equation*}
Jonathan Frederic
Refactored latex basic template...
r12660 ((*- else -*))
MinRK
move mime-bundle data to rich output.data...
r18589 ((( output.data['text/latex'] )))
Jonathan Frederic
Refactored latex basic template...
r12660 ((*- endif *))
((* endblock data_latex *))
% Default mechanism for rendering figures
MinRK
move mime-bundle data to rich output.data...
r18589 ((*- block data_png -*))((( draw_figure(output.metadata.filenames['image/png']) )))((*- endblock -*))
((*- block data_jpg -*))((( draw_figure(output.metadata.filenames['image/jpeg']) )))((*- endblock -*))
((*- block data_svg -*))((( draw_figure(output.metadata.filenames['image/svg+xml']) )))((*- endblock -*))
((*- block data_pdf -*))((( draw_figure(output.metadata.filenames['application/pdf']) )))((*- endblock -*))
Jonathan Frederic
Refactored latex basic template...
r12660
% Draw a figure using the graphicx package.
((* macro draw_figure(filename) -*))
((* set filename = filename | posix_path *))
((*- block figure scoped -*))
\begin{center}
Jonathan Frederic
Small fixes to latex_base
r12672 \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{((( filename )))}
Jonathan Frederic
Refactored latex basic template...
r12660 \end{center}
Jonathan Frederic
Small fixes to latex_base
r12672 { \hspace*{\fill} \\}
Jonathan Frederic
Refactored latex basic template...
r12660 ((*- endblock figure -*))
((*- endmacro *))
MinRK
update nbconvert to nbformat 4
r18580 % Redirect execute_result to display data priority.
((* block execute_result scoped *))
Jonathan Frederic
Refactored latex basic template...
r12660 ((* block data_priority scoped *))
((( super() )))
((* endblock *))
MinRK
update nbconvert to nbformat 4
r18580 ((* endblock execute_result *))
Jonathan Frederic
Refactored latex basic template...
r12660
% Render markdown
((* block markdowncell scoped *))
Peter Davis
`strip_files_prefix` now also strips markdown style links, `latex_base` updated to include filter
r13593 ((( cell.source | citation2latex | strip_files_prefix | markdown2latex )))
Jonathan Frederic
Refactored latex basic template...
r12660 ((* endblock markdowncell *))
% Don't display unknown types
((* block unknowncell scoped *))
((* endblock unknowncell *))