22

For Example: WriteString["stdout", "First part of the result: ", DateString[]]; (*Perform some calc*) i = 0; WriteString["stdout", " -- Addition to the result: ", DateString[], "\n"]; First part of the result: Thu 15 Oct 2015 12:58:29 -- Addition to the result: Thu 15 Oct 2015 12:58:29


20



19

You can set this in a style sheet so that it is done once and you don't have to do it again: Cell[StyleData[All, "Printout"], ShowCellLabel -> False] or can you programmatically add this private style to your notebook: SetOptions[EvaluationNotebook[], StyleDefinitions -> Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]], Cell[...


16

One common way to deal with diagnostic messages is something like this: Instead of Print use some other head of your choosing, e.g. debugPrint. f[x_] := (debugPrint["x is ", x]; x^2) Now you can either simply define debugPrint = Print to enable messages permanently, or you can do it temporarily in a localized way with Block[{debugPrint = Print}, f[5]] ...


15

Quite redundant after the other answers and links, but I use something like this for vector-based technical drawings and CNC data (using mm as unit). This is not foolproof as it might e.g. screw up with conflicting options and such, so make sure to check the output. Important: SetPlotRange for your graphics explicitely: gfx = Graphics[Line[{{10, 10}, {...


15

Short answer: I hope Export["foo.pdf", plot,Background->None] fixes it. Let's get there step by step. First, Acrobat X Pro on my Mac reports that both your PDF files are fine. They print fine, and pass all tests with flying colors. I uncompressed the PDF (thanks pdftk) and a diff on them reveals that one weird object that only appears in your “export” ...


14

This is admittedly messy, but something along these lines might work: insertBelowEvaluationCell[expr_] := (SelectionMove[EvaluationNotebook[], After, EvaluationCell]; NotebookWrite[EvaluationNotebook[], Cell[BoxData@ToBoxes[expr], "Print"]]) This function moves the insertion point just below the evaluation cell before inserting the text or ...


14

You could uncheck ShowCellLabel under Cell Options > Cell Labels in the Option Inspector. If you only want to turn off input and output cells in the printing environment, you could edit the style sheet of the document. In order to do that you choose Edit Stylesheet... in the format menu. Click on the link to the base definition of the style sheet and ...


12

You can specify ImageSize in inches. From docs > ImageSize> MoreInformation: Specifications for both width and height can be any of the following: ... 72di di inches (before magnification) ... Examples: Row[{Plot[{Sin[x], Cos[x]}, {x, -2 Pi, 2 Pi}, Frame -> True, AspectRatio -> 1/GoldenRatio, ImageSize -> 72 2], Plot[{...


11

Seems like you are looking for Inactivate: ClearAll[x, y]; Inactivate[ Print[x = 1]; Print[y = x + 3]; y, Print] 4


11

I don't think that this is a problem with Mathematica, but rather with a combination of (possibly) HP printers and PostScript printer drivers on Macs. The error you see is a PostScript error; see this site for an explanation. The short version is that the printer has reached some kind of internal limit, most commonly caused by a page that is too complex ...


10

You might also have luck if you specify the ImageSize Export[filename, plot, "PDF", ImageSize -> 8*72] I have also been able to print files when using the Print As Image option (under Advanced from the Print menu of Adobe).


10

Here is a starting point, which people with palette creation experience could expand on to create a "one click" solution. First, my setup: File number 1: "confidential.nb" with two sections and two text cells. I selected the entire first section and hit CTRL+J to bring up the cell tags: I added the tag "Confidential" to all of the cells. This is what ...


10

You have several possibilities: 1) Instead of Printing into usual StandardForm Cell where the parsing and 2D formatting take significant processor's time you can print into plain text Cells: CellPrint[Cell["stuff=" <> ToString[stuff]]]] This takes substantially less CPU time and should render much faster. 2) Instead of printing into separate cells ...


10

The issue is that for reasons that are mysterious, Mathematica has been using an incorrect value of the ScreenResolution parameters on Windows machines since time untold. I believe this has some historical reasons, related to developers using Apple machines at some time, for which somehow the 72dpi is appropriate (noting in parentheses that this "screen ...


9

This is an arguably even messier solution than Szabolcs', and its performance isn't going to win any awards, but it has some (somewhat dubious) advantages: It allows you to choose whatever target you want for the printing, putting things in an arbitrary notebook, and the output will appear at the current selection in that notebook; After that, printing won'...


9

Your question isn't very specific, so here is a generic example from another question From the documentation for ImageSize: The following settings can be given: 72di di inches (before magnification) Suppose we want to give sizes in centimeters. We establish a scale: cm = 72/2.54; And we give the ImageSize in this scale, also making sure to set ...


9

This is a known problem with nodejs on Windows. The stdout stream is an asynchronous stream and is not always being flushed before the process exits. A work-around is to perform an explicitly synchronous write to stdout (i.e. file descriptor #1): Import["!node -e require('fs').writeSync(1,'test')", "Text"] (* test *) The bug report referenced above ...


9

On a Linux pc, the relevant file is in a place like this one: /usr/local/Wolfram/Mathematica/10.1/SystemFiles/FrontEnd/TextResources/X/MenuSetup.tr To edit the file, one needs administrator rights, i.e. modify it under sudo. Since introducing errors can make Mathematica no longer usable, first make a backup copy of the original file before trying to ...


8

I have found one solution, using a temporary file:- streams = AppendTo[$Output, OpenWrite[]]; Module[{}, Print[Plot[Sin[x], {x, 0, 2 Pi}]]; a = 123]; Close@Last@streams; $Output = Most@streams; printoutput = ReadList@First@Last@streams


8

I'm not sure it is what you want, but have you tried CurrentValue[EvaluationNotebook[], "GraphicsBoxOptionsImageSizeRaw"] = 500 This instantly resizes all graphics inside a notebook to 500 pixels as long as your notebook window is large enough. As @Kuba pointed out, this can be used as option for Graphics Graphics[{Circle[]}, ImageSize -> Automatic,...


8

Printing uses the "Printout" screen environment. So, you can control this behavior automatically with a stylesheet. Something like: SetOptions[ EvaluationNotebook[], StyleDefinitions -> Notebook[ { Cell[StyleData[StyleDefinitions->"Default.nb"]], Cell @ CellGroupData[ { Cell[StyleData["Notebook"],...


7

Sounds like you are looking for $Messages and $Output, and maybe also $PrePrint or $Post. $Messages and $Output are a list of streams to which corresponding output is written (note that $Output is only getting output from Prints, not from return values of shift-return-evaluations). To cover return values of shift-return-evaluations you might want to ...


7

I thought this might be useful information for users. WRI tech support say this is a bug. However if you open the exported PDF in the open source PDF reader Evince then you can print.


7

You need to specify formatting directives for the "Print" style. Adding this cell to the custom style sheet: Cell[StyleData["Print"], FontSize->24, FontColor->RGBColor[1, 0, 0]] Should produce: There is also a "MSG" style for messages: Cell[StyleData["MSG"], FontWeight->"Bold", FontColor->RGBColor[1, 0.5, 0]] Both of these can be ...


7

A wide variety of print settings can be stored within a given notebook. If you are observing print settings that appear to differ from the default settings then my guess is that inadvertently some unwanted settings have been localized to the notebook. You can check this via the Options Inspector. For your specific problem you can ensure that the notebook ...


7

Progress, at least for my purposes. This is not a proper ‘PostScriptForm’, which should cope elegantly with all kinds of difficult cases. But it does satisfy my needs, mostly the PostScript’ification of polynomials of degree ≤8 in a few variables. I expect that I have not structured the code in a natural Mathematica idiom. Please suggest improvements. ...


7

ImageSize has a form (still undocumented) ImageSize -> a -> b to have a user units correspond to b printer's points. So you can use cm = 72/2.54; Plot[x^2, {x, 0, 5}, AspectRatio -> Automatic, ImageSize -> 1 -> cm] A paper ruler: metricruler = Plot[0, {x, 0, 20}, AspectRatio -> Automatic, AxesOrigin -> {0, 0}, ...


6

It turns out that the ordering of the output of Print cells is determined by whether the cells printed have the options CellAutoOverwrite and GeneratedCell both set to False. If so, the cells are printed at the top (in reverse order), otherwise they are printed at the bottom. In general, it is not easy to control whether the printed cells have these options ...


6

I haven't figured out how to add a "Content Removed" label or to hide entire groups of cells, but you can use Style Sheets and the Printout environment to at least automatically Close cells with the style "Confidential" while printing. With this method I think you would need to have a different Confidential style for each cell type (code, text, etc.) that ...


Only top voted, non community-wiki answers of a minimum length are eligible