Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nbconvert from jupyter notebook to pdf cell color not detected #623

Closed
arun-siv opened this issue Jul 9, 2017 · 12 comments
Closed

nbconvert from jupyter notebook to pdf cell color not detected #623

arun-siv opened this issue Jul 9, 2017 · 12 comments

Comments

@arun-siv
Copy link

arun-siv commented Jul 9, 2017

There is a clear cell color for [in] and [out]. Those are not detected when converted to pdf

@arun-siv
Copy link
Author

arun-siv commented Jul 9, 2017

How To Build DataFrame.pdf
I am uploading a file as example. It doesnt show the cell color for the [in]

@takluyver
Copy link
Member

I'm not quite sure what you mean - do you want the grey background for input code?

@arun-siv
Copy link
Author

@takluyver Yes, I wanted a grey background for input code . Also the table borders are not visible. It converts it as dash lines

@arun-siv
Copy link
Author

Even the table borders not appearing in the pdf output . There is not wrapping of the cell too .

@takluyver
Copy link
Member

I think not wrapping the code cells is a bug. The rest is just style questions - it goes via latex, so it doesn't look like the HTML option.

@parthi2929
Copy link

this issue was not solved yet?

@t-makaro
Copy link
Contributor

Wrapping code cells is not really possible without greatly refactoring the latex implementation. But, I have done this and fixed the style issues over at https://github.com/t-makaro/nb_pdf_template.

@parthi2929
Copy link

parthi2929 commented Sep 25, 2018

I was trying to get the code cell part with boxed grey background.. there is no style_jupyter in my anaconda nbconvert as in your repo.. i do not want your other changes, so was trying to extract only this from your template.. i have been trying for past few hours but some issue as am new to latex.. no error but am also not getting the code cell boxed.. is it possible to give template for that alone.. my current template is here

@parthi2929
Copy link

you have created new environments like InVerbatim that seem to work individually ( a simple MWE here) when I call but nbconvert does not seem to deploy it anyway in final converted code.. what is missing?

@t-makaro
Copy link
Contributor

t-makaro commented Sep 25, 2018

You could just inherit from style_jupyter, and overwrite some of my other modifications. Install my package and it will be available to you.

I do recommend using the OutVerbatim as well (it won't color the background, but it is need to format consistently). You would get a template like:

((* if not cell_style is defined *))
    ((*- set cell_style = 'style_jupyter.tplx' -*))
((* endif *))
((=- Inherit from the specified cell style. -=))
((* extends cell_style *))

((* block repygments *))((* end block repygments *))

((* block docclass *))
\documentclass[11pt]{article}
((*- endblock docclass -*))

All of my other modifications are in classic.tplx or classicm.tplx (except the syntax highlighting changes). You may want to modify the prompt as well with a \noindent since you won't be using \usepackage{parskip}:

((*- block style_prompt *))
    \newcommand{\prompt}[3]{
        \needspace{1.1cm}
        \settowidth{\promptlength}{ #1 [#3] }
        \ifleftmargins\hspace{-\promptlength}\hspace{-5pt}\fi
        \noindent{\color{#2}#1 [#3]:}
        \ifleftmargins\vspace{-2.7ex}\fi
    }
((* endblock style_prompt *))

@parthi2929
Copy link

I tried that, Since I have other customizations I had to tinker your style_jupyter.tplx more which was cumbersome (mostly because I am new to these stuff), so I am trying to keep my existing customizations as they are, and adding your box part alone for now. I almost get it, but the tex file ends up having "In Verbatim" instead of "InVerbatim", the space comes from value you are supplying as "In " while calling draw_cell I guess, do not know how to fix that (that space might be there for a reason? when I tried using your style_jupyter.tex this problem did not occur but conflicts with my other customizations)

@t-makaro
Copy link
Contributor

CC @MSeal. I think this should be closed by #992 as well.

@MSeal MSeal closed this as completed Apr 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants