Personal tools
You are here: Home / Users / Ralf Hemmecke / Work Related Items / Mathematica Help / Converting A Notebook to PDF

Converting A Notebook to PDF

This is the mail that has been returned from wolfram.com.

In short:

  1. Use Format -> Option Inspector.
  2. Select the notebook that you want to print.
  3. Change the PageWidth to PaperWidth ("By Category" and then "Notebook Options"->"Notebook Properties").
  4. Print to .pdf by "Print to File" with "filename.pdf" as name.
  5. Don't forget to select Portrait/Landscape and paper size at the bottom of the dialog.

There is still some problem with some Cell[...]'s. For "SlideShow" they appear to have infinite width. In order to change that do the following.

  1. open a new notebook
  2. Format -> Edit StyleSheet (for the new notebook).
  3. Click on "Default.nb" (on top of the stylesheet).
  4. Click on "Core.nb".
  5. Open Section "Styled for Mathematica System-specific Elements".
  6. Open Subsection "FormatType Styles".
  7. Select and copy the cell "InputForm".
  8. Close all stylesheets and the empty notebook.
  9. Format -> Edit StyleSheet (for the notebook that you want to print).
  10. Paste the cell "InputForm" anywhere in the style sheet.
  11. Edit its definition from "Infinite" to "PaperWidth" ("By Category" and then "Formatting Options"->"Text Layout Options").
  12. Close stylesheet and save the notebook.
  13. Then print the notebook.

 

Return-Path: <support@wolfram.com>
Received: from bullfinch.risc.uni-linz.ac.at (root@bullfinch.risc.uni-linz.ac.at [193.170.37.222])
by swan.risc.uni-linz.ac.at (8.12.3/8.12.3/Debian-7.2) with ESMTP id m61DUR3k024090
for <hemmecke@swan.risc.uni-linz.ac.at>; Tue, 1 Jul 2008 15:30:28 +0200
Received: from wolfram.com (mailhub.wolfram.com [140.177.10.16])
by bullfinch.risc.uni-linz.ac.at (8.13.8/8.13.8/Debian-3) with ESMTP id m61DUAff022365
for <hemmecke@risc.uni-linz.ac.at>; Tue, 1 Jul 2008 15:30:22 +0200
Received: from localhost.localdomain (southpark.wolfram.com [140.177.10.41])
by wolfram.com (8.12.11/8.12.11) with ESMTP id m61DU17h023160
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
for <hemmecke@risc.uni-linz.ac.at>; Tue, 1 Jul 2008 08:30:02 -0500
Received: (from support@localhost)
by localhost.localdomain (8.12.11.20060308/8.12.8/Submit) id m61DU0w1003969;
Tue, 1 Jul 2008 08:30:00 -0500
Message-Id: <200807011330.m61DU0w1003969@localhost.localdomain>
Content-Transfer-Encoding: binary
Content-Type: multipart/mixed; boundary="_----------=_121491900039620"
MIME-Version: 1.0
X-Mailer: MIME::Lite 3.01 (F2.71; A1.58; B2.12; Q2.03)
Date: Tue, 1 Jul 2008 13:30:00 UT
From: support@wolfram.com
To: hemmecke@risc.uni-linz.ac.at
Subject: [TS 20628]--Re:Notebook conversion to pdf

This is a multi-part message in MIME format.

--_----------=_121491900039620
Content-Disposition: inline
Content-Length: 6978
Content-Transfer-Encoding: binary
Content-Type: text/plain
MIME-Version: 1.0
X-Mailer: MIME::Lite 3.01 (F2.71; A1.58; B2.12; Q2.03)
Date: Tue, 1 Jul 2008 13:30:00 UT

-- Wolfram Research Technical Support --

This is a response to your email.
The reply to your question can be found at the bottom of this message.
Our classification number for this message is: [TS 20628]
Please give this number in any future correspondence
related to this question. If you leave this number in
the Subject: header in the form [TS 20628], it will
automatically be reassigned to the original technician.

From: Ralf HEMMECKE <hemmecke@risc.uni-linz.ac.at>
Date: Fri, 20 Jun 2008 21:29:09 +0200
Subject: Notebook conversion to pdf
To: support@wolfram.com
Cc : Peter.Paule@risc.uni-linz.ac.at

Dear Mathematica Support Team,

I've tried to convert the Mathematica notebook

http://www.risc.uni-linz.ac.at/people/hemmecke/paule/INRIA07_Talk_ExtendedVersion.nb

into a .pdf file.

However, that turns out to be not working well. Simply saving that file
as .pdf from the menu "File" -> "Save As" -> "File type: .pdf" yields

http://www.risc.uni-linz.ac.at/people/hemmecke/paule/INRIA07_Talk_ExtendedVersion.pdf

which is not even in landscape mode. I have, however, not found any
option that lets me specify the output layout.

In addition, I have tried printing the notebook into a file and
converting that to .pdf. That output is better, but still does not look
exactly as the notebook shows on screen. Printing to a file gave the
following output:
http://www.risc.uni-linz.ac.at/people/hemmecke/paule/INRIA07_Talk_ExtendedVersion.ps

The red titles usually are not centered as they show in Mathematica.
Even worse, some titles are not wrapped but rather shown incompletely.
See for example page 3. Also formulas are shown in an incomplete way in
the .ps which makes the scientific content of the slides wrong compared
to the original notebook.

Since there is similar behaviour in earlier versions of Mathematica, I
am sure that this problem is well known to the Mathematica support team.

Could you point me to concrete steps to produce a proper PDF file (i.e.
a .pdf file that looks exactly as what I see on screen inside
Mathematica) out of the above notebook file?

> {$Version, $ReleaseNumber, $LicenseID}
{"6.0 for Linux x86 (32-bit) (April 20, 2007)", 0, "L2319-0133"}

Thank you in advance
--
---------------------------------------------------------------------
Dr Ralf Hemmecke - Research Institute for Symbolic Computation (RISC)
Johannes Kepler University, Altenberger Str. 69, A-4040 Linz, Austria
hemmecke@risc.jku.at Tel: +43 732 2468 9961
http://www.risc.jku.at/people/hemmecke Fax: +43 732 2468 9930
---------------------------------------------------------------------


----------------------------------------------------------------------------

Hello,

Thank you for the email. I do apologise for the inordinate delay in getting
back to you.
The conversion to PDF is influenced by several factors. For instance, the
StyleSheet and the Notebook's options which set some printing options.
I tried to change a little these options in order to have a PDF exported
that is like the notebook.
The first thing I have done is to use Printing Settings to set the
Landscape orientation. This is required because the save as PDF is somehow
based on the printing options.
Then I changed the StyleSheet. Indeed, the notebook as the options
PrintingStyleEnvironment->"SlideShow". This implies that the printing to
PDF inherits the options from such style. Looking at the StyleSheet
definition in the section "Style Environment Names", the SlideShow
definition has the option PageWidth->WindowWidth. This have to be changed
to PaperWidth.
Finally, there is a problem about the cell in the third slide where is "
"Omega Package by Axel Riese ...."
This problem is quite subtle. When saving the file as PDF this cell has a
width higher than the page. Even setting the above option to PaperWidth,
doesn't work.
So, this is what I discovered.
The internal expression of the Cell is the following (Menu Cell->Show
Expression):

Cell["\<\
Omega Package by Axel Riese (in cooperation with George E. Andrews and
Peter \
Paule) \[LongDash] � RISC Linz \[LongDash] V 2.47 (06/21/05)\
\>", "Print",
CellFrame->0.5,
FontColor->GrayLevel[0],
Background->RGBColor[0.796887, 0.789075, 0.871107]]

So, the Cell has a first argument that is a string.
If you transform it to the following (adding a BoxData[RowBox[{...}]]):

Cell[BoxData[RowBox[{"\<\
Omega Package by Axel Riese (in cooperation with George E. Andrews and
Peter \Paule) \[LongDash] � RISC Linz \[LongDash] V 2.47 (06/21/05)\
\>"}]], "Print", CellFrame->0.5, FontColor->GrayLevel[0],
Background->RGBColor[0.796887, 0.789075, 0.871107]]
It looks fine in the PDF.

Otherwise you have to change the StyleSheet once again.
Indeed, when a Cell has just a string like first argument, the
visualization format is based on the style named "InputForm". Looking into
the Core.nb StyleSheet I discovered that "InputForm" has the option
PageWidth->Infinity. This should be set to PaperWidth, as above, to allow
the cell to be exported correctly to the PDF.
Your notebook has a private StyleSheet that doesn't define the InputFormat.
So it is inherited by the Core.nb one.
So, follow these steps to adjust your notebook:

1) open a new Notebook
2) edit the StyleSheet (menu Format -> Edit StyleSheet)
3) click on the Default.nb link that appears on the top of the stylesheet
4) click on the Core.nb link that appears on the top of the Default.nb
stylesheet
5) scroll down till the section named "Styles for Mathematica
System-specific Elements" then scroll down again to the subsection
"FormatType Styles". Select the cell with definitions for "InputForm"
6) close all stylesheets opened and the new notebook too
7) open your notebook and edit its stylesheet
8) wherever you prefer paste the whole cell of "InputForm" definition
copied from the Core.nb stylesheet
9) edit this definition and change the option PageWidth->Infinity to
PageWidth->PaperWidth
10) close the stylesheet and save your notebook


So, just to recap, you should apply three steps:
a) set the orientation to landscape in the printing settings
b) change the stylesheet allowing SlideShow to have PageWidth->PaperWidth
c) change the stylesheet allowing InputForm to have the
PageWidth->PaperWidth


I have done that and the result seems to be what you are looking for.
Attached are two files, the notebook I changed and the resulting PDF.
I hope this is helpful.
If I missed any important aspect of your question, please let me know.


Sincerely,

Roberto Cavaliere
Technical Support
Wolfram Research, Inc.
support@wolfram.com

 

September 2017 »
September
MoTuWeThFrSaSu
123
45678910
11121314151617
18192021222324
252627282930
Upcoming Events
RISC Forum Apr 22, 2024 01:30 PM - 01:45 PM
RISC Forum Apr 29, 2024 01:30 PM - 01:45 PM
RISC Forum May 06, 2024 01:30 PM - 01:45 PM
RISC Forum May 13, 2024 01:30 PM - 01:45 PM
NO RISC Forum May 20, 2024 01:30 PM - 01:45 PM
Previous events…
Upcoming events…