nbconvert-examples icon indicating copy to clipboard operation
nbconvert-examples copied to clipboard

style_simple.tplx

Open bgrant opened this issue 9 years ago • 4 comments

Where can I find style_simple.tplx, as mentioned here:

https://github.com/ipython/nbconvert-examples/tree/master/latex_cell_style

?

I don't seem to see it in the source tree for any of the major IPython releases.

bgrant avatar Sep 14 '15 17:09 bgrant

In this folder for Anaconda distribution:

home/anaconda3/lib/python3.4/site-packages/IPython/nbconvert/templates/latex

But this:

((* set cell_style = 'style_python.tplx' *))

Is where you set the style in your template.

Siggenx avatar Sep 17 '15 11:09 Siggenx

I have Anaconda 3, but that style_simple.tplx is missing. Where can I find more details how to write a notebook template?

cpieringer avatar Sep 23 '15 19:09 cpieringer

Seems like style_simple.tplx it got removed in commit 930d72c697f4e61ee2c43feb60dfe9d27b46dab5 (23 Sep 2013) in the ipython repository. At that time it looked like this:

((= Simple input/output style =))

((*- extends 'latex_base.tplx' -*))

% Custom packages
((* block packages *))
    ((( super() )))

    \usepackage{needspace} % Make prompts follow contents
((* endblock packages *))

% Custom definitions
((* block definitions *))
    ((( super() )))

    % Pygments definitions
    ((( resources.latex.pygment_definitions )))

    \newlength{\promptspace}
    \setlength{\promptspace}{4\baselineskip} % Space needed to start a new
                                             % input/output
((* endblock definitions *))
%===============================================================================
% Input
%===============================================================================

((*- block in_prompt scoped -*))
    \par\vspace{-1\baselineskip}
    ((( draw_prompt('Input') )))
((*- endblock in_prompt -*))

((*- block input_group scoped -*))
    (((- super() )))
    \par\vspace{-2\baselineskip}
((* endblock input_group -*))

((* block input scoped *))
    ((( cell.input | highlight2latex )))
((* endblock input *))

%===============================================================================
% Output
%===============================================================================

((*- block output_prompt scoped -*))
    ((( draw_prompt('Output') )))
((*- endblock output_prompt -*))

((*- block output_group scoped -*))
    (((- super() )))
    \par\vspace{-1\baselineskip}
((* endblock output_group -*))

%==============================================================================
% Support Macros
%==============================================================================

% Name: draw_prompt
% Purpose: Renders an output/input prompt for notebook style pdfs
((* macro draw_prompt(prompt) *))
    % Add a horizantal break, along with break title.
    \needspace{\promptspace}
    \br\br
    {\scriptsize ((( prompt )))}
    \br
    \rule[10pt]{\linewidth}{0.5pt}
    \vspace{-2.5em}
((* endmacro *))

Please note that this is old and will not work, but the jinja2 elements should be there.

On

http://nbconvert.readthedocs.org/en/latest/customizing.html#template-structure

can you find info on how a template is structured. These examples should definitely be updated.

Siggenx avatar Sep 24 '15 15:09 Siggenx

Thank you!

cpieringer avatar Oct 02 '15 14:10 cpieringer