Ask Your Question
0

Print to pdf, Bad quality in evaluated latex

asked 2011-03-19 03:58:40 +0200

Kabi gravatar image

updated 2011-03-19 04:17:12 +0200

Hi

In the sage notebook there is a problem when wanting to print to pdf or printer. I have "typeset" enabled. An example: 1st cell:

%latex
Something is wrong

2nd cell:

2/3

The first cell produces blurry output and the second cell produces much better output. I have read that when using the latex interpreter then sage prints to pdf/dvi (depending on using latex/pdflatex) converts to png and crops the png. And the output of the first cell is obviously an image of poor quality.

What I would like to be able to do, is to write latex code such as sections and formatting, and then print or email the resulting notebook in a normal readable quality.

Any help appreciated.

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
1

answered 2011-03-21 20:22:30 +0200

kcrisman gravatar image

I'm putting this in a different answer spot because I think you have a different question than I first thought.

What is your use case? Here are two ways to get nice-looking TeX-ish code in the notebook.

  1. Use a text cell! Move your cursor until you see a thin blue line between two regular math cells, and then press Shift at the same time as you click. Now you get a nice WYSIWYG editor, with the advantage that most things you put between $xyz$ or $$xyz$$ will end up looking like $xyz$ or $$xyz\; .$$ This is how I usually get nicely TeXed stuff.
  2. Use the html() command. You can often get good stuff from that - such as html("I like the number $%s$"%5) becomes "I like the number $5$." This requires a little use of string formatting if you want to have a variable input, but otherwise should behave normally with respect to LaTeX. I use this in interactive cells a lot.

I do not know why the %latex gives such unsatisfactory results, but my guess is that it's using some inferior font in the browser, as opposed to the jsmath fonts, which the two solutions above will use. I really don't know why sws2tex would have problems with this, but remember that sws2tex isn't necessarily about converting percent directives, but just normal Sage input. In any case, I don't think you need %latex, given the two options above - but if you do, please reply!

edit flag offensive delete link more

Comments

Thank you!! This is great and exactly what I was looking for. Didn't know about the text cell..

Kabi gravatar imageKabi ( 2011-03-21 21:49:04 +0200 )edit

Thank you!!

Kabi gravatar imageKabi ( 2011-03-21 21:49:06 +0200 )edit
1

answered 2011-03-19 20:34:27 +0200

kcrisman gravatar image

updated 2011-03-19 20:34:47 +0200

This is somewhat of a workaround, since it's not part of Sage proper, but you may enjoy trying to use sws2tex which creates a nice pdf for you. It can't handle 100% of worksheets, but it's handled most of mine I've used very nicely.

edit flag offensive delete link more
0

answered 2011-03-21 15:32:58 +0200

Kabi gravatar image

Hi

Thanks for the reply.

I just tried your suggestion using sws2tex, and it has the exact same problem as I described in the notebook.

The evaluated LaTeX code is a blurry image. The example code example from my first post is enough to show the problem.

This problem is to bad, and I hope there is some way to get around it. Sage is very good for doing day 2 day work, but it's not so usefull when it's not possible to print a notebook containing evaluated LaTeX code. The only workaround I have is to not write evaluated LaTeX code in the notebook, but just plain text, and sage code.

edit flag offensive delete link more

Comments

I am wondering if there is a way to make sage use a better resolution for the image. This would be a workaround, just have the text more readable

Kabi gravatar imageKabi ( 2011-03-21 17:14:31 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-03-19 03:58:40 +0200

Seen: 1,128 times

Last updated: Mar 21 '11