##// END OF EJS Templates
Added missing closing curly bracket
Added missing closing curly bracket

File last commit:

r12683:857f525d
r12683:857f525d
Show More
notebook_style.tplx
126 lines | 3.5 KiB | text/plain | TextLexer
Jonathan Frederic
Notebook style rough draft
r12666 ((= Notebook input/output style =))
((* extends 'latex_base.tplx' *))
% Custom packages
((* block packages *))
((( super() )))
% Needed to box output/input
\usepackage{tikz}
\usetikzlibrary{calc,arrows,shadows}
\usepackage[framemethod=tikz]{mdframed}
Jonathan Frederic
Adjusted notebook style vertical spacing
r12677
Jonathan Frederic
Modify margin instead of putting output indented mdframed
r12674 \usepackage{scrextend} % Used to indent output
Jonathan Frederic
Adjusted notebook style vertical spacing
r12677 \usepackage{needspace} % Make prompts follow contents
Jonathan Frederic
Notebook style rough draft
r12666 ((* endblock packages *))
% Custom definitions
((* block definitions *))
((( super() )))
\listfiles
\def\smaller{\fontsize{9.5pt}{9.5pt}\selectfont}
\definecolor{nbframe-border}{rgb}{0.867,0.867,0.867}
\definecolor{nbframe-bg}{rgb}{0.969,0.969,0.969}
\definecolor{nbframe-in-prompt}{rgb}{0.0,0.0,0.502}
\definecolor{nbframe-out-prompt}{rgb}{0.545,0.0,0.0}
\newenvironment{ColorVerbatim}
{\vspace{-2\baselineskip}
\leavevmode\begin{mdframed}[%
roundcorner=1.0pt, %
backgroundcolor=nbframe-bg, %
userdefinedwidth=1\linewidth, %
leftmargin=0.1\linewidth, %
innerleftmargin=0pt, %
innerrightmargin=0pt, %
linecolor=nbframe-border, %
linewidth=1pt, %
usetwoside=false, %
Jonathan Frederic
Allow box to break across pages
r12675 everyline=false, %
Jonathan Frederic
Notebook style rough draft
r12666 innerlinewidth=3pt, %
innerlinecolor=nbframe-bg, %
middlelinewidth=1pt, %
middlelinecolor=nbframe-bg, %
outerlinewidth=0.5pt, %
outerlinecolor=nbframe-border, %
Jonathan Frederic
Adjusted notebook style vertical spacing
r12677 needspace=3em, %
nobreak=false
Jonathan Frederic
Notebook style rough draft
r12666 ]}
Jonathan Frederic
Added missing close env for Verbatim
r12676 {\end{mdframed}\vspace{-1\baselineskip}}
Jonathan Frederic
Notebook style rough draft
r12666
Jonathan Frederic
Adjusted notebook style vertical spacing
r12677 % Space needed to start a new input/output
\newlength{\promptspace}
\setlength{\promptspace}{4\baselineskip}
Jonathan Frederic
Notebook style rough draft
r12666 ((* endblock definitions *))
%===============================================================================
% Input
%===============================================================================
((* block in_prompt scoped *))
\br
((( draw_prompt("In", cell.prompt_number, "nbframe-in-prompt") )))
((* endblock in_prompt *))
((* block input scoped *))
% Add contents below.
\begin{ColorVerbatim}
Jonathan Frederic
Added missing closing curly bracket
r12683 \smaller{\leavevmode\hspace*{-0.1\linewidth}((( super() )))}
Jonathan Frederic
Notebook style rough draft
r12666 \end{ColorVerbatim}
((* endblock input *))
((* block input_group scoped *))
((( super() )))
((* endblock input_group *))
%===============================================================================
% Output
%===============================================================================
Jonathan Frederic
Adjusted notebook style vertical spacing
r12677 ((* block output_group *))
{\br}((( super() )))
((* endblock output_group *))
Jonathan Frederic
Notebook style rough draft
r12666 ((* block output *))
% Only render the prompt if the cell is pyout. Note, the outputs prompt
% block isn't used since we need to check each indiviual output and only
% add prompts to the pyout ones.
((* if output.output_type in ['pyout'] *))
((( draw_prompt("Out", cell.prompt_number, "nbframe-out-prompt") )))
((* endif *))
Jonathan Frederic
Modify margin instead of putting output indented mdframed
r12674 \begin{addmargin}[0.1\linewidth]{0em} % left, right
\smaller{((( super() )))}
\end{addmargin}
Jonathan Frederic
Notebook style rough draft
r12666 ((* endblock output *))
%==============================================================================
% Support Macros
%==============================================================================
% Name: draw_prompt
% Purpose: Renders an output/input prompt for notebook style pdfs. Prompt is
% rendered at the current location, the cursor position is left
% unmodified.
((* macro draw_prompt(prompt, number, color) *))
Jonathan Frederic
Adjusted notebook style vertical spacing
r12677 \needspace{\promptspace}
Jonathan Frederic
Notebook style rough draft
r12666 {
\smaller
\tt
\color{((( color )))}
\noindent
((( prompt )))
{[}((( number ))){]}:
}
\vspace{-1\baselineskip}
((* endmacro *))