Giter VIP home page Giter VIP logo

Comments (16)

lamping7 avatar lamping7 commented on June 3, 2024 1

Hooray! Moving from TeX Live 2015 to 2018 did the trick! I used the official directions (https://www.tug.org/texlive/quickinstall.html), not random ppa's you can find on SO. Closing this and opening a new issue for the print output.

from nb_pdf_template.

t-makaro avatar t-makaro commented on June 3, 2024

Have you installed with the minted option? If you haven't then it should be identical to the old version. If you have can you send me the a conversion done with --to latex. I'll need the latex to diagnose.

from nb_pdf_template.

t-makaro avatar t-makaro commented on June 3, 2024

Raw pyout will automatically wrap. (So, text displayed with an "Out []" prompt). Printing from a print statement will reply on the newline characters already in the string (which can easily be added there, but not so easily in raw pyout). I can look into text wrapping other text outputs.

I can't replicate this issue locally. What OS are you using? Does doing:

python -m nb_pdf_template.install

fix it? The minted option is still experimental (for reasons exactly like this!)

from nb_pdf_template.

lamping7 avatar lamping7 commented on June 3, 2024

I'm on Ubuntu 16.04. I installed with the --minted option. I tied to revert to the non-minted version with python -m nb_pdf_template.install, but ended up getting latex errors about shell escape. I then tried going back to the regular nbconvert template, and got the same error. Ultimately I reinstalled nbconvert with pip to get back to normal.

I ended up finding this to solve the problem I was really after (wrapping). http://www.markus-beuckelmann.de/blog/customizing-nbconvert-pdf.html Maybe It'll help you.

from nb_pdf_template.

t-makaro avatar t-makaro commented on June 3, 2024

The problem with that solution is that if code wraps, then it may not be highlighted properly. I'd have liked to see what some of those errors were.

from nb_pdf_template.

lamping7 avatar lamping7 commented on June 3, 2024

So I just did this again on a different computer, with Ubuntu 16.04 as well. Same problem with the minted version.

Then, going back to python -m nb_pdf_template.install renders the pdf as expected, with overflow. I'm not sure what my issue was before.

from nb_pdf_template.

lamping7 avatar lamping7 commented on June 3, 2024

The problem with that solution is that if code wraps, then it may not be highlighted properly.

Yes. You're right. Using that template I linked to, the wrapped line isn't exactly colored correctly.

from nb_pdf_template.

t-makaro avatar t-makaro commented on June 3, 2024

I had to remove the images to compile since I didn't have those, but it compiled fine for me.

Maybe try settings the latex command to:

c.PDFExporter.latex_command = ['xelatex', '--8bit', '--shell-escape', '{filename}']

Maybe the extra dashes are needed on your system.

Try finding a latex command like:

XeLaTeX --shell-escape -8bit hw1.tex

If we can find the command to compile it, then it should work. (adding the shell-escape to nbconvert's latex command should do nothing when using the non-minted option)

from nb_pdf_template.

lamping7 avatar lamping7 commented on June 3, 2024

It's compiling. But the output isn't correct. Look at the first post with the image.

If I check xelatex --help, it shows single dash arguments: -shell-escape -8bit

$ xelatex --version:

XeTeX 3.14159265-2.6-0.99992 (TeX Live 2015/Debian)
kpathsea version 6.2.1
Copyright 2015 SIL International, Jonathan Kew and Khaled Hosny.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the XeTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the XeTeX source.
Primary author of XeTeX: Jonathan Kew.
Compiled with ICU version 55.1; using 55.1
Compiled with zlib version 1.2.8; using 1.2.8
Compiled with FreeType2 version 2.5.5; using 2.5.5
Compiled with Graphite2 version 1.3.6; using 1.3.10
Compiled with HarfBuzz version 1.0.1; using 1.2.6
Compiled with libpng version 1.6.17; using 1.6.17
Compiled with poppler version 0.41.0
Compiled with fontconfig version 2.11.1; using 2.11.94

from nb_pdf_template.

lamping7 avatar lamping7 commented on June 3, 2024

Does your system render the pdf correctly from my .tex file?

from nb_pdf_template.

t-makaro avatar t-makaro commented on June 3, 2024

It compiles perfectly on my system. Windows 10 with:

MiKTeX-XeTeX 2.9.6634 (0.99999) (MiKTeX 2.9.6745 64-bit)
(C) 1994-2008 by SIL International, (C) 2009-2012 by Jonathan Kew, (C) 2010-2012 by Han The Thanh, (C) 2012-2013 by Khaled Hosny
TeX is a trademark of the American Mathematical Society.
using bzip2 version 1.0.6, 6-Sept-2010
compiled with curl version 7.56.1; using libcurl/7.56.1 WinSSL
compiled with expat version 2.2; using expat_2.2.0
compiled with fontconfig version 2.12.6; using 2.12.6
compiled with freetype2 version 2.8.1; using 2.8.1
compiled with graphite2 version 1.3.10; using 1.3.10
compiled with harfbuzz version 1.8.0; using 1.8.0
compiled with icu version 60.1; using 60.1
compiled with jpeg version 9.2
compiled with liblzma version 50020032; using 50020032
compiled with libpng version 1.6.34; using 1.6.34
compiled with libressl version LibreSSL 2.5.3; using LibreSSL 2.5.3
compiled with MiKTeX Application Framework version 2.6636; using 2.6636
compiled with MiKTeX Core version 7.6745; using 7.6778
compiled with MiKTeX Archive Extractor version 1.6300; using 1.6300
compiled with MiKTeX Package Manager version 3.6727; using 3.6727
compiled with poppler version 0.60.1
using teckit version 2.4
compiled with uriparser version 0.8.4
compiled with zlib version 1.2.11; using 1.2.11

You can try droping the -8bit (it's only needed for processing tab characters).
Also, is pygmentize in your path? To find the version: pygmentize -V. I think the latex minted package may be tokenizing properly, but then failing to call pygmentize.

from nb_pdf_template.

lamping7 avatar lamping7 commented on June 3, 2024

Also, is pygmentize in your path?

$ pygmentize -V
Pygments version 2.1, (c) 2006-2015 by Georg Brandl.

I upgraded to 2.2.0. Same thing as original post. I removed -8bit from the command list (i.e [NbConvertApp] Running xelatex 3 times: ['xelatex', '-shell-escape', 'notebook.tex'] ) Same result. There is nothing telling me what is going on. Here is output I'm seeing:

$ jupyter nbconvert --to pdf hw1.ipynb --template classicm
[NbConvertApp] Converting notebook hw1.ipynb to pdf
[NbConvertApp] Support files will be in hw1_files/
[NbConvertApp] Making directory hw1_files
[NbConvertApp] Making directory hw1_files
[NbConvertApp] Making directory hw1_files
[NbConvertApp] Making directory hw1_files
[NbConvertApp] Making directory hw1_files
[NbConvertApp] Making directory hw1_files
[NbConvertApp] Making directory hw1_files
[NbConvertApp] Making directory hw1_files
[NbConvertApp] Making directory hw1_files
[NbConvertApp] Making directory hw1_files
[NbConvertApp] Making directory hw1_files
[NbConvertApp] Making directory hw1_files
[NbConvertApp] Making directory hw1_files
[NbConvertApp] Writing 54727 bytes to notebook.tex
[NbConvertApp] Building PDF
[NbConvertApp] Running xelatex 3 times: ['xelatex', '-shell-escape', 'notebook.tex']
[NbConvertApp] Running bibtex 1 time: [u'bibtex', u'notebook']
[NbConvertApp] WARNING | bibtex had problems, most likely because there were no citations
[NbConvertApp] PDF successfully created
[NbConvertApp] Writing 176946 bytes to hw1.pdf

from nb_pdf_template.

t-makaro avatar t-makaro commented on June 3, 2024

I set up a ubuntu virtual machine last week, so I'll try to test it out, but it'll have to wait (maybe until the weekend). You could try updating LaTeX and minted if that's an option.

For now I'll have to suggest going back to the non-minted version, and keeping lines to a max length of 94 characters (for classicm.tplx, 86 for classic.tplx) (latex uses a monospaced font so this will always work). Which PEP8 recommends 80 characters anyway.

For the printing of stuff. You can convert to a string with str(…) manually first and add newlines \n as needed. I'll try to get a fix for that this weekend though.

from nb_pdf_template.

lamping7 avatar lamping7 commented on June 3, 2024

OK. I'll look into that. I'm not sure if this will help, but here is the complete output from nbconvert: https://pastebin.com/GDCXRY1e and tex log hw1.out.txt

Yeah I know 80 is PEP8. The whole point of jupyter for me is to act as a quick scratch pad. The code isn't hardened or really meant for others to read. For real projects I use yapf for linting.

from nb_pdf_template.

lamping7 avatar lamping7 commented on June 3, 2024

I'm going to get texlive 2018 installed (currently using the 2015 version that you can install with apt) and see how that goes.

from nb_pdf_template.

t-makaro avatar t-makaro commented on June 3, 2024

I'll add something to the readme about using newer versions of latex for the minted option.

from nb_pdf_template.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.